similar to: Integer bit size and the modulus operator

Displaying 20 results from an estimated 10000 matches similar to: "Integer bit size and the modulus operator"

2006 Jan 30
2
[R] Integer bit size and the modulus operator (PR#8541)
On 1/30/2006 1:39 PM, Ionut Florescu wrote: > Thank you for the quick reply, I will look into the R packages. > For crashing R try this: > > generator.zp=function(x,p) > {a=1:(p-1); b=x^a%%p; > if(all(b[1:(p-2)]!=1)&&(b[p-1]==1)){return(x, " Good ")} > else{return(x, " No Good, try another integer ")} > } Thanks, I can reproduce the crash using
2006 Jan 30
5
Help! What does this R command mean?
Hi all, R is so difficult. I am so desperate. What does the ":" mean in the following statement? What does the "[, -1]" mean? > > # Leaps takes a design matrix as argument: throw away the intercept > # column or leaps will complain > > X <- model.matrix(lm(V ~ I + D + W +G:I + P + N, election.table))[,-1] Thanks a lot! [[alternative HTML version
2006 Jan 30
5
Help! What does this R command mean?
Hi all, R is so difficult. I am so desperate. What does the ":" mean in the following statement? What does the "[, -1]" mean? > > # Leaps takes a design matrix as argument: throw away the intercept > # column or leaps will complain > > X <- model.matrix(lm(V ~ I + D + W +G:I + P + N, election.table))[,-1] Thanks a lot! [[alternative HTML version
2005 May 11
7
bug in modulus operator %% (PR#7852)
The following can't be right, first rw2010: > 1 %% 0.001 [1] 0.001 Then rw2001: > 1 %% 0.001 [1] -2.081668e-17 > and the last seems about right. -- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra -- No virus found in this outgoing message. Checked by AVG Anti-Virus.
2009 Nov 27
2
Modular inverses
I want to find the inverse of an integer k mod p (prime.) Is there a function that can do this for me? I know i could simply write (k^(p-2)) %% p, but i need to do this for large primes (above 100) and this gives the warning message: Warning message: probable complete loss of accuracy in modulus so this method does not work. Any ideas? Thanks, Samuel --
2001 Apr 28
2
Modulus operator??
I'm trying to do a modulus operator in R-1.2.2 on Windows -- specific version: R : Copyright 2001, The R Development Core Team Version 1.2.2 Patched (2001-03-22) Here's what the R language manual says: "R contains a number of operators. They are listed in the table below. [snip] % Modulus, binary" Here's what happens on the R console: > records <- 100000 >
2003 May 19
4
modulus operator?
Is there a modulus operator in R? Anna
2012 Feb 04
3
the ^ and % operators in context
The % is modulus (remainder) operator and ^ is bitwise. In this context, we take a file, and go through each character and encrypt it. But why are the ^ and % operators used here: def encrypt(reader, writer) key_index = 0 while not reader.eof? clear_char = reader.getc encrypted_char = clear_char ^ @key[key_index] writer.putc(encrypted_char) key_index = (key_index +
2001 Apr 28
1
modulus operator gets syntax error (PR#925)
Full_Name: M. Edward Borasky Version: 1.2.2 OS: both Windows 2000 and Red Hat Linux 7.1 Submission from: (NULL) (208.130.245.188) According to the R language manual, "%" is the modulus operator. However, on both Windows and Linux, I get a syntax error when I type records <- 100000 records % 1000 I tried wrapping the operands with "as.integer ()" but that didn't help
2008 Nov 03
1
How to calculate modulus of complex number
suppose I have following complex number : a = -0.0475983+0.5364486i This number I got as an eigen value of a matrix. Now I would like to calculate the Modulus of this complex number. Is there any function for doing that? Regards, -- View this message in context: http://www.nabble.com/How-to-calculate-modulus-of-complex-number-tp20308154p20308154.html Sent from the R help mailing list archive
2009 Apr 17
3
Modular Arithmetic Error?
Hi, I'm using the '%%' operator in some code, and am running into the following erroneous outcome: > 1.2 %% 0.2 [1] 0.2 Unless I'm very mistaken, the result should be 0 (indeed, 12 %% 2 does result in 0). Furthermore: > 1.20000000000000001 %% 0.2 [1] 0.2 > (1.2+1e17) %% .2 [1] 0 Warning message: probable complete loss of accuracy in modulus (Warning
2004 Dec 08
2
Modulus Problem
R users, I am having a problem with the modulus operator for large numbers as follows, a <- 2 n <- 561 ## n is the first Carmichael number, so by Fermat's Little Theorem the below should equal zero. (a^(n-1) - 1) %% n [1] 2.193172e+152 ## Seems that R and Fermat disagree ## Also, 1000000000000000000 %% 11 [1] -32 This seems like a bug. Should I be avoiding integer math for large
2011 Nov 03
2
[PATCH 4 of 5] virtio: avoid modulus operation
Since we know vq->vring.num is a power of 2, modulus is lazy (it's asserted in vring_new_virtqueue()). Signed-off-by: Rusty Russell <rusty at rustcorp.com.au> --- drivers/virtio/virtio_ring.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c @@
2011 Nov 03
2
[PATCH 4 of 5] virtio: avoid modulus operation
Since we know vq->vring.num is a power of 2, modulus is lazy (it's asserted in vring_new_virtqueue()). Signed-off-by: Rusty Russell <rusty at rustcorp.com.au> --- drivers/virtio/virtio_ring.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c @@
2000 Jul 06
1
factorial(), modulus()
Dear R friends, I was wondering if there were factorial and modulus functions out there that I've somehow overlooked? -P. -- Peter L. Hurd, Ph.D. phurd at uts.cc.utexas.edu http://www.zo.utexas.edu/research/phurd fax 512.471-3878 Section of Integrative Biology, University of Texas, Austin TX 78712 USA
2017 Sep 25
4
DH Group Exchange Fallback
On 25 September 2017 at 02:32, Mark D. Baushke <mdb at juniper.net> wrote: > [+CC Loganaden Velvindron <logan at hackers.mu>] primary author of > the RFC 4419 refresh draft. https://datatracker.ietf.org/doc/draft-lvelvindron-curdle-dh-group-exchange/ ? Tangent: has any consideration been given to increasing the maximum allowed beyond 8192 bits (which is below the current NIST
2013 Jul 13
2
missing PROTECT() in src/main/arithmetic.c
at lines 651 & 653 (integer_binary function): if (code == DIVOP || code == POWOP) ans = allocVector(REALSXP, n); else ans = allocVector(INTSXP, n); There are calls to warningcall() later in the function, which can trigger garbbage collection. Looks like the typical scenario where it seemed pretty safe to not PROTECT in the original version of the function but
2003 May 19
0
FW: modulus operator?
try "%%" as the modulus operator and "%/%" for integer division eg 5%%2 equals 1 John Marsland > > -----Original Message----- > > From: Anna H. Pryor [mailto:anna at ptolemy.arc.nasa.gov] > > Sent: 19 May 2003 16:56 > > To: R Help > > Subject: [R] modulus operator? > > > > > > > > Is there a modulus operator in R?
2001 Nov 24
2
Authenticating the rsync server
Scenario: I have a main website. I want to allow other people with web servers to use rsync to synchronize mirror copies of my website. When the mirror website uses rsync to connect to the server, how can it be sure that the server is not an IP spoofing impostor that is serving up altered files?
2004 Dec 09
1
Modulus Bug (PR#7409)
R Developers, 1000000000000000000 %% 11 [1] -32 I now understand that integers cannot be larger than .Machine$integer.max, but because the above produces a result than is patently wrong instead of an error, I'm reporting this as a bug. Thank you for the incredible contributions all of you have made in developing the R platform. Best, Robert Robert McGehee Geode Capital Management, LLC 53