Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Precision

package main

import (
	"fmt"
	"strconv"
)

func main() {
	aStr := "2.1"
	bStr := "7.3"
	a, _ := strconv.ParseFloat(aStr, 64)
	b, _ := strconv.ParseFloat(bStr, 64)
	fmt.Println(a + b)
	fmt.Println(a - b)
}
9.4
-5.199999999999999