[Haskell-cafe] 9.3 - (2 * 4.5) => 0.3000000000000007

Austin Seipp mad.one at gmail.com
Wed Jan 16 14:31:18 CET 2013


This is a rounding error. It will happen in any language due to the
imprecision of floats; for example, using Ruby:

$ irb
1.9.3-p286 :001 > 9.3 - (2 * 4.5)
 => 0.3000000000000007
1.9.3-p286 :001 > ^D
$

Read this:

http://floating-point-gui.de/

On Wed, Jan 16, 2013 at 7:25 AM, ivan dragolov <ivan at dragolov.net> 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
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>



-- 
Regards,
Austin



More information about the Haskell-Cafe mailing list