Cbrt()

manikanta528's avatar
Published Jul 25, 2023
Contribute to Docs

The Cbrt() function returns the cube root of a given number of type float64.

Syntax

import math

cbrt = math.Cbrt(x)

Where Cbrt() function takes a single argument of type float64.

Example

package main
import (
"fmt"
"math"
)
func main() {
fmt.Printf("Cube root of 27 = %f", math.Sqrt(27))
}

The output will be:

Cube root of 27 = 5.196152

Codebyte Example

The following example is runnable and demonstrates the usage of Cbrt() in several different cases:

Code
Output
Loading...

All contributors

Contribute to Docs

Learn Go on Codecademy