256
Surely "1337" is the same as 1337, right?
(sopuli.xyz)
Post funny things about programming here! (Or just rant about your favourite programming language.)
All of us fintech devs however, know the true horrors. Make everything a string, lest ye end up in precision hell
Just reminded me of an argument trying to explain that arithmetic with floating point numbers is not always correct to a coworker who was a mathematician just starting in software dev.
In a mathematicians mind the fact that an arithmetic operation can produce inaccurate result is just incomprehensible
Floating point numbers and arithmetic is not inaccurate. They are actually very accurate but a lot of developers have inaccurate assumptions about them. They can't exactly represent base 10 decimals. That's the only inaccuracy. If you have two floating point numbers and you let's say add or multiply them the result is always the closest floating point representation of the real result.
The list of misconceptions wouldn't reasonably fit in a comment, but if you are really interested and have a few minutes you could give that a read: https://zeta.one/floats-are-not-inaccurate/