# # simple float test to calculate float unique numbers in range from -1..1 # # output: # # 1 -1.0 # 2 -0.99999994 # 3 -0.9999999 # ... # 2130706431 0.9999999 # 2130706432 0.99999994 # 2130706433 1.0 # import numpy as np i = 1 f = np.float32(-1) end = np.float32(1) while ( f <= end ): print(i, f) f = np.nextafter(f, np.inf) i += 1