Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #39001
| References | <kfm2t8$9ru$1@ger.gmane.org> <mailman.1841.1360957660.2939.python-list@python.org> <pan.2013.02.16.13.55.31.206000@nowhere.com> |
|---|---|
| Date | 2013-02-17 01:30 +1100 |
| Subject | Re: python math problem |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1873.1361025049.2939.python-list@python.org> (permalink) |
On Sun, Feb 17, 2013 at 12:55 AM, Nobody <nobody@nowhere.com> wrote: > Furthermore, any such calculation for which the correct answer isn't > exactly representable should produce the same result as if the correct > answer had been calculated to an infinite number of digits then rounded to > the nearest representable value according to the current rounding mode. That doesn't change the fact that, according to Murphy's Law of Floating Point Operations, the error will accumulate in one direction instead of balancing itself out. So while one operation might well produce the nearest representable value to what you'd expect from real arithmetic (and I'm not differentiating "real" from "fake" here, but rather referring to the notion of "real numbers"), multiple sequential operations will quite probably draw you further and further away. It's not something to *fear*, just something to understand and manage. It's no different from estimating by rounding things off, except that a computer estimates with a tad more precision than a human (since a computer does *everything* with a tad more precision). Gratuitous example of ridiculous rounding that still results in a plausible ball-park figure: "One pound is one kilogram." http://what-if.xkcd.com/4/ ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: python math problem Gary Herron <gherron@digipen.edu> - 2013-02-15 11:47 -0800
Re: python math problem Nobody <nobody@nowhere.com> - 2013-02-16 13:55 +0000
Re: python math problem Chris Angelico <rosuav@gmail.com> - 2013-02-17 01:30 +1100
Re: python math problem Roy Smith <roy@panix.com> - 2013-02-16 09:32 -0500
Re: python math problem Dave Angel <davea@davea.name> - 2013-02-16 13:24 -0500
csiph-web