Re: LDBL_MAX -1.#QNAN0e+000 with MinGW?



guiguan@xxxxxxxxx wrote:
I have tried to run this with both eclipse(CDT)+MinGW and Cygwin+GCC

#include <stdio.h>
#include <stdlib.h>
#include <float.h>

int main()
{
puts("The range of ");
printf("\tlong double is [%Le, %Le]?[%Le, %Le]\n", -LDBL_MAX, -
LDBL_MIN, LDBL_MIN, LDBL_MAX);
return EXIT_SUCCESS;
}

but got different results:

* In eclipse(CDT)+MinGW
The range of
long double is [-1.#QNAN0e+000, 3.237810e-319]?[6.953674e-310,
0.000000e+000]
* In Cygwin+GCC
The range of
long double is [-1.189731e+4932,
-3.362103e-4932]?[3.362103e-4932, 1.189731e+4932]

This is weird, and I googled it, then just found this
http://www.thescripts.com/forum/thread498535.html

The LDBL_MAX of long double is machine-dependent, but why it like this
in same machine? I guess it?s the problem with MinGW. Anyone hv any
idea?
If you run this on a compiler which doesn't support long double in
printf(), results such as these are to be expected.
.



Relevant Pages

  • [PATCH/RFC] dont support %n in printk
    ... indicated by the int * pointer argument. ... more common use - in printf format string exploits. ... We don't support floating point, for example, and I ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • Re: Usefulness of %hd in printf
    ... and the corresponding argument was of type 'short int'? ... Think about the scanf() family of functions. ... I'm asking about the printf() family. ... support for %hd just to try and keep the printf family similar to the ...
    (comp.lang.c)