File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
c/misra/test/rules/DIR-4-15 Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -162,8 +162,8 @@ void f1(float p1) {
162162 (int )pow (2 , sin (p1 )); // COMPLIANT: not likely to be Infinity
163163 (int )(1 /
164164 sin (p1 )); // NON_COMPLIANT: possible infinity from zero in denominator
165- (int )(1 / log (p1 )); // COMPLIANT: not possibly zero in denominator
166- (int )pow (p1 , p1 ); // NON_COMPLIANT: NaN if p1 is zero
165+ (int )(1 / log (p1 )); // COMPLIANT: not possibly zero in denominator
166+ (int )pow (p1 , p1 ); // NON_COMPLIANT: NaN if p1 is zero
167167 if (p1 != 0 ) {
168168 (int )pow (p1 , p1 ); // COMPLIANT: p1 is not zero
169169 }
@@ -193,10 +193,10 @@ void f2() {
193193 castToInt (1.0 /
194194 0.0 ); // NON_COMPLIANT: Infinity flows to denominator in division
195195 castToInt (0.0 / 0.0 ); // NON_COMPLIANT: NaN flows to denominator in division
196- checkBeforeCastToInt (1.0 / 0.0 ); // COMPLIANT
197- checkBeforeCastToInt (0.0 / 0.0 ); // COMPLIANT
198- addOneThenCastToInt (1.0 / 0.0 ); // NON_COMPLIANT[False negative]
199- addOneThenCastToInt (0.0 / 0.0 ); // NON_COMPLIANT
196+ checkBeforeCastToInt (1.0 / 0.0 ); // COMPLIANT
197+ checkBeforeCastToInt (0.0 / 0.0 ); // COMPLIANT
198+ addOneThenCastToInt (1.0 / 0.0 ); // NON_COMPLIANT[False negative]
199+ addOneThenCastToInt (0.0 / 0.0 ); // NON_COMPLIANT
200200 castToIntToFloatToInt (1.0 / 0.0 ); // NON_COMPLIANT
201201 castToIntToFloatToInt (0.0 / 0.0 ); // NON_COMPLIANT
202202
You can’t perform that action at this time.
0 commit comments