This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libfortran/33469] Default formats for real input are not precise enough
- From: "fxcoudert at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 2 Oct 2007 00:37:27 -0000
- Subject: [Bug libfortran/33469] Default formats for real input are not precise enough
- References: <bug-33469-12313@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from fxcoudert at gcc dot gnu dot org 2007-10-02 00:37 -------
(In reply to comment #5)
> Hum, the real(16) case looks like loads of fun to come!
Part of it is simply a libc bug. There are numbers close to 1.0 and -1.0 that
the darwin libc can't output properly:
$ cat k2.c
#include <stdio.h>
int main (void)
{
long double x;
x = 0.99999999999999998L;
printf ("%Lg\n", x);
printf ("%.60Lg\n", x);
x = -0.999999999999999999999999999999975L;
printf ("%Lg\n", x);
printf ("%.60Lg\n", x);
}
$ gcc k2.c && ./a.out
2
1.99999999999999997999999999999999548766360788798414493987417
-2
-1.99999999999999999999999999999997534809671184338108088348233
I've reported this to Apple (it is now bug #5516762). Otherwise, as far as I
can tell, the default format width seems wide enough for real(kind=16).
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33469