octave-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Octave-bug-tracker] [bug #61300] primes() is 4 times slower for integer


From: Arun Giridhar
Subject: [Octave-bug-tracker] [bug #61300] primes() is 4 times slower for integer types than for double, patch attached
Date: Wed, 6 Oct 2021 13:37:34 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:93.0) Gecko/20100101 Firefox/93.0

Follow-up Comment #5, bug #61300 (project octave):

Note: depending on input value n, sometimes the output of primes(n) can exceed
n because of the range violation:


>> n = double(1.5e9); p = primes(n); p(end-5:end)
ans =
     1499999909     1499999927     1499999929     1499999933     1499999951   
 1499999957

>> n = uint64(1.5e9); p = primes(n); p(end-5:end)
ans =
  1499999927  1499999929  1499999933  1499999951  1499999957  1500000001


That last value 1500000001 is more than n.

    _______________________________________________________

Reply to this item at:

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

_______________________________________________
  Message sent via Savannah
  https://savannah.gnu.org/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]