Decimals to fraction strings

Dennis E. Hamilton infonuovo at email.com
Sat May 20 11:49:52 EDT 2000


OK, I can't help myself.

Here's a great example of precision versus accuracy.

Early in this thread, someone wrote .6667 and talked about 1/3 being
better, and it has stayed that way for several rounds of position
sharpening.  I suggest that 2/3 would be a *lot* better than that.

There's a lesson in here somewhere.

-- Dennis

-----Original Message-----
From: python-list-admin at python.org
[mailto:python-list-admin at python.org]On Behalf Of Mike Steed
Sent: Thursday, 18 May 2000 10:00
To: python-list at python.org; python-list at python.org
Subject: RE: Decimals to fraction strings


> From: jraven at psu.edu [mailto:jraven at psu.edu]
> Sent: Thursday, May 18, 2000 10:56 AM
> To: python-list at python.org
> Subject: Re: Decimals to fraction strings
>
>
> On 17 May 2000 11:56:51 GMT, Mark Jackson
> <mjackson at wc.eso.mc.xerox.com> wrote:
> >=?ISO-8859-1?Q?Fran=E7ois_Pinard?= <pinard at iro.umontreal.ca> writes:
> >> mjackson at wc.eso.mc.xerox.com (Mark Jackson) writes:
> >>
> >> Not necessarily.  0.6667 is well approximated by 1:3, for
> example, while
> >> if you force the denominator to be an exponent of 10, you
> will obtain a
> >> fraction which is not only uglier, but less precise.
> >
> >It's only less precise if the intended result was 1/3 rather than
> >6667/10000, but if "0.6667" is what you're given there's no way to
> >tell.  One could introduce an arbitrary tolerance within which a
> >"simpler" rational fraction is accepted (as I see you have in the
> >renamed thread) but in the end what you've shown is that the original
> >poster's approach doesn't always yield the "best" answer to a
> >*different* problem.
> >
>
> Well, in keeping with the comp.lang.python tradition of drifting
> off-topic, there actually is a sense, due to Dirichlet, in which
> 1/3 is a better approximation to 0.6667.

[snip]

This is all very interesting, but perhaps I am getting lost in the
arithmetic.  Isn't 1/3 actually closer to 0.3333?

The-only-useful(?)-contribution-I-have-ly-y'rs,
Mike.

--
http://www.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list