fix: NewFromFloat(1.1001).RoundHalfDown(2).String() // output: 1.10

This commit is contained in:
yijiong 2024-08-07 10:14:07 +08:00 committed by GitHub
parent 54e62db847
commit 1b31f22216
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1614,7 +1614,7 @@ func (d Decimal) RoundHalfUp(places int32) Decimal {
// //
// NewFromFloat(550).RoundHalfDown(-2).String() // output: "500" // NewFromFloat(550).RoundHalfDown(-2).String() // output: "500"
// NewFromFloat(560).RoundHalfDown(-2).String() // output: "600" // NewFromFloat(560).RoundHalfDown(-2).String() // output: "600"
// NewFromFloat(1.1001).RoundHalfDown(2).String() // output: "1.11" // NewFromFloat(1.1001).RoundHalfDown(2).String() // output: "1.10"
// NewFromFloat(-1.454).RoundHalfDown(1).String() // output: "-1.5" // NewFromFloat(-1.454).RoundHalfDown(1).String() // output: "-1.5"
// NewFromFloat(-1.444).RoundHalfDown(1).String() // output: "-1.4" // NewFromFloat(-1.444).RoundHalfDown(1).String() // output: "-1.4"
func (d Decimal) RoundHalfDown(places int32) Decimal { func (d Decimal) RoundHalfDown(places int32) Decimal {