Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #20690 > unrolled thread

Re: Python math is off by .000000000000045

Started byMark Lawrence <breamoreboy@yahoo.co.uk>
First post2012-02-22 18:24 +0000
Last post2012-02-22 18:24 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Python math is off by .000000000000045 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2012-02-22 18:24 +0000

#20690 — Re: Python math is off by .000000000000045

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2012-02-22 18:24 +0000
SubjectRe: Python math is off by .000000000000045
Message-ID<mailman.50.1329935101.3037.python-list@python.org>
On 22/02/2012 18:13, Alec Taylor wrote:
> Simple mathematical problem, + and - only:
>
>>>> 1800.00-1041.00-555.74+530.74-794.95
> -60.950000000000045
>
> That's wrong.
>
> Proof
> http://www.wolframalpha.com/input/?i=1800.00-1041.00-555.74%2B530.74-794.95
> -60.95 aka (-(1219/20))
>
> Is there a reason Python math is only approximated? - Or is this a bug?
>
> Thanks for all info,
>
> Alec Taylor

Please google for floating point numbers.

-- 
Cheers.

Mark Lawrence.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web