我一直在尝试找到很长的数字,特别是 100 位数字的自然对数。我希望能够计算一个数字的自然对数次方并找到 100 位数字,例如 2^x = n; n= 100 位数字。 x = ln(n)/ln(2),我确实设法找到 x 的值,但它总是错误的,因为我永远无法取回 100 位数字。请帮忙。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Numerics;
namespace expo
{
internal class Program
{
static void Main(string[] args)
{
var myBigInteger = BigInteger.Parse("251414251418251727251719251713251423251427251722251727251423251427251714251427251423251723251414251");
BigInteger x = (int)(BigInteger.Log((BigInteger)(double)myBigInteger) / Math.Log(2));
// x = 326
var s =BigInteger.Pow(2, (int)x);
// s = 136703170298938245273281389194851335334573089430825777276610662900622062449960995201469573563940864
// instead of 251414251418251727251719251713251423251427251722251727251423251427251714251427251423251723251414251
Console.WriteLine(s);
}
}
}
我尝试增加底座的大小,我尝试使用Math.Pow和双星号方法(例如2**3),但它仍然不起作用。