我试图计算没有数学库的arkus sin().它工作,但在不同的平台上产生不同的结果.
Windows和Mac(正确):5.2359877560e-001 Linux:5.1532736669e-01
哪里有问题?
double my_asin(double k)
{
double x = k;
double a = 1;
double s = x;
const double hodnota = 0.00000000001f;
double s1 = 0;
double d = x;
double e = 1.0;
double y;
y = x * x;
while(my_abs(s1 - s) >= hodnota) {
s1 = s;
d = d * y;
e = e * ((a * a) / ((++a) * (++a)) );
s = s + (d * e);
}
return …Run Code Online (Sandbox Code Playgroud)