* 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. */
| 6518 | * by calling the number function. |
| 6519 | */ |
| 6520 | void |
| 6521 | xmlXPathModValues(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 | * * |
no test coverage detected