Exemple #1
0
Result FunctionPower::createResult(DynamicContext* context, int flags) const
{
  Numeric::Ptr base = getNumericParam(1, context);
  if(base.isNull()) return 0;
  Numeric::Ptr pow = getNumericParam(2, context);
  if(pow.isNull()) return 0;
  return (Item::Ptr)base->power(pow, context);
}
Exemple #2
0
Sequence FunctionFloor::createSequence(DynamicContext* context, int flags) const
{
  Numeric::Ptr numericArg = getNumericParam(1, context);

  //If the argument is the empty sequence, the empty sequence is returned.
  if(numericArg.isNull()) {
    return Sequence(context->getMemoryManager());
  }

  if(numericArg->isNaN() || numericArg->isInfinite())
    return Sequence(numericArg, context->getMemoryManager());
  return Sequence(numericArg->floor(context), context->getMemoryManager());
}
Exemple #3
0
Sequence FunctionRound::createSequence(DynamicContext* context, int flags) const
{
  XPath2MemoryManager* memMgr = context->getMemoryManager();

  Numeric::Ptr numericArg = getNumericParam(1, context);
    
  //If the argument is the empty sequence, the empty sequence is returned.
  if(numericArg.isNull()) {
    return Sequence(memMgr);
  }

  if(numericArg->isNaN() || numericArg->isInfinite())
    return Sequence(numericArg, memMgr);
  return Sequence(numericArg->round(context), memMgr);
}
Exemple #4
0
Result FunctionAsin::createResult(DynamicContext* context, int flags) const
{
  Numeric::Ptr num = getNumericParam(1, context);
  if(num.isNull()) return 0;
  return (Item::Ptr)num->asin(context);
}