------- 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

Reply via email to