Re: [Numpy-discussion] max value of np scalars

2009-09-30 Thread Travis Oliphant
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:

Re: [Numpy-discussion] max value of np scalars

2009-09-29 Thread Charles R Harris
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))

Re: [Numpy-discussion] max value of np scalars

2009-09-29 Thread Robert Kern
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))) >

[Numpy-discussion] max value of np scalars

2009-09-29 Thread Neal Becker
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)