Beispiel #1
0
        public static void fp4x4_operator_not_equal_scalar_wide()
        {
            fp      a0 = (478.353149m);
            fp4x4   b0 = fp4x4(459.553223m, 436.453247m, -488.714172m, 392.767944m, -266.736633m, 338.557861m, -338.100128m, -152.314545m, -452.820679m, 209.439331m, 50.10797m, 372.4344m, -488.0213m, 489.740784m, 270.4001m, -472.846771m);
            bool4x4 r0 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);

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

            fp      a1 = (-286.850464m);
            fp4x4   b1 = fp4x4(-384.691864m, 443.423523m, 358.7472m, -15.4140625m, -342.179169m, 468.967529m, -130.568085m, 401.785828m, -268.352264m, -239.231018m, 411.386536m, 139.769348m, 334.522034m, -223.629242m, -12.4884644m, 113.468872m);
            bool4x4 r1 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);

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

            fp      a2 = (-189.652252m);
            fp4x4   b2 = fp4x4(-212.846558m, 306.1256m, -178.330383m, 382.141968m, -340.8656m, -17.58023m, -409.874847m, -349.70166m, 275.8543m, -229.371948m, -127.505737m, 90.75342m, -422.087128m, -2.44754028m, -280.5517m, -484.374359m);
            bool4x4 r2 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);

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

            fp      a3 = (-33.7634277m);
            fp4x4   b3 = fp4x4(374.593872m, 437.092346m, 286.22583m, -18.2327881m, 289.732361m, 479.485718m, 153.853943m, 502.982117m, -510.3844m, 65.78888m, -237.4867m, 219.916138m, -275.342743m, -78.93146m, -449.403564m, -253.034515m);
            bool4x4 r3 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);

            TestUtils.AreEqual(a3 != b3, r3);
        }
Beispiel #2
0
        public static void fp4x4_operator_equal_scalar_wide()
        {
            fp      a0 = (36.38391m);
            fp4x4   b0 = fp4x4(-400.4892m, -71.2868347m, 156.978088m, -225.238739m, 499.141785m, -211.979919m, 428.311951m, -489.501343m, -5.691559m, -30.8659363m, -362.9831m, 184.503174m, -160.470612m, 316.668823m, 390.369263m, 505.1051m);
            bool4x4 r0 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);

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

            fp      a1 = (-294.6487m);
            fp4x4   b1 = fp4x4(443.1991m, 96.5592651m, -257.012939m, -245.054962m, 326.464844m, -23.9599m, -168.694885m, 386.2486m, -227.090637m, -336.612427m, 365.108154m, -405.390839m, -473.995483m, 298.435364m, -149.86322m, 450.0664m);
            bool4x4 r1 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);

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

            fp      a2 = (153.47644m);
            fp4x4   b2 = fp4x4(56.28778m, 39.3421021m, -350.403717m, -482.717224m, 239.9654m, -3.40603638m, -1.49484253m, 105.960449m, 151.537537m, 63.2832031m, -289.693176m, 137.553772m, -247.666473m, -339.420563m, 23.2382813m, 21.1778564m);
            bool4x4 r2 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);

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

            fp      a3 = (477.03656m);
            fp4x4   b3 = fp4x4(-411.318146m, 122.397095m, -401.49884m, -230.5611m, -214.954041m, 464.6731m, -186.327m, -99.4873352m, 214.232483m, -387.3675m, -448.7962m, 427.889526m, -43.6960449m, 182.698669m, 298.880127m, 246.436829m);
            bool4x4 r3 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);

            TestUtils.AreEqual(a3 == b3, r3);
        }
Beispiel #3
0
        public static void fp4x4_operator_not_equal_wide_scalar()
        {
            fp4x4   a0 = fp4x4(-155.4411m, -19.4266052m, 174.633057m, 507.920715m, 59.177063m, 171.151489m, -58.92328m, -398.176849m, 492.20105m, -165.241516m, 270.341m, -380.243256m, 501.899048m, -134.345459m, 458.400452m, 46.7709961m);
            fp      b0 = (-393.413544m);
            bool4x4 r0 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);

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

            fp4x4   a1 = fp4x4(161.459961m, -145.6124m, -0.449920654m, 350.461426m, 202.221008m, 242.664m, 382.677063m, -468.967957m, -497.459473m, -80.93225m, -328.587769m, -506.490326m, 449.348145m, 210.771m, 249.181824m, -338.468536m);
            fp      b1 = (261.514221m);
            bool4x4 r1 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);

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

            fp4x4   a2 = fp4x4(229.670654m, 317.286072m, 401.939575m, 210.984863m, -147.096313m, -193.399048m, 207.731384m, 284.3921m, -509.0853m, 414.307617m, -52.2944641m, -140.437927m, -316.787781m, -358.696838m, 312.31897m, 270.629456m);
            fp      b2 = (-76.5433044m);
            bool4x4 r2 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);

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

            fp4x4   a3 = fp4x4(-140.016724m, 113.137207m, 479.6996m, 6.097473m, -83.63458m, 249.909363m, 303.956m, 464.888672m, 44.6365356m, -259.91626m, -242.33551m, -403.686523m, -469.1471m, 135.987488m, -490.840759m, 470.225281m);
            fp      b3 = (108.910645m);
            bool4x4 r3 = bool4x4(true, true, true, true, true, true, true, true, true, true, true, true, true, true, true, true);

            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);
        }
Beispiel #5
0
 public static void AreEqual(fp4x4 a, fp4x4 b, fp delta = default)
 {
     AreEqual(a.c0, b.c0, delta);
     AreEqual(a.c1, b.c1, delta);
     AreEqual(a.c2, b.c2, delta);
     AreEqual(a.c3, b.c3, delta);
 }
        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_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);
        }
Beispiel #9
0
        public static void fp4x4_operator_equal_wide_scalar()
        {
            fp4x4   a0 = fp4x4(65.6712m, 404.415527m, -269.730164m, 83.6306152m, 152.9945m, -155.868286m, 314.671265m, 386.365173m, 290.04895m, -132.6352m, -65.66748m, -69.68326m, -191.190765m, 186.845215m, -232.895691m, -319.144043m);
            fp      b0 = (-155.815765m);
            bool4x4 r0 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);

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

            fp4x4   a1 = fp4x4(-49.70108m, 333.396851m, 386.3775m, -296.7019m, -309.1172m, 141.542358m, -227.323334m, 83.87286m, -410.91687m, 110.501282m, -390.103577m, 36.57434m, -427.541443m, -268.170837m, 175.8117m, -193.47995m);
            fp      b1 = (-300.8819m);
            bool4x4 r1 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);

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

            fp4x4   a2 = fp4x4(291.051941m, -429.8739m, -275.156952m, -56.3323669m, -95.83597m, -124.865326m, 253.006165m, -300.509521m, 314.866516m, 195.616211m, -26.1289063m, -284.7747m, -242.672058m, 140.3606m, 505.644348m, 506.537964m);
            fp      b2 = (423.97168m);
            bool4x4 r2 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);

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

            fp4x4   a3 = fp4x4(-502.3698m, 87.36731m, -433.136383m, -149.626923m, -358.698547m, -249.126862m, 469.5932m, 511.757751m, 51.911377m, 245.630432m, 192.774841m, -162.209167m, 205.5904m, -376.464355m, 270.5208m, -388.2033m);
            fp      b3 = (-249.517639m);
            bool4x4 r3 = bool4x4(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false, false);

            TestUtils.AreEqual(a3 == b3, r3);
        }
Beispiel #10
0
 public static void AreEqual(fp4 a, fp4 b, fp delta = default)
 {
     AreEqual(a.x, b.x, delta);
     AreEqual(a.y, b.y, delta);
     AreEqual(a.z, b.z, delta);
     AreEqual(a.w, b.w, delta);
 }
Beispiel #11
0
 public static void AreEqual(fp a, fp b, long maxUlp, bool signedZeroEqual)
 {
     try
     {
         AreEqual((double)a, (double)b, maxUlp, signedZeroEqual);
     }
     catch (System.Exception e)
     {
         throw new System.AggregateException($"{a} == {b}", e);
     }
 }
        public static void fp3_operator_equal_wide_scalar()
        {
            fp3 a0 = fp3(65.6712m, 404.415527m, -269.730164m);
            fp b0 = (-155.815765m);
            bool3 r0 = bool3(false, false, false);
            TestUtils.AreEqual(a0 == b0, r0);

            fp3 a1 = fp3(83.6306152m, -155.868286m, 314.671265m);
            fp b1 = (152.9945m);
            bool3 r1 = bool3(false, false, false);
            TestUtils.AreEqual(a1 == b1, r1);

            fp3 a2 = fp3(386.365173m, -132.6352m, -65.66748m);
            fp b2 = (290.04895m);
            bool3 r2 = bool3(false, false, false);
            TestUtils.AreEqual(a2 == b2, r2);

            fp3 a3 = fp3(-69.68326m, 186.845215m, -232.895691m);
            fp b3 = (-191.190765m);
            bool3 r3 = bool3(false, false, false);
            TestUtils.AreEqual(a3 == b3, r3);
        }
        public static void fp3_operator_not_equal_scalar_wide()
        {
            fp a0 = (478.353149m);
            fp3 b0 = fp3(459.553223m, 436.453247m, -488.714172m);
            bool3 r0 = bool3(true, true, true);
            TestUtils.AreEqual(a0 != b0, r0);

            fp a1 = (392.767944m);
            fp3 b1 = fp3(-266.736633m, 338.557861m, -338.100128m);
            bool3 r1 = bool3(true, true, true);
            TestUtils.AreEqual(a1 != b1, r1);

            fp a2 = (-152.314545m);
            fp3 b2 = fp3(-452.820679m, 209.439331m, 50.10797m);
            bool3 r2 = bool3(true, true, true);
            TestUtils.AreEqual(a2 != b2, r2);

            fp a3 = (372.4344m);
            fp3 b3 = fp3(-488.0213m, 489.740784m, 270.4001m);
            bool3 r3 = bool3(true, true, true);
            TestUtils.AreEqual(a3 != b3, r3);
        }
Beispiel #14
0
        /// <summary>
        /// 发票明细
        /// </summary>
        /// <param name="item"></param>
        /// <returns></returns>
        private XElement GetFPMX(fp item)
        {
            XElement xeFPMX = new XElement("FPMX", new XAttribute("RowNum", 4), new XAttribute("HJJE", item.ZJE));

            int rowNum = 0;
            if (item.金额 > 0)
            {
                XElement xeRow = new XElement("Row",
                    new XAttribute("XH", 1),
                    new XAttribute("HPMC", item.项目 ?? ""),
                    new XAttribute("JLDW", item.单位 ?? ""),
                    new XAttribute("SL", item.数量),
                    new XAttribute("DJ", item.单价),
                    new XAttribute("JE", item.金额),
                    new XAttribute("BZ", "")
                );
                xeFPMX.Add(xeRow);
                rowNum++;
            }
            if (item.金额1 > 0)
            {
                XElement xeRow = new XElement("Row",
                    new XAttribute("XH", 2),
                    new XAttribute("HPMC", item.项目1 ?? ""),
                    new XAttribute("JLDW", item.单位1 ?? ""),
                    new XAttribute("SL", item.数量1),
                    new XAttribute("DJ", item.单价1),
                    new XAttribute("JE", item.金额1),
                    new XAttribute("BZ", "")
                );
                xeFPMX.Add(xeRow);
                rowNum++;
            }
            if (item.金额2 > 0)
            {
                XElement xeRow = new XElement("Row",
                    new XAttribute("XH", 3),
                    new XAttribute("HPMC", item.项目2 ?? ""),
                    new XAttribute("JLDW", item.单位2 ?? ""),
                    new XAttribute("SL", item.数量2),
                    new XAttribute("DJ", item.单价2),
                    new XAttribute("JE", item.金额2),
                    new XAttribute("BZ", "")
                );
                xeFPMX.Add(xeRow);
                rowNum++;
            }
            if (item.金额3 > 0)
            {
                XElement xeRow = new XElement("Row",
                    new XAttribute("XH", 4),
                    new XAttribute("HPMC", item.项目3 ?? ""),
                    new XAttribute("JLDW", item.单位3 ?? ""),
                    new XAttribute("SL", item.数量3),
                    new XAttribute("DJ", item.单价3),
                    new XAttribute("JE", item.金额3),
                    new XAttribute("BZ", "")
                );
                xeFPMX.Add(xeRow);
                rowNum++;
            }
            xeFPMX.FirstAttribute.Value = rowNum.ToString();

            return xeFPMX;
        }
Beispiel #15
0
        /// <summary>
        /// 开票记录
        /// </summary>
        /// <returns></returns>
        private XElement GetKPJL(fp item)
        {
            XElement xeKPJL = new XElement("KPJL");

            xeKPJL.Add(new XElement("FPDM", _config.FPDM),
                new XElement("FPHM", item.发票编号),
                new XElement("KPLX", GetKPLX(item)),
                new XElement("KPRQ", item.开票日期.ToString("yyyyMMdd")),
                new XElement("HYFLDM", "01"),
                new XElement("JE", item.ZJE),
                new XElement("SKRMC", item.收款单位名称),
                new XElement("SKRSH", item.收款单位税号),
                new XElement("FKRMC", item.付款单位名称),
                new XElement("FKRSH", item.付款单位税号),
                new XElement("GHFQYLX", "01"),
                new XElement("KPFDZJDH", _config.KPFDZJDH),
                new XElement("KPFYHJZH", _config.KPFYHJZH),
                new XElement("SPFDZJDH", ""),
                new XElement("SPFYHJZH", ""),
                new XElement("SE", item.税额),
                new XElement("SL", item.税率),
                new XElement("BZ1", String.IsNullOrEmpty(item.备注) ? "" : item.备注 ),
                new XElement("BZ2", ""),
                new XElement("BZ3", ""),
                new XElement("BZ4", ""),
                new XElement("BZ5", ""),
                new XElement("KPRXM", _config.KPRXM),
                new XElement("FHRXM", _config.FHRXM),
                new XElement("YFPDM", (item.作废 || item.ZJE < 0) ? _config.FPDM : ""),
                new XElement("YFPHM", (item.作废 || item.ZJE < 0) ? item.发票编号 : ""),
                new XElement("TPLX", (item.作废 || item.ZJE < 0) ? "1" : ""),
                new XElement("ZFRQ", (item.作废 || item.ZJE < 0) ? item.开票日期.ToString("yyyyMMdd") : ""),
                new XElement("ZFRXM", (item.作废 || item.ZJE < 0) ? _config.KPRXM : ""),
                GetFPMX(item)
            );
            return xeKPJL;
        }
Beispiel #16
0
        /// <summary>
        /// 获取到开票类型:规则如下
        /// 正票 0 是发票金额大于0,且不是废票。
        /// 废票 1 是要根据表中“作废”标志。
        /// 退票 2 是发票金额小于0,且不是废票。
        /// </summary>
        /// <returns></returns>
        private int GetKPLX(fp item)
        {
            if (item.作废) return 1;

            if (item.ZJE > 0)
                return 0;
            else
                return 2;
        }
Beispiel #17
0
 ((Reader) other).seek(fp, upto);