 
                            The C programming language provides the ability to use floating-point numbers for calculations. The C Standard specifies requirements on a conforming implementation for floating-point numbers but makes few guarantees about the specific underlying floating-point representation because of the existence of competing floating-point systems.
...
On 64-bit Linux, with GCC compiler 4.1, it produces
| Code Block | 
|---|
| Float is 0.33333334326744079589843750000000000000000000000000 | 
...
When compiled on an IA-32 Linux machine with GCC compiler 3.4.4 at optimization level 1 or higher, or on an IA-64 Windows machine with Microsoft Visual Studio 2012 in Debug or Release mode, this code prints
...
On an IA-32 Linux machine with GCC compiler 3.4.4 with optimization turned off, this code prints
...
Failing to understand the limitations of floating-point numbers can result in unexpected computational results and exceptional conditions, possibly resulting in a violation of data integrity.
| Recommendation | Severity | Likelihood | 
|---|
| Detectable | Repairable | Priority | Level | 
|---|---|---|---|
| FLP00-C | Medium | Probable | No | 
| No | P4 | L3 | 
Automated Detection
| Tool | Version | Checker | Description | ||||||
|---|---|---|---|---|---|---|---|---|---|
| CodeSonar | 
 | LANG.ARITH.FMULOFLOW LANG.ARITH.FPEQUAL | Float multiplication overflow Floating point equality | ||||||
| ECLAIR | 
 | 
| CC2.FLP00 | Fully implemented | ||||||||
| Helix QAC | 
 | C0275, C0581, C1490, C3339, | |||||||
| Parasoft C/C++test | 
 | CERT_C-FLP00-a | Floating-point expressions shall not be tested for equality or inequality | ||||||
| PC-lint Plus | 
 | 777, 9252 | Partially supported | ||||||
| 
 | CERT C: Rec. FLP00-C | Checks for absorption of float operand (rec. partially covered) | 
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this recommendation on the CERT website.
Related Guidelines
| SEI CERT C++ | 
| Coding Standard | VOID FLP00-CPP. Understand the limitations of floating-point numbers | 
| FLP35-CPP. Take granularity into account when comparing floating-point values | 
| CERT Oracle Secure Coding Standard for Java | 
| NUM53-J. Use the strictfp modifier for floating-point calculation consistency across platforms | |
| ISO/IEC TR 24772:2013 | Floating-point Arithmetic [PLF] | 
Bibliography
| [Gough 2005] | Section 8.6, "Floating-Point Issues" | 
| [ | 
| Hatton 1995] | Section 2.7.3, "Floating-Point Misbehavior" | 
| [IEEE 754 2006] | |
| [Lockheed Martin 2005] | AV Rule 202, Floating-point variables shall not be tested for exact equality or inequality | 
...
...