From: Steve Kargl <sgk@troutmask.apl.washington.edu>
To: Harald Anlauf via Fortran <fortran@gcc.gnu.org>
Cc: gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fortran: fix compile-time simplification of SET_EXPONENT [PR109511]
Date: Fri, 14 Apr 2023 12:33:18 -0700 [thread overview]
Message-ID: <ZDmqfsg+jIOOGqKY@troutmask.apl.washington.edu> (raw)
In-Reply-To: <trinity-d5a880c2-3bb0-4464-9940-ac3568977112-1681498764042@3c-app-gmx-bs43>
On Fri, Apr 14, 2023 at 08:59:24PM +0200, Harald Anlauf via Fortran wrote:
>
> the compile-time simplification of intrinsic SET_EXPONENT was
> broken since the early days of gfortran for argument X < 1
> (including negative X) and for I < 0. I identified and fixed
> several issues in the implementation. The testcase explores
> argument space comparing compile-time and runtime results and
> is checked against Intel.
>
> Regtested on x86_64-pc-linux-gnu. OK for mainline?
>
Yes, it is certainly better than the current situation.
> This is not a regression, but can lead to wrong code.
> Would it be OK to backport to open branches?
Sure. Looks simply and fairly specific.
I was wondering about the difference between set_exponent()
and scale(), and found that set_exponent() talks about IEEE
values while scale() doesn't. I'm wondering if we should
add the IEEE special cases to the testsuite. Of particular
note, I doubt that this is true:
If X is an IEEE NaN, the result is the same NaN.
program foo
real x, y
x = 1
y = x - x
x = (x - x) / y
print '(F4.0,1X,Z8.8)', x, x
y = set_exponent(x,1)
print '(F4.0,1X,Z8.8)', y, y
end program foo
gfcx -o z a.f90 && ./z
NaN FFC00000
NaN 7FC00000
Those are not the same NaN. The second is a qNaN.
The first looks like a qNaN with the sign bit set.
--
Steve
next prev parent reply other threads:[~2023-04-14 19:33 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-14 18:59 Harald Anlauf
2023-04-14 19:33 ` Steve Kargl [this message]
2023-04-14 19:48 ` Steve Kargl
2023-04-14 19:49 ` Harald Anlauf
2023-04-14 19:49 ` Harald Anlauf
2023-04-14 21:19 ` Steve Kargl
2023-04-17 19:41 ` Bernhard Reutner-Fischer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZDmqfsg+jIOOGqKY@troutmask.apl.washington.edu \
--to=sgk@troutmask.apl.washington.edu \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).