asdf-format / asdf-standard

Standards document describing ASDF, Advanced Scientific Data Format
http://asdf-standard.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
72 stars 29 forks source link

Support extended precision floating point numbers #20

Open mdboom opened 10 years ago

mdboom commented 10 years ago

Following Numpy's lead on this is going to lead to confusion, so it's been backed out.

But at some point, we should find a way to support the landscape of different floating point numbers -- probably as an "optional" feature, since not all programming environments will find it very convenient.

perrygreenfield commented 10 years ago

Is it simple to write code to truncate extended precision to match the maximum on a given platform? If so, the standard behavior could be to do that and issue a warning.

mdboom commented 10 years ago

Yes -- that's simple enough to do -- with the implementation caveat that pyfinf is trying to avoid some of the pitfalls of pyfits when the in-memory representation doesn't match the on-disk representation. (i.e. Numpy custom dtypes may be a better way to handle that rather than the copying tricks which were the best option at the time PyFITS was started).

The other complication is that there are multiple extended precision formats. There are the 80-bit numbers supported by Intel hardware (but not in the IEEE 754) that are aligned (generally) by 96 bits on 32-bit processors/operating systems and 128 bits on 64-bit processors/operating systems. Then there are the true quad-precision numbers as defined in IEEE 754, but not directly supported by Intel hardware.

As an archival format, we probably need to support all three forms (at least) and give them unambiguous names. (Which Numpy doesn't do -- it calls things differently depending on what platform it's running on, which doesn't make sense for a data interchange format).