[Numpy-discussion] supporting quad precision
Wed Jun 12 13:55:51 CDT 2013
On 9 June 2013 13:23, David Cournapeau <firstname.lastname@example.org> wrote:
> So it depends on the CPU, the OS and the compiler. Using long double
> for anything else than compatibility (e.g. binary files) is often a
> mistake IMO, and highly unportable.
Now this I have to comment on. Long double is highly questionable for
compatibility, especially with binary files, for the reasons you describe.
But if what you want is something like double but with a few extra decimal
places and hardware support, long double is exactly what you want.
Portably! Some platforms will fail to give you any extra decimal places,
and in-memory size may differ, but you can be pretty confident that it'll
give you approximately what you're looking for anywhere.
I am using it right now (and in fact one of the standard tools, tempo2 does
this also) for handling pulsar pulse arrival times. These are expressed in
Modified Julian Days, so typically are of order 50000, but we care about
nanosecond-level differences in these numbers (and yes, there are pulsars
where you can track every rotation for ten thousand days to less than a
microsecond). Doubles give you quarter-microsecond roundoff error on every
operation. Long doubles are better, though not enough for me to be really
comfortable. Hence pining after quads.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the NumPy-Discussion