#853 float equality, __fseq not called

closed-out-of-date
nobody
5
2013-05-25
2004-12-28
No

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:

http://www.pjrc.com/tmp/float_compare_test.c

Compile with "sdcc float_compare_test.c"

Tested with SDCC version:

SDCC :
mcs51/gbz80/z80/avr/ds390/pic16/pic14/TININative/xa51/ds400/hc08
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.

Discussion

  • Bernhard Held

    Bernhard Held - 2005-11-22

    Logged In: YES
    user_id=203539

    Can you confirm this still exists in 2.5.4?

     
  • Bernhard Held

    Bernhard Held - 2005-11-22
    • milestone: --> unreproducable
    • status: open --> pending-out-of-date
     
  • SourceForge Robot

    • status: pending-out-of-date --> closed-out-of-date
     
  • SourceForge Robot

    Logged In: YES
    user_id=1312539

    This Tracker item was closed automatically by the system. It was
    previously set to a Pending status, and the original submitter
    did not respond within 30 days (the time period specified by
    the administrator of this Tracker).

     

Log in to post a comment.