Re: [R] Bug on r-bc?

2010-07-27 Thread Paul Smith
On Tue, Jul 27, 2010 at 5:12 AM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
 The following code should return 1, but it returns 0:

 source(http://r-bc.googlecode.com/svn/trunk/R/bc.R;)
 bc(9 % 2)


 See FAQ 2 on the r-bc package home page:
 http://r-bc.googlecode.com

 Thanks to all respondents for your replies. It seems that there is
 still a problem:

 bc(2 % 50,sample=0)
 [1] 0

 Its scale=0,  not sample=0

 bc(2 % 50, scale=0)
 [1] 2

 bc(scale=0; 2 % 50)
 [1] 2

 options(bc.scale=0)
 bc(2 % 50)
 [1] 2


That is right! Sorry and thanks, Gabor.

Paul

__
R-help@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.


Re: [R] Bug on r-bc?

2010-07-26 Thread Ben Bolker
Paul Smith phhs80 at gmail.com writes:

 
 Dear All,
 
 The following code should return 1, but it returns 0:
 
 source(http://r-bc.googlecode.com/svn/trunk/R/bc.R;)
 bc(9 % 2)
 
 Do you confirm this bug?
 

  It's not a bug in r-bc, it's a misfeature (?) in bc.
It has to do with the 'scale' parameter in bc (which gets
set to 100 explicitly by r-bc, but would be set to 20 in any
case by the use of the '-l' option to bc)

http://superuser.com/questions/31445/gnu-bc-modulo-with-scale-other-than-0
http://en.wikipedia.org/wiki/Bc_programming_language
http://www.linuxquestions.org/questions/programming-9/bc-using-l-messes-up-modulus-331003/

a workaround;

 source(http://r-bc.googlecode.com/svn/trunk/R/bc.R;)
 bc(scale=0; 9%2)
[1] 1

__
R-help@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.


Re: [R] Bug on r-bc?

2010-07-26 Thread Gabor Grothendieck
On Mon, Jul 26, 2010 at 1:44 PM, Paul Smith phh...@gmail.com wrote:
 Dear All,

 The following code should return 1, but it returns 0:

 source(http://r-bc.googlecode.com/svn/trunk/R/bc.R;)
 bc(9 % 2)


See FAQ 2 on the r-bc package home page:
http://r-bc.googlecode.com

__
R-help@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.


Re: [R] Bug on r-bc?

2010-07-26 Thread Ben Bolker
Gabor Grothendieck ggrothendieck at gmail.com writes:

 See FAQ 2 on the r-bc package home page:
 http://r-bc.googlecode.com

  This is getting a little bit self-referential -- that FAQ refers to 
the previous message in this thread ...

__
R-help@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.


Re: [R] Bug on r-bc?

2010-07-26 Thread Gabor Grothendieck
On Mon, Jul 26, 2010 at 10:00 PM, Ben Bolker bbol...@gmail.com wrote:
 Gabor Grothendieck ggrothendieck at gmail.com writes:

 See FAQ 2 on the r-bc package home page:
 http://r-bc.googlecode.com

  This is getting a little bit self-referential -- that FAQ refers to
 the previous message in this thread ...


The above was written before I saw your post but (in fact I had an
entire offline conversation with the poster) but when I did see it the
links and other info seemed so useful that I improved the FAQ and
linked to it.

__
R-help@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.


Re: [R] Bug on r-bc?

2010-07-26 Thread Paul Smith
On Mon, Jul 26, 2010 at 11:42 PM, Gabor Grothendieck
ggrothendi...@gmail.com wrote:
 The following code should return 1, but it returns 0:

 source(http://r-bc.googlecode.com/svn/trunk/R/bc.R;)
 bc(9 % 2)


 See FAQ 2 on the r-bc package home page:
 http://r-bc.googlecode.com

Thanks to all respondents for your replies. It seems that there is
still a problem:

 bc(2 % 50,sample=0)
[1] 0

However,

 bc(scale = 0; 2 % 50)
[1] 2


Paul

__
R-help@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.


Re: [R] Bug on r-bc?

2010-07-26 Thread Gabor Grothendieck
On Mon, Jul 26, 2010 at 6:54 PM, Paul Smith phh...@gmail.com wrote:
 On Mon, Jul 26, 2010 at 11:42 PM, Gabor Grothendieck
 ggrothendi...@gmail.com wrote:
 The following code should return 1, but it returns 0:

 source(http://r-bc.googlecode.com/svn/trunk/R/bc.R;)
 bc(9 % 2)


 See FAQ 2 on the r-bc package home page:
 http://r-bc.googlecode.com

 Thanks to all respondents for your replies. It seems that there is
 still a problem:

 bc(2 % 50,sample=0)
 [1] 0

Its scale=0,  not sample=0

 bc(2 % 50, scale=0)
[1] 2

 bc(scale=0; 2 % 50)
[1] 2

 options(bc.scale=0)
 bc(2 % 50)
[1] 2

__
R-help@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.