[SciPy-user] longfloat print out problem in Windows XP

David Cournapeau david@ar.media.kyoto-u.ac...
Thu Oct 23 08:10:34 CDT 2008

Macro Zhu wrote:
> Hi,
> I met this print out problem for longfloat type:
> > print scipy.longfloat(10)
> -1.49166814624e-154
> > print float(scipy.longfloat(10))
> 10.0
> > print scipy.array(10, dtype='longfloat')
> -1.49166814624e-154
> The same problem happens with Numpy as well.
> How can I get the print out of longfloat correctly, except by
> converting it back to the float type?

You can't. I won't bore you with details, but basically, the Microsoft C
runtime (printf) does not handle long double. There is a solution, but
it was too involved when 1.2.0 was about to be released. I hope to solve
the problem for 1.3.0.

Note that the problem is only in the print statement. For example:

a = scipy.longfloat(10)
b = scipy.longfloat(10)
print a # garbage
print a.astype(scipy.float) # 10
print (a+b).astype(scipy.float) # 20



More information about the SciPy-user mailing list