I should have remembered that int and Integer are different. Thanks
very much for setting me straight!

On Feb 15, 12:38 am, "D. S. McNeil" <[email protected]> wrote:
> I think it's neither Sage nor numpy that's at fault, it's a weird
> interaction (Sage 4.6.1):
>
> sage: import numpy
> sage: numpy.binary_repr(17)
> ''
> sage: numpy.binary_repr(int(17))
> '10001'
>
> and I think it's rooted in this fact:
>
> sage: hex(17)
> '11'
> sage: hex(int(17))
> '0x11'
>
> That is, Sage capital-I Integers deliberately don't have the '0x'
> prepended, and the numpy.binary_repr routine has lines
>
> ostr = hex(num)
> [..]
> bin = ''.join([_lkup[ch] for ch in ostr[2:]])
>
> which fail if the prefix isn't there.
>
> Doug
>
> --
> Department of Earth Sciences
> University of Hong Kong

-- 
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org

Reply via email to