[Rd] Strange behaviour of type conversion (PR#8256)
g.toedt@dkfz-heidelberg.de
g.toedt at dkfz-heidelberg.de
Thu Oct 27 15:40:09 CEST 2005
Where is my error??
I have a strange behaviour in R, looks like type conversions are messed =
up.
Maybe i just make a stupid mistake, but help would be appreciated.
To reproduce:
expected:
> typeof(3)
[1] "double"
> as.integer(3)
[1] 3
> typeof((0.3/0.1))
[1] "double"
!!!! strange:
> as.integer((0.3/0.1))
[1] 2
also for trunc:
>trunc(c(5,7))
[1] 5 7
>c(0.5,0.7)/c(0.1,0.1)
[1] 5 7
and now watch:
>trunc((c(0.5,0.7)/c(0.1,0.1)))
[1] 5 6
My R-Version:
platform i386-pc-mingw32
arch i386 =20
os mingw32 =20
system i386, mingw32 =20
status =20
major 2 =20
minor 1.1 =20
year 2005 =20
month 06 =20
day 20 =20
language R
Cheers,
Grischa T=F6dt
More information about the R-devel
mailing list