Learn and Learn

Learn And Learn - great place for tutorials, references and how-to

GoLang – Find Cube Root – Cbrt() Function – Examples & Explanation

Cbrt() function is used to find the cube root of the given input (x – parameter) in Go language. The standard math package of Go programming language has Cbrt() function.

Syntax of Cbrt() Function in Go Language

The syntax of Cbrt() function in Go Language is:

Note: float64 is a data type in Go language which has IEEE-754 64-bit floating-point numbers.
Special cases are:
Cbrt(±0) = ±0
Cbrt(±Inf) = ±Inf
Cbrt(NaN) = NaN


Parameters of Cbrt() Function in Go Language

x – Where x is any Valid float64 Input value. This parameter is required.


Error Handling

If the x parameter is not a number (numeric value) Cbrt() function returns an error .
If there is no argument (x – input value) passes to the function, then the compiler will produce an error.


Return Value of Cbrt() Function in Go Language

Cbrt() function will return the cube root of the given input(x – parameter).


GoLang Cbrt() Function Example 1



GoLang Cbrt() Function Example 2



GoLang Cbrt() Function Example 3



LearnAndLearn.com © 2018 - All rights reserved