3 ms·
SymPy, being Python, gets it wrong... but if you use S = sympify to transform the long numbers into SymPy objects it works: S('9999999999999999.0') - S('99
by ivan_ah 10y ago
SymPy, being Python, gets it wrong... but if you use S = sympify to transform the long numbers into SymPy objects it works:
S('9999999999999999.0') - S('9999999999999998.0')
1.0
- flaviojuvenal 10y agoYou can use Decimal built-in also: In [1]: from decimal import Decimal as D In [2]: D('9999999999999999.0') - D('9999999999999998.0') Out[2]: Decimal('1.0') From docs: Decimal “is based on a floating-point model which was designed with people in mind, and necessarily has a paramount guiding principle – computers must provide an arithmetic that works in the same way as the arithmetic that people learn at school.” https://docs.python.org/3.6/library/decimal.html https://docs.python.org/3.6/library/decimal.html
- PDoyle 10y ago...until they divide by 3.