From jeremiah.cohen at gmail.com  Thu Jul 23 21:30:12 2009
From: jeremiah.cohen at gmail.com (jeremiah.cohen at gmail.com)
Date: Thu, 23 Jul 2009 21:30:12 +0200 (CEST)
Subject: [Rd] Bug in seq() (PR#13849)
Message-ID: <20090723193012.D69F3282EFFB@mail.pubhealth.ku.dk>

Full_Name: Jeremiah Cohen
Version: 2.9.0
OS: Windows XP
Submission from: (NULL) (129.59.230.235)


I believe there is a bug in the seq() function for certain values of the "from"
argument. Here are examples:

> seq(-.2, .1, .1)
[1] -0.2 -0.1  0.0  0.1
> seq(-.3, .1, .1)
[1] -3.000000e-01 -2.000000e-01 -1.000000e-01  5.551115e-17  1.000000e-01
> seq(-.4, .1, .1)
[1] -0.4 -0.3 -0.2 -0.1  0.0  0.1
> seq(-.5, .1, .1)
[1] -0.5 -0.4 -0.3 -0.2 -0.1  0.0  0.1
> seq(-.6, .1, .1)
[1] -6.000000e-01 -5.000000e-01 -4.000000e-01 -3.000000e-01 -2.000000e-01
-1.000000e-01  1.110223e-16  1.000000e-01
> seq(-.7, .1, .1)
[1] -7.000000e-01 -6.000000e-01 -5.000000e-01 -4.000000e-01 -3.000000e-01
-2.000000e-01 -1.000000e-01  1.110223e-16
[9]  1.000000e-01
> seq(-.8, .1, .1)
[1] -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1  0.0  0.1

So, for example,

> which(seq(-.2, .1, .1) == 0)
[1] 3
> which(seq(-.3, .1, .1) == 0)
integer(0)

Here are the results of the "version" command on my machine:

platform       i386-pc-mingw32             
arch           i386                        
os             mingw32                     
system         i386, mingw32               
status                                     
major          2                           
minor          9.0                         
year           2009                        
month          04                          
day            17                          
svn rev        48333                       
language       R                           
version.string R version 2.9.0 (2009-04-17)



[Rd] Bug in seq() (PR#13849)
jeremiah.cohen at gmail.com