User and Reference Guide for the Intel® C++ Compiler 14.0

Floating-point Formats

The IEEE Standard 754 specifies values and requirements for floating-point representation (such as base 2). The standard outlines requirements for two formats: basic and extended, and for two word-lengths within each format: single and double.

The decimal floating-point exception functions are defined in the fenv.h header file.

The binary counterpart floating-point exception functions are described in ISO C99.

The Intel® C++ Compiler supports decimal floating point types in C and C++. The decimal floating point formats are defined in IEEE 754-2008 standard. In C, the following decimal floating types are supported: _Decimal32, _Decimal64, and _Decimal128.

To use this feature on Linux*, gcc 4.5 or later is required.

Example:

#include <decimal/decimal>
#include <iostream>

int main() {
std::decimal::decimal32 d = 4.7df;
std::cout << decimal_to_long_double(d) << std::endl; return 0; }

To ensure correct decimal floating-point behavior, the user must define __STDC_WANT_DEC_FP__ before any standard headers are included. This is mandated that standard decimal macros and library functions be declared only when __STDC_WANT_DEC_FP__ is defined. Missing library function prototypes may cause incorrect decimal floating-point results at run-time.

Functions to check decimal FP status

To detect exceptions occurring during decimal floating-point arithmetic, use the following floating-point exception functions:

Function

Brief Description

fe_dec_feclearexcept()

Clears the supported floating-point exceptions

fe_dec_fegetexceptflag

Stores an implementation-defined representation of the states of the floating-point status flags

fe_dec_feraiseexcept

Raises the supported floating-point exceptions

fe_dec_fesetexceptflag

Sets the floating-point status flags

fe_dec_fetestexcept()

Determines which of a specified subset of the floating point exception flags are currently set


Submit feedback on this help topic