Skip to content

Commit

Permalink
bugfix lcm
Browse files Browse the repository at this point in the history
  • Loading branch information
yaxu committed Jun 18, 2024
1 parent 0d1c3c9 commit 9f0e128
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/fraction.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,10 @@ export const lcm = (...fractions) => {
if (fractions.length === 0) {
return undefined;
}

const x = fractions.pop();
return fractions.reduce(
(lcm, fraction) => (lcm === undefined || fraction === undefined ? undefined : lcm.lcm(fraction)),
fraction(1),
x,
);
};

Expand Down

0 comments on commit 9f0e128

Please sign in to comment.