We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 55944e1 commit 33c0a48Copy full SHA for 33c0a48
3 files changed
go.mod
@@ -1,3 +1,5 @@
1
module cheat-sheet
2
3
go 1.17
4
+
5
+require github.com/shopspring/decimal v1.4.0 // indirect
go.sum
@@ -0,0 +1,2 @@
+github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
+github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=
main.go
@@ -1,7 +1,20 @@
package main
-import "fmt"
+import (
+ "fmt"
6
+ "github.com/shopspring/decimal"
7
+)
8
9
func main() {
- fmt.Println("hello world!")
10
+ n := 10
11
+ fmt.Printf("%d\n", n)
12
+ fmt.Printf("%v\n", n)
13
+ fmt.Printf("%b\n", n)
14
+ fmt.Printf("%o\n", n)
15
+ fmt.Printf("%x\n", n)
16
17
+ a := 8.2
18
+ b := 3.8
19
+ fmt.Println(decimal.NewFromFloat(a).Sub(decimal.NewFromFloat(b)), a-b)
20
}
0 commit comments