Assuming IEEE-754 floating point, they are equivalent.
This is the main theorem of FP-arithmetic that for finite x and y, x - y == 0 if and only if x == y, assuming a gradual overflow.
If the subnormal results are reset to zero (instead of a gradual lower flow), this theorem is true only if the result x - y is normal. Since 1.0 scales well, y - 1.0 never subnormal, and so y - 1.0 is zero if and only if y is 1.0, regardless of how underflow is handled.
C ++ does not guarantee IEEE-754, of course, but the theorem is true for most "smart" floating point systems.
Stephen canon
source share