Numerical Methods
Least squares, three ways
The normal equations, QR, and the SVD solve the same problem with very different accuracy. The difference is the square of a condition number.
Adding up ten million numbers
Recursive summation in single precision loses four digits over ten million terms. Pairwise and compensated summation keep them for little extra work.
A note on log-sum-exp
Subtracting the maximum turns an overflow into an exact identity. The same shift makes softmax safe.