std::numeri...n_exponent10(3)

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

πŸ’– NAME πŸ’–

okay bestie, welcome to the certified slay page for std::numeric_limits::min_exponent10 β€” and the official NAME line is literally std::numeric_limits::min_exponent10 - std::numeric_limits::min_exponent10 (yes, twice, it’s giving main character energy πŸ‘‘). you’re in the C++ Standard Libary manual, section std::numeri...n_exponent10(3), so fold that tiny crown into your brain and let’s go πŸ’….


✨ Synopsis ✨

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

the value of std::numeric_limits<T>::min_exponent10 is the lowest negative number n such that 10^n is a valid normalized value of the floating-point type T. no cap, that’s the whole vibe check 🫢.


🌈 Standard specializations 🌈

here’s the value of std::numeric_limits<T>::min_exponent10 for every T on the list, bestie:

  • /* 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_10_EXP
  • double β€” DBL_MIN_10_EXP
  • long double β€” LDBL_MIN_10_EXP

πŸ§ͺ 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 πŸ‘€

  • min_exponent [static] β€” one more than the smallest negative power of the radix that is a valid normalized floating-point value (public static member constant)
  • max_exponent [static] β€” one more than the largest integer power of the radix that is a valid finite floating-point value (public static member constant)
  • max_exponent10 [static] β€” the largest integer power of 10 that is a valid finite floating-point value (public static member constant)

source/version/date sign-off: http://cppreference.com Β· 2024.06.10 Β· std::numeri...n_exponent10(3) β€” mwah, bye bestie πŸ’–πŸ«Ά

πŸ“¦ where this page comes from