Eliminate intermediate overflow for encodeFloat, fixes #5524