Golang math.Log10E Constant with Examples

Golang | math.Log10E Constant: Here, we are going to learn about the Log10E constant of the math package with its usages, syntax, and examples.
Submitted by IncludeHelp, on August 25, 2021

math.Log10E Constant

The Log10E constant is an inbuilt constant of the math package which is used to get the base-10 logarithm of the mathematical constant e, approximately equal to 1. 0.43429448. The math.Log10E constant is equivalent to 1/math.Ln10.

Syntax:

float64 math.Log10E

Parameter(s):

  • None

Return Value:

The return type of math.Log10E constant is float64, it returns the base-10 logarithm of mathematical constant e.

Example 1:

// Golang program to demonstrate the
// example of math.Log10E Constant

package main

import (
	"fmt"
	"math"
)

func main() {
	fmt.Printf("Type of math.Log10E is %T\n", math.Log10E)
	fmt.Println("Value of math.Log10E:", math.Log10E)
}

Output:

Type of math.Log10E is float64
Value of math.Log10E: 0.4342944819032518

Explanation:

In the above program, we imported the math package to use the math.Log10E constant, then printed the type and value of the math.Log10E constant.

Example 2:

// Golang program to demonstrate the
// example of math.Log10E Constant

package main

import (
	"fmt"
	"math"
)

// creating function to
// return the value of Log10E.
func getLog10E() float64 {
	return math.Log10E
}

func main() {
	fmt.Println("Value of math.Log10E:", getLog10E())
}

Output:

Value of math.Log10E: 0.4342944819032518

Golang math Package Constants and Functions »





Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.