[plt-scheme] Numerical precision

From: Henk Boom (henk at henk.ca)
Date: Wed Mar 11 22:25:04 EDT 2009

2009/3/11 Richard Cleis <rcleis at mac.com>:
> You could consider computing everything with integers that represent the
> precision in your sim.  (e.g., $1.23 would be 123 cents or 1230 mills or
> whatever.) After a division or multiply, rounding or truncation can be used
> to create a new integer with the algorithm that your sim requires.
>  Converting between the sim integers and $nn.nn needs to occur only when you
> want to display values or accept input.

This does not avoid the associativity problems though, nor the
problems of accumulation of error. You really want to do rounding only
when necessary.

    Henk


Posted on the users mailing list.