std::numeric_limits::round_error

From cppreference.com
 
 
Utilities library
Type support (basic types, RTTI, type traits)
Dynamic memory management
Error handling
Program utilities
Variadic functions
Date and time
Function objects
(C++11)
Relational operators
Optional and any
(C++17)
(C++17)
Pairs and tuples
(C++11)
(C++17)
Swap, forward and move
(C++14)
(C++11)
(C++11)
Type operations
(C++11)
(C++17)
 
Type support
Basic types
Fundamental types
Fixed width integer types (C++11)
Numeric limits
C numeric limits interface
Runtime type information
Type traits
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)
Type trait constants
Metafunctions
(C++17)
(C++17)
(C++17)
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++17)
(C++11)
(C++11)
(C++11)
(C++11)
 
 
static T round_error();
(until C++11)
static constexpr T round_error();
(since C++11)

Returns the largest possible rounding error in ULPs (units in the last place) as defined by ISO 10967, which can vary from 0.5 (rounding to the nearest digit) to 1.0 (rounding to zero or to infinity). It is only meaningful if std::numeric_limits<T>::is_integer == false.

[edit] Return value

T std::numeric_limits<T>::round_error()
/* non-specialized */ T();
bool false
char 0
signed char 0
unsigned char 0
wchar_t 0
char16_t 0
char32_t 0
short 0
unsigned short 0
int 0
unsigned int 0
long 0
unsigned long 0
long long 0
unsigned long long 0
float 0.5F
double 0.5
long double 0.5L

[edit] Exceptions

(none) (until C++11)
noexcept specification:  
noexcept
  
(since C++11)

[edit] See also

[static]
identifies the rounding style used by the type
(public static member constant)