Std::sqrt is required by the IEEE standard to be exact. The only other operations required to be exact are the arithmetic operators and the function std::fma. After rounding to the return type (using default rounding mode), the result of std::sqrt. C pow The pow function computes a base number raised to the power of exponent number. This function is defined in header file. Pow Prototype As of C 11 standard Since C.
In the C Programming Language, the sqrt function returns the square root of x.
The syntax for the sqrt function in the C Language is:
The sqrt function returns the square root of x. If x is negative, the sqrt function will return a domain error.
In the C Language, the required header for the sqrt function is:
In the C Language, the sqrt function can be used in the following versions: /auto-tune-80-free.html.
When compiled and run, this application will output:
Other C functions that are similar to the sqrt function:
-->Calculates the square root.
x
Non-negative floating-point value
Because C++ allows overloading, you can call overloads of sqrt that take float or longdouble types. In a C program, sqrt always takes and returns double.
By default, this function's global state is scoped to the application. To change this, see Global state in the CRT.
The sqrt functions return the square-root of x. By default, if x is negative, sqrt returns an indefinite NaN.
Input | SEH Exception | _matherr Exception |
---|---|---|
± QNAN,IND | none | _DOMAIN |
- ∞ | none | _DOMAIN |
x<0 | none | _DOMAIN |
Function | C header | C++ header |
---|---|---|
sqrt, sqrtf, sqrtl | <math.h> | <cmath> |
For compatibility information, see Compatibility.
Floating-Point Support
exp, expf, expl
log, logf, log10, log10f
pow, powf, powl
_CIsqrt