468,294 Members | 1,829 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,294 developers. It's quick & easy.

22.800000 and a 1 on the end!!??

>>x = 5
>>x /= 2
x
2
>>x *=11.4
x
22.800000000000001

ok where does the 1 in the come from?
Jun 27 '08 #1
3 784
On May 25, 8:58*pm, notnorweg...@yahoo.se wrote:
>x = 5
x /= 2
x
2
>x *=11.4
x

22.800000000000001

ok where does the 1 in the come from?
Floating point arithmetic.

Michael Foord
http://www.ironpythoninaction.com/
Jun 27 '08 #2
no**********@yahoo.se schrieb:
ok where does the 1 in the come from?
Conversion to floating point values, which have no precise
representation for all numbers that have such in the decimal system.
Read more on http://en.wikipedia.org/wiki/IEEE_754-1985

Regards,
Johannes

--
"Wer etwas kritisiert muss es noch lange nicht selber besser können. Es
reicht zu wissen, daß andere es besser können und andere es auch
besser machen um einen Vergleich zu bringen." - Wolfgang Gerber
in de.sci.electronics <47***********************@news.freenet.de>
Jun 27 '08 #3
ok where does the 1 in the come from?

http://www.python.org/doc/faq/genera...-so-inaccurate

Regards,
Martin
Jun 27 '08 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Nat | last post: by
10 posts views Thread by NKOBAYE027 | last post: by
3 posts views Thread by Bob Hynes | last post: by
11 posts views Thread by Steve Jorgensen | last post: by
8 posts views Thread by rdemyan via AccessMonster.com | last post: by
5 posts views Thread by The alMIGHTY N | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.