[Numpy-discussion] PEP 31XX: A Type Hierarchy for Numbers (and other algebraic entities)
Thu Apr 26 11:07:20 CDT 2007
[sage list added]
"Travis E. Oliphant" <email@example.com> writes:
> The SAGE people may be interested in this, but I doubt there will more
> than a handful of users of these algebraic base classes.
SAGE has quite a sophisticated type hierarchy, and a sophisticated set
of coercion methods. What is done in SAGE should definitely be
consulted, since it is probably the most complex set of mathematical
types yet written in python. The SAGE tutorial is at
and Section 2.2 gives a brief introduction to numbers:
The SAGE reference manual is at
and nearby chapters are quite relevant for this discussion.
> For general purpose Python, I would do something like
> Floating_Complex # uses hardware float
> Floating # uses hardware float
Note also that double-precision reals are a subset of the rationals,
since each double precision real is exactly representable as a
rational number, but many rational numbers are not exactly
representable as double precision reals. Not sure if this means
that reals should be a subclass of the rationals.
I believe that in SAGE these relationships aren't expressed using
More information about the Numpy-discussion