public void Atan2UnnormalValueTest() { MultiPrecision <Pow2.N8>[] vs = new MultiPrecision <Pow2.N8>[] { MultiPrecision <Pow2.N8> .NaN, MultiPrecision <Pow2.N8> .PositiveInfinity, MultiPrecision <Pow2.N8> .NegativeInfinity, }; foreach (MultiPrecision <Pow2.N8> v in vs) { MultiPrecision <Pow2.N8> y = MultiPrecision <Pow2.N8> .Atan2(0, v); Assert.IsTrue(y.IsNaN); } foreach (MultiPrecision <Pow2.N8> v in vs) { MultiPrecision <Pow2.N8> y = MultiPrecision <Pow2.N8> .Atan2(v, 0); Assert.IsTrue(y.IsNaN); } foreach (MultiPrecision <Pow2.N8> v in vs) { MultiPrecision <Pow2.N8> y = MultiPrecision <Pow2.N8> .Atan2(v, v); Assert.IsTrue(y.IsNaN); } }
public void Atan2BorderTest() { foreach (MultiPrecision <Pow2.N8> x in TestTool.EnumerateNeighbor <Pow2.N8>(0)) { MultiPrecision <Pow2.N8> y = MultiPrecision <Pow2.N8> .Atan2(x, 1); Console.WriteLine(x); Console.WriteLine(x.ToHexcode()); Console.WriteLine(y); Console.WriteLine(y.ToHexcode()); Console.Write("\n"); TestTool.Tolerance(Math.Atan2((double)x, 1), y); } Console.Write("\n"); foreach (MultiPrecision <Pow2.N8> x in TestTool.EnumerateNeighbor <Pow2.N8>(0)) { MultiPrecision <Pow2.N8> y = MultiPrecision <Pow2.N8> .Atan2(x, -1); Console.WriteLine(x); Console.WriteLine(x.ToHexcode()); Console.WriteLine(y); Console.WriteLine(y.ToHexcode()); Console.Write("\n"); TestTool.Tolerance(Math.Atan2((double)x, -1), y); } Console.Write("\n"); foreach (MultiPrecision <Pow2.N8> x in TestTool.EnumerateNeighbor <Pow2.N8>(0)) { MultiPrecision <Pow2.N8> y = MultiPrecision <Pow2.N8> .Atan2(1, x); Console.WriteLine(x); Console.WriteLine(x.ToHexcode()); Console.WriteLine(y); Console.WriteLine(y.ToHexcode()); Console.Write("\n"); TestTool.Tolerance(Math.Atan2(1, (double)x), y); } Console.Write("\n"); foreach (MultiPrecision <Pow2.N8> x in TestTool.EnumerateNeighbor <Pow2.N8>(0)) { MultiPrecision <Pow2.N8> y = MultiPrecision <Pow2.N8> .Atan2(-1, x); Console.WriteLine(x); Console.WriteLine(x.ToHexcode()); Console.WriteLine(y); Console.WriteLine(y.ToHexcode()); Console.Write("\n"); TestTool.Tolerance(Math.Atan2(-1, (double)x), y); } }
public void Atan2Test() { for (Int64 iy = -10; iy <= 10; iy++) { for (Int64 ix = -10; ix <= 10; ix++) { MultiPrecision <Pow2.N8> x = (MultiPrecision <Pow2.N8>)ix / 10; MultiPrecision <Pow2.N8> y = (MultiPrecision <Pow2.N8>)iy / 10; MultiPrecision <Pow2.N8> d = MultiPrecision <Pow2.N8> .Atan2(y, x); Console.WriteLine($"{x}, {y}"); Console.WriteLine(d); TestTool.Tolerance(Math.Atan2((double)y, (double)x), d); } } }