Funny issue with casting double to ulong
Saurabh Das via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jul 2 21:06:23 PDT 2017
On Monday, 3 July 2017 at 03:57:25 UTC, Basile B wrote:
> On Monday, 3 July 2017 at 03:50:14 UTC, Saurabh Das wrote:
>> [...]
>
> 6.251 has no perfect double representation. It's real value is:
>
> 6.21509999999999962483343551867E0
>
> Hence when you cast to ulong after the product by 10_000, this
> is the equivalent of
>
> trunc(62150.9999999999962483343551867E0)
>
> which gives 62150
>
> CQFD ;-]
That explains it!
Thank you.
More information about the Digitalmars-d-learn
mailing list