Mod value calculation using XPathNavigator

61 Views Asked by At

I am calculating mod of value "89001012012341234" using XPathNavigator in C# its not correct.

public object Evaluate(string expression)
{
    try
    {
        var result = base.Evaluate("\"89001012012341234\" mod 97");
        **//Value of result=>20**
        var result1 = 89001012012341234 % 97;
       **//Value of result1=>22**
        return result;
    }
    catch (Exception Exception)
    {
    }
    return null;
}

Value of result and result1 is not same why???

Thanks

1

There are 1 best solutions below

0
On

Your XPath will be evaulated as 89001012012341234.0 % 97.0, operands will have double type, not int. See MOD operator implementation.