[bug #68459] Optimize "__isprimelarge__.cc" on systems with native 128-bit arithmetics

"Dmitri A. Sergatskov" <[email protected]> Thu, 18 Jun 2026 16:29:42 -0400 (EDT)
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.

URL:
  <https://savannah.gnu.org/bugs/?68459>

                 Summary: Optimize "__isprimelarge__.cc" on systems with
native 128-bit arithmetics
                   Group: GNU Octave
               Submitter: dasergatskov
               Submitted: Thu 18 Jun 2026 08:29:39 PM UTC
                Category: Octave Function
                Severity: 3 - Normal
                Priority: 5 - Normal
              Item Group: Performance
                  Status: None
             Assigned to: None
         Originator Name:
        Originator Email:
             Open/Closed: Open
         Discussion Lock: Unlocked
                 Release: dev
        Operating System: Any
           Fixed Release: None
         Planned Release: None


    _______________________________________________________

Follow-up Comments:


-------------------------------------------------------
Date: Thu 18 Jun 2026 08:29:39 PM UTC By: Dmitri A. Sergatskov <dasergatskov>
On most 64-bit systems gcc and clang (and, I assume, its derivatives like
Intel compiler) support wide integer type (int128). On those systems it is
possible to optimize "__isprimelarge__.cc" by doing "mod (a*b, modulus)"
without overflow.

I will post CSET shortly.

Dmitri.
-- 








    _______________________________________________________

Reply to this item at:

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

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

iHUEABYIAB0WIQQk97aszIMMAvLLwm6qLAuaBUf3TgUCajRVNgAKCRCqLAuaBUf3
Tt8KAP4s3JWGP8bwpVK00kfIOERXRPqS5HWEcjeJNW7vjAUV3wD/bqsZHode/wYa
69tMh7spAMEgxamd6aXxoIsCiia2ZAU=
=OYDZ
-----END PGP SIGNATURE-----