1688 shaares
869 private links
869 private links
A really innovative way to store exact floating point numbers:
- for "safe numbers" (numbers whose value can be expressed precisely in floating point), store them as is
- for non-"safe numbers", store two safe numbers as denominator and nominator.
There is a lot of this method comparing to the other alternatives:
- BigDecimal: a lot faster than arbitrary precision BigDecimal
- Rational: denom and nom deoesn't blow up to extremely large numbers
And it is also faster and uses less space.