So I was googling for a long time and i found almost nothing. I found some info about possible implementation of Math.Pow from this url, but they are inaccurate, for example this code
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));
}
provides output:
1,15158266266297E+18
8,9966384455562E+17
So inaccurate...
I was thinking that it works like a sum of series but I don't know for certain.
Math.Pow
is fairly old. – PowwowMath.Pow
, it is incorrect, and he's looking for an implementation that will correctly mirrorMath.Pow
. – Cadel