Many languages have implementations of this <http:...
# thinking-together
m
Many languages have implementations of this http://speleotrove.com/decimal/decarith.html for example python https://docs.python.org/3.8/library/decimal.html
n
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
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
the idea would be that the decimal type in python (and in that spec) is your core decimal type
n
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
Clojure has a built in Ratio type, no? I thought many lisps have this.
n
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
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.