Skip to content
Prev 205650 / 398506 Next

Strange behaviour of as.integer()

Use round(), floor(), or ceiling() to convert
numbers with possible fractional parts to numbers
without fraction parts.

as.integer()'s main use is to convert from one
internal representation (i.e., bit pattern)
of a number to another so you can interface to
C or Fortran code.

Note that as.integer(x) also doesn't "work" when
abs(x)>2^31, while round(), floor(), and ceiling()
do work up to c. 2^52.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com