Casting double to ulong weirdness
bachmeier via Digitalmars-d
digitalmars-d at puremagic.com
Mon Aug 24 12:15:43 PDT 2015
On Monday, 24 August 2015 at 18:59:58 UTC, Steven Schveighoffer
wrote:
> All this gets down to: FP cannot accurately represent decimal.
> Should this be fixed? Can it be fixed? I don't know. But I
> would be very cautious about converting anything FP to integers
> without some epsilon.
>
> -Steve
I don't see anything that needs to be fixed, because I don't
think anything is broken - there is nothing that violates my
understanding of floating point precision in D.
cast is not round. What is broken is a program that attempts to
convert a double to an integer type using a cast rather than the
functions that were written to do it correctly.
More information about the Digitalmars-d
mailing list