"McGehee, Robert" <[EMAIL PROTECTED]> writes:

> Yes, but from ?"%%":
> "It is guaranteed that 'x == (x %% y) + y * (x %/% y)' (up to rounding
> error) ..."
> 
> (R 2.1.0)
> > x <- 1
> > y <- 0.2
> > x %% y
> [1] 0.2
> > (x %% y) + y * (x %/% y)
> [1] 1.2
> 
> Certainly 1 does not equal 1.2 as the documentation would suggest, and
> these seem like large enough numbers to not be effected by rounding
> errors or lack of precision.

Now that looks a bit odd, but it isn't universal:

> x <- 1
> y <- 0.2
> x %% y
[1] 0.2
> x %/% y
[1] 4
> (x %% y) + y * (x %/% y)
[1] 1

So what platform was that happening on?

-- 
   O__  ---- Peter Dalgaard             Blegdamsvej 3  
  c/ /'_ --- Dept. of Biostatistics     2200 Cph. N   
 (*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - ([EMAIL PROTECTED])             FAX: (+45) 35327907

______________________________________________
R-devel@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to