|  3DSoftware.com > Programming > Floating Point > Page 9 |
|
Floating Point Numbers
Page 9
Wide Floating Point Elementary Functions For some of the elementary functions we use arithmetic geometric mean To calculate the natural logarithm of 2 with AGM, we use For computation of trigonometric functions, we use power series. Trigonometric power series formulas and identities are listed in math reference |
|
|
|
Cosine and sine are both computed, for efficiency purposes and also because they are usually both needed. The numerator of each term is a power of x. The denominator is a factorial that can be precomputed. Since the denominators are constant, the series converges faster with smaller values |
| cos2x = 2cos²x 1 |
|
the value of x is halved several times before computing the series, then the cosine series sum is plugged into this identity that many times (multiple squaring). The following works for sine: |
| sin(2x) = 2sin(x)cos(x) |
|
If you need to compute only sin(x) without cos(x), calculate it as a cosine with this trigonometric identity: |
| sin(x) = cos( pi/2 x ) |
|
There is another algorithm, which we have not implemented, that is an extension of these algorithms we have implemented. It is used in the For inverse trigonometry (arctangent) we go back to using AGM, as reported in Muller |
|
|
|
References: |
|
|
Muller, J.M., 2006,
Elementary Functions: Algorithms and Implementation
|
|
|
Abramowitz, M., and Stegun, I.A., 1972,
Handbook of Mathematical Functions,
|
|
|
Polyanin, A.D., and Manzhirov, A.V., 2007,
Handbook of Mathematics for Engineers and Scientists,
|
|
|
Rade, L., and Westergren, B., 2004,
Mathematics Handbook for Science and Engineering
|
|
|
Milne-Thomson, L.M., 1972,
Elliptic Integrals, |
|
|
Muller,
|
|
|
Press, W.H., Teukolsky, S.A., Vetterling, W.T., and Flannery, B.P., 2002,
Numerical Recipes in C++
|
|
|
Gradshteyn, I.S. and Ryzhik, I.M., 2007,
Table of Integrals, Series, and Products
|
|
|
Polyanin and Manzhirov,
|
|
|
Rade and Westergren,
|
|
|
Zucker, R., 1972, Elementary Transcendental Functions,
|
|
|
Bronshtein, I.N., Semendyayev, K.A., Musiol, G., and Muehlig, H.,
2007, Handbook of Mathematics
|
| Page 9 | ||||||
|
|
Copyright © 2008 by 3D Software. All rights reserved. 3D Software, P.O. Box 221190, Sacramento CA 95822 USA www.3DSoftware.com Contact us |
| Thursday, 20-Nov-2008 13:51:32 GMT |