#include <float.h>
#include <stdio.h>
int main (void)
{
printf ("%.2a\n", DBL_MAX);
return 0;
}
the correctly rounded value of DBL_MAX the given precision, whilst
still being representable as a double, is +infinity in round-to-
nearest mode.
Is the intent of the standard that in this case text like "inf" (etc)
be output, or that an unrepresentable value like
0x2.00p+1023
be output? Most C libraries I have tried output the latter.
> #include <float.h>
> #include <stdio.h>
> 0x2.00p+1023
I think this is the only correct output, as string representations
don't have a limited exponent range (0x2.00p+1023 is representable
as a string). This is consistent with what you would get with %e
and %f.
--
Vincent Lef�vre <vin...@vinc17.org> - Web: <http://www.vinc17.org/>
100% accessible validated (X)HTML - Blog: <http://www.vinc17.org/blog/>
Work: CR INRIA - computer arithmetic / Arenaire project (LIP, ENS-Lyon)