rogersce / cnpy

library to read/write .npy and .npz files in C/C++
MIT License
1.31k stars 300 forks source link

Incorrect results when loading a float32 array #62

Closed netw0rkf10w closed 4 years ago

netw0rkf10w commented 4 years ago

Hello,

I would like to report a potential bug in the software: when loading a float32 numpy array, it gives incorrect values. I spent a while on this bug before realizing that converting the numpy array to float64 before saving makes it work.

Best regards.

netw0rkf10w commented 4 years ago

Sorry, this was because I loaded it as double. I changed to float and it works.

Joevaen commented 4 years ago

Sorry, this was because I loaded it as double. I changed to float and it works.

Hi, could you please tell me how to check data of the array loaded via the type cnpy::NpyArray?

netw0rkf10w commented 4 years ago

@Joevaen I just followed this example, which is quite straightforward.