|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
||||
|
||||
|
Re: Arcsin?
|
|
#2
|
||||
|
||||
|
Re: Arcsin?
Quote:
|
|
#3
|
||||
|
||||
|
Re: Arcsin?
Or you could roll your own. Accurate to less than 3 minutes of arc. Code:
#include <math.h>
double asin (double x) {
const double pi2=1.57079632679;
const double hroot2=0.707106781186;
double f(double x);
if (x<-hroot2) return -pi2+f(sqrt(1-x*x));
else if (x<0) return -f(-x);
else if (x<hroot2) return f(x);
else return pi2-f(sqrt(1-x*x));
}
double f(double x) {
return -0.000786215+x*(1.021878945+x*(-0.118183378+x*(0.344819444)));
}
void main (void) {
int i;
for (i=-100;i<=100;i++) printf("%f,%f\n",0.01*i,asin(0.01*i));
}
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|