Пример #1
0
        private void SubByScalar()
        {
            float[] a = new[]
            {
                1f,
                0f,
                15f,
                2f,
                100f,
                0.1f,
                1234f,
                678.234f,
            };

            const float b = 100f;

            float[] r = new[]
            {
                -99f,
                -100f,
                -85f,
                -98f,
                0f,
                -99.9f,
                1134f,
                578.234f,
            };

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

            NumericsHelpers.Sub(a, b, s);

            EqualsApprox(r, s);
        }
Пример #2
0
        private void Sub()
        {
            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[]
            {
                0f,
                -1f,
                -1f,
                0f,
                90f,
                -0.9f,
                -3087f,
                111.11100f,
            };

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

            NumericsHelpers.Sub(a, b, s);

            EqualsApprox(r, s);
        }