Round a to nd digits (or fewer). If nd is zero, it means we're rounding just to the left of the digits, as in 0.09 -> 0.1.
(nd int)
| 315 | // just to the left of the digits, as in |
| 316 | // 0.09 -> 0.1. |
| 317 | func (a *decimal) Round(nd int) { |
| 318 | if nd < 0 || nd >= a.nd { |
| 319 | return |
| 320 | } |
| 321 | if shouldRoundUp(a, nd) { |
| 322 | a.RoundUp(nd) |
| 323 | } else { |
| 324 | a.RoundDown(nd) |
| 325 | } |
| 326 | } |
| 327 | |
| 328 | // Round a down to nd digits (or fewer). |
| 329 | func (a *decimal) RoundDown(nd int) { |
no test coverage detected