I have forgotten

• https://me.yahoo.com

arcsin

29 Jan 10, 7:55PM
(2 replies)
arcsin
Has anyone actually been able to program this algorithm in c++ in such a way that arcsin(1)=90 ? Ive tried hard but at arcsin(0.9) im already 1 behind as far as my calculator is concerned.
30 Jan 10, 7:49AM
Internally, its generally calculated using a Taylors series, thus
$arcsin(x)=\sum_{n=0}^{\infy}&space;\frac{(2n)!}{4^n(n!)^2&space;(2n+1)}&space;x^{2n+1}$

Naturally x must lie between -1 and 1.
30 Jan 10, 8:35AM
The Taylor series finds the arcsine in relatively few calculations up to arcsin(0.8)/arcsin(-0.8). For values above 0.8 it tends to take much more. At arcsin(0.9) it loses 1 precision and at arcsin(1) it returns 77.5 (more or less). It seems to me that this algorithm requires more exactitude than the c++ types can give. Its quite easy to program this in c++ but for it to work (and it should) it requires more than the standard c++ library can offer. So I wonder how to tackle this problem and if anyone has actually managed to program the arcsine function without 3rd party includes.

Before anyone mentions it; I already know that math.h contains the prototype for the function arcsine. But thanks anyway.