Renamed math tools
This commit is contained in:
		
							parent
							
								
									f39064dc05
								
							
						
					
					
						commit
						36c94be6d0
					
				| @ -16,7 +16,7 @@ public sealed class ChiSquareK1<TNum> : Distribution<TNum> where TNum : IFloatin | |||||||
|     static ChiSquareK1() |     static ChiSquareK1() | ||||||
|     { |     { | ||||||
|         var twoToTheKHalf = TNum.Pow(TWO, K_HALF); |         var twoToTheKHalf = TNum.Pow(TWO, K_HALF); | ||||||
|         var gammaKHalf = FloatingPointMathTools<TNum>.Gamma(K_HALF); |         var gammaKHalf = MathToolsFloatingPoint<TNum>.Gamma(K_HALF); | ||||||
|         DIVISOR = twoToTheKHalf * gammaKHalf; |         DIVISOR = twoToTheKHalf * gammaKHalf; | ||||||
|     } |     } | ||||||
|          |          | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ public sealed class ChiSquareK10<TNum> : Distribution<TNum> where TNum : IFloati | |||||||
|     static ChiSquareK10() |     static ChiSquareK10() | ||||||
|     { |     { | ||||||
|         var twoToTheKHalf = TNum.Pow(TWO, K_HALF); |         var twoToTheKHalf = TNum.Pow(TWO, K_HALF); | ||||||
|         var gammaKHalf = FloatingPointMathTools<TNum>.Gamma(K_HALF); |         var gammaKHalf = MathToolsFloatingPoint<TNum>.Gamma(K_HALF); | ||||||
|         DIVISOR = twoToTheKHalf * gammaKHalf; |         DIVISOR = twoToTheKHalf * gammaKHalf; | ||||||
|     } |     } | ||||||
|          |          | ||||||
|  | |||||||
| @ -16,7 +16,7 @@ public sealed class ChiSquareK4<TNum> : Distribution<TNum> where TNum : IFloatin | |||||||
|     static ChiSquareK4() |     static ChiSquareK4() | ||||||
|     { |     { | ||||||
|         var twoToTheKHalf = TNum.Pow(TWO, K_HALF); |         var twoToTheKHalf = TNum.Pow(TWO, K_HALF); | ||||||
|         var gammaKHalf = FloatingPointMathTools<TNum>.Gamma(K_HALF); |         var gammaKHalf = MathToolsFloatingPoint<TNum>.Gamma(K_HALF); | ||||||
|         DIVISOR = twoToTheKHalf * gammaKHalf; |         DIVISOR = twoToTheKHalf * gammaKHalf; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -13,7 +13,7 @@ public sealed class GammaA5B15<TNum> : Distribution<TNum> where TNum : IFloating | |||||||
|          |          | ||||||
|     static GammaA5B15() |     static GammaA5B15() | ||||||
|     { |     { | ||||||
|         GAMMA_ALPHA = FloatingPointMathTools<TNum>.Gamma(ALPHA); |         GAMMA_ALPHA = MathToolsFloatingPoint<TNum>.Gamma(ALPHA); | ||||||
|         BETA_TO_THE_ALPHA = TNum.Pow(BETA, ALPHA); |         BETA_TO_THE_ALPHA = TNum.Pow(BETA, ALPHA); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -12,7 +12,7 @@ public sealed class InverseGammaA3B05<TNum> : Distribution<TNum> where TNum : IF | |||||||
|          |          | ||||||
|     static InverseGammaA3B05() |     static InverseGammaA3B05() | ||||||
|     { |     { | ||||||
|         var gammaAlpha = FloatingPointMathTools<TNum>.Gamma(ALPHA); |         var gammaAlpha = MathToolsFloatingPoint<TNum>.Gamma(ALPHA); | ||||||
|         var betaToTheAlpha = TNum.Pow(BETA, ALPHA); |         var betaToTheAlpha = TNum.Pow(BETA, ALPHA); | ||||||
|              |              | ||||||
|         FACTOR_LEFT = CONSTANT * (betaToTheAlpha / gammaAlpha); |         FACTOR_LEFT = CONSTANT * (betaToTheAlpha / gammaAlpha); | ||||||
|  | |||||||
| @ -17,8 +17,8 @@ public sealed class StudentTNu1<TNum> : Distribution<TNum> where TNum : IFloatin | |||||||
|          |          | ||||||
|     static StudentTNu1() |     static StudentTNu1() | ||||||
|     { |     { | ||||||
|         DIVIDEND = FloatingPointMathTools<TNum>.Gamma((NU + TNum.One) * HALF); |         DIVIDEND = MathToolsFloatingPoint<TNum>.Gamma((NU + TNum.One) * HALF); | ||||||
|         DIVISOR = TNum.Sqrt(NU * TNum.Pi) * FloatingPointMathTools<TNum>.Gamma(NU * HALF); |         DIVISOR = TNum.Sqrt(NU * TNum.Pi) * MathToolsFloatingPoint<TNum>.Gamma(NU * HALF); | ||||||
|         EXPONENT = -((NU +  TNum.One) * HALF); |         EXPONENT = -((NU +  TNum.One) * HALF); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ namespace FastRng; | |||||||
| /// <summary> | /// <summary> | ||||||
| /// Provides some mathematical function, which are not available within in .NET itself. | /// Provides some mathematical function, which are not available within in .NET itself. | ||||||
| /// </summary> | /// </summary> | ||||||
| public static class FloatingPointMathTools<TNum> where TNum : IFloatingPointIeee754<TNum>, IAdditionOperators<TNum, TNum, TNum> | public static class MathToolsFloatingPoint<TNum> where TNum : IFloatingPointIeee754<TNum>, IAdditionOperators<TNum, TNum, TNum> | ||||||
| { | { | ||||||
|     private static readonly TNum SQRT_2 = TNum.Sqrt(TNum.One + TNum.One); |     private static readonly TNum SQRT_2 = TNum.Sqrt(TNum.One + TNum.One); | ||||||
|     private static readonly TNum SQRT_PI = TNum.Sqrt(TNum.Pi); |     private static readonly TNum SQRT_PI = TNum.Sqrt(TNum.Pi); | ||||||
|  | |||||||
| @ -5,7 +5,7 @@ namespace FastRng; | |||||||
| /// <summary> | /// <summary> | ||||||
| /// Provides some mathematical function, which are not available within in .NET itself. | /// Provides some mathematical function, which are not available within in .NET itself. | ||||||
| /// </summary> | /// </summary> | ||||||
| public static class IntegerMathTools | public static class MathToolsInteger | ||||||
| { | { | ||||||
|     /// <summary> |     /// <summary> | ||||||
|     /// The mathematical factorial function for integer numbers. |     /// The mathematical factorial function for integer numbers. | ||||||
| @ -15,7 +15,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void GammaTest01() |     public void GammaTest01() | ||||||
|     { |     { | ||||||
|         Assert.That(FloatingPointMathTools<float>.Gamma(-0.5f), Is.EqualTo(-3.544907701811087f).Within(1e-6f)); |         Assert.That(MathToolsFloatingPoint<float>.Gamma(-0.5f), Is.EqualTo(-3.544907701811087f).Within(1e-6f)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -23,7 +23,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void GammaTest02() |     public void GammaTest02() | ||||||
|     { |     { | ||||||
|         Assert.That(FloatingPointMathTools<float>.Gamma(0.1f), Is.EqualTo(9.51350975f).Within(1e-6f)); |         Assert.That(MathToolsFloatingPoint<float>.Gamma(0.1f), Is.EqualTo(9.51350975f).Within(1e-6f)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -31,7 +31,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void GammaTest03() |     public void GammaTest03() | ||||||
|     { |     { | ||||||
|         Assert.That(FloatingPointMathTools<float>.Gamma(0.5f), Is.EqualTo(1.772453850905517f).Within(1e-6f)); |         Assert.That(MathToolsFloatingPoint<float>.Gamma(0.5f), Is.EqualTo(1.772453850905517f).Within(1e-6f)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -39,7 +39,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void GammaTest04() |     public void GammaTest04() | ||||||
|     { |     { | ||||||
|         Assert.That(FloatingPointMathTools<float>.Gamma(1.0f), Is.EqualTo(1.0f).Within(1e-6f)); |         Assert.That(MathToolsFloatingPoint<float>.Gamma(1.0f), Is.EqualTo(1.0f).Within(1e-6f)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -47,7 +47,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void GammaTest05() |     public void GammaTest05() | ||||||
|     { |     { | ||||||
|         Assert.That(FloatingPointMathTools<float>.Gamma(1.5f), Is.EqualTo(0.8862269254527587f).Within(1e-6f)); |         Assert.That(MathToolsFloatingPoint<float>.Gamma(1.5f), Is.EqualTo(0.8862269254527587f).Within(1e-6f)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -55,7 +55,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void GammaTest06() |     public void GammaTest06() | ||||||
|     { |     { | ||||||
|         Assert.That(FloatingPointMathTools<float>.Gamma(2.0f), Is.EqualTo(1.0f).Within(1e-6f)); |         Assert.That(MathToolsFloatingPoint<float>.Gamma(2.0f), Is.EqualTo(1.0f).Within(1e-6f)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -63,7 +63,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void GammaTest07() |     public void GammaTest07() | ||||||
|     { |     { | ||||||
|         Assert.That(FloatingPointMathTools<float>.Gamma(3.0f), Is.EqualTo(2.0f).Within(1e-6f)); |         Assert.That(MathToolsFloatingPoint<float>.Gamma(3.0f), Is.EqualTo(2.0f).Within(1e-6f)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -71,7 +71,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void GammaTest08() |     public void GammaTest08() | ||||||
|     { |     { | ||||||
|         Assert.That(FloatingPointMathTools<float>.Gamma(10.0f), Is.EqualTo(362_880.719f).Within(1e-6f)); |         Assert.That(MathToolsFloatingPoint<float>.Gamma(10.0f), Is.EqualTo(362_880.719f).Within(1e-6f)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -79,7 +79,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void GammaTest09() |     public void GammaTest09() | ||||||
|     { |     { | ||||||
|         Assert.That(FloatingPointMathTools<float>.Gamma(140.0f), Is.EqualTo(float.NaN)); |         Assert.That(MathToolsFloatingPoint<float>.Gamma(140.0f), Is.EqualTo(float.NaN)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -87,7 +87,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void GammaTest10() |     public void GammaTest10() | ||||||
|     { |     { | ||||||
|         Assert.That(FloatingPointMathTools<float>.Gamma(170.0f), Is.EqualTo(float.NaN)); |         Assert.That(MathToolsFloatingPoint<float>.Gamma(170.0f), Is.EqualTo(float.NaN)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     #endregion |     #endregion | ||||||
| @ -99,7 +99,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger01() |     public void FactorialInteger01() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(0), Is.EqualTo(1)); |         Assert.That(MathToolsInteger.Factorial(0), Is.EqualTo(1)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -107,7 +107,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger02() |     public void FactorialInteger02() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(1), Is.EqualTo(1)); |         Assert.That(MathToolsInteger.Factorial(1), Is.EqualTo(1)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -115,7 +115,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger03() |     public void FactorialInteger03() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(2), Is.EqualTo(2)); |         Assert.That(MathToolsInteger.Factorial(2), Is.EqualTo(2)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -123,7 +123,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger04() |     public void FactorialInteger04() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(3), Is.EqualTo(6)); |         Assert.That(MathToolsInteger.Factorial(3), Is.EqualTo(6)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -131,7 +131,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger05() |     public void FactorialInteger05() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(4), Is.EqualTo(24)); |         Assert.That(MathToolsInteger.Factorial(4), Is.EqualTo(24)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -139,7 +139,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger06() |     public void FactorialInteger06() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(5), Is.EqualTo(120)); |         Assert.That(MathToolsInteger.Factorial(5), Is.EqualTo(120)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -147,7 +147,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger07() |     public void FactorialInteger07() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(6), Is.EqualTo(720)); |         Assert.That(MathToolsInteger.Factorial(6), Is.EqualTo(720)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -155,7 +155,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger08() |     public void FactorialInteger08() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(7), Is.EqualTo(5_040)); |         Assert.That(MathToolsInteger.Factorial(7), Is.EqualTo(5_040)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -163,7 +163,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger09() |     public void FactorialInteger09() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(8), Is.EqualTo(40_320)); |         Assert.That(MathToolsInteger.Factorial(8), Is.EqualTo(40_320)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -171,7 +171,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger10() |     public void FactorialInteger10() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(9), Is.EqualTo(362_880)); |         Assert.That(MathToolsInteger.Factorial(9), Is.EqualTo(362_880)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -179,7 +179,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger11() |     public void FactorialInteger11() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(10), Is.EqualTo(3_628_800)); |         Assert.That(MathToolsInteger.Factorial(10), Is.EqualTo(3_628_800)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -187,7 +187,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger12() |     public void FactorialInteger12() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(11), Is.EqualTo(39_916_800)); |         Assert.That(MathToolsInteger.Factorial(11), Is.EqualTo(39_916_800)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -195,7 +195,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger13() |     public void FactorialInteger13() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(12), Is.EqualTo(479_001_600)); |         Assert.That(MathToolsInteger.Factorial(12), Is.EqualTo(479_001_600)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -203,7 +203,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger14() |     public void FactorialInteger14() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(13), Is.EqualTo(6_227_020_800)); |         Assert.That(MathToolsInteger.Factorial(13), Is.EqualTo(6_227_020_800)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -211,7 +211,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger15() |     public void FactorialInteger15() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(14), Is.EqualTo(87_178_291_200)); |         Assert.That(MathToolsInteger.Factorial(14), Is.EqualTo(87_178_291_200)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -219,7 +219,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger16() |     public void FactorialInteger16() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(15), Is.EqualTo(1_307_674_368_000)); |         Assert.That(MathToolsInteger.Factorial(15), Is.EqualTo(1_307_674_368_000)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -227,7 +227,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger17() |     public void FactorialInteger17() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(16), Is.EqualTo(20_922_789_888_000)); |         Assert.That(MathToolsInteger.Factorial(16), Is.EqualTo(20_922_789_888_000)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -235,7 +235,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger18() |     public void FactorialInteger18() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(17), Is.EqualTo(355_687_428_096_000)); |         Assert.That(MathToolsInteger.Factorial(17), Is.EqualTo(355_687_428_096_000)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -243,7 +243,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger19() |     public void FactorialInteger19() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(18), Is.EqualTo(6_402_373_705_728_000)); |         Assert.That(MathToolsInteger.Factorial(18), Is.EqualTo(6_402_373_705_728_000)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -251,7 +251,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger20() |     public void FactorialInteger20() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(19), Is.EqualTo(121_645_100_408_832_000)); |         Assert.That(MathToolsInteger.Factorial(19), Is.EqualTo(121_645_100_408_832_000)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -259,7 +259,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger21() |     public void FactorialInteger21() | ||||||
|     { |     { | ||||||
|         Assert.That(IntegerMathTools.Factorial(20), Is.EqualTo(2_432_902_008_176_640_000)); |         Assert.That(MathToolsInteger.Factorial(20), Is.EqualTo(2_432_902_008_176_640_000)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -267,7 +267,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger22() |     public void FactorialInteger22() | ||||||
|     { |     { | ||||||
|         Assert.Throws<ArgumentOutOfRangeException>(() => IntegerMathTools.Factorial(21)); |         Assert.Throws<ArgumentOutOfRangeException>(() => MathToolsInteger.Factorial(21)); | ||||||
| 
 | 
 | ||||||
|         // Note: 21! is not possible in C# until we got 128 bit integers, since: |         // Note: 21! is not possible in C# until we got 128 bit integers, since: | ||||||
|         //       ulong.max == 18_446_744_073_709_551_615 < 51_090_942_171_709_400_000 |         //       ulong.max == 18_446_744_073_709_551_615 < 51_090_942_171_709_400_000 | ||||||
| @ -278,7 +278,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialInteger23() |     public void FactorialInteger23() | ||||||
|     { |     { | ||||||
|         Assert.Throws<ArgumentOutOfRangeException>(() => IntegerMathTools.Factorial(45_646)); |         Assert.Throws<ArgumentOutOfRangeException>(() => MathToolsInteger.Factorial(45_646)); | ||||||
| 
 | 
 | ||||||
|         // Note: 45_646! is not possible in C# since: |         // Note: 45_646! is not possible in C# since: | ||||||
|         //       ulong.max == 18_446_744_073_709_551_615 |         //       ulong.max == 18_446_744_073_709_551_615 | ||||||
| @ -293,7 +293,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialFloatingPoint01() |     public void FactorialFloatingPoint01() | ||||||
|     { |     { | ||||||
|         Assert.That(FloatingPointMathTools<float>.Factorial(0.5f), Is.EqualTo(0.886226925f).Within(1e6f)); |         Assert.That(MathToolsFloatingPoint<float>.Factorial(0.5f), Is.EqualTo(0.886226925f).Within(1e6f)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -301,7 +301,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialFloatingPoint02() |     public void FactorialFloatingPoint02() | ||||||
|     { |     { | ||||||
|         Assert.That(FloatingPointMathTools<float>.Factorial(1.5f), Is.EqualTo(1.329340388f).Within(1e6f)); |         Assert.That(MathToolsFloatingPoint<float>.Factorial(1.5f), Is.EqualTo(1.329340388f).Within(1e6f)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -309,7 +309,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialFloatingPoint03() |     public void FactorialFloatingPoint03() | ||||||
|     { |     { | ||||||
|         Assert.That(FloatingPointMathTools<float>.Factorial(-1.5f), Is.EqualTo(-1.329340388f).Within(1e6f)); |         Assert.That(MathToolsFloatingPoint<float>.Factorial(-1.5f), Is.EqualTo(-1.329340388f).Within(1e6f)); | ||||||
|     } |     } | ||||||
|          |          | ||||||
|     [Test] |     [Test] | ||||||
| @ -317,7 +317,7 @@ public class MathToolsTests | |||||||
|     [Category(TestCategories.NORMAL)] |     [Category(TestCategories.NORMAL)] | ||||||
|     public void FactorialFloatingPoint04() |     public void FactorialFloatingPoint04() | ||||||
|     { |     { | ||||||
|         Assert.That(FloatingPointMathTools<float>.Factorial(7.5f), Is.EqualTo(14_034.407293483f).Within(1e6f)); |         Assert.That(MathToolsFloatingPoint<float>.Factorial(7.5f), Is.EqualTo(14_034.407293483f).Within(1e6f)); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     #endregion |     #endregion | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user