You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was trying to read an array-valued attribute from an HDF file using PDL::IO::HDF5 package and noticed that the return value is incorrect. The attribute datatype is 8-bit signed char (H5T_STD_I8LE) and I expected the package to return [-127, 127], but instead it returned [129, 127]. Examining the source code, I found out why this is happening.
The code maps H5T_STD_I8LE to $PDL::Types::PDL_Bhere. However, $PDL::Types::PDL_B represents an unsigned char datatype. Therefore, the bits representing -127 in the buffer are interpreted as 129 by PDL.
To correct this behavior, I suggest that H5T_STD_I8LE and H5T_STD_I8BE are mapped to $PDL::Types::PDL_SB which represents signed char datatype.
The text was updated successfully, but these errors were encountered:
I was trying to read an array-valued attribute from an HDF file using
PDL::IO::HDF5
package and noticed that the return value is incorrect. The attribute datatype is 8-bit signed char (H5T_STD_I8LE
) and I expected the package to return[-127, 127]
, but instead it returned[129, 127]
. Examining the source code, I found out why this is happening.The code maps
H5T_STD_I8LE
to$PDL::Types::PDL_B
here. However,$PDL::Types::PDL_B
represents an unsigned char datatype. Therefore, the bits representing-127
in the buffer are interpreted as129
by PDL.To correct this behavior, I suggest that
H5T_STD_I8LE
andH5T_STD_I8BE
are mapped to$PDL::Types::PDL_SB
which represents signed char datatype.The text was updated successfully, but these errors were encountered: