roundAddOne adds 1 to abs(b).
(b *BigInt, diff *int64)
| 112 | |
| 113 | // roundAddOne adds 1 to abs(b). |
| 114 | func roundAddOne(b *BigInt, diff *int64) { |
| 115 | if b.Sign() < 0 { |
| 116 | panic("unexpected negative") |
| 117 | } |
| 118 | nd := NumDigits(b) |
| 119 | b.Add(b, bigOne) |
| 120 | nd2 := NumDigits(b) |
| 121 | if nd2 > nd { |
| 122 | b.Quo(b, bigTen) |
| 123 | *diff++ |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | // roundings is a set containing all available Rounders. |
| 128 | var roundings = map[Rounder]struct{}{ |