I was experimenting with numpy.uint()
and numpy.around()
Here is what I have done:
>>> matrix = np.matrix([-32, -32.0, -3.91886975727153e-15])
>>> matrix
matrix([[-3.20000000e+01, -3.20000000e+01, -3.91886976e-15]])
>>> np.uint(matrix)
...
matrix([[4294967264, 4294967264, 0]], dtype=uint32)
>>> np.around(matrix)
...
matrix([[-32., -32., -0.]])
>>> np.uint(np.around(matrix))
...
matrix([[4294967264, 4294967264, 0]], dtype=uint32)
Same happends with np.uint8
np.uint16
but with different values:
np.uint8(np.around(matrix))
matrix([[224, 224, 0]], dtype=uint8)
np.uint16(np.around(matrix))
matrix([[65504, 65504, 0]], dtype=uint16)
Why uint functions act that way?