×

Golang Tutorial

Golang Reference

Golang Programs

Golang Practice

Golang Miscellaneous

Golang math.Ln10 Constant with Examples

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

math.Ln10 Constant

The Ln10 constant is an inbuilt constant of the math package which is used to get the base-10 logarithm, approximately equal to 2.302585092994.

Syntax

float64 math.Ln10

Parameters

  • None

Return Value

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

Example 1

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

package main

import (
	"fmt"
	"math"
)

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

Output:

Type of math.Ln10 is float64
Value of math.Ln10: 2.302585092994046

Explanation:

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

Example 2

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

package main

import (
	"fmt"
	"math"
)

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

func main() {
	fmt.Println("Value of math.Ln10:", getLn10())
}

Output:

Value of math.Ln10: 2.302585092994046

Golang math Package Constants and Functions »




Comments and Discussions!

Load comments ↻





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