Assuming the following:
package main
import (
"fmt"
)
func main() {
var MaxInt uint64
MaxInt = 1<<64 - 1
fmt.Printf("Type: %T Value: %v
", MaxInt, MaxInt)
}
I get the results of:
Type: uint64 Value: 18446744073709551615
Just as expected.
However, say I want to get a larger, say 1<<256 - 1
, when I use
func main() {
x:= 1<<256-1
fmt.Printf("Type: %T Value: %v
", x, x)
}
I get:
./prog.go:10:10: constant 115792089237316195423570985008687907853269984665640564039457584007913129639936 overflows int
For x:=1<<512-1
I get:
./prog.go:10:10: shift count too large: 512
My question is: What types can I use go to play with large numbers at this scale?