3 ms·
when you work with floats, never expect anything to exactly equal a value, ie, it should be banned to use <float> === <constant> . That is universal across lan
by keithnz 10y ago
when you work with floats, never expect anything to exactly equal a value, ie, it should be banned to use <float> === <constant> . That is universal across languages, for exact representations often languages provide another type. But floating point is popular because CPUs can natively work with them.
- Roboprog 10y agoFor financial work, you want to use a fixed precision or binary coded decimal library, such as java's BigDecimal. You knew that, but I'm just spelling it out for others.
- qwertyuiop924 10y ago...Or you could use Scheme, where we have precise numbers (fractions)