Same comparison concern here. The old code was an integer rounding trick, but you can do it properly by doing fabsf(val - 1.0f) < 2.0f * FLT_EPSILON.