On Mon, Apr 5, 2010 at 9:33 PM, Glenn Fowler <[email protected]> wrote:
>
> here is some example code that shows what ksh93/ast use for printing nan
> on systems that support both isnan() and signbit()
> ---
> #include <stdio.h>
> #include <math.h>
> int
> main()
> {
> long double v;
> long double z = 0.0;
>
> v = z / z;
> printf("isnan=%d signbit=%d %Lg\n", !!isnan(v), !!signbit(v), v);
> v = -v;
> printf("isnan=%d signbit=%d %Lg\n", !!isnan(v), !!signbit(v), v);
> return 0;
> }
> ---
> from a few tests it seems that it may be an x86 issue
> for the ast stdio
> on non-x86 systems
> isnan=1 signbit=0 nan
> isnan=1 signbit=1 -nan
> and on x86 systems (linux solaris)
> isnan=1 signbit=1 -nan
> isnan=1 signbit=0 nan
I knew Intel can't do math :)
I still think this needs to be corrected at compiler level. Just
because the hardware is broken doesn't mean the software can't work
around it.
We're now replacing (( x==nan )) with (( x==nan || x=-nan )) as
workaround. *PAIN*
Chris
--
^---^
(@)v(@) Chris Pickett
| / IT consultant
===m==m=== [email protected]
_______________________________________________
tools-compilers mailing list
[email protected]