[PYTHON MATRIX-SIG] floating point equalities

Hinsen Konrad hinsenk@ere.umontreal.ca
Tue, 23 Jan 1996 15:39:57 -0500


   I bet this is because in x**y, Python currently coerces y, meaning you
   were really calculating 1.0j ** 2.0j...

   (Note that the (by now pathetically incomplete) Python test suite has
   a similar problem and solution when testing the pow() function.)

For complex numbers, 1j**2.0 is calculated as 1j**2. And with my
set of patches, the same happens for real numbers. You still don't
get the full efficiency of an integer exponentiation, but at least
the accuracy.

That is of course no argument for not fixing the pow() coercion
problem...

-------------------------------------------------------------------------------
Konrad Hinsen                     | E-Mail: hinsenk@ere.umontreal.ca
Departement de chimie             | Tel.: +1-514-343-6111 ext. 3953
Universite de Montreal            | Fax:  +1-514-343-7586
C.P. 6128, succ. Centre-Ville     | Deutsch/Esperanto/English/Nederlands/
Montreal (QC) H3C 3J7             | Francais (phase experimentale)
-------------------------------------------------------------------------------

=================
MATRIX-SIG  - SIG on Matrix Math for Python

send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================