From: David M. C. <co...@ph...> - 2006-06-30 18:59:32
|
On Fri, 30 Jun 2006 14:42:33 -0400 "Jonathan Taylor" <jon...@ut...> wrote: > +1 for some sort of float. I am a little confused as to why Float64 > is a particularly good choice. Can someone explain in more detail? > Presumably this is the most sensible ctype and translates to a python > float well? It's "float64", btw. Float64 is the old Numeric name. Python's "float" type is a C "double" (just like Python's "int" is a C "long"). In practice, C doubles are 64-bit. In NumPy, these are the same type: float32 == single (32-bit float, which is a C float) float64 == double (64-bit float, which is a C double) Also, some Python types have equivalent NumPy types (as in, they can be used interchangably as dtype arguments): int == long (C long, could be int32 or int64) float == double complex == cdouble (also complex128) Personally, I'd suggest using "single", "float", and "longdouble" in numpy code. [While we're on the subject, for portable code don't use float96 or float128: one or other or both probably won't exist; use longdouble]. -- |>|\/|< /--------------------------------------------------------------------------\ |David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/ |co...@ph... |