search for: r_pow_di

Displaying 6 results from an estimated 6 matches for "r_pow_di".

2001 Oct 22
1
round() doesn't (PR#1139)
...specifically for negative "digits". This is in 1.3.1 on Solaris 2.6 (full description at bottom). [Apologies for making everyone read this 3 times; my bug.report() burped.] Peter Dalgaard <p.dalgaard@biostat.ku.dk> says the problem is in fround.c, which reads in part: pow10 = R_pow_di(10., dig) ... return sgn * (intx + R_rint(x * pow10) / pow10); and (says Peter), > the problem is most likely that pow10 (== 1/100) has no finite binary > representation. Patches are welcome... I'm not up to patching C code, but I will say that a workaround is: R> round(round(...
2002 Jan 16
0
round() doesn't (PR#1139)
...C function that I posted (in a followup) on 10/24/2001 (copied below). I substituted it into src/nmath/fround.c, successfully re-built R, and it works. It handles the 3 cases dig=0, dig>0, and dig<0 separately, avoids the roundoff errors that were occurring for dig<0, and avoids a call to R_pow_di altogether when dig=0. It gets the correct answer "0" in the above example. Here are a few explicit test cases; the last one fails in R-patched 01/13/2002, but all work with my "fround". all.equal(round(1234.5678, 2), 1234.57) all.equal(round(1234.5678, 0),...
2005 Jun 29
6
x*x*x*... vs x^n
Hi I have been wondering if there one can speed up calculating small powers of numbers such as x^8 using multiplication. In addition, one can be a bit clever and calculate x^8 using only 3 multiplies. look at this: > f1 <- function(x){x*x*x*x*x*x*x*x} > f2 <- function(x){x^8} > f3 <- function(x){x2 <- x*x;x4 <- x2*x2;return(x4*x4)} [so f1() and f2() and f3() are
2014 May 14
1
large integer values
Dear devels, I need to create a (short) vector in C, which contains potentially very large numbers, exponentially to the powers of 2. This is my test example: lgth = 35; int power[lgth]; power[lgth - 1] = 1; for (j = 1; j < lgth; j++) { power[lgth - j - 1] = 2*power[lgth - j]; } Everything works ok until it reaches the limit of 2^32: power: 1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024,
2000 Feb 29
7
R-1.0.0 is released
...ey created, and detach data frames and libraries they attach. o library(help=foo) lists only contents of first version if multiple matches are found on lib.loc. o round(2.345e-99, 100) now works (not giving 0). C functions fprec() and fround() [= R's signif() and round()], now use R_pow_di(10.0, n) which is clean and more efficient. This changes some results in the least significant bits. o rpois sometimes had problems with mu=0, now special-cased o Rare memory overrun in rpois fixed. o --nsize and --vsize arguments to R CMD check now work. o plot.stepfun...
2000 Feb 29
7
R-1.0.0 is released
...ey created, and detach data frames and libraries they attach. o library(help=foo) lists only contents of first version if multiple matches are found on lib.loc. o round(2.345e-99, 100) now works (not giving 0). C functions fprec() and fround() [= R's signif() and round()], now use R_pow_di(10.0, n) which is clean and more efficient. This changes some results in the least significant bits. o rpois sometimes had problems with mu=0, now special-cased o Rare memory overrun in rpois fixed. o --nsize and --vsize arguments to R CMD check now work. o plot.stepfun...