[R] erratic behavior of match()?

Bernhard Klingenberg Bernhard.Klingenberg at williams.edu
Thu Apr 19 22:29:15 CEST 2007


Thank you! Is floating point arithmetic also the reason why 

1 %% 0.1

gives the "surprising" answer 0.1 (because 0.1 cannot be written as a 
fraction with denominator a power of 2, e.g. 1%%0.5 correctly gives 0).

This seems to go a bit against the statement in the help for '%%', which 
states "For real arguments, '%%' can be subject to catastrophic loss of 
accuracy if 'x' is much larger than 'y', and a warning is given if this 
is detected."



More information about the R-help mailing list