mirror of
https://github.com/shopspring/decimal.git
synced 2024-11-22 20:40:48 +01:00
add docs for Floor and Ceil
This commit is contained in:
parent
1a6d69cb90
commit
5359bc7cb4
1 changed files with 2 additions and 0 deletions
|
@ -422,6 +422,7 @@ func (d Decimal) Round(places int32) Decimal {
|
||||||
return almost
|
return almost
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Floor returns the nearest integer value less than or equal to d.
|
||||||
func (d Decimal) Floor() Decimal {
|
func (d Decimal) Floor() Decimal {
|
||||||
exp := big.NewInt(10)
|
exp := big.NewInt(10)
|
||||||
exp.Exp(exp, big.NewInt(int64(-d.exp)), nil)
|
exp.Exp(exp, big.NewInt(int64(-d.exp)), nil)
|
||||||
|
@ -429,6 +430,7 @@ func (d Decimal) Floor() Decimal {
|
||||||
return Decimal{value: z, exp: 0}
|
return Decimal{value: z, exp: 0}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ceil returns the nearest integer value greater than or equal to d.
|
||||||
func (d Decimal) Ceil() Decimal {
|
func (d Decimal) Ceil() Decimal {
|
||||||
exp := big.NewInt(10)
|
exp := big.NewInt(10)
|
||||||
exp.Exp(exp, big.NewInt(int64(-d.exp)), nil)
|
exp.Exp(exp, big.NewInt(int64(-d.exp)), nil)
|
||||||
|
|
Loading…
Reference in a new issue