The UnsignedInteger64
data format should be able to encode correctly any integer in $[0,2^{64}-1]$. When using this data format with Export
in HDF5
format, is exhibits a strange behavior around $2^{63}$.
The Export
command I use is (in Mathematica 12)
Export["file.h5","/list"->{"Data" -> x, "DataFormat" -> "UnsignedInteger64"}]
where list
is a list of integers. The Import
command is
y=Import["file.h5", "/list"]
I used the following cases for x
:
x1 = {2^63};
x3 = {2^63 + 1};
x2 = {2^63 - 1};
x4 = {2^63, 2^63 + 1};
x5 = {2^63 - 1, 2^63 - 2};
x6 = {2^63 - 1, 2^63 + 1};
which provide outputs y1
, y2
, y3
, y4
, y5
and y6
, respectively.
The condition that xi==yi
is met for i
from 1 to 5, but not for 6. In case 6 the value of y
is a list of the same Length
as x
but where all elements are $2^{63}$.
Q: What is going on?