std::numeri...min_exponent(3)

πŸ“¦ version 2024.07.05, in nixpkgs unstable, opensuse-leap 16.0

πŸ’– NAME πŸ’–

std::numeric_limits::min_exponent β€” std::numeric_limits::min_exponent

hiii bestie, welcome to the std::numeri...min_exponent(3) page from the C++ Standard Libary manual. Yes, the name section is literally the same thing twice β€” iconic symmetry, no notes πŸ’….


🌸 Synopsis 🌸

static const int min_exponent;      (until C++11)
static constexpr int min_exponent;  (since C++11)

okay so the tea is: the value of std::numeric_limits<T>::min_exponent is the lowest negative number n such that r^(n-1) β€” yep, r to the n-1, also shown as rn-1 in the flattened text β€” where r is std::numeric_limits<T>::radix, is a valid normalized value of the floating-point type T. That's the whole vibe ✨.


πŸ‘‘ Standard specializations πŸ‘‘

here's the whole squad, bestie β€” for each T, this is the value of std::numeric_limits<T>::min_exponent:

  • /* non-specialized */ β€” 0
  • bool β€” 0
  • char β€” 0
  • signed char β€” 0
  • unsigned char β€” 0
  • wchar_t β€” 0
  • char8_t (since C++20) β€” 0
  • char16_t (since C++11) β€” 0
  • char32_t (since C++11) β€” 0
  • short β€” 0
  • unsigned short β€” 0
  • int β€” 0
  • unsigned int β€” 0
  • long β€” 0
  • unsigned long β€” 0
  • long long (since C++11) β€” 0
  • unsigned long long (since C++11) β€” 0
  • float β€” FLT_MIN_EXP
  • double β€” DBL_MIN_EXP
  • long double β€” LDBL_MIN_EXP

πŸ¦‹ Example πŸ¦‹

This example demonstrates the relationships of min_exponent, min_exponent10, min(), and radix for the type float:

// Run this code

#include <iostream>
#include <limits>

int main()
{
    std::cout << "min() = " << std::numeric_limits<float>::min() << '\n'
              << "min_exponent10 = " << std::numeric_limits<float>::min_exponent10 << '\n'
              << std::hexfloat << '\n'
              << "min() = " << std::numeric_limits<float>::min() << '\n'
              << "min_exponent = " << std::numeric_limits<float>::min_exponent << '\n';
}

πŸ“ Output πŸ“

min() = 1.17549e-38
min_exponent10 = -37

min() = 0x1p-126
min_exponent = -125

🌈 See also 🌈

  • radix β€” the radix or integer base used by the representation of the given type. [static] (public static member constant).
  • min_exponent10 β€” the smallest negative power of ten that is a valid normalized floating-point value. [static] (public static member constant).
  • max_exponent β€” one more than the largest integer power of the radix that is a valid finite floating-point value. [static] (public static member constant).
  • max_exponent10 β€” the largest integer power of 10 that is a valid finite floating-point value. [static] (public static member constant).

πŸ’Œ source: http://cppreference.com Β· version/date: 2024.06.10 β€” mwah πŸ’‹ go slay those normalized floats, bestie πŸ’…

πŸ“¦ where this page comes from