public static void fp2_operator_not_equal_scalar_wide()
        {
            fp    a0 = (478.353149m);
            fp2   b0 = fp2(459.553223m, 436.453247m);
            bool2 r0 = bool2(true, true);

            TestUtils.AreEqual(a0 != b0, r0);

            fp    a1 = (-488.714172m);
            fp2   b1 = fp2(392.767944m, -266.736633m);
            bool2 r1 = bool2(true, true);

            TestUtils.AreEqual(a1 != b1, r1);

            fp    a2 = (338.557861m);
            fp2   b2 = fp2(-338.100128m, -152.314545m);
            bool2 r2 = bool2(true, true);

            TestUtils.AreEqual(a2 != b2, r2);

            fp    a3 = (-452.820679m);
            fp2   b3 = fp2(209.439331m, 50.10797m);
            bool2 r3 = bool2(true, true);

            TestUtils.AreEqual(a3 != b3, r3);
        }
        public static void fp2_operator_not_equal_wide_wide()
        {
            fp2   a0 = fp2(279.994141m, -43.34201m);
            fp2   b0 = fp2(-460.9121m, -476.009033m);
            bool2 r0 = bool2(true, true);

            TestUtils.AreEqual(a0 != b0, r0);

            fp2   a1 = fp2(-465.724731m, 317.466553m);
            fp2   b1 = fp2(468.1364m, -341.012543m);
            bool2 r1 = bool2(true, true);

            TestUtils.AreEqual(a1 != b1, r1);

            fp2   a2 = fp2(85.7149658m, 360.8905m);
            fp2   b2 = fp2(-62.65805m, -458.801666m);
            bool2 r2 = bool2(true, true);

            TestUtils.AreEqual(a2 != b2, r2);

            fp2   a3 = fp2(366.081543m, 154.542847m);
            fp2   b3 = fp2(-457.730225m, -59.5232544m);
            bool2 r3 = bool2(true, true);

            TestUtils.AreEqual(a3 != b3, r3);
        }
        public static void fp2_operator_not_equal_wide_scalar()
        {
            fp2   a0 = fp2(-155.4411m, -19.4266052m);
            fp    b0 = (-393.413544m);
            bool2 r0 = bool2(true, true);

            TestUtils.AreEqual(a0 != b0, r0);

            fp2   a1 = fp2(174.633057m, 59.177063m);
            fp    b1 = (507.920715m);
            bool2 r1 = bool2(true, true);

            TestUtils.AreEqual(a1 != b1, r1);

            fp2   a2 = fp2(171.151489m, -398.176849m);
            fp    b2 = (-58.92328m);
            bool2 r2 = bool2(true, true);

            TestUtils.AreEqual(a2 != b2, r2);

            fp2   a3 = fp2(492.20105m, 270.341m);
            fp    b3 = (-165.241516m);
            bool2 r3 = bool2(true, true);

            TestUtils.AreEqual(a3 != b3, r3);
        }
        public static void fp2_operator_equal_scalar_wide()
        {
            fp    a0 = (36.38391m);
            fp2   b0 = fp2(-400.4892m, -71.2868347m);
            bool2 r0 = bool2(false, false);

            TestUtils.AreEqual(a0 == b0, r0);

            fp    a1 = (156.978088m);
            fp2   b1 = fp2(-225.238739m, 499.141785m);
            bool2 r1 = bool2(false, false);

            TestUtils.AreEqual(a1 == b1, r1);

            fp    a2 = (-211.979919m);
            fp2   b2 = fp2(428.311951m, -489.501343m);
            bool2 r2 = bool2(false, false);

            TestUtils.AreEqual(a2 == b2, r2);

            fp    a3 = (-5.691559m);
            fp2   b3 = fp2(-30.8659363m, -362.9831m);
            bool2 r3 = bool2(false, false);

            TestUtils.AreEqual(a3 == b3, r3);
        }
        public static void fp2_operator_equal_wide_wide()
        {
            fp2   a0 = fp2(-135.18924m, -49.0941162m);
            fp2   b0 = fp2(-220.014648m, 66.98004m);
            bool2 r0 = bool2(false, false);

            TestUtils.AreEqual(a0 == b0, r0);

            fp2   a1 = fp2(169.129822m, 240.8053m);
            fp2   b1 = fp2(499.2016m, -371.1131m);
            bool2 r1 = bool2(false, false);

            TestUtils.AreEqual(a1 == b1, r1);

            fp2   a2 = fp2(314.7392m, 442.393m);
            fp2   b2 = fp2(208.448669m, 390.8037m);
            bool2 r2 = bool2(false, false);

            TestUtils.AreEqual(a2 == b2, r2);

            fp2   a3 = fp2(177.924438m, 335.5334m);
            fp2   b3 = fp2(-72.44382m, 362.97644m);
            bool2 r3 = bool2(false, false);

            TestUtils.AreEqual(a3 == b3, r3);
        }
        public static void fp2_operator_equal_wide_scalar()
        {
            fp2   a0 = fp2(65.6712m, 404.415527m);
            fp    b0 = (-155.815765m);
            bool2 r0 = bool2(false, false);

            TestUtils.AreEqual(a0 == b0, r0);

            fp2   a1 = fp2(-269.730164m, 152.9945m);
            fp    b1 = (83.6306152m);
            bool2 r1 = bool2(false, false);

            TestUtils.AreEqual(a1 == b1, r1);

            fp2   a2 = fp2(-155.868286m, 386.365173m);
            fp    b2 = (314.671265m);
            bool2 r2 = bool2(false, false);

            TestUtils.AreEqual(a2 == b2, r2);

            fp2   a3 = fp2(290.04895m, -65.66748m);
            fp    b3 = (-132.6352m);
            bool2 r3 = bool2(false, false);

            TestUtils.AreEqual(a3 == b3, r3);
        }
        public static void fp2_static_scalar_constructor()
        {
            fp2 a = fp2(17.0m);

            TestUtils.AreEqual(a.x, 17.0m);
            TestUtils.AreEqual(a.y, 17.0m);
        }
        public static void fp2_static_constructor()
        {
            fp2 a = fp2(1, 2);

            TestUtils.AreEqual(a.x, 1);
            TestUtils.AreEqual(a.y, 2);
        }
        public static void fp2_shuffle_result_1()
        {
            fp2 a = fp2(0, 1);
            fp2 b = fp2(2, 3);

            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX), (0));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftY), (1));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX), (2));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY), (3));
        }
示例#10
0
        public void ItPerformsDivision()
        {
            fp2 ten  = new fp2(10, 10);
            fp2 five = new fp2(5, 5);

            fp2 result = ten / five;

            Assert.Equal(result.x, (fp)2);
            Assert.Equal(result.y, (fp)2);
        }
示例#11
0
        public void ItPerformsSubtraction()
        {
            fp2 one = new fp2(1, 1);
            fp2 two = new fp2(2, 2);

            fp2 result = two - one;

            Assert.Equal(result.x, (fp)1);
            Assert.Equal(result.y, (fp)1);
        }
示例#12
0
        public void ItPerformsMultiplication()
        {
            fp2 seven = new fp2(7, 7);
            fp2 three = new fp2(3, 3);

            fp2 result = three * seven;

            Assert.Equal(result.x, (fp)21);
            Assert.Equal(result.y, (fp)21);
        }
示例#13
0
        public void ItPerformsAddition()
        {
            fp2 one = new fp2(1, 1);
            fp2 two = new fp2(2, 2);

            fp2 result = one + two;

            Assert.Equal(result.x, (fp)3);
            Assert.Equal(result.y, (fp)3);
        }
        public static void fp2_shuffle_result_4()
        {
            fp2 a = fp2(0, 1);
            fp2 b = fp2(2, 3);

            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.LeftX, ShuffleComponent.LeftY, ShuffleComponent.RightX), fp4(0, 0, 1, 2));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftY, ShuffleComponent.LeftX, ShuffleComponent.RightY), fp4(2, 1, 0, 3));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightX, ShuffleComponent.RightY, ShuffleComponent.RightX), fp4(3, 2, 3, 2));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftX, ShuffleComponent.RightY, ShuffleComponent.RightY), fp4(2, 0, 3, 3));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.RightY, ShuffleComponent.LeftX, ShuffleComponent.RightX), fp4(0, 3, 0, 2));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftX, ShuffleComponent.RightY, ShuffleComponent.LeftY), fp4(3, 0, 3, 1));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightX, ShuffleComponent.RightY, ShuffleComponent.LeftX), fp4(2, 2, 3, 0));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightX, ShuffleComponent.LeftX, ShuffleComponent.RightY), fp4(2, 2, 0, 3));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.LeftY, ShuffleComponent.RightX, ShuffleComponent.LeftY), fp4(0, 1, 2, 1));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftY, ShuffleComponent.RightY, ShuffleComponent.RightY), fp4(2, 1, 3, 3));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.RightY, ShuffleComponent.RightY, ShuffleComponent.LeftY), fp4(3, 3, 3, 1));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightX, ShuffleComponent.LeftY, ShuffleComponent.LeftY), fp4(2, 2, 1, 1));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightY, ShuffleComponent.LeftX, ShuffleComponent.LeftX, ShuffleComponent.LeftX), fp4(3, 0, 0, 0));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.RightX, ShuffleComponent.RightX, ShuffleComponent.RightY), fp4(2, 2, 2, 3));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.LeftX, ShuffleComponent.RightY, ShuffleComponent.LeftX, ShuffleComponent.RightY), fp4(0, 3, 0, 3));
            TestUtils.AreEqual(shuffle(a, b, ShuffleComponent.RightX, ShuffleComponent.LeftX, ShuffleComponent.LeftX, ShuffleComponent.LeftX), fp4(2, 0, 0, 0));
        }
示例#15
0
 public static fp3 XY(this fp2 v, float z = 0f)
 {
     return(new fp3(v.x, v.y, z));
 }
示例#16
0
 public static fp3 XZ(this fp2 v, float y = 0f)
 {
     return(new fp3(v.x, y, v.y));
 }
示例#17
0
 // fp
 public static void AreEqual(fp2 a, fp2 b, fp delta = default)
 {
     AreEqual(a.x, b.x, delta);
     AreEqual(a.y, b.y, delta);
 }
示例#18
0
 public static fp2 Y(this fp2 v, float value = 0f)
 {
     return(new fp2(v.x, value));
 }
示例#19
0
 public static void AreEqual(fp2 a, fp2 b, long maxUlp, bool signedZeroEqual)
 {
     AreEqual(a.x, b.x, maxUlp, signedZeroEqual);
     AreEqual(a.y, b.y, maxUlp, signedZeroEqual);
 }
示例#20
0
 public static fp2 X(this fp2 v, float value = 0f)
 {
     return(new fp2(value, v.y));
 }