[bug #45481] rem and fmod may give very wrong results for large arguments

<[email protected]>
Newsgroups gmane.comp.gnu.octave.bugs
Message-ID <[email protected]>
Please use the bug tracker to post updates to a bug report.  The mailing list is intended as a read-only notification stream.  Info posted to this mailing list address won't appear in the tracker database where it is most useful.

Follow-up Comment #6, bug #45481 (group octave):

Use Chinese remainder theorem.

mod (a ^ n, b) is same as mod (mod (a, b) ^ n, b).

r = mod (a, b);
for d = 2 : n
    r = mod (r * a, b);
end

Then r is the correct value of remainder.


    _______________________________________________________

Reply to this item at:

  <https://savannah.gnu.org/bugs/?45481>

_______________________________________________
Message sent via Savannah
https://savannah.gnu.org/
signature.asc (application/pgp-signature, 228 B)
-----BEGIN PGP SIGNATURE-----

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCaYjVtQAKCRCqLAuaBUf3
TshgAP9a5f8QVk3HgKUTewX/rqGxNeGGW50p2672HCQzqxTFhwD/QeJF5nygegs+
eoRuAZamy9C8TUomq2JsGMgYfPNWOAc=
=q8Cj
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.