4 ms·
And Common Lisp, although it’s not necessarily “default”. (/ 2 3) works as expected, but 1.7 is a float (unfortunately), and not a rational 17/100. Shame, reall
by nothrabannosir 9y ago
And Common Lisp, although it’s not necessarily “default”. (/ 2 3) works as expected, but 1.7 is a float (unfortunately), and not a rational 17/100. Shame, really.
- Grue3 9y agoNothing unfortunate about that. When you work with rationals, it's very easy to grow incredibly large denominators, at which point all arithmetic operations slow to a crawl. Floats are fast and predictable, which is why they're used for most calculations in CL and other languages.
- AstralStorm 9y agoExcept when you hit denormals or underflow. Or accidentally lose precision ending up with a wrong result. If I could get a cent for every money transaction done on floats and incorrectly rounded, I'd be a billionaire.
- jjnoakes 9y ago17/10