[R] modulo operation

"José M. Blanco Moreno" jmblanco at ub.edu
Thu Sep 9 13:41:51 CEST 2010


  Dear R-users,
May be there is something that I am not understanding, missed or else...
Why do these operations yield these results?
 > 25%/%0.2
[1] 124
 > 25%%0.2
[1] 0.2

I would expect (although I know that what I do expect and what is really 
intended in the code may be different things)
 > 25/0.2
[1] 125
 > 25 - floor(25/0.25)*0.25
[1] 0

(At least this second one is what I would expect from the code in 
arithmetic.c, lines 168 to 178)

-- 
---------------------------------------
José M. Blanco-Moreno

Dept. de Biologia Vegetal (Botànica)
Facultat de Biologia
Universitat de Barcelona
Av. Diagonal 645
08028 Barcelona
SPAIN
---------------------------------------

phone: (+34) 934 039 863
fax: (+34) 934 112 842



More information about the R-help mailing list