Gast
#268266
Hallo, ich versuche gerade mal eine asin funktion zu Programmieren, in der GCC Lib habe ich für den AVR folgendes gefunden: /*---------------------------------------------------------------------- ------ asin(x) = pi/2 - (1 - x)^2 (P0 + x(P1 + x(P2 + x(P3 + x(P4 + x(P5 + x(P6 + x(P7)))))))) * * P0 : 1.57079 63050 [3FC90FDA] * P1 : -0,21459 88016 [BE5BBFCA] * P2 : 0.08897 89874 [3DB63A9E] * P3 : -0.05017 43046 [BD4D8392] * P4 : 0.03089 18810 [3CFD10F8] * P5 : -0.01708 81256 [BC8BFC66] * P6 : 0.00667 00901 [3BDA90C5] * P7 : -0.00126 24911 [BAA57A2C] */ ich habe das so implementiert: const float P0= 1.57079; const float P1= -0.21459; const float P2= 0.08897; const float P3= -0.05017; const float P4= 0.03089; const float P5= -0.01708; const float P6= 0.00667; const float P7= -0.00126; float Asin(float winkel){ float result= _PI/2; float temp= P7; temp *= winkel; temp += P6; temp *= winkel; temp += P5; temp *= winkel; temp += P4; temp *= winkel; temp += P3; temp *= winkel; temp += P2; temp *= winkel; temp += P1; temp *= winkel; temp += P0; temp *= winkel; temp *= ((1-winkel) * (1-winkel)); //(1-x)^2 result -= temp; //pi/2 - --> return(result); } leider kommt da nur müll bei raus, kann mir vielleicht jemand etwas auf die sprünge helfen? Sebastian