please ignore this post, I misread algorithm, so the question is not relevant.
However, I cannot close post anymore.
Please vote to close
I have been using certain algorithm from numerical recipes, which converges to zero via underflow:
// all types are the same floating type
sum = 0
for (i in 0,N)
sum += abs(V[i]);
my question, how does it happen? how does sum of small positive floating-point numbers converge to underflow/zero?
is there some condition where 0 + f = 0 , f > 0?
algorithm in question is Jacoby, http://www.mpi-hd.mpg.de/astrophysik/HEA/internal/Numerical_Recipes/f11-1.pdf, page 460.
It is quite possible I misunderstand how the convergence is achieved, if so, please correct me.
thank you
If
Vis an array ofdoublesandsumis afloat(orsingle), you can certainly have values that are > 0 but when added to sum produces 0 if they are smaller than the smallest non-zero denormalized value representable in afloat.How do you know
sumis actually zero and not just really really close? Are all bits set to zero?EDIT: after reading the actual application, the underflow to zero remark is probably referring to repeated rotations around various axes to determine the eigenvalues and eigenvectors of a matrix. In that case, the algorithm only works if you can assume that repeated multiplications of very small numbers will clamp or underflow to zero. The actual sum won’t underflow itself, however.