コード例 #1
0
        private void DivideByScalar()
        {
            float[] a = new[]
            {
                1f,
                0f,
                10000f,
                2000f,
                1234f,
                9999f,
                12340f,
                678.234f,
            };

            float b = 1234f;

            float[] r = new[]
            {
                0.000810372771f,
                0f,
                8.10372771f,
                1.62074554f,
                1f,
                8.10291734f,
                10f,
                0.549622366f,
            };

            Span <float> s = stackalloc float[r.Length];

            NumericsHelpers.Divide(a, b, s);

            EqualsApprox(r, s);
        }
コード例 #2
0
        private void Divide()
        {
            float[] a = new[]
            {
                1f,
                0f,
                1f,
                2f,
                100f,
                0.1f,
                1234f,
                678.234f,
            };

            float[] b = new[]
            {
                1f,
                1f,
                2f,
                2f,
                10f,
                1f,
                4321f,
                567.123f,
            };

            float[] r = new[]
            {
                1f,
                0f,
                0.5f,
                1f,
                10f,
                0.1f,
                0.285582041f,
                1.19592046f,
            };

            Span <float> s = stackalloc float[r.Length];

            NumericsHelpers.Divide(a, b, s);

            EqualsApprox(r, s);
        }