MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlXPathModValues

Function xmlXPathModValues

ThirdParty/libxml2/vtklibxml2/xpath.c:6520–6538  ·  view source on GitHub ↗

* xmlXPathModValues: * @ctxt: the XPath Parser context * * Implement the mod operation on XPath objects: @arg1 / @arg2 * The numeric operators convert their operands to numbers as if * by calling the number function. */

Source from the content-addressed store, hash-verified

6518 * by calling the number function.
6519 */
6520void
6521xmlXPathModValues(xmlXPathParserContextPtr ctxt) {
6522 xmlXPathObjectPtr arg;
6523 double arg1, arg2;
6524
6525 arg = valuePop(ctxt);
6526 if (arg == NULL)
6527 XP_ERROR(XPATH_INVALID_OPERAND);
6528 arg2 = xmlXPathCastToNumberInternal(ctxt, arg);
6529 xmlXPathReleaseObject(ctxt->context, arg);
6530 CAST_TO_NUMBER;
6531 CHECK_TYPE(XPATH_NUMBER);
6532 arg1 = ctxt->value->floatval;
6533 if (arg2 == 0)
6534 ctxt->value->floatval = xmlXPathNAN;
6535 else {
6536 ctxt->value->floatval = fmod(arg1, arg2);
6537 }
6538}
6539
6540/************************************************************************
6541 * *

Callers 1

xmlXPathCompOpEvalFunction · 0.85

Calls 4

valuePopFunction · 0.85
xmlXPathReleaseObjectFunction · 0.85
fmodFunction · 0.50

Tested by

no test coverage detected