[Cuis-dev] Integer>>lcm:

Luciano Notarfrancesco luchiano at gmail.com
Thu Jun 27 03:57:06 PDT 2019


Integer>>lcm: was defined in such a way that it could return negative
numbers. Also '0 lcm: 0' produced division by zero.

The least common multiple is unique "up to units", so to make it unique you
have to do a consistent choice of associate (negative or positive). For
integers it is customary to define LCM(a,b) to be 0 if a=0 or b=0, and
strictly positive otherwise. This is how it is defined in Magma, GAP and
GMP, etc, and this change set fixes Integer>>lcm: to behave like that.

I also attach some tests for Integer>>gcd: and Integer>>lcm:.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20190627/2e64d8dc/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Integer-lcm.st
Type: application/vnd.sailingtracker.track
Size: 510 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20190627/2e64d8dc/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: GCDAndLCMTests.cs
Type: application/octet-stream
Size: 5257 bytes
Desc: not available
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20190627/2e64d8dc/attachment.obj>


More information about the Cuis-dev mailing list