Hacker News new | ask | show | jobs
by dnautics 3035 days ago
Rationals are not generally useful for scientific computation because eventually you need to start invoking the relatively costly euclidean algorithm to do basic operations, the compute time is no longer constant. Also lots of operations take square roots anyways, so you wind up in trouble that way.
1 comments

Yeah, you're right, there's a good historic reason for this current mess. Computing originated in scientific computational math problems, so the algorithms and data types are biased for that.

Javascript programmers don't need a number type designed for accurately computing trig and square roots and representing pi, but they got one anyways.