Hi,

With the 64-bit gcc-4.9.2 compiler available from:
http://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win64/Personal%20Builds/mingw-builds/4.9.2/threads-posix/sjlj/

I have the issue that casting a long double inf to a __float128 results in a 
__float128 nan.
No such problem in casting a double inf - or with gcc-4.8.2 or 4.7.3.

Here's the demo program:

/***************************************/

/* filename is bug492.c */
/*
built with:
   gcc -o bug492.exe bug492.c -lquadmath
*/

#ifndef __USE_MINGW_ANSI_STDIO
#define __USE_MINGW_ANSI_STDIO 1
#endif

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

int main(void) {
__float128 my_inf1, my_inf2;
double d;
long double ld;
char buf1[8], buf2[8];

  d = strtod ("inf", NULL);
ld = strtold("inf", NULL);

printf("%e %Le\n", d, ld);


my_inf1 = (__float128) d;
my_inf2 = (__float128)ld;

quadmath_snprintf(buf1, 6, "%Qe", my_inf1);
quadmath_snprintf(buf2, 6, "%Qe", my_inf2);
printf("%s %s\n", buf1, buf2);

return 0;

}

/***************************************/

Using the above gcc-4.9.2 it outputs:
inf inf
inf nan

Using the other mingw64 compilers that I have at my disposal (both 64-bit 
and 32-bit gcc-4.7.3 and gcc-4.8.2) it outputs:
inf inf
inf inf

Is this a bug in 4.9.2 ? ... or is there something inherently unguaranteed 
about casting a long double to a __float128 ?

Cheers,
Rob



------------------------------------------------------------------------------
Dive into the World of Parallel Programming The Go Parallel Website, sponsored
by Intel and developed in partnership with Slashdot Media, is your hub for all
things parallel software development, from weekly thought leadership blogs to
news, videos, case studies, tutorials and more. Take a look and join the 
conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to