##### cppreference.com

##### Search

Create account

##### Namespaces

- Page
- Discussion

##### Variants

##### Views

- View
- Edit
- History

##### Actions

# std::cbrt

From cppreference.com
< cpp‎ | numeric‎ | math

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`.

### [edit] Parameters

arg | - | value of a floating-point or Integral type

### [edit] Return value

Cubic root of `arg`.

### [edit] Example

Run this code

    #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

sqrt | computes square root (√x) (function) [edit]
pow | raises a number to the given power (xy) (function) [edit]
C documentation for cbrt

Retrieved from "http://en.cppreference.com/mwiki/index.php?title=cpp/numeric/math/cbrt&oldid=67130"