CWE Database
/

CWE-1077

Back to CWE list

CWE-1077

Floating Point Comparison with Incorrect Operator

Variant
Incomplete

Description

The code performs a comparison such as an equality test between two float (floating point) values, but it uses comparison operators that do not account for the possibility of loss of precision.

{"xhtml:p":["Numeric calculation using floating point values\n\t can generate imprecise results because of rounding errors.\n\t As a result, two different calculations might generate\n\t numbers that are mathematically equal, but have slightly\n\t different bit representations that do not translate to the\n\t same mathematically-equal values. As a result, an equality\n\t test or other comparison might produce unexpected\n\t results."]}

Parent Weaknesses (ChildOf)

Common Consequences

Scope

Other

Impact

Reduce Reliability

Applicable Platforms

Not Language-Specific

Security Training

Train your team to recognize and prevent security threats with our comprehensive security awareness program.

Start Training

Vulnerability Scanning

Discover vulnerabilities in your applications and infrastructure before attackers do.

Scan Now