C Standard Libraries C++

sqrt()

Declaration

double sqrt(double dX);

Description

This function returns the square root of the passed-in argument.

Overloads

float sqrt(float);
double sqrt(double);
long double sqrt(long double);

Related Functions

float sqrtf(float);
long double sqrtl(long double);

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

Domain

[0, ∞)

Range

[0, ∞)

Periodicity

None

Symmetry

None

Asymptotes

None





Example

#include <iostream>
#include <cmath>

int main() {
    using namespace std;

    double dX = 10.0;
    cout << "x = " << dX << "  sqrt(x) = " << sqrt(dX) << endl;

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

    return 0;
}

Output

sqrt() Output
 

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