3 ms·
>I appreciate the sentiment but in this case I do not want to hurl around a bignum lib to add up 2 tiny numbers. That is why integers and floats exist. >build
by constantcrying 3y ago
>I appreciate the sentiment but in this case I do not want to hurl around a bignum lib to add up 2 tiny numbers.
That is why integers and floats exist.
>build in functionality should do the small number arithmetic.
Every CPU has that.
Floating point numbers CAN NOT be fixed. It is mathematically impossible. The inconsistencies always will be there.
- Groxx 3y agoHence why most should avoid floating point, yes. Many people approach them as "oh, they're decimals" when they absolutely are not... but there are no convenient alternatives in most languages. So people use the convenient one that they see 99% of other code using, rather than something that is more likely to fit their expectations. That's the problem. People are surrounded by screws and hammers and they understandably choose to hammer in the screws rather than 1) knowing a screwdriver exists, and 2) hunting down the few three-handed screwdrivers in existence and trying to use them.
- constantcrying 3y agoThere is nothing which fits their expectations. There can not be. Floats are the best in almost every circumstance. Which is why they are the right default.
- Groxx 3y agoThat depends on their expectations, and is a matter of opinion. Clearly others disagree with you.
- constantcrying 3y agoFloats are still the only sane default.