Esempio n. 1
0
        public void Vector2DotTest2()
        {
            Vector2 a = new Vector2(Single.MinValue, Single.MinValue);
            Vector2 b = new Vector2(Single.MaxValue, Single.MaxValue);

            Single actual = Vector2.Dot(a, b);

            Assert.True(Single.IsNegativeInfinity(actual), "Vector2f.Dot did not return the expected value.");
        }
Esempio n. 2
0
        public void Vector2DotTest1()
        {
            Vector2 a = new Vector2(1.55f, 1.55f);
            Vector2 b = new Vector2(-1.55f, 1.55f);

            Single expected = 0.0f;
            Single actual   = Vector2.Dot(a, b);

            Assert.Equal(expected, actual);
        }
Esempio n. 3
0
        public void Vector2DotTest()
        {
            Vector2 a = new Vector2(1.0f, 2.0f);
            Vector2 b = new Vector2(3.0f, 4.0f);

            Single expected = 11.0f;
            Single actual;

            actual = Vector2.Dot(a, b);
            Assert.True(MathHelper.Equal(expected, actual), "Vector2f.Dot did not return the expected value.");
        }
Esempio n. 4
0
        public static Single DotJitOptimizeCanaryTest()
        {
            Single result = 0.0f;
            var    value  = VectorTests.Vector2Value;

            for (var iteration = 0; iteration < Benchmark.InnerIterationCount; iteration++)
            {
                value  += VectorTests.Vector2Delta;
                result += Vector2.Dot(value, VectorTests.Vector2ValueInverted);
            }

            return(result);
        }
Esempio n. 5
0
        public static Single DotTest()
        {
            Single result = 0.0f;

            for (var iteration = 0; iteration < Benchmark.InnerIterationCount; iteration++)
            {
                // The inputs aren't being changed and the output is being reset with each iteration, so a future
                // optimization could potentially throw away everything except for the final call. This would break
                // the perf test. The JitOptimizeCanary code below does modify the inputs and consume each output.
                result = Vector2.Dot(VectorTests.Vector2Value, VectorTests.Vector2ValueInverted);
            }

            return(result);
        }