||If the values you compare are greater than one, then an absolute error of 1e-9 is smaller than a relative error of 1e-9. In other words, if a,b>1 and abs(a-b)<1e-9, there is no need to check whether b is between a*(1-1e-9) and a*(1+1e-9), 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 1e-9 will always be accurate enough. (Note that for these numbers, adding/subtracting 1e-9 changes the value of the variable.)