(in)exactness of complex numbers

Steve Holden sholden at holdenweb.com
Sun Jul 29 22:23:50 EDT 2001


"Guido van Rossum" <guido at python.org> wrote in message
news:cp4rry2qvh.fsf at cj20424-a.reston1.va.home.com...
> Skip Montanaro <skip at pobox.com> writes:
>
> > Once these numeric changes are all implemented, if I define a complex
> > constant with either integer real or imaginary parts, e.g.
> >
> >     c = 1+2.1j
> >
> >     d = 1.2+5j
> >
> >     e = 4+7j
> >
> > should I get an integer back (exact) or a float (inexact) when asking
for an
> > attribute that was originally an integer?  In general, can complex
numbers
> > be considered to have two exactness attributes?
>
> That's probably not worth the implementation complexity.  I expect
> that all floats and complex will be considered inexact, and all
> rationals and ints exact.  That seems to be the most practical set of
> rules, even if it doesn't satisfy everybody.
>
Wouldn't it be more sensible to say that a complex is exact if both its real
and imaginary components are exact?

Or would that require too much (sorry, no pun intended) implementation
complexity?

regards
 Steve
--
http://www.holdenweb.com/








More information about the Python-list mailing list