[IronPython] Bug of big integer manipulation

Martin Maly Martin.Maly at microsoft.com
Thu Aug 10 06:53:14 CEST 2006


By any chance, were you able to determine which operation caused the exception and which numbers were involved? What would help me find out what the problem is faster would be get a call stack (for that, could you please run your repro with -X:ExceptionDetail switch? Then ideally if you could find out what the big integer numbers were with which the operation failed, that would be ideal.

Thanks!
Martin

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of HEMMI, Shigeru
Sent: Tuesday, August 08, 2006 4:31 PM
To: Discussion of IronPython
Subject: [IronPython] Bug of big integer manipulation

Hello,

NZMATH is a Python based number theory oriented calculation system developed by Tokyo Metropolitan University. The URL is http://tnt.math.metro-u.ac.jp/nzmath/.

Using NZMATH, I encounterd a bug of big integer manipulation.

IronPython
============================
C:\IronPython-2604>ipy
IronPython 1.0.2411 on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved.
>>> import sys
>>> sys.path.append(r'C:\Python24\Lib')
>>> sys.path.append(r'C:\Python24\Lib\site-packages')
>>> from nzmath import prime
>>> prime.nextPrime(256)
257
>>> nx = sys.maxint
>>> prime.nextPrime(nx*nx)
Traceback (most recent call last):
  File , line 0, in <stdin>##115
  File C:\Python24\Lib\site-packages\nzmath\prime.py, line 158, in nextPrime
  File C:\Python24\Lib\site-packages\nzmath\prime.py, line 206, in primeq
  File C:\Python24\Lib\site-packages\nzmath\prime.py, line 188, in smallSpsp
  File C:\Python24\Lib\site-packages\nzmath\prime.py, line 41, in spsp
ValueError: value too big
>>> prime.nextPrime(nx)  ## Seems going into infinite loop.

CPython
============================
C:\IronPython-2604>python
Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> from nzmath import prime
>>> nx = sys.maxint
>>> prime.nextPrime(nx*nx)
4611686014132420667L
>>> prime.nextPrime(nx)
2147483659L
>>>

Regards,
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list