Always false float comparisons

Ola Fosheim Grøstad via Digitalmars-d digitalmars-d at puremagic.com
Wed May 18 09:02:55 PDT 2016


On Wednesday, 18 May 2016 at 15:30:42 UTC, Matthias Bentrup wrote:
> On Wednesday, 18 May 2016 at 14:29:42 UTC, Ola Fosheim Grøstad 
> wrote:
>> On Wednesday, 18 May 2016 at 12:27:38 UTC, Ola Fosheim Grøstad 
>> wrote:
>>> And yes, half-precision is only 10 bits.
>>
>> Actually, it turns out that the mantissa is 11 bits. So it 
>> clearly plays louder than other floats. ;-)
>
> The mantissa is 10 bits, but it has 11 bit precision, just as 
> the float type has a 23 bit mantissa and 24 bit precision. 
> AFAIK the only float format that stores the always-one-bit of 
> the mantissa is the x87 80 bit format.

It turns out both 10bits and 11bits are "right" and that one 
should qualify it with «with/without the hidden bit», except that 
it shouldn't be called the «mantissa», but the «significand»:

https://en.wikipedia.org/wiki/Significand

Thanks, always fun with learning  ;-)



More information about the Digitalmars-d mailing list