std::numeri...x_exponent10(3)
π NAME π
std::numeric_limits::max_exponent10 β std::numeric_limits::max_exponent10
okay so bestie, welcome to the C++ Standard Libary manual β yes, thatβs the manual name, spelling and all π
β and todayβs main character is std::numeric_limits::max_exponent10. Itβs giving very specific floating-point limit energy, and weβre gonna understand it fr fr. π¦
β¨ Synopsis β¨
Hereβs the signature tea β:
static const int max_exponent10; (until C++11)
static constexpr int max_exponent10; (since C++11)
The value of std::numeric_limits<T>::max_exponent10 is the largest positive number n such that 10^n is a representable finite value of the floating-point type T. πΈ
π Standard specializations π
For each T, hereβs the value of std::numeric_limits<T>::max_exponent10 β no cap, this is the whole roster:
/* non-specialized */β0boolβ0charβ0signed charβ0unsigned charβ0wchar_tβ0char8_t (since C++20)β0char16_t (since C++11)β0char32_t (since C++11)β0shortβ0unsigned shortβ0intβ0unsigned intβ0longβ0unsigned longβ0long long (since C++11)β0unsigned long long (since C++11)β0floatβFLT_MAX_10_EXPdoubleβDBL_MAX_10_EXPlong doubleβLDBL_MAX_10_EXP
bestie, notice how all the non-specialized and integer-ish types are sitting at 0 β thatβs not a typo, thatβs literally the table. π
π Example π
Demonstrates the relationships of max_exponent, max_exponent10, and max() for the type float:
// Run this code
#include <iostream>
#include <limits>
int main()
{
std::cout << "max() = " << std::numeric_limits<float>::max() << '\n'
<< "max_exponent10 = " << std::numeric_limits<float>::max_exponent10 << '\n'
<< std::hexfloat << '\n'
<< "max() = " << std::numeric_limits<float>::max() << '\n'
<< "max_exponent = " << std::numeric_limits<float>::max_exponent << '\n';
}
π Output π
max() = 3.40282e+38
max_exponent10 = 38
max() = 0x1.fffffep+127
max_exponent = 128
π See also π
Go peek at these too, iykyk:
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)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)min_exponent10[static]β the smallest negative power of ten that is a valid normalized floating-point value (public static member constant)
Thatβs the whole page, bestie π«Ά β source: http://cppreference.com, version/date: 2024.06.10. Slay and stay numeric πβ¨
π¦ where this page comes from
- nixpkgs unstable: stdman 2024.07.05
- opensuse-leap 16.0: stdman 2024.07.05-bp160.1.9 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms