×

Golang Tutorial

Golang Reference

Golang Programs

Golang Practice

Golang Miscellaneous

Golang math.MinInt64 Constant with Examples

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

math.MaxInt64 Constant

The MinInt64 constant is an inbuilt constant of the math package which is used to get the lowest (minimum) value that can be represented by an int64.

The value of math.MinInt64 constants is -1 << 63 or -9223372036854775808.

Syntax

int math.MinInt64

Parameters

  • None

Return Value

The return type of math.MinInt64 constant is int, it returns the lowest (minimum) value that can be represented by an int64.

Example 1

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

package main

import (
	"fmt"
	"math"
)

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

Output:

Type of math.MinInt64 is int
Value of math.MinInt64: -9223372036854775808

Explanation:

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

Example 2

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

package main

import (
	"fmt"
	"math"
)

// creating function to
// return the value of MinInt64.
func getMinInt64() int {
	return math.MinInt64
}

func main() {
	fmt.Println("Value of math.MinInt64:", getMinInt64())
}

Output:

Type of math.MinInt64 is int
Value of math.MinInt64: -9223372036854775808

Golang math Package Constants and Functions »




Comments and Discussions!

Load comments ↻





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