小编Joh*_*ith的帖子

为什么使用大整数 (System.Numerics) 会导致系统溢出?

我收到此错误: System.OverflowException: '值不是数字。' 我的印象是大整数可以存储任何大小的值(在这种情况下为 500 ^ 500),所以我不明白为什么会发生这种情况。

public int decode(int code)
{
   int totient = (p - 1) * (q - 1);
   int d = modInverse(e, totient);
   int pq = p * q;
   BigInteger decodedMessage = new BigInteger(Math.Pow(code, d) % pq);
   return (int)decodedMessage;
}
Run Code Online (Sandbox Code Playgroud)

c# numeric biginteger system.numerics

2
推荐指数
1
解决办法
46
查看次数

标签 统计

biginteger ×1

c# ×1

numeric ×1

system.numerics ×1