[Cuis-dev] Bug in Integer>>#raisedTo:modulo:

Luciano Notarfrancesco luchiano at gmail.com
Mon Jun 5 09:55:57 PDT 2023


Doing
    pow := pow * pow \\ m
instead of
    pow := pow * pow \\\ m
at the beginning of the loop in Integer>>#slidingLeftRightRaisedTo:modulo:
seems to fix it. But still I’m not sure why it is random otherwise, and I’m
not sure that this really fixes the problem.


On Mon, 5 Jun 2023 at 18:42 Luciano Notarfrancesco <luchiano at gmail.com>
wrote:

> The following:
>     5445648384 raisedTo: 3 modulo: 1 << 34
> Returns 0, which is right. But
>     5445648384 raisedTo: 4 modulo: 1 << 34
> Returns different numbers every time I call it (it should return 0).
> It’s very weird… I don’t see where the randomness is coming from, perhaps
> from LargeIntegerPlugin?
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cuis.st/mailman/archives/cuis-dev/attachments/20230605/cc9d45fe/attachment.htm>


More information about the Cuis-dev mailing list