[Numpy-discussion] Casting. Method to the madness?

Mathew Yeates mathew at comma.jpl.nasa.gov
Thu Sep 26 16:13:03 EDT 2002


Hmmm, aparently, I can cast a long array to a double array but not
to a float array.

Check out the following code from arrayobject.c (Numeric 22.0)
[this is a switch on the type being casted from]

case PyArray_LONG:
    /*Shouldn't allow Longs to be cast to Ints, not safe on 64-bit 
machines!*/
    return (totype >= PyArray_INT) && (totype != PyArray_FLOAT);

This makes absolutely no sense to me. Is this a bug?

Mathew

-- 
M47h3w `/34735






More information about the NumPy-Discussion mailing list