operator % method

  1. @override
XPathNumeric operator %(
  1. XPathNumeric other
)
override

Implementation

@override
XPathNumeric operator %(XPathNumeric other) => switch (other) {
  final XPathInteger i =>
    i.value == BigInt.zero
        ? throw XPathEvaluationException(
            XPathErrorCode.FOAR0001,
            'Division by zero in mod',
          )
        : XPathInteger(value.remainder(i.value)),
  final XPathDecimal d => toDecimal() % d,
  final XPathDouble d => XPathDouble(toDouble().remainder(d.value)),
};