On Sep 29, 2009, at 4:14 PM, Charles R Harris wrote:
On Tue, Sep 29, 2009 at 2:52 PM, Neal Becker
wrote:
I need the max value of an np scalar type. I had used this code:
def get_max(is_signed, base_type, total_bits):
print 'get_max:', is_signed, base_type, total_bits
if is_signed:
On Tue, Sep 29, 2009 at 2:52 PM, Neal Becker wrote:
> I need the max value of an np scalar type. I had used this code:
>
> def get_max(is_signed, base_type, total_bits):
>print 'get_max:', is_signed, base_type, total_bits
>if is_signed:
>return (~(base_type(-1) << (total_bits-1))
On Tue, Sep 29, 2009 at 15:52, Neal Becker wrote:
> I need the max value of an np scalar type. I had used this code:
>
> def get_max(is_signed, base_type, total_bits):
> print 'get_max:', is_signed, base_type, total_bits
> if is_signed:
> return (~(base_type(-1) << (total_bits-1)))
>
I need the max value of an np scalar type. I had used this code:
def get_max(is_signed, base_type, total_bits):
print 'get_max:', is_signed, base_type, total_bits
if is_signed:
return (~(base_type(-1) << (total_bits-1)))
else:
print type(base_type (-1) << total_bits)