20170524, 09:06  #1 
"Mihai Preda"
Apr 2015
2×23×29 Posts 
Correct way to compute the 64bit residue
Hi, I would like to ask for confirmation about the correct way to compute the residue.
Let's consider this simplified example: N words. bitsperword == 10 everywhere. In nonbalanced representation ("wnb"), word values are 0 everywhere except: wnb[N2] == 1023 wnb[N1] == 1023 In balanced representation ("wb"), this becomes 0 everywhere except: wb[N2] == 1 wb[N1] == 0 wb[0] == 1. In this situation, should the 64bit residue be 1 or 0? Thanks! 
20170524, 09:20  #2  
(loop (#_fork))
Feb 2006
Cambridge, England
6,379 Posts 
Quote:


20170524, 10:11  #3 
"Mihai Preda"
Apr 2015
2×23×29 Posts 

20170524, 21:22  #4  
∂^{2}ω=0
Sep 2002
República de California
10110101000000_{2} Posts 
Quote:
/* If mostsignificant digit in the balancedrepresentation form is < 0, add the modulus to the residue. For Mersenne (2^p1) and Fermat (2^p+1) moduli, can combine this with the normalizetononnegativedigit step (which we do in any event) by simply initializing the carry into the latter to 1 or +1, respectively: */ Once the carry has been set thusly, we feed it into an upward loop starting from the low residue word, which does several things at once: o Onthefly normalizes each word to nonnegativedigit representation (taking account of the IBDWT's variable wordsize, obviously); o propagates the resulting carries upward; o counts #bits accumulated and exits when this is >+ 64. In your example, loop 1 would set cy = 1, which would cancel the lowword 1 in the first pass of loop 2, yielding 0. 

20170524, 21:57  #5 
"Mihai Preda"
Apr 2015
10100110110_{2} Posts 
Yes, everything is clear now, thank you!

Thread Tools  
Similar Threads  
Thread  Thread Starter  Forum  Replies  Last Post 
CudaLucas correct config  jpalo  GPU Computing  8  20170806 15:35 
How to manually correct CPU GHz in prime net  laich2  PrimeNet  6  20120116 04:51 
Are these commands correct?  jasong  Linux  2  20071018 23:40 
correct me.  Washuu  Math  3  20050525 09:04 
ARE THE ODDS CORRECT..Please help  lpmurray  Lounge  4  20050209 10:38 