# [R] seq() in 0.62.4 and 0.63

Peter Dalgaard BSA p.dalgaard at biostat.ku.dk
Sun Nov 15 02:21:21 CET 1998

```Peter Dalgaard BSA <p.dalgaard at biostat.ku.dk> writes:

> Prof Brian D Ripley <ripley at stats.ox.ac.uk> writes:
>
> > Solaris 2.6, R Version 0.63.0  (November 14, 1998)
> >                Version 0.62.4  (October 24, 1998)
> >
> > > seq(0.15, 0.70, 0.05)
> >  [1] 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65
> >
> > The much reviled (on r-help) 0.62.3 got such simple cases right (even if
> > 0.62.1 did not).

The following patch appears to work. At least it passes the following
test, which is more than can be said for the original:

# This takes a while...
max(sapply(rnorm(1000),
function(x)max(seq(x+1/x,x+10000/x,1/x)-(x + (1:10000)/x))))

(gives 1.490116e-08, broken version gave several warnings about object
length mismatch)

*** /tmp/T0a004hF       Sun Nov 15 14:09:09 1998
--- seq.R       Sun Nov 15 14:09:09 1998
***************
*** 31,44 ****
dd <- abs(del)/max(abs(to), abs(from))
if (dd < sqrt(.Machine\$double.eps))
return(from)
!           eps <- .Machine\$double.eps * max(1, 1/dd)
!           n <- as.integer(n * (1 + eps))
!           if(eps*2*n >= 1)
!               warning(paste("seq.default(f,t,by): n=",n,
!                             ": possibly imprecise intervals"))
!           if(by>0)    while(from+ n*by > to) n <- n - 1
!           else        while(from+ n*by < to) n <- n - 1
!
from + (0:n) * by
}
else if(length.out < 0)
--- 31,37 ----
dd <- abs(del)/max(abs(to), abs(from))
if (dd < sqrt(.Machine\$double.eps))
return(from)
!           n <- as.integer(n + 1e-7)
from + (0:n) * by
}
else if(length.out < 0)

--
O__  ---- Peter Dalgaard             Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics     2200 Cph. N
(*) \(*) -- University of Copenhagen   Denmark      Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk)             FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._

```

More information about the R-help mailing list