[MATRIX-SIG] Fix to NumPy10

Kevin Rodgers krodgers@tdyryan.com
Fri, 06 Mar 1998 12:32:56 -0800


At 05:59 PM 3/6/98 -0000, Andrey Kaliazin wrote:
>Look - another bug? (I use Win'95, Python 1.5, Numpy10)
>Maybe it is a supposed behaviour, but ...
>>>> r = arange(13)
>>>> r
>array([ 0,  1,  2,  3,  4,  5,  6,  7,  8,  9, 10, 11, 12])
>>>> ar=pow(10,r)
>### ar=10**r produce the same
>>>> ar
>array([1, 10, 100,1000, 10000,100000,
>         1000000, 10000000, 100000000, 1000000000,
>       1410065408, 1215752192, -727379968])
>
>How do you like it? I do not.
>never can be 10**10 =1410065408
>
>of course, 10.0**r gives "right" result.

If you omit the "type" argument to array, it will pick the smallest type
that all of the array elements will fit in, so in your case it picked
32-bit signed integer.  10**10 overflows a 32-bit signed integer . . .
----------------------------------------------------------------------
Kevin Rodgers     Teledyne Ryan Aeronautical  krodgers@tdyryan.com
"This one goes up to eleven."  --  Nigel Tufnel
----------------------------------------------------------------------

_______________
MATRIX-SIG  - SIG on Matrix Math for Python

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