1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//! FLP01-C: Take care in rearranging floating-point expressions
//!
//! This rule cautions against reorganizing floating-point expressions without accounting
//! for precision limitations. The C Standard (ISO/IEC 9899:2011, §5.1.2.3, ¶14) states:
//! "The implementation cannot generally apply the mathematical associative rules for
//! addition or multiplication, nor the distributive rule, because of roundoff error."
//!
//! ## Examples:
//!
//! **Problematic patterns:**
//! ```c
//! // These transformations may affect precision:
//! x * y * z // vs. x *= y * z
//! (x - y) + y // May not equal x due to rounding
//! x + x * y // vs. x * (1.0 + y)
//! x * 0.2 // vs. x / 5.0
//! ```
//!
//! ## Detection Strategy:
//!
//! This rule is marked as **"unenforceable"** through automated detection alone in the
//! CERT C coding standard. Static analysis cannot reliably determine:
//! - Whether an expression was intentionally reorganized
//! - Whether the reorganization affects required precision
//! - What the original expression structure was
//!
//! Therefore, this implementation provides a **conservative stub** that:
//! - Does not report false positives
//! - Serves as a placeholder for potential future heuristics
//! - Documents the rule's requirements for manual code review
//!
//! **Manual review is recommended** for code involving floating-point arithmetic,
//! particularly in performance-critical sections or when compiler optimizations
//! (e.g., `-ffast-math`) are enabled.
use crate;
use crateRuleViolation;
use crateCertRule;
use Node;
;