[PYTHON MATRIX-SIG] floating point handling

Hinsen Konrad hinsenk@ere.umontreal.ca
Fri, 3 Nov 1995 12:00:14 -0500


   Hmm...  Globals that affect the behavior of low-level objects are
   rarely a good idea.  For instance, some non-compute-intensive module
   may be using floats and expecting exceptions -- it will break if it is
   used in your program that turns off exceptions...

That's indeed a problem. In fact this is a well-known problem for
APL users, since APL has a range of global variables that affect
the meaning of all functions (i.e. the index origin can be set to
zero or one). The solution that APL offers is that these variables
can be made local and thereby changed for an individual function,
but that is far from an ideal solution.

   How about introducing a new type, say ieeefloat, with the desired
   behavior?  Its casting behavior could easily be designed to force
   mixed-mode arithmetic (between standard and ieee floats) to be done in
   ieee mode.

I am sure two float types would create quite a bit of confusion for
users, especially those who don't care about error handling and don't
even want to understand the difference. For example, there would have
to be two different input and output notations to make clear which
version is used.

-------------------------------------------------------------------------------
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
=================