A Date With Tim Peters...

Mark C Favas mark at chem.uwa.edu.au
Tue Dec 7 12:06:46 EST 1999


rob at hooft.net (Rob W. W. Hooft) writes:

>>>>>> "TP" == Tim Peters <tim_one at email.msn.com> writes:

> TP>>> import math 
> TP>>> zero = 0.0 
> TP>>> math.atan2(zero, zero)
> TP> 0.0
> TP>>> zero = -zero 
> TP>>> math.atan2(zero, zero)
> TP> -3.14159265359

> TP> That is, IEEE-754 mandates signed zeroes too, in part so that an
> TP> underflow "remembers which direction it came from".

>Python 1.5.2b1 (#4, Jan 14 1999, 12:05:48)  [GCC egcs-2.90.21 971202 (egc on irix5
>Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>>> import math
>>>> zero=0.0
>>>> math.atan2(zero,zero)
>Traceback (innermost last):
>  File "<stdin>", line 1, in ?
>ValueError: math domain error
>>>> 
>no11[101]nonius% uname -a
>IRIX no11 5.3 02091401 IP22 mips

>So it is not portable.....

And indeed I get the same result as Rob on DEC^H^H^HCompaq Alpha, Tru64Unix
Version 4.0F (with current CVS version of Python 1.5.2) - portably
non-portable... (modulo -ieee compilation flags) <grin>

Mark
--
Email  - mark at chem.uwa.edu.au      ,-_|\                           Mark C Favas
Phone  - +61 9 380 3482           /     \               Department of Chemistry
Fax    - +61 9 380 1005      ---> *_,-._/   The University of Western Australia
                                       v                               Nedlands
Loc    - 31.97 S, 115.81 E                               Western Australia 6009



More information about the Python-list mailing list