【问题标题】:Mod value calculation using XPathNavigator使用 XPathNavigator 计算 Mod 值
【发布时间】:2016-05-31 14:13:29
【问题描述】:

我在 C# 中使用 XPathNavigator 计算值“89001012012341234”的 mod,它不正确。

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的值不一样为什么???

谢谢

【问题讨论】:

  • 那么result的值是多少?
  • result = 20 and result1=22
  • 谢谢。你想把它放到你的问题中吗:) 让其他人很容易看到

标签: c# xpathnavigator


【解决方案1】:

您的 XPath 将被评估为 89001012012341234.0 % 97.0,操作数将具有 double 类型,而不是 int。 See MOD 运算符实现。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2015-12-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多