Skip to content
Prev 293588 / 398503 Next

read-in, error???

You didn't mention it, but did you use something like
   options(digits=20)
before displaying that data?  In any case,
  >  1000000000000.4000244 == 1000000000000.4
  [1] TRUE
because R uses the IEEE-754 double precision floating point
arithmetic that all modern computers support.  That gives
you 52 binary digits of precision, somewhat less than 17 decimal
digits, so your difference in the 18th digit is ignored.

If you need more than 16 decimal digits of precision, you
could break the numbers into parts (via string manipulation,
before reading them as numbers) and or use a high precision
package like Rmpfr to manipulate them (it will be slow and  has
limited functionality).

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com