public void PositiveInfinityTest() { var number = float.PositiveInfinity; Assert.IsTrue(float.IsInfinity(number)); var gama = Float754.FastSqrtFloat(number); Assert.AreEqual(1.82484417E+19f, gama); }
public void Sqrt256Test() { var number = 256.0f; Assert.AreEqual("1.00000000 * 2^(8)", Float754.FloatToString(number)); var gama = Float754.FastSqrtFloat(number); Assert.AreEqual(16.0f, gama, 0.173f); }
public void LargestNormalizedNumberSqrt() { var number = BitConverter.Int32BitsToSingle(0x7F7FFFFF); Assert.AreEqual(3.40282347E+38f, number); var gama = Float754.FastSqrtFloat(number); Assert.AreEqual(1.82484406E+19f, gama); }
public void Sqrt4Test() { var number = 4.0f; Assert.AreEqual("1.00000000 * 2^(2)", Float754.FloatToString(number)); var gama = Float754.FastSqrtFloat(number); Assert.AreEqual(2.0f, gama, 0.0216f); }
public void Sqrt16Test() { var number = 16.0f; Assert.AreEqual("1.00000000 * 2^(4)", Float754.FloatToString(number)); var gama = Float754.FastSqrtFloat(number); Assert.AreEqual(4.0f, gama, 0.0431f); }
public void Sqrt2Test() { var number = 2.0f; Assert.AreEqual("1.00000000 * 2^(1)", Float754.FloatToString(number)); var gama = Float754.FastSqrtFloat(number); Assert.AreEqual(1.41421356237f, gama, 0.0643f); }
public void MiddleDenormalizedNumberSqrt() { var number = BitConverter.Int32BitsToSingle(0x00400000); Assert.AreEqual(5.87747175E-39f, number); var gama = Float754.FastSqrtFloat(number); Assert.AreEqual(9.37021732E-20f, gama); }
public void SqrtQuarterTest() { var number = 0.25f; Assert.AreEqual("1.00000000 * 2^(-2)", Float754.FloatToString(number)); var gama = Float754.FastSqrtFloat(number); Assert.AreEqual(0.5f, gama, 0.00538f); }
public void SqrtHalfTest() { var number = 0.5f; Assert.AreEqual("1.00000000 * 2^(-1)", Float754.FloatToString(number)); var gama = Float754.FastSqrtFloat(number); Assert.AreEqual(0.7071067811f, gama, 0.0322f); }
public void SqrtOneSixteenthTest() { var number = 0.0625f; Assert.AreEqual("1.00000000 * 2^(-4)", Float754.FloatToString(number)); var gama = Float754.FastSqrtFloat(number); Assert.AreEqual(0.25f, gama, 0.00269f); }
public void SmallestNormalizedNumberSqrt() { var number = BitConverter.Int32BitsToSingle(0x00800000); Assert.AreEqual(1.17549435E-38f, number); var gama = Float754.FastSqrtFloat(number); Assert.AreEqual(1.072547E-19f, gama); }
public void LargestDenormalizedNumberSqrt() { var number = BitConverter.Int32BitsToSingle(0x007FFFFF); Assert.AreEqual(1.17549421E-38f, number); var gama = Float754.FastSqrtFloat(number); Assert.AreEqual(1.07254694E-19f, gama); }
public void NotANumberTest() { var number = float.NaN; Assert.IsTrue(float.IsNaN(number)); var gama = Float754.FastSqrtFloat(number); Assert.AreEqual(6.65971189E-20f, gama); }
public void Sqrt1Test() { var number = 1.0f; Assert.AreEqual("1.00000000 * 2^(0)", Float754.FloatToString(number)); var gama = Float754.FastSqrtFloat(number); Assert.AreEqual(1.0f, gama, 0.0108f); }
public void SmallestDenormalizedNumberSqrt() { var number = BitConverter.Int32BitsToSingle(0x00000001); Assert.AreEqual(1.40129846E-45f, number); var gama = Float754.FastSqrtFloat(number); Assert.AreEqual(8.01496461E-20f, gama); }
public void ZeroSqrt() { var number = 0.0f; var bits = Float754.FloatToString(number); Assert.AreEqual("0.00000000 * 2^(-126)", bits); var gama = Float754.FastSqrtFloat(number); Assert.AreEqual(0.0, gama, 8.1e-20); }
public void Test() { var number = 256.0f; Assert.AreEqual("1.00000000 * 2^(8)", Float754.FloatToString(number)); var gama = Float754.FastSqrtFloat(number); Assert.AreEqual("1.00000000 * 2^(4)", Float754.FloatToString(16.0f)); var y = BitConverter.Int32BitsToSingle(0x1FBD3F7D); Assert.AreEqual("1.47850001 * 2^(-64)", Float754.FloatToString(y)); Assert.AreEqual("1.97850001 * 2^(3)", Float754.FloatToString(gama)); Assert.AreEqual(16.0f, gama, 0.18); }