MCPcopy
hub / github.com/pquerna/ffjson / Round

Method Round

fflib/v1/decimal.go:317–326  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

315// just to the left of the digits, as in
316// 0.09 -> 0.1.
317func (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).
329func (a *decimal) RoundDown(nd int) {

Callers 2

bigFtoaFunction · 0.45
roundShortestFunction · 0.45

Calls 3

RoundUpMethod · 0.95
RoundDownMethod · 0.95
shouldRoundUpFunction · 0.70

Tested by

no test coverage detected