Which rule of MISRA C:2012 matches rule 13.3 of MISRA C: 2004

Questions and discussions about moving to the latest version of MISRA C

Moderators: misra-c, david ward

Qiong
Posts: 3
Joined: Thu Dec 01, 2016 2:47 pm
Company: Ford Motor Company

Which rule of MISRA C:2012 matches rule 13.3 of MISRA C: 2004

Postby Qiong » Wed Dec 14, 2016 6:31 pm

MISRA C: 2004 has Rule 13.3 (required): Floating-point expressions shall not be tested for equality or inequality.

This rule is very useful. We use Mathworks/Polyspace for static analysis. We can find issues of (floating variable == or != 0.0) by turning on MISRA C: 2004, but we miss this check by using MISRA C:2012.

We want to always apply the latest MISRA C standard, but not sure which rule in MISRA C: 2012 matches rule 13.3 of MISRA C: 2004?

dg1980
Posts: 108
Joined: Wed Apr 27, 2016 2:33 pm
Company: Elektrobit Automotive GmbH

Re: Which rule of MISRA C:2012 matches rule 13.3 of MISRA C: 2004

Postby dg1980 » Thu Dec 15, 2016 8:23 am

Qiong wrote:MISRA C: 2004 has Rule 13.3 (required): Floating-point expressions shall not be tested for equality or inequality.

This rule is very useful. We use Mathworks/Polyspace for static analysis. We can find issues of (floating variable == or != 0.0) by turning on MISRA C: 2004, but we miss this check by using MISRA C:2012.

We want to always apply the latest MISRA C standard, but not sure which rule in MISRA C: 2012 matches rule 13.3 of MISRA C: 2004?


https://misra.org.uk/forum/viewtopic.php?f=241&t=1256

Qiong
Posts: 3
Joined: Thu Dec 01, 2016 2:47 pm
Company: Ford Motor Company

Re: Which rule of MISRA C:2012 matches rule 13.3 of MISRA C: 2004

Postby Qiong » Thu Dec 15, 2016 6:15 pm

The information is really useful. Thank you.
dg1980 wrote:
Qiong wrote:MISRA C: 2004 has Rule 13.3 (required): Floating-point expressions shall not be tested for equality or inequality.

This rule is very useful. We use Mathworks/Polyspace for static analysis. We can find issues of (floating variable == or != 0.0) by turning on MISRA C: 2004, but we miss this check by using MISRA C:2012.

We want to always apply the latest MISRA C standard, but not sure which rule in MISRA C: 2012 matches rule 13.3 of MISRA C: 2004?


https://misra.org.uk/forum/viewtopic.php?f=241&t=1256

misra-c
Posts: 547
Joined: Thu Jan 05, 2006 1:11 pm

Re: Which rule of MISRA C:2012 matches rule 13.3 of MISRA C: 2004

Postby misra-c » Fri Feb 03, 2017 3:31 pm

Floating-point arithmetic is inherently implementation-defined, which is covered by:
Directive 1.1 Any implementation-defned behaviour on which the output of the
program depends shall be documented and understood

The https://misra.org.uk/forum/viewtopic.php?t=1256 document on MISRA-C:2004 to MISRA C:2012 mappings states
Focussing on one aspect of floating-point arithmetic (as in MISRA C:2004 Rule 13.3) attached too much importance to that aspect and might give users a false sense of confidence.
---
Posted by and on behalf of
the MISRA C Working Group


Return to “MISRA C:2004 to MISRA C:2012 migration”

Who is online

Users browsing this forum: No registered users and 1 guest