Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #20871
| References | <mailman.49.1329934400.3037.python-list@python.org> <ji3kb2$hk3$1@reader1.panix.com> <wh92r.13653$1I2.11412@newsfe08.iad> <1330196927.17481.2.camel@tim-laptop> |
|---|---|
| From | Devin Jeanpierre <jeanpierreda@gmail.com> |
| Date | 2012-02-25 21:49 -0500 |
| Subject | Re: Python math is off by .000000000000045 |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.165.1330224642.3037.python-list@python.org> (permalink) |
On Sat, Feb 25, 2012 at 2:08 PM, Tim Wintle <tim.wintle@teamrubber.com> wrote: > > It seems to me that there are a great many real numbers that can be > > represented exactly by floating point numbers. The number 1 is an > > example. > > > > I suppose that if you divide that count by the infinite count of all > > real numbers, you could argue that the result is 0%. > > It's not just an argument - it's mathematically correct. ^ this The floating point numbers are a finite set. Any infinite set, even the rationals, is too big to have "many" floats relative to the whole, as in the percentage sense. ---- In fact, any number we can reasonably deal with must have some finite representation, even if the decimal expansion has an infinite number of digits. We can work with pi, for example, because there are algorithms that can enumerate all the digits up to some precision. But we can't really work with a number for which no algorithm can enumerate the digits, and for which there are infinitely many digits. Most (in some sense involving infinities, which is to say, one that is not really intuitive) of the real numbers cannot in any way or form be represented in a finite amount of space, so most of them can't be worked on by computers. They only exist in any sense because it's convenient to pretend they exist for mathematical purposes, not for computational purposes. What this boils down to is to say that, basically by definition, the set of numbers representable in some finite number of binary digits is countable (just count up in binary value). But the whole of the real numbers are uncountable. The hard part is then accepting that some countable thing is 0% of an uncountable superset. I don't really know of any "proof" of that latter thing, it's something I've accepted axiomatically and then worked out backwards from there. But surely it's obvious, somehow, that the set of finite strings is tiny compared to the set of infinite strings? If we look at binary strings, representing numbers, the reals could be encoded as the union of the two, and by far most of them would be infinite. Anyway, all that aside, the real numbers are kind of dumb. -- Devin
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Python math is off by .000000000000045 Alec Taylor <alec.taylor6@gmail.com> - 2012-02-23 05:13 +1100
Re: Python math is off by .000000000000045 nn <pruebauno@latinmail.com> - 2012-02-22 10:29 -0800
Re: Python math is off by .000000000000045 Jussi Piitulainen <jpiitula@ling.helsinki.fi> - 2012-02-22 20:44 +0200
Re: Python math is off by .000000000000045 Grant Edwards <invalid@invalid.invalid> - 2012-02-22 20:48 +0000
Re: Python math is off by .000000000000045 Tobiah <toby@tobiah.org> - 2012-02-25 09:56 -0800
Re: Python math is off by .000000000000045 Tim Wintle <tim.wintle@teamrubber.com> - 2012-02-25 19:08 +0000
Re: Python math is off by .000000000000045 Terry Reedy <tjreedy@udel.edu> - 2012-02-25 16:05 -0500
Re: Python math is off by .000000000000045 jmfauth <wxjmfauth@gmail.com> - 2012-02-25 13:25 -0800
Re: Python math is off by .000000000000045 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-25 22:51 +0000
Re: Python math is off by .000000000000045 jmfauth <wxjmfauth@gmail.com> - 2012-02-26 01:59 -0800
Re: Python math is off by .000000000000045 Ethan Furman <ethan@stoneleaf.us> - 2012-02-27 09:28 -0800
Re: Python math is off by .000000000000045 Michael Torrie <torriem@gmail.com> - 2012-02-27 17:53 -0700
Re: Python math is off by .000000000000045 Ethan Furman <ethan@stoneleaf.us> - 2012-02-28 09:56 -0800
Re: Python math is off by .000000000000045 Devin Jeanpierre <jeanpierreda@gmail.com> - 2012-02-25 21:49 -0500
Re: Python math is off by .000000000000045 Terry Reedy <tjreedy@udel.edu> - 2012-02-26 00:44 -0500
Re: Python math is off by .000000000000045 John Ladasky <ladasky@my-deja.com> - 2012-02-26 16:24 -0800
Re: Python math is off by .000000000000045 Terry Reedy <tjreedy@udel.edu> - 2012-02-26 20:30 -0500
Re: Python math is off by .000000000000045 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2012-02-27 03:28 +0000
Re: Python math is off by .000000000000045 Grant Edwards <invalid@invalid.invalid> - 2012-02-27 15:02 +0000
Re: Python math is off by .000000000000045 Michael Torrie <torriem@gmail.com> - 2012-02-27 08:34 -0700
csiph-web