MCPcopy Create free account
hub / github.com/BaseXdb/basex / round

Method round

basex-core/src/main/java/org/basex/query/func/fn/FnRound.java:46–53  ·  view source on GitHub ↗

Rounds values. @param qc query context @param mode rounding mode @return number or Empty#VALUE @throws QueryException query exception

(final QueryContext qc, final RoundMode mode)

Source from the content-addressed store, hash-verified

44 * @throws QueryException query exception
45 */
46 final Item round(final QueryContext qc, final RoundMode mode) throws QueryException {
47 final ANum value = toNumberOrNull(arg(0), qc);
48 final Item precision = arg(1).atomItem(qc, info);
49
50 final int scale = precision.isEmpty() ? 0 : (int) Math.max(-1 << 20,
51 Math.min(1 << 20, toLong(precision)));
52 return value == null ? Empty.VALUE : value.round(scale, mode);
53 }
54}

Callers 4

itemMethod · 0.95
startMethod · 0.45
endMethod · 0.45
itemMethod · 0.45

Calls 8

roundMethod · 0.95
toNumberOrNullMethod · 0.80
argMethod · 0.45
atomItemMethod · 0.45
isEmptyMethod · 0.45
maxMethod · 0.45
minMethod · 0.45
toLongMethod · 0.45

Tested by

no test coverage detected