Пример #1
0
        public void ExponentTest()
        {
            var target = new BitView(0.75);

            target.Exponent.Is(-1);

            new BitView(1).Exponent.Is(0);
        }
Пример #2
0
        public void bs_bitview()
        {
            var x  = Random.CpuVec256 <int>();
            var y  = BitView.ViewBits(ref x);
            var ys = y.Bytes.ToBitString();
            var xs = x.ToBitString();

            Claim.eq(ys, xs);
        }
Пример #3
0
        public void SignTest()
        {
            var target = new BitView(-1.0);

            target.Sign.Is(SignTypes.Negative);

            target = new BitView(1.0);
            target.Sign.Is(SignTypes.Positive);
        }
Пример #4
0
        static void Main(string[] args)
        {
            Console.WriteLine(Math.Sin(2 / Math.PI).ToString("g17"));
            Console.WriteLine(Math.Cos(2 / Math.PI).ToString("g17"));

            var view = new BitView(Math.PI);

            Console.WriteLine(view.ToString());
        }
Пример #5
0
        public void ValueTest()
        {
            var target = new BitView(Math.PI);

            target.Value.Is(Math.PI);

            target = new BitView(Math.E);
            target.Value.Is(Math.E);

            target = new BitView(0.0);
            target.Value.Is(0.0);
        }
Пример #6
0
        public void MantissaTest()
        {
            var target = new BitView(1.0).Mantissa;

            target.Take(52).All(x => !x).IsTrue();
            target[52].IsTrue();

            target = new BitView(0.5).Mantissa;

            target.Take(52).All(x => !x).IsTrue();
            target[52].IsTrue();


            target = new BitView(.75).Mantissa;
            target.Take(51).All(x => !x).IsTrue();
            target[51].IsTrue();
            target[52].IsTrue();
        }
Пример #7
0
        public void VerifyPrimalView()
        {
            var src  = UInt64.MaxValue;
            var len  = sizeof(ulong);
            var view = BitView.ViewBits(ref src);

            for (var i = 0; i < len; i++)
            {
                for (byte j = 0; j < 8; j++)
                {
                    view[i, j] = j % 2 == 0;
                }
            }

            var bs = src.ToBitString();

            for (var i = 0; i < len * 8; i++)
            {
                Claim.yea(bs[i] == (i % 2 == 0));
            }
        }
Пример #8
0
        void ReleaseDesignerOutlets()
        {
            if (BitView != null)
            {
                BitView.Dispose();
                BitView = null;
            }

            if (ClearButton != null)
            {
                ClearButton.Dispose();
                ClearButton = null;
            }

            if (CS_Label != null)
            {
                CS_Label.Dispose();
                CS_Label = null;
            }

            if (Input1Binary != null)
            {
                Input1Binary.Dispose();
                Input1Binary = null;
            }

            if (Input2Binary != null)
            {
                Input2Binary.Dispose();
                Input2Binary = null;
            }

            if (InputLabel1 != null)
            {
                InputLabel1.Dispose();
                InputLabel1 = null;
            }

            if (InputNumber2 != null)
            {
                InputNumber2.Dispose();
                InputNumber2 = null;
            }

            if (InputTextbox1 != null)
            {
                InputTextbox1.Dispose();
                InputTextbox1 = null;
            }

            if (InputTextbox2 != null)
            {
                InputTextbox2.Dispose();
                InputTextbox2 = null;
            }

            if (Results != null)
            {
                Results.Dispose();
                Results = null;
            }

            if (ResultsTextbox != null)
            {
                ResultsTextbox.Dispose();
                ResultsTextbox = null;
            }

            if (SegementedControl != null)
            {
                SegementedControl.Dispose();
                SegementedControl = null;
            }

            if (TypeLabel != null)
            {
                TypeLabel.Dispose();
                TypeLabel = null;
            }
        }