1 from scipy import *
   2 Float_str=['float32','float64','float96','complex64','complex128','complex192']
   3 Float=array([float32,float64,float96,complex64,complex128,complex192])
   4 print 'Numerischer Typ\tSpeicherbelegung'
   5 for k in range(Float.size):
   6         f=Float_str[k]
   7         a=Float[k](1)
   8         Speicher=a.nbytes
   9         print f,'\t',Speicher,'byte(s)'

Ausgabe:

Numerischer Typ

Speicherbelegung

float32

4 byte(s)

float64

8 byte(s)

float96

12 byte(s)

complex64

8 byte(s)

complex128

16 byte(s)

complex192

24 byte(s)

LehreWiki: SiaExercisesLesson2LoesungNumpyFloat (last edited 2008-04-21 13:31:06 by NinaMaass)