I have just started learning python and I have stumbled across a particularity
python version:
Python 2.7.2 (default, Jul 20 2011, 02:32:18) [GCC 4.2.1 (LLVM, Emscripten 1.5, Empythoned)] on linux2
on:http://repl.it/languages/Python
Working with the interpreter assigning:
pi = 3.141 // 3 places decimal precision
#typing pi & pressing return puts 3.141
type(pi)
=> <type 'float'>
pi = 3.1415
type(pi)
=> <type 'float'>
#pi puts 3.1415000000000002
Ok floating point precision is notorious for being unprecise; but why do only the 4 point precision get that "tail"?
Also:
pi2 = 3.1415100000000002
pi == pi2 # pi was assigned 3.1415
=> True
print(pi2)
3.14151 # Where's my precision?