| 1 | initial version |
FWIW :
sage: x = -5564456128*e + 15125759978
sage: (x-1/47749).n(digits=50)
2.2327547500435249115043756744718383299006623385945e-10
As usual, stay exact as long as possible... The chapters of this book dedicated to numerical computation may enlighten you...
Note that a "visual" comparison based on :
sage: "%8.6g, %8.6g"%(x,1/47749)
'2.09808e-05, 2.09428e-05'
misses the target by about two magnitude orders (implying a difference of about 4e-8...).
Note also that :
sage: (x-1/47749).is_zero()
False
sage: (x-1/47749).is_positive()
False
sage: (x-1/47749).is_negative()
False
which is surprising, but conformant to the definitions of the methods : nothoing is known nor deducible about these quantities, and only numerical computation of their differences allows to answer the question.
Copyright Sage, 2010. Some rights reserved under creative commons license. Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.