This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug fortran/15441] RRSPACING broken for denormals
- From: "wf_cs at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 15 Sep 2004 09:40:03 -0000
- Subject: [Bug fortran/15441] RRSPACING broken for denormals
- References: <20040514173037.15441.tobi@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From wf_cs at yahoo dot com 2004-09-15 09:40 -------
I understand this problem this way. In fortran standard,
RRSPACING (X) = |X * POW (2, -e)| * POW (2, p) = FRACTION (X) * POW (2, p)
So the result's exponenet is p. And if X is normalized, X's fraction part
is the result's fraction. If X is denormalized, to get the X's fraction we
shift X's fraction part to left until the first '1' is removed.
That's why if X's fraction has only '1', we will get the same result as you
test.
I agree that the behavior of RRSPACING is not specified for denormals. But I
think we do the Right Thing as I explained.
I attach a pathch to give more comments about the code and add some folding.
How do you think?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15441