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

Patrick Mylund Nielsen haskell at patrickmylund.com
Wed Jan 16 14:30:13 CET 2013


Fun with floating point!

# ghci
GHCi, version 7.4.2: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> 9223372036854775807.0 == 9223372036854775808
True

http://en.wikipedia.org/wiki/Floating_point#Accuracy_problems



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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20130116/dce37940/attachment.htm>


More information about the Haskell-Cafe mailing list