Always false float comparisons

Walter Bright via Digitalmars-d digitalmars-d at puremagic.com
Wed May 18 16:09:28 PDT 2016


On 5/18/2016 1:22 PM, deadalnix wrote:
> On Wednesday, 18 May 2016 at 20:14:22 UTC, Walter Bright wrote:
>> On 5/18/2016 4:48 AM, deadalnix wrote:
>>> Typo: arbitrary precision FP. Meaning some soft float that grows as big as
>>> necessary to not lose precision à la BitInt but for floats.
>>
>> 0.10 is not representable in a binary format regardless of precision.
>
> You should ask the gcc guys how they do it, but you can surely represent this as
> a fraction,

Right.

> so I see no major blocker.

Now try the square root of 2. Or pi, e, etc. The irrational numbers are, by 
definition, not representable as a ratio.



More information about the Digitalmars-d mailing list