
If the values you compare are greater than one, then an absolute error of 1e9 is smaller than a relative error of 1e9. In other words, if a,b>1 and abs(ab)<1e9, there is no need to check whether b is between a*(11e9) and a*(1+1e9), it will always be true.
The numbers I was comparing in this task were between sqrt(2)/2 and 1000000*sqrt(2), and they were almost exact. Thus I decided that testing for an absolute error 1e9 will always be accurate enough. (Note that for these numbers, adding/subtracting 1e9 changes the value of the variable.) 