<p>Looking at the rational module, I think you're right: it really shouldn't be too hard to get quads working as a user type using gcc's __float128 type, which will provide hardware arithmetic in the unlikely case that the user has hardware quads. Alternatively, probably more work, one could use a package like qd to provide portable quad precision (and quad-double).</p>
<p>I'll take a look.</p>
<p>Anne</p>
<div class="gmail_quote">On Jun 5, 2013 7:10 PM, "David Cournapeau" <<a href="mailto:cournape@gmail.com">cournape@gmail.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On Wed, Jun 5, 2013 at 5:21 PM, Charles R Harris<br>
<<a href="mailto:charlesr.harris@gmail.com">charlesr.harris@gmail.com</a>> wrote:<br>
> Hi Anne,<br>
><br>
> Long time no see ;)<br>
><br>
> On Wed, Jun 5, 2013 at 10:07 AM, Anne Archibald <<a href="mailto:archibald@astron.nl">archibald@astron.nl</a>> wrote:<br>
>><br>
>> Hi folks,<br>
>><br>
>> I recently came across an application I needed quad precision for<br>
>> (high-accuracy solution of a differential equation). I found a C++ library<br>
>> (odeint) that worked for the integration itself, but unfortunately it<br>
>> appears numpy is not able to work with quad precision arrays. For my<br>
>> application the quad precision is only really needed for integrator state,<br>
>> so I can manually convert my data to long doubles as I go to and from numpy,<br>
>> but it's a pain. So quad precision support would be nice.<br>
>><br>
>> There's a thread discussing quad support:<br>
>> <a href="http://mail.scipy.org/pipermail/numpy-discussion/2012-February/061080.html" target="_blank">http://mail.scipy.org/pipermail/numpy-discussion/2012-February/061080.html</a><br>
>> Essentially, there isn't any, but since gcc >= 4.6 supports them on Intel<br>
>> hardware (in software), it should be possible. (Then the thread got bogged<br>
>> down in bike-shedding about what to call them.)<br>
>><br>
>> What would it take to support quads in numpy? I looked into the numpy base<br>
>> dtype definitions, and it's a complex arrangement involving detection of<br>
>> platform support and templatized C code; in the end I couldn't really see<br>
>> where to start. But it seems to me all the basics are available: native C<br>
>> syntax for basic arithmetic, "qabs"-style versions of all the basic<br>
>> functions, NaNs and Infs. So how would one go about adding quad support?<br>
>><br>
><br>
> There are some improvements for user types committed in 1.8-dev. Perhaps<br>
> quad support could be added as a user type as it is still platform/compiler<br>
> dependent. The rational type added to numpy could supply a template for<br>
> adding the new type.<br>
<br>
I would be in support of that direction as well: let it live<br>
separately until CPU/compiler support is coming up.<br>
<br>
Anne, will you be at scipy conference ? Improving user data type<br>
internal API is something I'd like to work on as well<br>
<br>
David<br>
_______________________________________________<br>
NumPy-Discussion mailing list<br>
<a href="mailto:NumPy-Discussion@scipy.org">NumPy-Discussion@scipy.org</a><br>
<a href="http://mail.scipy.org/mailman/listinfo/numpy-discussion" target="_blank">http://mail.scipy.org/mailman/listinfo/numpy-discussion</a><br>
</blockquote></div>