[PYTHON MATRIX-SIG] floating point equalities

L. Larrabee Strow strow@umbc.edu
Tue, 23 Jan 1996 14:40:48 -0500


>In preparation for the 0.30 release (still on for Friday) I've been
>cleaning up the array math functions.
>
>I'm now working on improving the floating point equality operator.  My
>understanding is that doing a == b is unreasonable for floating point
>numbers, and instead the test should be something like
>
>abs(a-b) < TOLERANCE*abs(a)
>
>Rather than have me try and rederive what this should look like from
>my vague memories of the IEEE floating point standard, I was wondering
>if anybody out there has a good chunk of code for doing this
>comparision?
>
>Thanks, Jim
>

Let the user decide how to compare for equality.  We are used to avoiding
the a==b problem.  It would probably be a mistake to "help" us too much,
since we might get lazy and make even more subtle mistakes.

--
L. Larrabee Strow                            E-mail: strow@umbc.edu
Department of Physics                        FAX   : (410) 455-1072
University of Maryland Baltimore County      Phone : (410) 455-2528
5401 Wilkens Avenue
Baltimore, MD 21228-5398                  



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

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