/** * Checks if the specified, non-empty item is a double. Returns the double or throws an exception. * * @param it item to be checked * @return number * @throws QueryException query exception */ private ANum toNumber(final Item it) throws QueryException { if (it.type.isUntyped()) return Dbl.get(it.dbl(info)); if (it instanceof ANum) return (ANum) it; throw numberError(this, it); }
@Override public Item item(final QueryContext qc, final InputInfo ii) throws QueryException { final Item it = exprs[0].atomItem(qc, info); return it == null ? null : Dbl.get(sqrt(toDouble(it))); }