Namespaces
Variants
Views
Actions

std::cbrt

From cppreference.com
< cpp‎ | numeric‎ | math
Revision as of 05:40, 28 August 2013 by P12 (Talk | contribs)

 
 
 
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)
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

Parameters

arg - floating point value

Return value

Cubic root of arg.

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

See also

computes square root (x)
(function) [edit]
raises a number to the given power (xy)
(function) [edit]