Extract integer part, rounded appropriately. No guarantees about overflow.
()
| 360 | // Extract integer part, rounded appropriately. |
| 361 | // No guarantees about overflow. |
| 362 | func (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 | } |
nothing calls this directly
no test coverage detected