Your Browser is not longer supported

Please use Google Chrome, Mozilla Firefox or Microsoft Edge to view the page correctly
Loading...

{{viewport.spaceProperty.prod}}

cos, cosf, cosl - Cosinus

&pagelevel(4)&pagelevel

Definition

#include <math.h>

double cos(double x);
float cosf(float x); (C11)
long double cosl(long double x); (C11)

Diese Funktionen berechnen für die Gleitkommazahl x die trigonometrische Funktion Cosinus.

Returnwert

cos(x)        Gleitkommazahl im Intervall [-1.0, +1.0].

Beispiel

Folgendes Programm gibt für Werte aus [-pi, +pi] die entsprechenden Cosinus-Werte aus.

#include <math.h>
#include <stdio.h>
#define pi 3.14159265358979
int main(void)
{
   double x;
   for (x = -pi; x <= pi; x = x + pi/4.)
       printf("cos(%f) = %f\n", x, cos(x));
   return 0;
}

Siehe auch  acos, cosh, sin, asin, sinh, tan, atan, atan2, tanh