double support in Python?
Isaac To
kkto at csis.hku.hk
Thu Feb 6 20:57:16 EST 2003
More information about the Python-list mailing list
Thu Feb 6 20:57:16 EST 2003
- Previous message (by thread): float / double support in Python?
- Next message (by thread): float / double support in Python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
>>>>> "Brandon" == Brandon Van Every <vanevery at 3DProgrammer.com> writes: Brandon> Um, that's like, absolutely brain-dead to a 3D game developer. Brandon> Does Numeric Python give you a 4-byte float type? The only benefit of 4-byte floats on real computers is that it consumes less space. Computations done in 4-byte floats are seldom faster than those in 8-byte doubles (some computers convert them back and forth to 8-byte doubles even for 4-byte floats, so they can even be slower). But the benefit of space efficiency is doubtful in Python, since every object uses 8 more bytes: #define PyObject_HEAD \ int ob_refcnt; \ struct _typeobject *ob_type; #define PyObject_HEAD_INIT(type) 1, type, so the comparison is 12-byte vs. 16-byte. On the other hand, if you have a whole bunch of double's to store, look at the array module. It allows you to store a bit array of values, without making each of them an object. And in that array module, you can choose to store 4-byte or 8-byte values. When you actually get values from them, it will wrap up the values to an object, so it is slower, but more space efficient. Regards, Isaac.
- Previous message (by thread): float / double support in Python?
- Next message (by thread): float / double support in Python?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list