Skip to content

Commit 33c0a48

Browse files
committed
chore: github.com/shopspring/decimal
1 parent 55944e1 commit 33c0a48

3 files changed

Lines changed: 19 additions & 2 deletions

File tree

go.mod

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
module cheat-sheet
22

33
go 1.17
4+
5+
require github.com/shopspring/decimal v1.4.0 // indirect

go.sum

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
github.com/shopspring/decimal v1.4.0 h1:bxl37RwXBklmTi0C79JfXCEBD1cqqHt0bbgBAGFp81k=
2+
github.com/shopspring/decimal v1.4.0/go.mod h1:gawqmDU56v4yIKSwfBSFip1HdCCXN8/+DMd9qYNcwME=

main.go

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,20 @@
11
package main
22

3-
import "fmt"
3+
import (
4+
"fmt"
5+
6+
"github.com/shopspring/decimal"
7+
)
48

59
func main() {
6-
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)
720
}

0 commit comments

Comments
 (0)