[Numpy-discussion] supporting quad precision

Anne Archibald archibald at astron.nl
Wed Jun 5 12:07:56 EDT 2013


Hi folks,

I recently came across an application I needed quad precision for
(high-accuracy solution of a differential equation). I found a C++ library
(odeint) that worked for the integration itself, but unfortunately it
appears numpy is not able to work with quad precision arrays. For my
application the quad precision is only really needed for integrator state,
so I can manually convert my data to long doubles as I go to and from
numpy, but it's a pain. So quad precision support would be nice.

There's a thread discussing quad support:
http://mail.scipy.org/pipermail/numpy-discussion/2012-February/061080.html
Essentially, there isn't any, but since gcc >= 4.6 supports them on Intel
hardware (in software), it should be possible. (Then the thread got bogged
down in bike-shedding about what to call them.)

What would it take to support quads in numpy? I looked into the numpy base
dtype definitions, and it's a complex arrangement involving detection of
platform support and templatized C code; in the end I couldn't really see
where to start. But it seems to me all the basics are available: native C
syntax for basic arithmetic, "qabs"-style versions of all the basic
functions, NaNs and Infs. So how would one go about adding quad support?

Thanks,
Anne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130605/0427efe4/attachment.html>


More information about the NumPy-Discussion mailing list