C Standard Libraries C++

cos()

Declaration

double cos(double dX);

Description

This function returns the cosine of the passed-in argument.

Overloads

float cos(float);
double cos(double);
long double cos(long double);

Related Functions

float cosf(float);
long double cosl(long double);

* Note: Since C does not allow function overloading, these other versions of this function exist.

Domain

(-∞, ∞)

Range

[-1, 1]

Periodicity

Symmetry

Y-axis

Asymptotes

None





Example

#include <iostream>
#include <cmath>

int main() {
    using namespace std;

    double dX = -1000.0;
    cout << "x = " << dX << "  cos(x) = " << cos(dX) << endl;

    dX = 1.8;
    cout << "x = " << dX << "  cos(x) = " << cos(dX) << endl;

    return 0;
}

Output

cos() Output
 

© 2007–2024 XoaX.net LLC. All rights reserved.