Math Cbrt Function - C++ Programming Tutorial
C++ Course / Math Functions / Math Cbrt Function

Math Cbrt Function

BLUF: Mastering Math Cbrt Function is a critical step in becoming a proficient C++ developer. This lesson provides a deep dive into the syntax, performance considerations, and real-world applications of this concept.
Key Performance Insight: Math Cbrt Function

C++ is renowned for its efficiency. Learn how Math Cbrt Function enables low-level control and high-performance computing in the tutorial below.

C++ Math cbrt

This function is employed to calculate the cube root of a specified numerical value.

Consider a argument 'arg' :

Example

Cube root of a number : ∛arg

Syntax

Syntax would be :

Example

double cbrt(double arg);
float cbrt(float arg);
long double cbrt(long double arg);
double cbrt(integral arg);

Parameter

arg : It is the value of float or integer type.

Return value

It returns the cube root of a given number arg.

Example 1

Let's observe a basic scenario where the parameter 'arg' is of the integer data type.

Example

#include <iostream>
#include<cmath>
using namespace std;
int main()
{ int arg=8;
 std::cout << "Cube root of a number is :" <<cbrt(arg);
  return 0;
}

Output:

Output

Cube root of a number is :2

Example 2

Let's consider a basic scenario where the parameter 'arg' is of type float.

Example

#include <iostream>
#include<cmath>
using namespace std;
int main()
{
 float arg=12.8;
 std::cout << "Cube root of a number is :" <<cbrt(arg);
  return 0;
}

Output:

Output

Cube root of a number is :2.33921

Input Required

This code uses input(). Please provide values below:

Logic Practice
Install Logic Practice
Add to home screen for a faster app-like experience