[Rd] [Patch] Minor glitch in 'Writing R Extensions'

From: Dirk Eddelbuettel <edd_at_debian.org>
Date: Mon, 03 Sep 2012 10:58:32 -0500

The (marked up in info mode) manual Writing R Extensions says in 6.1.3

     This is the function used by R's `round()'.

-- Function: double fround (double X, double DIGITS)
Returns the value of X rounded to DIGITS _significant_ decimal digits. This is the function used by R's `signif()'. ^^^^^^^^^^^

I think that is crossed vis-a-vis the the corresponding R functions, ie

   'double fprec is used by 'signif (not round)

   'double fround' is used by 'round' (not signif)

as I just found out by trying to unit-test wrappers just added to Rcpp.

Sources seem to agree -- src/main/arithmetic.c has

    case 10001: return Math2(args, fround);/* round(), src/nmath/fround.c */     case 10004: return Math2(args, fprec); /* signif(), src/nmath/fprec.c */

So with that I suggest to alter the R-exts.texi as the patch below does.

Hope this helps, Dirk

edd_at_max:/tmp$ diff -u R-exts.texi.orig R-exts.texi --- R-exts.texi.orig 2012-09-03 10:56:21.219528679 -0500 +++ R-exts.texi 2012-09-03 10:56:42.359529056 -0500 @@ -10659,14 +10659,14 @@
 Returns the value of @var{x} rounded to @var{digits} decimal digits  (after the decimal point).  

-This is the function used by @R{}'s @code{round()}. +This is the function used by @R{}'s @code{signif()}.  @end deftypefun  

 @deftypefun double fround (double @var{x}, double @var{digits})  Returns the value of @var{x} rounded to @var{digits} @emph{significant}  decimal digits.  

-This is the function used by @R{}'s @code{signif()}. +This is the function used by @R{}'s @code{round()}.  @end deftypefun  

 @deftypefun double ftrunc (double @var{x}) edd_at_max:/tmp$

Dirk Eddelbuettel | edd@debian.org | http://dirk.eddelbuettel.com

R-devel_at_r-project.org mailing list
Received on Mon 03 Sep 2012 - 16:02:15 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sat 15 Sep 2012 - 19:00:45 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive