The man page for modf claims it produces an exact fractional part: http://manpages.ubuntu.com/manpages/quantal/en/man3/modf.3.html
It's possible for modf to do this because the fractional part of a floating point number cannot require more precision than the original value.
So I think you've essentially just rewritten modf. My understanding is that floating point equality comparisons are exact, except in weird cases like NaN.