Menu

Comparison operator with floating points

2022-07-05
2022-07-05
  • david ingamells

    david ingamells - 2022-07-05

    I cannot find any check for "Floating point expressions shall not be compared using either the == or != operators." - is there one?
    My company's standards justify this rule with:
    "Comparing floating point expressions for equality or inequality is a famous source of well-documented software system failures."

     
  • Daniel Marjamäki

    It seems we don't have it. But I thought every compiler would have such warning. I.e. gcc has -Wfloat-equal. Do you feel it's acceptable to use gcc for this (and possibly get various other warnings)?

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.