} else if (reqItemType == Type.NUMBER_TYPE || Type.isSubType(reqItemType, Type.DOUBLE_TYPE)) {
// TODO: in the Nov 2003 draft, the rules have changed so that number() is called
// only if the supplied value doesn't match the expected type. We're currently
// returning different results for round(()) depending on whether the arg value
// is known statically or not.
NumberFn fn = (NumberFn)SystemFunction.makeSystemFunction("number", env.getNamePool());
Expression[] args = new Expression[1];
args[0] = exp;
fn.setArguments(args);
if (exp instanceof Value) {
try {
exp = ExpressionTool.eagerEvaluate(fn, null);
} catch (XPathException err) {
throw new StaticError(err);
}
} else {
fn.adoptChildExpression(exp);
exp = fn;
}
suppliedItemType = Type.DOUBLE_TYPE;
suppliedCard = StaticProperty.EXACTLY_ONE;
cardOK = Cardinality.subsumes(reqCard, suppliedCard);