### Underflow

#### (Sep 14, 2010)

Earlier I described a problem in mathematical computing for mortality modelling.  This was where an intermediate step resulted in a number too big for the computer to handle, causing the entire calculation to overflow and fail.  The cause is due to the compromises inherent in how computers deal with real numbers, and the solution lies in a bit of careful programming.

Unfortunately, computer representation of real numbers also involve compromises in accuracy as well as scale.  A particular problem area lies in subtracting numbers which differ by a very small amount.  On each computer there is usually a limit number, sometimes denoted epsilon, whereby 1+epsilon or 1-epsilon is still distinguishable from…

### Overflow

#### (Aug 9, 2010)

A good general-purpose formula for describing pensioner mortality rates is the logistic function:

q = exp(α) / (1 + exp(α))

where the value of α varies by age.  This particular formula arises when using logistic regression, a type of generalised linear model (GLM).  Any mathematician looking at the equation above will see that the value of q tends to 1 as α increases.  This is demonstrated in Table 1 for various increasing values of α.

Table 1. Evaluation of the logistic function for various values of α.

α Logistic function
5 0.993307149
10 0.999954602
15 0.999999694
20 0.999999998
25 1

So far so good: as α increases, the value of the logistic function approaches…