On May 9, 6:51 pm, Grant Edwards <[EMAIL PROTECTED]> wrote:

> Is there any way to do single-precision floating point
> calculations in Python?

Yes, use numpy.float32 objects.

> I know the various array modules generally support arrays of
> single-precision floats.  I suppose I could turn all my
> variables into single-element arrays, but that would be way
> ugly...


Numpy has scalars as well.

>>> import numpy
>>> a = numpy.float32(2.0)
>>> b = numpy.float32(8.0)
>>> c = a+b
>>> print c
10.0
>>> type(c)
<type 'numpy.float32'>
>>>



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to