On 12/09/2012 15:14, P Purkayastha wrote:
Can anyone point out what is wrong with this comparison:

sage: 0.2 + 0.1 == 0.3
False

It seems baffling that something as simple as this returns False.


Its a fairly common problem with doing arithmetic with floatingpoint numbers as they are only storred to some finite precision and the binary expansion could be infinite. In particular note that 0.2+0.1-0.3 returns something very small but non-zero.

Alastair

--
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
Visit this group at http://groups.google.com/group/sage-support?hl=en.


Reply via email to