Libraries are good, but don't give you a "language without floats". When you have the float escape hatch, you don't have to design your fixed/rational numbers to work well for computations such as the one Konrad mentioned.
m
Mariano Guerra
04/11/2020, 12:07 PM
I mentioned as a design and interface to implement the core decimal type in your language, not that you should implement it as a library
➕ 1
Mariano Guerra
04/11/2020, 12:08 PM
the idea would be that the decimal type in python (and in that spec) is your core decimal type
n
Nick Smith
04/11/2020, 12:32 PM
Sure, that would be useful. I wouldn't put a Decimal type in my language though, because a Decimal is just a Rational (fraction) where the denominator can only be a power of 10. Rationals subsume Decimals.
s
shalabh
04/11/2020, 6:42 PM
Clojure has a built in Ratio type, no? I thought many lisps have this.
n
Nick Smith
04/12/2020, 12:14 AM
Yeah you're right. I mentioned Scheme and Racket earlier. But as far as I'm aware, these are used alongside floats rather than replacing them as the primary numeric type.
k
Konrad Hinsen
04/12/2020, 9:11 AM
Good number support is a tradition in the Lisp family. Common Lisp has it as well, as does Smalltalk, presumably as a Lisp heritage. Unlimited size integers, rationals, and floats. Sometimes more. But as @Nick Smith says, this numerical stack always leads to a heavy use of floats as a default choice for non-integers.