In some cases a direct binary comparison of floats is
used to test for equality, rather than calling __fseq.
This fails when both floats may be zero, because IEEE
float has two different binary representations for zero
(0x00000000 and 0x80000000).
This code demonstrates the problem:
Compile with "sdcc float_compare_test.c"
Tested with SDCC version:
2.4.7 #912 (Dec 28 2004) (UNIX)
Code compiles fine, but test cases #11 and #12 fail:
Test 11: Error: actual=0, correct=1, in1=80000000, in2=0
Test 12: Error: actual=0, correct=1, in1=0, in2=80000000
Contact paul AT pjrc.com for more info.
Log in to post a comment.