strtold("inf",NULL) returns a NaN

Segher Boessenkool segher@kernel.crashing.org
Mon Jul 4 03:26:00 GMT 2016


On Mon, Jul 04, 2016 at 11:45:42AM +1000, sisyphus1@optusnet.com.au wrote:
> ld is:      7fff8000000000000000

This is +Inf in 80-bit 8087 format.

> f128 is: 7fff8000000000000000000000000000

This is a NaN in standard format (Inf would be
7fff0000000000000000000000000000).

> It's only when this long double value is cast to __float128 that it behaves 
> as a NaN.
> 
> Where to from here ?

Look at the generated machine code for the cast?  The value returned
from strtold looks correct.


Segher



More information about the Gcc-help mailing list