| Home | Libraries | People | FAQ | More

## Overview

The header `<boost/cstdfloat.hpp>` provides optional standardized floating-point `typedef`s having specified widths. These are useful for writing portable code because they should behave identically on all platforms. These `typedef`s are the floating-point analog of specified-width integers in `<cstdint>` and `stdint.h`.

The `typedef`s are based on N3626 proposed for a new C++14 standard header `<cstdfloat>` and N1703 proposed for a new C language standard header `<stdfloat.h>`.

All `typedef`s are in `namespace boost` (would be in namespace `std` if eventually standardized).

The `typedef`s include `float16_t, float32_t, float64_t, float80_t, float128_t`, their corresponding least and fast types, and the corresponding maximum-width type. The `typedef`s are based on underlying built-in types such as `float`, `double`, or `long double`, or the proposed N2016 short float type, or based on other compiler-specific non-standardized types such as `__float128`. The underlying types of these `typedef`s must conform with the corresponding specifications of binary16, binary32, binary64, and binary128 in IEEE_floating_point floating-point format, and `std::numeric_limits<>::is_iec559 == true`.

The 128-bit floating-point type (of great interest in scientific and numeric programming) is not required in the Boost header, and may not be supplied for all platforms/compilers, because compiler support for a 128-bit floating-point type is not mandated by either the C standard or the C++ standard.

See Jahnke-Emden-Lambda function example for an example using both a `<cmath>` function and a Boost.Math function to evaluate a moderately interesting function, the Jahnke-Emden-Lambda function and normal distribution as an example of a statistical distribution from Boost.Math.