Floating-point overflow (source code)

= Floating-point overflow

Floating-point overflow occurs when the magnitude of a computed result exceeds the largest finite representable <floating-point number>. Large values of an <exponential function> are a common source. In a normalized weighted sum, replacing exponentials $e^{r_i}$ by $e^{r_i-r_{\max}}$ before division prevents this particular overflow while leaving the normalized weights unchanged; this is an application of the <log-sum-exp> construction.