Skip to content

Commit 638dbd4

Browse files
committed
Updated isProperFraction.
1 parent 8e6a64c commit 638dbd4

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Sprint-3/1-implement-and-rewrite-tests/implement/2-is-proper-fraction.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ function isProperFraction(numerator, denominator) {
1616
return false;
1717
}
1818
let fraction = numerator / denominator;
19-
return fraction > 0 && fraction < 1;
19+
return Math.abs(fraction) < 1 && fraction !== 0;
2020
}
2121

2222
// The line below allows us to load the isProperFraction function into tests in other files.
@@ -46,10 +46,10 @@ assertEquals(isProperFraction(2, 2), false);
4646
// Example: denominator is 0,not a proper fraction.
4747
assertEquals(isProperFraction(5, 0), false);
4848

49-
// Example: numerator is negative, not a proper fraction.
50-
assertEquals(isProperFraction(-1, 2), false);
49+
// Example: numerator is negative,is a proper fraction.
50+
assertEquals(isProperFraction(-1, 2), true);
5151

52-
// Example: denominator is negative,not a proper fraction.
52+
// Example: denominator is smaller than numerator,not a proper fraction.
5353
assertEquals(isProperFraction(4, -3), false);
5454

5555
// Example: numerator and denominator are both negative values is a proper fraction.

0 commit comments

Comments
 (0)