Fast remainder
|
05-10-2021, 02:44 PM
(This post was last modified: 08-20-2021 10:56 PM by Albert Chan.)
Post: #2
|
|||
|
|||
RE: Fast remainder
With better digit buckets, we improved n=60 timing, from 58 to 16 sec.
Here is the reason the better bucket work. Time savings is directly related to the much reduced search cases. Original version, using gcd(n, d) buckets, required 529,631,194 recursive calls. Updated version, with gcd(2n,d) buckets, required 148,843,222 recursive calls. 148843222 / 529631194 ≈ 28% → 58 * 28% = 16 sec (as expected) Code: #include <stdio.h> Update1: fixed fastmod domain problem (see previous post) Update2: unroll loop 1 time (but, 2 fastmod per loop), n=60 timing at 14.5 sec (1.5 sec saving) |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Fast remainder - Albert Chan - 05-09-2021, 08:48 PM
RE: Fast remainder - Albert Chan - 05-10-2021 02:44 PM
RE: Fast remainder - Albert Chan - 05-12-2021, 12:05 AM
RE: Fast remainder - Albert Chan - 05-12-2021, 03:10 PM
RE: Fast remainder - Albert Chan - 05-12-2021, 11:03 PM
RE: Fast remainder - Albert Chan - 05-12-2021, 04:12 PM
RE: Fast remainder - Albert Chan - 05-14-2021, 06:15 PM
|
User(s) browsing this thread: 1 Guest(s)