[MATRIX-SIG] Re: [PYTHONMAC-SIG] MacPython v1.5b3 / NumPy bugs?
Jack Jansen
Jack.Jansen@cwi.nl
Wed, 07 Jan 1998 13:09:52 +0100
I've added the matrix-sig people to the recipients, hopefully there's someone
there who has a bright idea.
>
> 2) I reported this next problem in the NumPy that came with v1.5a4 and it
> seems to still be there. However, I suspect this is a NumPy specific
> problem. By just importing the RandomArray module, I get:
>
> >>>>> import RandomArray
> >>Traceback (innermost last):
> >> File "<stdin>", line 1, in ?
> >> File "Macintosh HD:Development:Python v1.5:Python
> >>1.5b3:Extensions:NumPy:NumPy:RandomArray.py", line 12, in ?
> >> seed()
> >> File "Macintosh HD:Development:Python v1.5:Python
> >>1.5b3:Extensions:NumPy:NumPy:RandomArray.py", line 8, in seed
> >> x = int(t)
> >>OverflowError: float too large to convert
> >>>>>
This is because MacPython time.time() can return a float that is bigger than
can be represented in a signed int (but it could have been represented in a
32bit unsigned int, had Python had such a type).
>
> Rob Managan reported this fix but my first concern is if this is legit and
> doesn't introduce any problems or correlations in the generator:
>
> >def seed(x=0,y=0):
> > if x == y == 0:
> > import time
> > t = time.time()
> > x = long(t)
> > y = long((t-long(t))*1000000)
> > ranlib.set_seeds(x,y)
> >
>
> Now this fix generates errors at ranlib.set_seeds with:
>
> OverflowError: long int too long to convert.
Yes, I noticed that. All the other fixes I tried (clamping the x value to 31
bits, or by trickery converting the longint to the 32bit signed representation
that corresponds to the unsigned value) have resulted in strange crashes
inside ranlib.set_seeds(). It turns out that the library that underlies the
ranlib module handles errors by calling printf() and then exit(); not very
nice on the Mac because you never get to see the output:-(
Apparently the numbers you give to ranlib.set_seeds() have to satisfy certain
criteria, what are these criteria, matrix-folks? If I know these I can come up
with two randomish numbers that match them for the mac...
--
Jack Jansen | ++++ stop the execution of Mumia Abu-Jamal ++++
Jack.Jansen@cwi.nl | ++++ if you agree copy these lines to your sig ++++
http://www.cwi.nl/~jack | see http://www.xs4all.nl/~tank/spg-l/sigaction.htm
_______________
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________