...

/

Puzzle 12 Explanation: Go spec2

Puzzle 12 Explanation: Go spec2

Understand different types and their behavior in Go.

We'll cover the following...

Try it yourself

Try executing the code below to see the result for yourself.

Press + to interact
Go (1.16.5)
package main
import (
"fmt"
)
func main() {
fmt.Println(0x1p-2)
}

Explanation

Go has several number types. The two main ones are integers and floats.

Integer

These are whole numbers. Go has int8, int16, int32, int64, and int. There are also all the unsigned ones, such as uint8 and so on.

Float

These are real numbers. Go has float32 and float64 ...