By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,172 Members | 762 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,172 IT Pros & Developers. It's quick & easy.

22.800000 and a 1 on the end!!??

P: n/a
>>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
Share this Question
Share on Google+
3 Replies


P: n/a
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

P: n/a
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

P: n/a
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.