bitsize?

David C. Ullrich ullrich at math.okstate.edu
Thu Mar 16 20:37:48 CET 2000


    Some comments of mine in the past have been misinterpreted
as requests for changes when they really were not that at all.
Here otoh I have a request: It would be nice if there was a
builtin "bitsize" function returning the number of bits in a
long value. (Ie ceil(log_2(n)), more or less).

    A few bugs (features?) in real.py have got me to doing
a few numeric things using longs. A person really does
need bitsize() to get an appropriate "initial guess"
for lots of algorithms. The bitsize function in real.py is
a magnificent hack, but it really shouldn't be needed -
something inside Python knows how many bits the long
is taking, and I don't see what harm it could do to expose
this information. It's not like I want the address or anything...

    (Speaking of addresses: Does anyone know a valid one
for Jurjen N.E. Bos, the author of real.py? I have a few that
don't work if you want to trade.)

Thanks,
DU.




More information about the Python-list mailing list