48 template <const
bool isDouble>
54 const Numeric *
const num1 = o1.template as<Numeric>();
55 const Numeric *
const num2 = o2.template as<Numeric>();
62 if(num1->
isNaN() || num2->isNaN())
64 context->error(QtXmlPatterns::tr(
"No operand in an integer division, %1, can be %2.")
67 ReportContext::FOAR0002,
this);
69 else if(num1->
isInf())
71 context->error(QtXmlPatterns::tr(
"The first operand in an integer division, %1, cannot be infinity (%2).")
74 ReportContext::FOAR0002,
this);
76 else if(num2->toInteger() == 0)
77 context->error(QtXmlPatterns::tr(
"The second operand in a division, %1, cannot be zero (%2).")
80 ReportContext::FOAR0001,
this);
82 return Integer::fromValue(static_cast<xsInteger>(num1->
toDouble() / num2->toDouble()));
Base template class for Float and Double classes.
static QString formatKeyword(const VariableDeclaration::Ptr &var, const NamePool::Ptr &np)
Formats var appropriately for display.
Item toItem(const QExplicitlySharedDataPointer< T > atomicValue)
Represents an item in the XPath 2.0 Data Model.
Performs arithmetics between AbstractFloat values (Float and Double classes).
Base class for all numeric values.
virtual xsDouble toDouble() const =0
virtual bool isNaN() const =0
virtual bool isInf() const =0
static QString formatData(const QXmlNodeModelIndex node)