Cbrt()

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:

us
Visit us
code
Hide code
Code
Output
Hide output
Hide output
Loading...

All contributors

Looking to contribute?

Learn Go on Codecademy