Tolerence check If statement

How do you preform a tolerance check
e.g.
expected value = x
measured value = y
Basically I want to check if the measured value(e.g voltage) is equal to expected value +/-5%
if(x+/-5% == y)

Basically I want to check if the measured value(e.g voltage) is equal to expected value +/-5%
if(x+/-5% == y)

if(y >= x * .95 && y <= x * 1.05)