On Fri, Sep 20, 2013 at 12:17 PM, damodar kulkarni
<kdamodar2...@gmail.com>wrote:

> Ok, let's say it is the effect of truncation. But then how do you explain
> this?
>
> Prelude> sqrt 10.0 == 3.1622776601683795
> True
> Prelude> sqrt 10.0 == 3.1622776601683796
> True
>

Because there's no reliable difference there. The truncation is in bits
(machine's binary representation) NOT decimal digits. A difference of 1 in
the final digit is probably within a bit that gets truncated.

I suggest you study IEEE floating point a bit. Also, study why computers do
not generally store anything like full precision for real numbers. (Hint:
you *cannot* store random real numbers in finite space. Only rationals are
guaranteed to be storable in their full precision; irrationals require
infinite space, unless you have a very clever representation that can store
in terms of some operation like sin(x) or ln(x).)

-- 
brandon s allbery kf8nh                               sine nomine associates
allber...@gmail.com                                  ballb...@sinenomine.net
unix, openafs, kerberos, infrastructure, xmonad        http://sinenomine.net
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to