cosf
Cosine function
Interface
#include <math.h>
double | cos (double x) |
long | cosl (long double x) |
float | cosf (float x) |
#include <complex.h>
double complex | ccos (double complex z) |
long double complex | ccosl (long double complex z) |
float complex | ccosf (float complex z) |
Description
The cos function computes the cosine of x (measured in radians). It returns a value in the range of -1 to 1. The complex cosine is defined byExample:
Example - Cosine function
Workings
#include <stdio.h> #include <math.h> int main() { double x = 1.047198; double result = cos(x); printf("The cosine of %lf is %lf\n", x, result); return 0; }
Solution
Output:
The cosine of 1.047198 is 0.500000