[Numpy-discussion] Formatting uint64 number

David Goldsmith d.l.goldsmith at gmail.com
Thu Nov 5 16:35:31 EST 2009


On Sun, Nov 1, 2009 at 8:49 PM, Charles R Harris
<charlesr.harris at gmail.com>wrote:

>
> On Sun, Nov 1, 2009 at 8:37 PM, Thomas Robitaille <
> thomas.robitaille at gmail.com> wrote:
>
>> Hello,
>>
>> I have a question concerning uint64 numbers - let's say I want to
>> format a uint64 number that is > 2**31, at the moment it's necessary
>> to wrap the numpy number inside long before formatting
>>
>> In [3]: "%40i" % np.uint64(2**64-1)
>> Out[3]: '                                      -1'
>>
>> In [4]: "%40i" % long(np.uint64(2**64-1))
>> Out[4]: '                    18446744073709551615'
>>
>> Would it be easy to modify numpy such that it automatically converts
>> uint64 numbers to long() instead of int() when implicitly converted to
>> python types?
>>
>> Hmm, I suspect this is a bug whose source is uint64 having an integer
> conversion function as part of the type whereas it should be undefined. A
> quick look at the source leaves me befuddled, so tracking down just how this
> happens might be a bit of work.
>
> Chuck
>

Based on this, unless someone has other ideas/input, Thomas, please file a
bug ticket at:

http://projects.scipy.org/numpy

(Note: you'll have to register first - please see
http://scipy.org/BugReportfor more on that, as well as bug report
submission guidelines.)

Thanks,

DG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20091105/53779450/attachment.html>


More information about the NumPy-Discussion mailing list