Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix roundCeil,roundFloor,roundUp and roundDown examples #285

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions decimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -1107,7 +1107,7 @@ func (d Decimal) Round(places int32) Decimal {
// NewFromFloat(545).RoundCeil(-2).String() // output: "600"
// NewFromFloat(500).RoundCeil(-2).String() // output: "500"
// NewFromFloat(1.1001).RoundCeil(2).String() // output: "1.11"
// NewFromFloat(-1.454).RoundCeil(1).String() // output: "-1.5"
// NewFromFloat(-1.454).RoundCeil(1).String() // output: "-1.4"
//
func (d Decimal) RoundCeil(places int32) Decimal {
if d.exp >= -places {
Expand All @@ -1133,7 +1133,7 @@ func (d Decimal) RoundCeil(places int32) Decimal {
// NewFromFloat(545).RoundFloor(-2).String() // output: "500"
// NewFromFloat(-500).RoundFloor(-2).String() // output: "-500"
// NewFromFloat(1.1001).RoundFloor(2).String() // output: "1.1"
// NewFromFloat(-1.454).RoundFloor(1).String() // output: "-1.4"
// NewFromFloat(-1.454).RoundFloor(1).String() // output: "-1.5"
//
func (d Decimal) RoundFloor(places int32) Decimal {
if d.exp >= -places {
Expand All @@ -1159,7 +1159,7 @@ func (d Decimal) RoundFloor(places int32) Decimal {
// NewFromFloat(545).RoundUp(-2).String() // output: "600"
// NewFromFloat(500).RoundUp(-2).String() // output: "500"
// NewFromFloat(1.1001).RoundUp(2).String() // output: "1.11"
// NewFromFloat(-1.454).RoundUp(1).String() // output: "-1.4"
// NewFromFloat(-1.454).RoundUp(1).String() // output: "-1.5"
//
func (d Decimal) RoundUp(places int32) Decimal {
if d.exp >= -places {
Expand Down Expand Up @@ -1187,7 +1187,7 @@ func (d Decimal) RoundUp(places int32) Decimal {
// NewFromFloat(545).RoundDown(-2).String() // output: "500"
// NewFromFloat(-500).RoundDown(-2).String() // output: "-500"
// NewFromFloat(1.1001).RoundDown(2).String() // output: "1.1"
// NewFromFloat(-1.454).RoundDown(1).String() // output: "-1.5"
// NewFromFloat(-1.454).RoundDown(1).String() // output: "-1.4"
//
func (d Decimal) RoundDown(places int32) Decimal {
if d.exp >= -places {
Expand Down