gpt4 book ai didi

c# - 使用 XPathNavigator 计算 Mod 值

转载 作者:太空宇宙 更新时间:2023-11-03 12:51:08 25 4
gpt4 key购买 nike

我在 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 类型,而不是 intSee MOD算子实现。

关于c# - 使用 XPathNavigator 计算 Mod 值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35497961/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com