[Haskell-cafe] rounding errors with real numbers.

Jared Updike jupdike at gmail.com
Sun Feb 26 11:40:27 EST 2006

> Well, if you are relying on exact results from floating point
> arithmetic you're in trouble no matter what you do.

As long as you don't do anything irrational (exp, sin, sqrt, etc.),
you should be able to get away with using Rational. Number constants
with decimals are not automatically constructors for floating point
numbers in Haskell; they are exact (fromRational) until you make them
Doubles or some other floating point value. If you have to use Doubles
for other reasons (performance/memory, interfacing with other code,
etc.) this won't help you...

Just my 2c.
reverse ")-:"

More information about the Haskell-Cafe mailing list