Example of this major problem:
c=np.array([2600.0])
In [3]: c=c.astype(np.float16)
In [4]: c
Out[4]: array([ 2600.], dtype=float16)
All good, then:
In [5]: c=np.array([2583.0])
In [6]: c=c.astype(np.float16)
In [7]: c
Out[7]: array([ 2584.], dtype=float16)
So 2583.0 turns to 2584.0, cool that's not going to cause any problems!!!! I have also seen 2583.0 convert in the opposite direction to 2582.0 when I converted a large array to np.float16.
What is going on I spent a literal full day trying to find this bug and I never imagined this was happening to my data? I am using float16 to limit my memory consumption but if its this dangerous I will move on up to 32 bits.
Can anyone shed some light on this?
Thanks very much everyone.