From raimon.massanet at upc.edu  Wed Nov 11 13:15:11 2009
From: raimon.massanet at upc.edu (raimon.massanet at upc.edu)
Date: Wed, 11 Nov 2009 13:15:11 +0100 (CET)
Subject: [Rd] Unexpected behaviour of seq(from,to,by) (PR#14057)
Message-ID: <20091111121511.7A0842831FF8@mail.pubhealth.ku.dk>

Full_Name: Raimon Massanet
Version: 2.9.2
OS: Linux Ubuntu 8.10
Submission from: (NULL) (147.83.71.76)


# Hi there.
# I'm not sure whether or not this is a bug.
# But it surely is an unexpected behaviour.

V <- seq(from=0,to=1,by=0.1)

# Should generate a sequence with a step of 0.1

V==0
# [1]  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
# Ok!

V==0.1
# [1] FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
# Ok!

V==0.6
# [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
# None?

V[7]
# [1] 0.6
V[7]==0.6
# [1] FALSE
# Rounding!?

V[8]
# [1] 0.7
V[8]==0.7
# [1] FALSE
# Rounding!?

V[9]
# [1] 0.8
V[9]==0.8
# [1] TRUE
# Back to normal

# The generated sequence is fine for all values except for 0.6
# and 0.7, which appear to be somewhat off the expected value.

# According to the R manual the sequence is generated in the form:
# from, from+by, ..., to
# which is not the case.

# Either the function or the documentation lead to an unexpected
# behaviour of seq(from,to,by).

# Thanks!



[Rd] Unexpected behaviour of seq(from,to,by) (PR#14057)
raimon.massanet at upc.edu