cast(int) getting an unexpected number

Joel Christensen joelcnz at gmail.com
Wed Nov 4 16:38:45 PST 2009


> To be safe, whenever converting to int, always add a small epsilon.  I 
> think you can use float.epsilon, but I don't have any experience with 
> whether that is always reasonable.
> 
> -Steve

Thanks every one for the replies.

I still have problems. How do I use epsilon? 'real' helps in my example 
program but not in my money program. I think there's a function out 
there that does dollars and cents (eg. .89 -> 89c and 1.00 -> $1), but 
I'm interested how to solve this problem.


More information about the Digitalmars-d-learn mailing list