compute-io/lcm

Incorrect lcm result

Closed this issue · 5 comments

I recently ran into a case where lcm was returning the incorrect result. The numbers 186028, 193052 and 144624, as computed by:

const lcm = require('compute-lcm');
console.log(lcm(186028, 193052, 144624));

reports the result 108206102374928, however the correct answer is 324618307124784.

@sgerace Thanks for reporting. Was able to reproduce. Seems to stem from a bug in the gcd implementation.

A patch submitted against gcd should resolve the issue.

This bug is not present in the stdlib implementation.

We will, however, push a patch to gcd.

This was fixed in gcd. @sgerace Can you reinstall your node_modules dependencies and confirm that the issue is resolved?

The gcd dep version has been updated, a test case added, and a new version published. Closing as resolved.

Thank you, @sgerace, for reporting and @Planeshifter for fixing.

Hi @kgryte, thanks for the quick response. I can confirm that the issue has been fixed in 1.1.2.