Rewriting mathematical expressions

The first example in Chapter 7 computed the hyperbolic arctangent of a floating-point argument z. It involved the expression , which was recast in the algebraically equivalent, but "more numerically stable" form . Although a complete analysis of these expressions is beyond the scope of this documentation, the example illustrates the computational differences between mathematically equivalent expressions, even when the results of individual operations are correctly rounded.

When z is so small that rounds to 1, the expressions reduce to and , respectively. Here is one place to look for differences between the expressions. For very tiny z, the latter expressions will also round to 1. But are there some sufficiently small values of z for which when rounding to nearest?

It is a fact not shown here that there are no positive z satisfying the requirement. Instead, consider the value , where p is the precision used in the computation. For this value of z, is a half-way case, rounding to 1. rounds to 1 for all smaller negative magnitudes. For , is exactly, while is exactly. Here is one example where the two expressions differ computationally. In fact, they differ throughout the interval , in which the expression is more accurate.

Although the difference between and is small relative to 1, recall that the computation of the hyperbolic arctangent hinged on the natural logarithm. For , , while the poorer expression evaluates to , off by a factor of two. The moral is that, even in the presence of a robust computational model, you must be careful when choosing from among mathematically equivalent formulations.


[Contents] [Previous] [Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.
Copyright©1995 Taligent,Inc. All rights reserved.

Generated with WebMaker