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

Method RoundedInteger

fflib/v1/decimal.go:362–378  ·  view source on GitHub ↗

Extract integer part, rounded appropriately. No guarantees about overflow.

()

Source from the content-addressed store, hash-verified

360// Extract integer part, rounded appropriately.
361// No guarantees about overflow.
362func (a *decimal) RoundedInteger() uint64 {
363 if a.dp > 20 {
364 return 0xFFFFFFFFFFFFFFFF
365 }
366 var i int
367 n := uint64(0)
368 for i = 0; i < a.dp && i < a.nd; i++ {
369 n = n*10 + uint64(a.d[i]-'0')
370 }
371 for ; i < a.dp; i++ {
372 n *= 10
373 }
374 if shouldRoundUp(a, a.dp) {
375 n++
376 }
377 return n
378}

Callers

nothing calls this directly

Calls 1

shouldRoundUpFunction · 0.70

Tested by

no test coverage detected