【问题标题】:BigInteger bigger than the Long and Int?BigInteger 比 Long 和 Int 大吗?
【发布时间】:2015-03-16 19:21:13
【问题描述】:

我正在做一个使用非常大的数字的程序,即使是最慢的,它也会有太多的工作。 我的问题是: big_integer 是否比正常的 int 和 long 慢?

    long number = 12;
    BigInteger number2 = 12;

public void add()
{
    number += 1;
}
public void add2()
{
    number2 += 1;
}

现在哪个更快?

【问题讨论】:

  • 测试一下就知道了。
  • 另外——如果你的数字大于 Int64,你真的别无选择。

标签: c# numbers int long-integer biginteger


【解决方案1】:

是的,BigInteger 类型比 int 或 long 慢。

但是对于具有非常大数字的整数计算,需要 BigInteger。

【讨论】:

    猜你喜欢
    • 2012-06-24
    • 1970-01-01
    • 2017-06-06
    • 2023-01-03
    • 1970-01-01
    • 2021-06-25
    • 2019-12-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多