3 ms·
Try the usual decimally-unrepresentable numbers (like 1/3).
by fulafel 11y ago
Try the usual decimally-unrepresentable numbers (like 1/3).
- mkesper 11y agoAs illumen pointed out, Python has also got fractions. For things like Pi however, there is no exact numerical representation and you'd probably want sympy or something similar.
- fulafel 11y agoSure. But the inability to represent 1/3 in decimal is just the same as inability to represent 1/10 in binary. The binary case just seems different because we are using a foreign base (decimal) literal "0.1" to express the binary number.