Hi Benjamin,
Thanks for pointing that out.
Sorry, didn't read the question carefully.
(0.1%%1)-0.1
#[1] 0
?(1.1%%1)-0.1
#[1] 8.326673e-17
(1%%1.1)
#[1] 1
A.K.
________________________________
From: Benjamin <hess.bn at gmail.com>
To: arun <smartpink111 at yahoo.com>
Sent: Tuesday, June 18, 2013 11:33 AM
Subject: Re: [R] Problem with the mod function %%
Hi, Arun.
I think you have an order of operations problem. ?Try parentheses around 1.1%%1.
Best,
Benjamin
On Tue, Jun 18, 2013 at 10:23 AM, arun <smartpink111 at yahoo.com> wrote:
Hi,>Possibly, R FAQ: 7.31
>http://www.hep.by/gnu/r-patched/r-faq/R-FAQ_82.html
>
>(1.1%%1)-0.1
>#[1] 8.326673e-17
>
>fun1 <- function(x, y, eps = .Machine$double.eps^0.5) abs(x - y) < eps
>?fun1(1.1%%1,0.1)
>#[1] TRUE
>A.K.
>
>
>
>0.1%%1==0.1
>returns TRUE, which is right
>
>But
>1.1%%1==0.1
>returns FALSE !!
>
>Note that 1.1%%1>0.1 returns TRUE
>
>Can someone explain what is wrong?
>I'm using R version 2.15.3 on a mac.
>
>Thank you in advance
>
>______________________________________________
>R-help at r-project.org mailing list
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.
>