Bart Lateur wrote:
>
> Er... may I suggest ratio's as a data format? It won't work for sqrt(2)
> or PI, but it can easily store 1/3 as two (long) integers. You can
> postpone doing integer divisions until you need a result, at which time
^to stringify a
> you can reorder calculations between * and /, so
>
> (2/3)*9
>
> will return exactly 6.
if the numerator and denominator just keep accumulating factors, the
re-ordering is automatic -- or not needed at all.
However, if we have bigints built in, it is not that tricky to rewrite
your integer math to do the deferments at user-code level, instead of
promising accuracy which will break in ways that surprise the lusers.