std::numeric_limits<T>::lowest

From cppreference.com
 
 
Utilities library
General utilities
Date and time
Function objects
Formatting library (C++20)
(C++11)
Relational operators (deprecated in C++20)
Integer comparison functions
(C++20)(C++20)(C++20)   
(C++20)
Swap and type operations
(C++14)
(C++11)
(C++11)
(C++11)
(C++17)
Common vocabulary types
(C++11)
(C++17)
(C++17)
(C++17)
(C++11)
(C++17)
(C++23)
Elementary string conversions
(C++17)
(C++17)
 
 
 
static constexpr T lowest() noexcept;
(since C++11)

Returns the lowest finite value representable by the numeric type T, that is, a finite value x such that there is no other finite value y where y < x. This is different from std::numeric_limits<T>::min() for floating-point types. Only meaningful for bounded types.

Return value

T std::numeric_limits<T>::lowest()
/* non-specialized */ (C++11) T()
bool (C++11) false
char (C++11) CHAR_MIN
signed char (C++11) SCHAR_MIN
unsigned char (C++11) 0
wchar_t (C++11) WCHAR_MIN
char8_t (C++20) 0
char16_t (C++11) 0
char32_t (C++11) 0
short (C++11) SHRT_MIN
unsigned short (C++11) 0
int (C++11) INT_MIN
unsigned int (C++11) 0
long (C++11) LONG_MIN
unsigned long (C++11) 0
long long (C++11) LLONG_MIN
unsigned long long (C++11) 0
float (C++11) -FLT_MAX
double (C++11) -DBL_MAX
long double (C++11) -LDBL_MAX

Notes

For every standard C++ floating-point type T std::numeric_limits<T>::lowest() == -std::numeric_limits<T>::max(), but this does not necessarily have to be the case for any third-party specialization.

Example

Demonstrates min, max, and lowest for floating-point types

#include <limits>
#include <iostream>
int main()
{
 
    std::cout << "std::numeric_limits<T>::min():\n"
              << "\tfloat: " << std::numeric_limits<float>::min()
              << " or " << std::hexfloat << std::numeric_limits<float>::min() << '\n'
              << "\tdouble: " << std::defaultfloat << std::numeric_limits<double>::min()
              << " or " << std::hexfloat << std::numeric_limits<double>::min() << '\n';
    std::cout << "std::numeric_limits<T>::lowest():\n"
              << "\tfloat: " << std::defaultfloat << std::numeric_limits<float>::lowest()
              << " or " << std::hexfloat << std::numeric_limits<float>::lowest() << '\n'
              << "\tdouble: " << std::defaultfloat << std::numeric_limits<double>::lowest()
              << " or " << std::hexfloat << std::numeric_limits<double>::lowest() << '\n';
    std::cout << "std::numeric_limits<T>::max():\n"
              << "\tfloat: " << std::defaultfloat << std::numeric_limits<float>::max()
              << " or " << std::hexfloat << std::numeric_limits<float>::max() << '\n'
              << "\tdouble: " << std::defaultfloat << std::numeric_limits<double>::max()
              << " or " << std::hexfloat << std::numeric_limits<double>::max() << '\n';
}

Output:

std::numeric_limits<T>::min():
        float: 1.17549e-38 or 0x1p-126
        double: 2.22507e-308 or 0x1p-1022
std::numeric_limits<T>::lowest():
        float: -3.40282e+38 or -0x1.fffffep+127
        double: -1.79769e+308 or -0x1.fffffffffffffp+1023
std::numeric_limits<T>::max():
        float: 3.40282e+38 or 0x1.fffffep+127
        double: 1.79769e+308 or 0x1.fffffffffffffp+1023

See also

[static]
returns the smallest finite value of the given type
(public static member function)
[static]
returns the smallest positive subnormal value of the given floating-point type
(public static member function)
[static]
returns the largest finite value of the given type
(public static member function)