cppx-core
Classes | Namespaces | Functions | Variables
number-type-properties.hpp File Reference

Concise, clear & consistent notation for number type properties: is_ieee_754_, largest_, smallest_, max_, min_, max_e_, min_e_, n_digits_, radix_ and epsilon_. More...

#include <cppx-core/language/syntax/macro-use.hpp>
#include <cppx-core/language/types/Truth.hpp>
#include <limits>
#include <type_traits>
Include dependency graph for number-type-properties.hpp:

Go to the source code of this file.

Classes

struct  cppx::Number_properties_< Type >
 The property values as members of class, so that they can be inherited in. More...
 

Namespaces

 cppx
 
 cppx::number_properties
 Concise, clear and consistent number type properties.
 

Functions

 cppx::number_properties::CPPX_USE_CPPX (is_ieee_754_, largest_, smallest_, max_, min_, max_e_, min_e_, n_digits_, radix_, epsilon_)
 

Variables

template<class T >
constexpr Truth cppx::is_ieee_754_
 FP only. Whether the implementation claims to conform to the IEEE 754 standard. More...
 
template<class T >
constexpr T cppx::largest_
 The largest representable-as-positive absolute value of the type. More...
 
template<class T >
constexpr T cppx::smallest_
 The smallest non-zero absolute value of the type. More...
 
template<class T >
constexpr T cppx::max_
 The largest positive value of the type. More...
 
template<class T >
constexpr T cppx::min_
 The largest negative value of the type. More...
 
template<class T >
constexpr int cppx::max_e_
 FP only. E-notation maximum (largest positive) exponent value. More...
 
template<class T >
constexpr int cppx::min_e_
 FP only. E-notation minimum (largest negative) exponent value. More...
 
template<class T >
constexpr int cppx::n_digits_
 Number of decimal digits that guaranteed can be represented. More...
 
template<class T >
constexpr int cppx::radix_
 FP only. The numeral system base of the floating point representation, 2 or 10. More...
 
template<class T >
constexpr T cppx::epsilon_
 The difference between 1 and the least floating point value greater than 1. More...
 

Detailed Description

Concise, clear & consistent notation for number type properties: is_ieee_754_, largest_, smallest_, max_, min_, max_e_, min_e_, n_digits_, radix_ and epsilon_.

The std::numeric_limits facility is very verbose, has in part cryptic names, is non-systematic in what values mean for different kinds of types, and needlessly (and bafflingly for one without historical knowledge of C++) expresses integral values as values but floating point type values as functions that must be invoked. Hence this more consistent and easy-to-use, but limited, facility.

Definition in file number-type-properties.hpp.