Learn and Learn

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

GoLang – Find Decimal Logarithm – Log10() Function – Examples & Explanation

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

Syntax of Log10() Function in Go Language

The syntax of Log10() 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:
Log(+Inf) = +Inf
Log(0) = -Inf
Log(x < 0) = NaN
Log(NaN) = NaN

Parameters of Log10() Function in Go

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) Log10() 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 Log10() Function in Go Language

Log10() function will return the decimal logarithm of the given input(x – parameters).

 

GoLang Log10() Function Example 1


Output:
NaN

 

GoLang Log10() Function Example 2


Output:
1.2011238972073794

 

GoLang Log10() Function Example 3


Output:
1.5314789170422551

 

Loading...
LearnAndLearn.com © 2018 - All rights reserved