diff --git a/X10D.Tests/src/Math/MathUtilityTests.cs b/X10D.Tests/src/Math/MathUtilityTests.cs
index 9a3fc92..97b27c8 100644
--- a/X10D.Tests/src/Math/MathUtilityTests.cs
+++ b/X10D.Tests/src/Math/MathUtilityTests.cs
@@ -83,4 +83,18 @@ public class MathUtilityTests
Assert.AreEqual(1.0, doubleResult);
Assert.AreEqual(1.0f, floatResult);
}
+
+ [TestMethod]
+ public void ScaleRangeDouble_ShouldScaleRange_GivenItsValues()
+ {
+ double result = MathUtility.ScaleRange(0.5, 0.0, 1.0, 5.0, 10.0);
+ Assert.AreEqual(7.5, result);
+ }
+
+ [TestMethod]
+ public void ScaleRangeSingle_ShouldScaleRange_GivenItsValues()
+ {
+ float result = MathUtility.ScaleRange(0.5f, 0.0f, 1.0f, 5.0f, 10.0f);
+ Assert.AreEqual(7.5f, result);
+ }
}
diff --git a/X10D/src/Math/MathUtility.cs b/X10D/src/Math/MathUtility.cs
index ad14d7b..561157c 100644
--- a/X10D/src/Math/MathUtility.cs
+++ b/X10D/src/Math/MathUtility.cs
@@ -244,6 +244,12 @@ public static class MathUtility
/// The new minimum value.
/// The new maximum value.
/// The scaled value.
+ [Pure]
+#if NETSTANDARD2_1
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+#else
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+#endif
public static float ScaleRange(float value, float oldMin, float oldMax, float newMin, float newMax)
{
float oldRange = oldMax - oldMin;
@@ -261,6 +267,12 @@ public static class MathUtility
/// The new minimum value.
/// The new maximum value.
/// The scaled value.
+ [Pure]
+#if NETSTANDARD2_1
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+#else
+ [MethodImpl(MethodImplOptions.AggressiveInlining | MethodImplOptions.AggressiveOptimization)]
+#endif
public static double ScaleRange(double value, double oldMin, double oldMax, double newMin, double newMax)
{
double oldRange = oldMax - oldMin;