ANN: Experimental Number Types (Integer, Rational, Floats)

Steve Holden sholden at holdenweb.com
Thu Apr 26 09:16:22 EDT 2001


[posted and mailed]

"Moshe Zadka" <moshez at zadka.site.co.il> wrote ...
> On Wed, 25 Apr 2001 12:14:01 +0200, "M.-A. Lemburg" <mal at lemburg.com>
wrote:
>
> > Still, you have valid points here and I think Moshe should consider
> > these in his PEP (that's why I put him on CC -- hi Moshe ;-)
>
> Thanks. I try to read c.l.py, but I sometimes miss out.
> I'll try to put some more words under "Open Issues". Basically,
> I'm not sure if I want to make the string matcher that complicated --
> also recognize "1.0 1/2"? "3/1 5/7"? "4/2 3/4" etc....
> And anyway, my PEP is behind the implementation -- this *will* be fixed,
> but anyone who is really interested in the future of my PEP should
> definitely checkout the implementation. Currently, the implementation
> recognizes these types strings --
>
> 1. "105"
> 2. "105.7"
> 3. "105.7e1"
> 4. "105/7"
> 5. "105.7/8.3"
> 6. "105.7e1/8.3e-2"
>
5 seems a bit odd, and 6 seems way bizarre to my little brain. Surely the
"ratio" in "rational" refers to the ration of two *integers*, not two reals.
Isn't the point of implementing rationals to move away from floating-point
representation, allowing us to work within specified error limits yet not be
confused by literal representations with insufficient precision to be as
accurate as we would like?

Note I have not checked your implementation, so if you are elevating
everything to integer before reducing to rational, and not using f-p at all,
I apologize in advance. It's a *long* time since my numerical analysis
classes... PEPs themselves are a lot for me to keep up with right now.

but-of-course-you-built-the-tests-first-didn't-you-ly y'rs  - steve





More information about the Python-list mailing list