# [Rd] seq (PR#1133)

**maechler@stat.math.ethz.ch
**
maechler@stat.math.ethz.ch

*Fri, 19 Oct 2001 17:15:42 +0200 (MET DST)*

>>>>>* "Wst" == Werner Stahel <stahel@stat.math.ethz.ch> writes:
*
Wst> In the following special case, seq fails to give the right answer
Wst> (which is 0 )
>> seq(0,0,1)
Wst> Error in if (dd < sqrt(.Machine$double.eps)) return(from) :
Wst> missing value where logical needed
.....
Wst> The error occurs in the statement
Wst> dd <- abs(del)/max(abs(to), abs(from))
Wst> of seq.default -- for obvious reasons.
Wst> This is certainly easy to debug...
yes
Wst> Thank you for your efforts.
Thank you, Werner!
It's now fixed for R-devel; this is the patch I've used:
--- src/library/base/R/seq.R 16 Aug 2001 14:55:20 -0000 1.14
+++ src/library/base/R/seq.R 19 Oct 2001 14:44:43 -0000
@@ -19,7 +19,9 @@
if(missing(by))
from:to
else { # dealing with 'by'
- n <- (del <- to - from)/by
+ del <- to - from
+ if(del == 0 && to == 0) return(to)
+ n <- del/by
if(!(length(n) && is.finite(n))) {
if(length(by) && by == 0 && length(del) && del == 0)
return(from)
Martin
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel 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-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._