For this type of problem, I prefer the solution described by Chambers in his book "Data Analysis Software":
match(1.68, seq(1, 1000, by = 1)/100)
(This works because there is no floating point problem associated with creating a sequence of integers. Rounding occurs only when divided by 100 and corresponds to the rounding obtained by converting the entered number 1.67
to a binary file.)
This solution has the property of not finding a match for a number like 1.6744
, which is clearly not in the sequence 0.10, 0.11, 0.12, ..., 9.98, 9.99, 10.00
:
match(1.6744, seq(1,1000, by = 1)/100)
source share