MCPcopy Create free account
hub / github.com/cockroachdb/apd / roundAddOne

Function roundAddOne

round.go:114–125  ·  view source on GitHub ↗

roundAddOne adds 1 to abs(b).

(b *BigInt, diff *int64)

Source from the content-addressed store, hash-verified

112
113// roundAddOne adds 1 to abs(b).
114func 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.
128var roundings = map[Rounder]struct{}{

Callers 1

RoundMethod · 0.85

Calls 4

NumDigitsFunction · 0.85
SignMethod · 0.45
AddMethod · 0.45
QuoMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…