Skip to content

Commit

Permalink
Bump cockroachdb/apd to v3.1.0
Browse files Browse the repository at this point in the history
This drastically improves Div() performance.
  • Loading branch information
bojanz committed Mar 3, 2022
1 parent 3ea042a commit a471283
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions amount.go
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ func (a Amount) Div(n string) (Amount, error) {
}
ctx := decimalContext(&a.number, &result)
ctx.Quo(&result, &a.number, &result)
result.Reduce(&result)

return Amount{result, a.currencyCode}, nil
}
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/bojanz/currency
go 1.15

require (
github.com/cockroachdb/apd/v3 v3.0.1
github.com/cockroachdb/apd/v3 v3.1.0
github.com/lib/pq v1.10.4 // indirect
github.com/pkg/errors v0.9.1 // indirect
)
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
github.com/cockroachdb/apd/v3 v3.0.1 h1:g1iaIyOhxq9f6iQ95fiPFJl9uCU69B3NkGXE2RLdZpI=
github.com/cockroachdb/apd/v3 v3.0.1/go.mod h1:6qgPBMXjATAdD/VefbRP9NoSLKjbB4LCoA7gN4LpHs4=
github.com/cockroachdb/apd/v3 v3.1.0 h1:MK3Ow7LH0W8zkd5GMKA1PvS9qG3bWFI95WaVNfyZJ/w=
github.com/cockroachdb/apd/v3 v3.1.0/go.mod h1:6qgPBMXjATAdD/VefbRP9NoSLKjbB4LCoA7gN4LpHs4=
github.com/lib/pq v1.10.4 h1:SO9z7FRPzA03QhHKJrH5BXA6HU1rS4V2nIVrrNC1iYk=
github.com/lib/pq v1.10.4/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
Expand Down

0 comments on commit a471283

Please sign in to comment.