C++ Math cbrt()

Last Updated : 21 May 2026

Math cbrt() Function

In C++, the cbrt() function is defined in the <cmath> header file and is used to calculate the cube root of a given number. It returns the value whose cube is equal to the specified argument.

The cbrt() function supports integer, float, double, and long double values.

Consider a argument 'arg'

Syntax

It has the following syntax.

Syntax would be.

Parameters

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

Return value

It returns the cube root of a given number arg.

Examples of the List cbrt() Function

Here, we are going to discuss several examples to demonstrate the List cbrt() Function Function.

Example 1: Calculate the Cube Root of an Integer Value Using cbrt()

This example demonstrates how the cbrt() function calculates the cube root of an integer value.

Output:

Cube root of a number is :2

Example 2: Calculate the Cube Root of a Floating-Point Value Using cbrt()

This example demonstrates how the cbrt() function calculates the cube root of a floating-point value.

Output:

Cube root of a number is :2.33921

Example 3: Calculate the Cube Root of a Negative Number Using cbrt()

This example demonstrates how the cbrt() function calculates the cube root of a negative number. Unlike sqrt(), the cbrt() function can return valid results for negative values.

Output:

Cube root of a number is : -3