1

6969277959563657216 is not one of the following numbers, yet %in% returns TRUE.

6969277959563657216  %in% c(6972646901044805634,
                            6935914801507893250,
                            6930019021496532993,
                            6969277959563657217,
                            7005257783989764866)
[1] TRUE

Why is this?

Skaqqs
  • 4,010
  • 1
  • 7
  • 21
L.Yang
  • 553
  • 1
  • 6
  • 12

1 Answers1

0

The reason is that most computer programs work with a precision of approx. 16 digits, see FAQ 7.31 Why doesn’t R think these numbers are equal? and the link therein. The interpretation here is of course: "Why does R think these numbers are equal".

Example:

6969277959563657216 == 6969277959563657217
[1] TRUE

More about this also on Wikipedia and several other places.

Edit: Here a SO posting about big integers long/bigint/decimal equivalent datatype in R

tpetzoldt
  • 5,338
  • 2
  • 12
  • 29