[metadata]
id = "FLP00-C"
type = "recommendation"
category = "FLP"
number = 0
title = "Understand the limitations of floating-point numbers"
description = """
The C programming language provides the ability to use floating-point numbers
for calculations. The C Standard specifies requirements on
aconformingimplementationfor floating-point numbers but makes few guarantees
about the specific underlying floating-point representation because of the
existence of competing floating-point systems.
By definition, a floating-point number is of finite precision and, regardless of
the underlying implementation, is prone to errors associated with rounding.
(SeeFLP01-C. Take care in rearranging floating-point expressionsandFLP02-C.
Avoid using floating-point numbers when precise computation is needed.)
The most common floating-point system is specified by the IEEE 754 standard. An
older floating-point system is the IBM floating-point representation (sometimes
called IBM/370). Each of these systems has different precisions and ranges of
representable values. As a result, they do not represent all of the same values,
are not binary compatible, and have different associated error rates.
"""
severity = "Medium"
likelihood = "Probable"
priority = "P4"
level = "L3"
cert_version = "2016 Edition (Wiki)"
last_modified = "May 20, 2025"
[rules.cert_c.FLP00-C]
enabled = true
[references]
wiki = "https://wiki.sei.cmu.edu/confluence/display/c/FLP00-C.+Understand+the+limitations+of+floating-point+numbers"
cwe = []