====== acos() ====== acos ist definiert in der ''[[start|math]]'', die in C über ''math.h'', bzw. in C++ über ''cmath'' eingebunden wird. ===== Funktion ===== acos() berechnet den Arcus Cosinus des übergebenen Parameters. Der Arcus Cosinus ist die Umkehrfunktion des [[c:lib:math:cos()|Cosinus]]. ===== Signatur ===== #include double acos ( double x ); float acos ( float x ); // nur C++ long double acos ( long double x ); // nur C++ float acosf( float x ); long double acosl( long double x ); **x**: Wert, dessen Winkel bestimmt werden soll, gültig zwischen -1 und +1. **Return value**: Winkel im Bereich von 0 bis π([[wpde>Kreiszahl|Kreiszahl Pi]]) ===== Fehlerquellen ===== Eine beliebte Fehlerquelle ist zu übersehen, dass der Computer Winkel im Bogenmaß berechnet, also von 0 bis π ([[wpde>Kreiszahl|Kreiszahl Pi]]). Winkel von 0 bis 180 Grad müssen [[theory:math:trigonometry:angular-dimensions|umgerechnet]] werden ===== Beispiel ===== #include // für EXIT_SUCCESS #include // für acos #include // für printf() #define PI 3.141592654 int main( void ) { double value, degree; double length = 0.5; value = acos( length ); degree = value * 180 / PI; printf( "acos(%f) sind %f bzw. %f Grad\n", length, value, degree ); return EXIT_SUCCESS; } Ausgabe: acos(0.500000) sind 1.047198 bzw. 60.000000 Grad ===== Hinweis ===== In C++ wird diese Funktion mit einem ValueArray-Template überladen. ===== siehe auch ===== [[c:lib:math:start|math]]: [[c:lib:math:asin()]], [[c:lib:math:atan()]], [[c:lib:math:sin()]], [[c:lib:math:cos()]], [[c:lib:math:tan()]] \\ [[cpp:lib:valarray:start|ValArray]]: [[cpp:lib:valarray:asin()]], [[cpp:lib:valarray:acos()]], [[cpp:lib:valarray:atan()]], [[cpp:lib:valarray:sin()]], [[cpp:lib:valarray:cos()]], [[cpp:lib:valarray:tan()]] \\ [[theory:math:trigonometry:start|Trigometrie]]: [[theory:math:trigonometry:angular-dimensions|Winkelmaße]]