...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
The implementation of <boost/cstdfloat.hpp>
is designed to utilize <float.h>
,
defined in the 1989 C standard. The preprocessor is used to query certain preprocessor
definitions in <float.h>
such as FLT_MAX, DBL_MAX, etc. Based on the results of these queries, an attempt
is made to automatically detect the presence of built-in floating-point types
having specified widths. An unequivocal test requiring conformance with IEEE_floating_point
(IEC599) based on std::numeric_limits<>::is_iec559
is performed with static_assert
.
In addition, this Boost implementation <boost/cstdfloat.hpp>
supports an 80-bit floating-point typedef
if it can be detected, and a 128-bit floating-point typedef
if it can be detected, provided that the underlying types conform with IEEE-754 precision extension
(provided std::numeric_limits<>::is_iec559 == true
for this type).
The header <boost/cstdfloat.hpp>
makes the standardized floating-point typedef
s
safely available in namespace boost
without placing any names in namespace std
.
The intention is to complement rather than compete with a potential future
C/C++ Standard Library that may contain these typedef
s.
Should some future C/C++ standard include <stdfloat.h>
and
<cstdfloat>
, then <boost/cstdfloat.hpp>
will continue to function, but will become redundant and may be safely deprecated.
Because <boost/cstdfloat.hpp>
is a Boost header, its name conforms to the boost header naming conventions,
not the C++ Standard Library header naming conventions.
Note | |
---|---|
|
Warning | |
---|---|
If |
Warning | |
---|---|
As an implementation artifact, certain C macro names from |
Tip | |
---|---|
For best results,
This is because
For this reason, making |