PDA

View Full Version : weirdness between windows and linux


SHY
10-25-2006, 07:53 PM
a m8 of mine was reading thru the python tutorial and while he was trying out some float numbers formatting, he came to a weird result (note: he is using windowsXP):


>>> print '%0.50f' % (22.0/7.0)
3.14285714285714280000000000000000000000000000000000


this is what i get on linux:


>>> print '%0.50f' % (22.0/7.0)
3.14285714285714279370154144999105483293533325195312


how the hell is this possible?

Shoot2Kill
10-25-2006, 10:02 PM
cos windowze sucks....

rawriddle
11-17-2006, 12:26 AM
http://www.cprogramming.com/tutorial/floating_point/understanding_floating_point_representation.html

Read that, and you'll have either an understanding or a better idea; if the latter, and you're still interested, do some more research.