From 44d3aec9a69b0310071bfc0bf1ca65c1c2be1621 Mon Sep 17 00:00:00 2001 From: Oliver Booth Date: Thu, 14 Nov 2024 16:15:37 +0000 Subject: [PATCH] fix: revert c7e78f5d195e0209871515c5332af2e1382f8cec --- CHANGELOG.md | 2 -- X10D/src/Math/BinaryIntegerExtensions.cs | 6 +++--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1564404..851973c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,8 +9,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed -- X1OD: `IBinaryInteger.Factorial` now starts at `IBinaryInteger.MultiplicativeIdentity` not -`IBinaryInteger.One`. - X10D: Removed `IEnumerable.GreatestCommonFactor` for all integer types in favour of generic math. - X10D: Removed `IEnumerable.LowestCommonMultiple` for all integer types in favour of generic math. - X10D: Removed `IEnumerable.Product` for all integer types in favour of generic math. diff --git a/X10D/src/Math/BinaryIntegerExtensions.cs b/X10D/src/Math/BinaryIntegerExtensions.cs index b24fe87..08d76fd 100644 --- a/X10D/src/Math/BinaryIntegerExtensions.cs +++ b/X10D/src/Math/BinaryIntegerExtensions.cs @@ -69,12 +69,12 @@ public static class BinaryIntegerExtensions return 1; } - TInteger result = TInteger.MultiplicativeIdentity; + long result = 1L; for (TInteger i = TInteger.One; i <= value; i++) { - result *= i; + result *= long.CreateChecked(i); } - return long.CreateChecked(result); + return result; } }