H5dump: displays wrong value for IEEE 754 quadruple precision value

Edit: Please see my second post below, I had wrong assumptions about C#'s decimal type.

I try to write a quadruple precision value ( = 128 bit floating point number, IEEE 754 - Wikipedia) using C# to an H5 file and then dump that file. The value I write is 99.38 and h5dump’s output is:

HDF5 "<file-path>" {
GROUP "/" {
   ATTRIBUTE "Decimal" {
      DATATYPE  128-bit little-endian floating-point 128-bit precision
      DATASPACE  SCALAR
      DATA {
      (0): 1.18705e-4942
      }
   }
}
}

I think the problem is that the datatype Decimal in C# is in the above mentioned quadruple precision format while C/h5dump uses long double which is the 80-bit Extended precision format (Extended precision - Wikipedia).

So h5dump tries to convert from 128-bit float to 80-bit float using the generic float conversion function H5T__conv_f_f and that seems to fail. Not with an error message but with an invalid printed value.

Note: HDFView prints “0E-26” and myhdf5.hdfgroup.org gives Float128 not supported.

The hexadecimal representation of 99.38 as 128-bit double is:

Here is the attached sample file:
tmpswoUFm.tmp (171 Bytes)

Is this maybe a known problem?

Thank you and sorry for all the new threads in this forum, I just try to support as many data types as possible in my writer implementation.

Please ignore my previous post, C#'s decimal is NOT IEEE 754 compliant: double - Decimal type in C# vs IEEE-754 standard - Stack Overflow

Sorry for the confusion.

1 Like