Mail Archives: djgpp-workers/2003/04/07/10:43:18
Hi.
I said:
> I propose all strto*() do use an unsigned long long to store the
> mantissa (X) given in "nan(X)". If X > the maximum for float or
> double, set the mantissa to all-ones (we clamp the value to the
> maximum possible).
>
> This will make ``strtof(sprintf(s, "%d", NAN), NULL)'' return a
> NaN.
Am I confused or what? ``strtof(sprintf(s, "%d", NAN), NULL)'' would
return a NaN even in my earlier posted implementation. The only
difference is that the bits might be set differently.
Do you have any preferences (clamping or masking)?
> If *printf() will handle NaN in a double separately from long doubles
> this should make ``double value1 =
> extreme_cpu_use_generating_unusual_nans();
> double value2 = strtod(sprintf(s, "%d", value1), NULL)'' make the bit
> pattern of value1 == the bit pattern of value2.
This is sane though (IMO).
Right,
MartinS
- Raw text -