[Numpy-discussion] Incorrect OverflowError?

Edward C. Jones edcjones at erols.com
Thu Oct 23 10:47:31 EDT 2003

#! /usr/bin/env python

import numarray
from numarray.numerictypes import *

# I run Gentoo 1.4 Linux with gcc 3.2.2.


arr = numarray.zeros((1,), Float64)
arr[0] = 4000000000.0
print '%f' % arr[0]
     arr[0] = 4000000000
     print "Doesn't get here."
except OverflowError, s:
     print 'Python OverflowError raised'
     print s
# OverflowError: long int too large to convert to int

# The Python long "4000000000" can be represented as a C double.
# If the OverflowError came from numarray, why was an exception raised?
# Are these problems bugs?

More information about the NumPy-Discussion mailing list