[Numpy-discussion] type info

Peter Verveer verveer at embl-heidelberg.de
Mon Sep 1 06:11:02 CDT 2003


On Monday 01 September 2003 14:55, Pearu Peterson wrote:
> On Mon, 1 Sep 2003, Peter Verveer wrote:
> > Is there some way in numarray to find out what the maximum and minimum
> > values are that a type can hold? For instance, is there a convenient way
> > to find out what the maximal possible value of the Float32 type is?
>
> I am not completely sure what is behind of the following way but
>
> >>> numarray.fromstring('\xff\xff\x7f\x7f','f')
>
> array([  3.40282347e+38], type=Float32)
>
> seems to give the maximum value for Float32.
>
> Pearu

Sure, it is not too difficult to find the minimum and maximum values of each 
type, given the bitsize (although there may be portability issues). But it 
would be convenient to have such properties directly accessible in numarray, 
I think.

Peter





More information about the Numpy-discussion mailing list