Skip to content

Instantly share code, notes, and snippets.

@empr
Created December 3, 2012 12:46
Show Gist options
  • Save empr/4194818 to your computer and use it in GitHub Desktop.
Save empr/4194818 to your computer and use it in GitHub Desktop.
maxmun, minimum value
// - http://stackoverflow.com/questions/6878590/the-maximum-value-for-an-int-type-in-go
// - http://golang.org/ref/spec#Numeric_types
package main
import "fmt"
const (
MaxUint = ^uint(0)
MinUint = 0
MaxInt = int(^uint(0) >> 1)
MinInt = -MaxInt - 1
)
func main() {
fmt.Printf("%d %d %d %d\n", MaxUint, MinUint, MaxInt, MinInt)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment