I have forgotten
my Password

Or login with:

  • Facebookhttp://facebook.com/
  • Googlehttps://www.google.com/accounts/o8/id
  • Yahoohttps://me.yahoo.com
Index » Programming » C/C++ »

arcsin

goldenboy\′s Photo
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.
will\′s Photo
30 Jan 10, 7:49AM
Internally, its generally calculated using a Taylors series, thus

Naturally x must lie between -1 and 1.
goldenboy\′s Photo
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.
Currently you need to be logged in to leave a message.