From: mark at chem.uwa.edu.au (Mark C Favas)
Date: 28 Apr 99 04:42:36 GMT
Subject: FP exception, core dump in Python 1.5.2 (Tim's doing <grin>)
Message-ID: <mark.925274556@declan>
Content-Length: 2561
X-UID: 1609                                                  

[Tim Peters suggests some code to generate INFs and NANs]

>def _make_inf():
>    x = 2.0
>    x2 = x * x
>    i = 0
>    while i < 100 and x != x2:
>        x = x2
>        x2 = x * x
>        i = i + 1
>    if x != x2:
>        raise ValueError("This machine's floats go on forever!")
>    return x

>PINF = _make_inf()
>MINF = -PINF
>NAN = PINF - PINF
>if 1.0 + NAN == 1.0:
>    raise ValueError("This machine doesn't have NaNs, "
>                     "'overflows' to a finite number, "
>                     "or is 754-conformant but is using "
>                     "a goofy rounding mode.")
>PZERO = 0.0
>MZERO = -PZERO

[Mark tries it, and...]

On my platform, (DEC Alpha, Digital Unix 4.0D, Python 1.5.2) I get... a core
dump! (exclamation because it's one of the few Python core dumps I've seen).

[code modified to print i, x, x2]

python ieee.py 
0 2.0 4.0
1 4.0 16.0
2 16.0 256.0
3 256.0 65536.0
4 65536.0 4294967296.0
5 4294967296.0 1.84467440737e+19
6 1.84467440737e+19 3.40282366921e+38
7 3.40282366921e+38 1.15792089237e+77
8 1.15792089237e+77 1.34078079299e+154
Floating exception (core dumped)

Python 1.5.2 (#1, Apr 17 1999, 05:27:57) [C] on osf1V4
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
>>>

dbx /usr/local/bin/python core 
dbx version 3.11.10
Type 'help' for help.
Core file created by program "python"

thread 0x5 signal Floating point exception at >*[nxm_thread_kill, 0x3ff8058a608]        ret     r31, (r26), 1
(dbx) where
>  0 nxm_thread_kill(0x140081940, 0x0, 0x1400b13c0, 0x0, 0x3ff00000000) [0x3ff8058a608]
   1 pthread_kill(0x0, 0x0, 0x11fffef20, 0x3ffc018a888, 0x3ff00000000) [0x3ff80577998]
   2 (unknown)() [0x3ff8056c234]
   3 (unknown)() [0x3ff807b22d8]
   4 (unknown)() [0x3ff807b3824]
   5 exc_unwind(0x3ff800d4544, 0x11fffdfe0, 0xabadabad00beed00, 0x1400b13c0, 0x3ff807b3af4) [0x3ff807b3864]
   6 exc_raise_signal_exception(0x86, 0x0, 0x12005b218, 0x1, 0x8) [0x3ff807b3af0]
   7 (unknown)() [0x3ff80578cc8]
   8 PyFloat_FromDouble(0x0, 0x0, 0x12006f404, 0x14005c770, 0x1200533cc) [0x12005b214]
   9 PyNumber_Multiply(0x1400b2988, 0x1400b13c0, 0x1400b13c0, 0x0, 0x3) [0x12006f400]
(dbx) 




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




