std::cbrt

From cppreference.com
< cpp‎ | numeric‎ | math
 
 
 
Common mathematical functions
Functions
Basic operations
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)(C++11)(C++11)
Exponential functions
(C++11)
(C++11)
(C++11)
(C++11)
Power functions
cbrt
(C++11)
(C++11)
Trigonometric and hyperbolic functions
(C++11)
(C++11)
(C++11)
Error and gamma functions
(C++11)
(C++11)
(C++11)
(C++11)
Nearest integer floating point operations
(C++11)(C++11)(C++11)
(C++11)
(C++11)
(C++11)(C++11)(C++11)
Floating point manipulation functions
(C++11)(C++11)
(C++11)
(C++11)
(C++11)(C++11)
(C++11)
Classification/Comparison
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Macro constants
(C++11)(C++11)(C++11)(C++11)(C++11)
 
Defined in header <cmath>
float       cbrt( float arg );
(since C++11)
double      cbrt( double arg );
(since C++11)
long double cbrt( long double arg );
(since C++11)
double      cbrt( Integral arg );
(since C++11)

Computes cubic root of arg.

Contents

[edit] Parameters

arg - value of a floating-point or Integral type

[edit] Return value

Cubic root of arg.

[edit] Example

#include <cmath>
#include <iostream>
 
int main()
{
    std::cout << std::fixed;
    std::cout << std::cbrt(27.0) << '\n';
    std::cout << std::cbrt(1.0) << '\n';
    std::cout << std::cbrt(125.0) << '\n';
    std::cout << std::cbrt(-0.125) << '\n';
}

Output:

3.000000
1.000000
5.000000
-0.500000

[edit] See also

computes square root (x)
(function)
raises a number to the given power (xy)
(function)
C documentation for cbrt