#1757 floating point comparison broken

closed-fixed
5
2013-05-25
2011-02-16
No

Comparison for equality does not work: The C standard (see e.g. verse 337 of the C99 standard) mandates that 0.0 compares equal to -0.0. In sdcc they do not always compare equal. In the attached sample they don't.

Discussion

  • Philipp Klaus Krause

    sdcc generates wrong test for equality.

     
    Attachments
  • Frieder Ferlemann

    There is a disabled test in support/regression/tests/float_single.c line 184 which also produces this. (Somehow that test got forgotten)

    gen/mcs51-small/float_single/float_single_func_FLOORF.rst shows that 0.0 and -0.0 are represented differently:

    ..
    0A05 00 00 00 00 464 .byte #0x00,#0x00,#0x00,#0x00 ; 0.000000e+00
    ..
    0A13 00 00 00 80 468 .byte #0x00,#0x00,#0x00,#0x80 ; -0.000000e+00
    ..

     
  • Maarten Brock

    Maarten Brock - 2011-09-02
    • labels: --> Run Time Library
    • milestone: --> fixed
    • assigned_to: nobody --> maartenbrock
    • status: open --> closed-fixed
     
  • Maarten Brock

    Maarten Brock - 2011-09-02

    Fixed in SDCC 3.0.4 #6805.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks