# [Python-Dev] Revamping Python's Numeric Model

**Moshe Zadka
**
moshez@zadka.site.co.il

*Sat, 04 Nov 2000 20:52:35 +0200*

[Moshe Zadka, about efficient and honest numbers]
>* I think they are, using a similar trick to Fred's automorphing dictionaries
*
[MAL]
>* You mean numbers "morph" to become floats, complex numbers, etc.
*>* on demand ? E.g. math.sqrt(-1) would return 1j ?!
*
math.sqrt has been dealt elsewhere in the PEP. It has been suggested
that math.foo will accept and return real numbers, and that
cmath.foo will accept and return complex numbers. If you
want to always deal with complex numbers, put this in your site.py
import cmath
import sys
sys.modules['math']=cmath
>* > No, I meant "not represented exactly". The real meaning for that (one
*>* > that we might or might not promise) is that it's a float. It's a place
*>* > where the numeric model takes the easy way out <wink>.
*>*
*>* Uhm, that's what I meant. I don't see much use for this though:
*>* the whole meaning of "exact" is void w/r to floats. It should
*>* be replaced by "accurate to n digits".
*
I'm just promising that floats are inexact. I don't see a need for
"accuracy to n digits" (interval mathematics, etc.) in core Python.
This should be a new module if anyone needs it. Since inexact numbers
will only come about via external modules, you can just use:
import imath # interval math module
import sys
sys.modules['math']=imath.
I'm not repeating myself.
>* This is just about as close as you can get to floating point
*>* values with computer machinery ;-)
*
I thought floats are the way to get to floating point values with computer
machinery?
--
Moshe Zadka <sig@zadka.site.co.il>