From 74e5005ec518fec6ae59fa0ad688bd0715b54e53 Mon Sep 17 00:00:00 2001 From: Camille Date: Tue, 16 Dec 2025 20:59:18 +0100 Subject: [PATCH] replaced test of 25! with test of 18! rationale: 18! is the largest factorial less than 2^53-1 (the precision of a double). When testing 25!, there could be rounding errors when the implemented solution was different from the solution provided by TOP, which resulted in the test to fail despite having a correct algorithm. Testing with 18! instead of 25! ensures that there will be no such fail. --- computer_science/recursion/1_factorial/factorial.spec.js | 4 ++-- .../recursion/1_factorial/solution/factorial-solution.spec.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/computer_science/recursion/1_factorial/factorial.spec.js b/computer_science/recursion/1_factorial/factorial.spec.js index 4250d5d9500..f2d8f3b01c9 100644 --- a/computer_science/recursion/1_factorial/factorial.spec.js +++ b/computer_science/recursion/1_factorial/factorial.spec.js @@ -13,8 +13,8 @@ describe('factorial', () => { test.skip('15th factorial number is 1307674368000', () => { expect(factorial(15)).toBe(1307674368000); }); - test.skip('25th factorial number is 1.5511210043330986e+25', () => { - expect(factorial(25)).toBe(1.5511210043330986e+25); + test.skip('18th factorial number is 6.402373705728e+15', () => { + expect(factorial(18)).toBe(6.402373705728e15) }); test.skip('0th factorial number is 1', () => { expect(factorial(0)).toBe(1); diff --git a/computer_science/recursion/1_factorial/solution/factorial-solution.spec.js b/computer_science/recursion/1_factorial/solution/factorial-solution.spec.js index 7532f54c990..9ba416cb62f 100644 --- a/computer_science/recursion/1_factorial/solution/factorial-solution.spec.js +++ b/computer_science/recursion/1_factorial/solution/factorial-solution.spec.js @@ -13,8 +13,8 @@ describe('factorial', () => { test('15th factorial number is 1307674368000', () => { expect(factorial(15)).toBe(1307674368000); }); - test('25th factorial number is 1.5511210043330986e+25', () => { - expect(factorial(25)).toBe(1.5511210043330986e+25); + test('18th factorial number is 6.402373705728e+15', () => { + expect(factorial(18)).toBe(6.402373705728e15) }); test('0th factorial number is 1', () => { expect(factorial(0)).toBe(1);