[Cfp-interest 2099] Re: number classification macros, fpclassify and normal numbers

Mike Cowlishaw mfc at speleotrove.com
Mon Aug 16 07:21:59 PDT 2021


> 
> On 2021-08-13 15:08:03 -0600, Fred J. Tydeman wrote:
> > The 32-bit decimal FP has 7 versions of the value 1:
> > 0000001e0
> > 0000010e-1
> > 0000100e-2
> > 0001000e-3
> > 0010000e-4
> > 0100000e-5
> > 1000000e-6
> > 
> > Only the value with a leading non-zero digit is normalized.
> > So, the other six are unnormals.  But, they should be considered 
> > normal floating-point numbers.
> 
> OK. So it seems that in C17, such unnormalized floating-point 
> numbers are regarded like the normalized floating-point 
> numbers with the same numerical value,

No, because the exponent is preserved in the appropriate way when an
arithmetic operation is effected.  2.40 and 2.4 are not the same (although
mathematically they compare equal, of course).

See http://speleotrove.com/decimal/decifaq1.html#tzeros for rationale.

Mike



More information about the Cfp-interest mailing list