1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
# ints shouldn't match floats:
>>> 3.0
3
>>> 3e0
3
>>> 1e3
1000
>>> 3
3.0
# Rounding:
>>> 3.1
3.0
>>> 3.1
3.2
>>> 3.1
4.0
>>> 8.22e5
810000.0
# Only the actual output is rounded up, not the expected output:
>>> 3.0
2.98
>>> 1e3
999
# The current implementation doesn't understand that numbers inside
# strings shouldn't be treated as numbers, however, you can work around with a comment:
>>> '3.1416'
'3.14' # It is important that this matches exactly!
|