Mathf.Pow在C#上显示无穷大

问题描述

我正在尝试使用Mathf.Pow()计算一个大数,但是当我放置一个断点显示无穷大时,我已经尝试使用System.Numerics.BigInteger,但是它显示 Big Integer无法显示无穷大

这是我的代码

    using System;
using System.Numerics;
namespace TestConsole
{
    class Program
    {
        static void Main(string[] args)
        {
            //43
            BigInteger res = new BigInteger(MathF.Pow(43,27));
            Console.WriteLine(res);
        }
    }
}

解决方法

如杰里米所说

您可以改用BigInteger.Pow

我使用了BigInteger res = BigInteger.Pow(43,27);,效果很好,谢谢!