cos, cosl
Nach oben zu Math.h - Index
Header-Datei
math.h
Kategorie
Mathematische Routinen, Inline-Routinen
Prototyp
double cos(double x);
long double cosl(long double x);
Beschreibung
Berechnet den Kosinus eines Werts.
cos berechnet den Kosinus des Eingabewerts. Der Winkel wird in Radianten angegeben.
cosl ist die long double-Version. Sie benötigt ein Argument vom Typ long double und gibt ein Ergebnis vom Typ long double zurück.
Rückgabewert
cos und cosl geben bei Angabe eines gültigen Arguments einen Wert im Bereich zwischen -1 bis 1 zurück. Die Fehlerbehandlung für diese Routinen kann über die Funktionen _matherr und _matherrl geändert werden.
Beispiel
#include <stdio.h> #include <math.h> int main(void) { double result; double x = 0.5; result = cos(x); printf("The cosine of %lf is %lf\n", x, result); return 0; }
Portabilität
POSIX | Win32 | ANSI C | ANSI C++ | |
---|---|---|---|---|
cos |
+ |
+ |
+ |
+ |
cosl |
+ |
+ |
+ |