add inRange function to main to test if a value lies within the absolute value of the supplied threshold