Pythagorean addition combines two real numbers and
to give
, the Euclidean
norm of
. The operation is used when computing vector norms,
the Frobenius norm, and Givens
rotations.
Directly squaring the inputs in floating-point arithmetic can cause overflow or underflow even when the final norm is representable. For finite inputs, set and
. If
, the result is zero. Otherwise, evaluate
Since , the intermediate square cannot overflow. Moler
and Morrison (1983) and Dubrulle (1983) describe iterative alternatives.