On Tuesday, June 12, 2012 3:16:15 AM UTC+1, Jason Grout wrote:
>
> You never compare decimal numbers exactly on a computer.  Because of 
> finite precision, there almost always will be corner cases that will 
> catch you.  Instead, do something like: 
>

sage: 10.44-10.30
0.139999999999999

Don't forget the abs() in the fuzzy zero comparison:

sage: abs( (10.44-10.30)  -0.14) < 1e-10 
True

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to