4 ms·
Neither `BigDecimal` in Ruby or `Decimal` in Python are quite what I'd expect for "arbitrary-precision". From the docs for [`BigDecimal`](http://ruby-doc.org/s
by aeorgnoieang 9y ago
Neither `BigDecimal` in Ruby or `Decimal` in Python are quite what I'd expect for "arbitrary-precision".
From the docs for [`BigDecimal`](http://ruby-doc.org/stdlib-1.9.3/libdoc/bigdecimal/rdoc/BigDecimal.html http://ruby-doc.org/stdlib-1.9.3/libdoc/bigdecimal/rdoc/BigD...):
> Ruby provides built-in support for arbitrary precision integer arithmetic. For example:
>
> 4213 -> 1265437718438866624512
>
> BigDecimal provides similar support for very large or very accurate floating point numbers.
My takeaway from the above is that, if arbitrary precision is needed, you should still just use integers. Tho, in practice, it may not be significant.
- fauigerzigerk 9y agoIntegers are not magic. If you want arbitrary precision on top of integers you're going to need arbitrarily long integers as well.
- aeorgnoieang 9y agoI was referring to Ruby and based on the first sentence I quoted: > Ruby provides built-in support for arbitrary precision integer arithmetic. [I'm also assuming that it's really arbitrary precision and not just 'really big but limited' precision.]