The problem is your FLIP_FLOAT_A macro -- it's just wrong. You need it to flip all the bits of negative numbers (not just the bottom bit), and for the macros to be the reverse of each other (so FLIP_FLOAT_B(FLIP_FLOAT_A(X)) == X for all values of X). Try: