Welcome to IEEE floating point math!

Wikipedia has a good article on the specification. If you want exact
fractional numbers for your own purposes, there are a number of ways around
the limits of floats.

Rational will represent numbers internally as fractions, and still allow
you to use the same syntax as above. The result will be "3 % 10", which you
read as the fraction 3 / 10.

If you also want irrational numbers, things get tricky. CReal will do it,
but has some limitations.
On Jan 16, 2013 8:26 AM, "ivan dragolov" <[email protected]> wrote:

>
> 9.3 - (2 * 4.5) => 0.3000000000000007
>
> I expected 0.3
>
> ?
>
> --
> Иван Драголов
> dragolov.net
>
> GSM: 0888 63 19 46
> GSM за SMS: 0878 82 83 93
> facebook.com/ivan.dragolov
> twitter.com/dragolov
>
> _______________________________________________
> Haskell-Cafe mailing list
> [email protected]
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>
>
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to