I am trying to calculate arkus sin() without math library. It works, however produces different results on different platforms.
Windows and Mac (correct): 5.2359877560e-001 Linux: 5.1532736669e-01
Where is problem?
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 s;
}