# [PYTHON MATRIX-SIG] Re: Yet another way to crash the interpreter.

**Jim Hugunin
**
hugunin@mit.edu

*Fri, 16 Aug 1996 12:49:41 -0400*

tim@lassi.ece.uiuc.edu wrote:
>*
*>* Hi,
*>*
*>* Here's one more: Numeric's sqrt doesn't work with long its. And other
*>* Numerical stuff seems to crash the interpreter when combined with long
*>* ints. For example:
*>*
*>* >>> from Numeric import *
*>* >>> sqrt(4l)
*>* Traceback (innermost last):
*>* File "<stdin>", line 1, in ?
*>* AttributeError: attribute-less object
*
That's life... Well seriously, what do you expect to happen here?
Taking the sqrt of a long int is a fairly involved process, and I'd hate
to be the one who had to write the code to find the sin of one.
If a python object has a __sqrt__ method, then the sqrt function will
work properly on it. Since long ints don't export any such methods
there's not really any good options. Sorry.
>* >>> 4/arange(1,3)
*>* 4 2
*>* >>> 4l/arange(1,3)
*>* Segmentation fault
*>*
*>* ...Later
*>*
*>* >>> from Numeric import *
*>* >>> 4l*arange(1,3)
*>* Segmentation fault
*
These are very strange, and don't happen to me on either solaris of NT
with alpha2. Please test them out again with alpha2 on your system and
if the problem persists we might have to track it down together.
BTW - what system are you working on?
-Jim
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================