August 2021
Beginner
112 pages
1h 23m
English
| Puzzle 7 | Can Numbers Lie? |
| | package main |
| | |
| | import ( |
| | "fmt" |
| | ) |
| | |
| | func main() { |
| | n := 1.1 |
| | fmt.Println(n * n) |
| | } |
Guess the Output | |
|---|---|
|
|
Try to guess what the output is before moving to the next page. |
This code will print: 1.2100000000000002
You might have expected 1.21, which is the right mathematical answer.
Some new developers, when seeing this or similar output, come to the message boards and say, “We found a bug in Go!” The usual ...
Read now
Unlock full access