[Matrix-SIG] precision of numbers

Konrad Hinsen hinsen@ibs.ibs.fr
Thu, 16 Apr 1998 17:19:08 +0200


> Is there another number type, or is there a precision parameter in Numpy,
> or can I fool it with a simple trick(I can think of one for my particular
> problem, but howabout in general)??? All answers gratefully received.

NumPy arrays by default use the C type "double". There is no guarantee
that a larger float type exists on any machine, so NumPy doesn't offer
"long double" arrays.

So if you really need more precision (i.e. if you can't solve your
problem with another algorithm), you'd have to use an
arbitrary-precision data type. There is at least one implementation
available at ftp.python.org, and you can use such a type in a
general-object array to get array behaviour. But be warned that this
will be *extremely* slow.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                          | E-Mail: hinsen@ibs.ibs.fr
Laboratoire de Dynamique Moleculaire   | Tel.: +33-4.76.88.99.28
Institut de Biologie Structurale       | Fax:  +33-4.76.88.54.94
41, av. des Martyrs                    | Deutsch/Esperanto/English/
38027 Grenoble Cedex 1, France         | Nederlands/Francais
-------------------------------------------------------------------------------