std::numeric_limits::has_denorm_loss

From cppreference.com
 
 
 
Type support
Basic types
Fundamental types
Fixed width integer types (C++11)
Numeric limits
C numeric limits interface
Runtime type information
Type traits
Primary type categories
(C++11)
(C++14)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Type properties
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++14)
(C++11)
Supported operations
Relationships and property queries
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Type modifications
(C++11)(C++11)(C++11)
(C++11)(C++11)(C++11)
(C++11)
(C++11)
Type transformations
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
(C++11)
Type trait constants
 
 
static const bool has_denorm_loss;
(until C++11)
static constexpr bool has_denorm_loss;
(since C++11)

The value of std::numeric_limits<T>::has_denorm_loss is true for all floating-point types T capable of distinguishing loss of precision due to denormalization from other causes of inexact result.

Contents

[edit] Standard specializations

T value of std::numeric_limits<T>::has_denorm_loss
/* non-specialized */ false
bool false
char false
signed char false
unsigned char false
wchar_t false
char16_t false
char32_t false
short false
unsigned short false
int false
unsigned int false
long false
unsigned long false
long long false
unsigned long long false
float implementation-defined
double implementation-defined
long double implementation-defined

[edit] Notes

Standard-compliant IEEE 754 floating-point implementations may detect the floating-point underflow at three predefined moments:

1) after computation of a result with absolute value smaller than std::numeric_limits<T>::min(), such implementation detects tinyness before rounding.

2) after rounding of the result to std::numeric_limits<T>::digits bits, if the result is tiny, such implementation detects tinyness after rounding.

3) if the conversion of the rounded tiny result to subnormal form resulted in the loss of precision, such implementation detects denorm loss.

[edit] Example

[edit] See also

identifies floating-point types that detect tinyness before rounding
(public static member constant)
[static]
identifies the denormalization style used by the floating-point type
(public static member constant)