我在 C# 中使用 XPathNavigator 计算值“89001012012341234”的模数不正确。
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;
}
result 和 result1 的值不一样为什么???
谢谢
最佳答案
您的 XPath 将被评估为 89001012012341234.0 % 97.0
,操作数将具有 double
类型,而不是 int
。 See MOD算子实现。
关于c# - 使用 XPathNavigator 计算 Mod 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35497961/