3 ms·
I wouldn’t consider this a leaky abstraction. Floating point numbers are explicitly not trying to be an abstraction for real numbers, but rather an approximati
by marklacey 7y ago
I wouldn’t consider this a leaky abstraction.
Floating point numbers are explicitly not trying to be an abstraction for real numbers, but rather an approximation for them that is good enough for most purposes (if you’re careful in how you use them).
That they might not be taught as such is another problem.
- beatgammit 7y agoExactly. Everyone dealing with JavaScript should be taught about .toFixed(num) for rendering numbers as strings. In fact, anyone working on front end code in any language should learn that language's number formatting tools (e.g. sprintf). There just isn't an excuse for this type of sloppiness.