Given the sequence
1/1, 1/2, 1/3, ... , 1/n How can I calculate at what point I will not be able to distinguish with precision E between two consecutive elements 1/i and 1/i+1 if I use numpy.float16 ? i.e. what is 'i' ?
What about the other np-floats ?
What is the smallest E ? and how to calculate 'i' for it ?
For example if E = 0.01 I can distinguish between 1/9 and 1/10, but not between 1/10 and 1/11, because :
1/9 = 0.111 1/10 = 0.100 1/11 = 0.091 0.111 - 0.100 = 0.01 >= E 0.100 - 0.091 = 0.009 < E i = 10 In more abstract way, given f(i) what is the maximum 'i' representable in np.floatXX ?
Interestingly the precision in practice is worse than calculated : /the place where logic breaks/
for i in range(int(1e3),int(12e6)) : if not np.floatXX(1/i) > np.floatXX(1/(i+1)) : print(i); break float32: 11864338 float16: 1464