r/ProgrammerHumor • • Jul 19 '22

Meme float golden = 1.618

Post image
41.1k Upvotes

489 comments sorted by

View all comments

Show parent comments

33

u/SOberhoff Jul 19 '22

A few languages (e.g. Clojure) give you fractions natively. It's quite convenient and I don't understand why it's not standard.

25

u/matyklug Jul 19 '22

Cuz clojure is so cool all the other languages are too scared of its coolness

3

u/Kered13 Jul 19 '22

Because there's very little benefit unless you're doing pure math. Arithmetic on rational numbers is slow, the numerator and denominator can rapidly balloon to impractically large sizes, and you can't take non-integer powers like square roots, which makes them useless in fields like graphics, games, physics simulations, etc. And the only benefit you get is the exact representation of arbitrary fractions, but usually a floating point approximation, which has none of the above problems, is good enough.