Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

For information regarding floating-point number conversions, see rule FLP34-C. Ensure that floating point conversions are within range of the new type.

...

Operating System

How to handle floating point errors

Linux
Solaris 10
AIX 5.3
HP-UX 11.31
Mac OS X 10.5

Use the C99 floating-point exception functions.

<ac:structured-macro ac:name="unmigrated-wiki-markup" ac:schema-version="1" ac:macro-id="6f84c8c43f62dfd9-178fa736-4eeb4f6f-95359d4a-69b0b5f24e4902924e4fc864"><ac:plain-text-body><![CDATA[

Windows

Either use the C99 floating-point exception function or structured exception handling through _fpieee_flt [[MSDN

AA. Bibliography#MSDN]]

]]></ac:plain-text-body></ac:structured-macro>

...

Search for vulnerabilities resulting from the violation of this recommendation on the CERT website.

Related Guidelines

CERT C++ Secure Coding Standard: FLP03-CPP. Detect and handle floating point errors

MITRE CWE: CWE-369, "Divide By Zero"

Bibliography

Wiki Markup
\[[IEEE 754|AA. Bibliography#IEEE 754 2006]\]
\[[Intel 2001|AA. Bibliography#Intel 01]\]
\[[Keil 2008|AA. Bibliography#Keil 08]\]
\[[MITRE 2007|AA. Bibliography#MITRE 07]\] [CWE ID 369|http://cwe.mitre.org/data/definitions/369.html], "Divide By Zero"
\[[MSDN|AA. Bibliography#MSDN]\] "[fpieee_flt (CRT)|http://msdn.microsoft.com/en-us/library/te2k2f2t(VS.80).aspx]"
\[[Open Group 2004|AA. Bibliography#Open Group 04]\] "[{{fenv.h}} - Floating-point environment|http://www.opengroup.org/onlinepubs/009695399/basedefs/fenv.h.html]"
\[[SecurityFocus 2007|AA. Bibliography#SecurityFocus 07]\]

...