所以我谷歌搜索了很长时间,我几乎找不到任何东西.我从这个url找到了一些关于可能实现Math.Pow的信息,但它们是不准确的,例如这段代码
public static double PowerA(double a, double b)
{
int tmp = (int)(BitConverter.DoubleToInt64Bits(a) >> 32);
int tmp2 = (int)(b * (tmp - 1072632447) + 1072632447);
return BitConverter.Int64BitsToDouble(((long)tmp2) << 32);
}
static void Main(string[] args)
{
double x = 12.53, y = 16.45;
Console.WriteLine(Math.Pow(x, y));
Console.WriteLine(PowerA(x, y));
}
Run Code Online (Sandbox Code Playgroud)
提供输出:
1,15158266266297E+18
8,9966384455562E+17
Run Code Online (Sandbox Code Playgroud)
如此不准确......
我当时认为它的作用类似于一系列,但我不确定.