I have 2 numbers, x and y, that are known and are represented exactly as floating point numbers. I want to know if z = x - y is always exact or if rounding errors can occur. For simple examples it's obvious:
x = 0.75 = (1 + 0.5) * 2^-1
y = 0.5 = 1 * 2^-1
z = x - y = 0.25 = 0.5 * 2^-1 = 1 * 2^-2
But what if I have x and y such that all significant digits are used and they have the same exponent? My intuition tells me the result should be exact, but I would like to see some kind of proof for this. Is it different if the result is negative?