Last active
October 2, 2017 18:47
-
-
Save inancgumus/7ab3b8759df6232e2cc5063e412bdaba to your computer and use it in GitHub Desktop.
go ageOfUniverse overflows
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
) | |
// on 32-bit machines, it'll overflow | |
// on 64-bit machines, everything is fine | |
// use: uint64 instead. | |
func main() { | |
var ageOfUniverse int = 14e9 // 14e9 = 14 and 9 zeros which is 14 billions | |
fmt.Printf("`ageOfUniverse` is %d.\n", ageOfUniverse) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment