std::cbrt,std::cbrtf,std::cbrtl (3) - Linux Manuals
std::cbrt,std::cbrtf,std::cbrtl: std::cbrt,std::cbrtf,std::cbrtl
NAME
std::cbrt,std::cbrtf,std::cbrtl - std::cbrt,std::cbrtf,std::cbrtl
Synopsis
Defined in header <cmath>
float cbrt ( float arg ); (1) (since C++11)
float cbrtf( float arg );
double cbrt ( double arg ); (2) (since C++11)
long double cbrt ( long double arg ); (3) (since C++11)
long double cbrtl( long double arg );
double cbrt ( IntegralType arg ); (4) (since C++11)
1-3) Computes the cubic root of arg.
4) A set of overloads or a function template accepting an argument of any integral_type. Equivalent to 2) (the argument is cast to double).
Parameters
arg - value of a floating-point or Integral_type
Return value
If no errors occur, the cubic root of arg (
3
√
arg), is returned.
If a range error occurs due to underflow, the correct result (after rounding) is returned.
Error handling
Errors are reported as specified in math_errhandling
If the implementation supports IEEE floating-point arithmetic (IEC 60559),
* if the argument is ±0 or ±∞, it is returned, unchanged
* if the argument is NaN, NaN is returned.
Notes
std::cbrt(arg) is not equivalent to std::pow(arg, 1.0/3) because std::pow cannot raise a negative base to a fractional exponent.
Example
// Run this code
Output:
See also
pow
powf
powl raises a number to the given power (xy)
(C++11)
(C++11)
sqrt
sqrtf computes square root (
sqrtl √
(C++11)
(C++11)
hypot computes square root of the sum of the squares of two given numbers (
hypotf √
hypotl x2
(C++11) )
(C++11) (function)
(C++11)