To answer your question though, there is an example in the HDF5 User's Guide, 
section 6.5.2.1


To illustrate a user-defined floating point number, the example below shows how 
to create a 24-bit floating point number that starts 5 bits into a 4 byte word. 
The floating point number is defined to have a mantissa of 19 bits (bits 5-23), 
an exponent of 3 bits (25-27), and the sign bit is bit 28. (Note that this is 
an illustration of what can be done and is not necessarily a floating point 
format that a user would require.)
hid_t dt;

dt = H5Tcopy(H5T_IEEE_F32LE);

H5Tset_precision(dt, 24);
H5Tset_fields (dt, 28, 25, 3, 5, 19);
H5Tset_pad(dt, H5T_PAD_ZERO, H5T_PAD_ONE);
H5Tset_inpad(dt, H5T_PAD_ZERO);

Code Example 6-8. A user-defined 24-bit floating point datatype


[Dtypes_fig9.JPG]

Figure 6-9. A user-defined floating point datatype



From: Hdf-forum [mailto:[email protected]] On Behalf Of 
Nelson, Jarom
Sent: Thursday, March 16, 2017 1:38 PM
To: HDF Users Discussion List <[email protected]>
Subject: Re: [Hdf-forum] High precision floats

The forum history is searchable on nabble:
http://hdf-forum.184993.n3.nabble.com/


From: Hdf-forum [mailto:[email protected]] On Behalf Of 
Martin Shetty
Sent: Wednesday, March 15, 2017 4:55 PM
To: [email protected]<mailto:[email protected]>
Subject: [Hdf-forum] High precision floats

I see from documentation that you can define custom floating types. Are there 
any examples out there for how to do this with GMP or MPFR? Or perhaps even 
more conveniently with boost/multiprecision?
http://www.boost.org/doc/libs/1_63_0/libs/multiprecision/doc/html/boost_multiprecision/tut/floats.html
Would (should?) hdfview also be able to understand these types? It sees 'long 
double' as opaque, but this one is not truly multiplatform so it is not of as 
much interest anyway.

P.S. Is there any way to search the HDF mailing list's archive other than 
downloading the gzips and grepping them? ;) I don't see any search capability 
on the website.
_______________________________________________
Hdf-forum is for HDF software users discussion.
[email protected]
http://lists.hdfgroup.org/mailman/listinfo/hdf-forum_lists.hdfgroup.org
Twitter: https://twitter.com/hdf5

Reply via email to