3 ms·
People have also very often been freaked out by >>> 1/2 0 >>> 2/3 0 ... and this has changed from Python 2 to Python 3. But the floating-point vs. rat
by schoen 11y ago
People have also very often been freaked out by
>>> 1/2
0
>>> 2/3
0
... and this has changed from Python 2 to Python 3. But the floating-point vs. rational/decimal hasn't.
You might get what you want from
>>> import decimal
>>> decimal.Decimal('0.1') + decimal.Decimal('0.2') == decimal.Decimal('0.3')
True
Still, that seems like a bunch of extra work compared to the more obvious way to type in numbers!