type comparisons

Steven Schveighoffer schveiguy at yahoo.com
Mon Jan 28 12:03:02 PST 2008


"Steven Schveighoffer" wrote
> To work correctly, you should always compare floating point values by 
> adding some small error.  So instead of:
>
> assert(x > y)
> you write
>
> const myError = 1e-10;
> assert(x + myError > y)

Er... this should be:

assert(x - myError > y)

-Steve 




More information about the Digitalmars-d-learn mailing list