Toppling the numeric tower
David Eppstein
eppstein at ics.uci.edu
Thu Jul 26 11:43:45 EDT 2001
In article <DLW77.49367$Cy.6275542 at news1.rdc1.az.home.com>,
"Tim Hochberg" <tim.hochberg at ieee.org> wrote:
> > 1. isnatural()
> > 2. isintegral()
> > 3. isrational()
> > 4. isreal()
> > 5. iscomplex()
> >
> > a. isexact()
>
> This is too many. I would strip this down to
>
> A. iscomplex()
> B. isexact()
> C. isintegral()
I have to say that this would be more convenient for situations such as
defining your own extension of number types for, say, exact arithmetic in
Q[sqrt(3)]. Or even better Q[sqrt(-3)]. I was wishing I was able to do
this recently for a different project unrelated to Python, unfortunately
the program I was using didn't make it easy to plug in your own number
types...
But a couple points of clarification:
(1) is it safe to assume that isintegral() implies isexact()?
(2) should isintegral() return true for algebraic integers that are not
rational integers?
--
David Eppstein UC Irvine Dept. of Information & Computer Science
eppstein at ics.uci.edu http://www.ics.uci.edu/~eppstein/
More information about the Python-list
mailing list