|
nfx-datatypes 0.1.1
Cross-platform C++ library with high-precision Int128 and Decimal datatypes
|
Internal constants for Decimal and Int128 implementations. More...
#include <array>#include <cstdint>#include <string_view>
Go to the source code of this file.
Variables | |
| constexpr int | nfx::datatypes::constants::BITS_PER_UINT8 { 8 } |
| Bit shift amount for 8-bit operations. | |
| constexpr int | nfx::datatypes::constants::BITS_PER_UINT16 { 16 } |
| Bit shift amount for 16-bit operations. | |
| constexpr int | nfx::datatypes::constants::BITS_PER_UINT32 { 32 } |
| Bit shift amount for 32-bit operations (used for extracting/combining uint32_t from uint64_t). | |
| constexpr int | nfx::datatypes::constants::BITS_PER_UINT64 { 64 } |
| Bit shift amount for 64-bit operations (used for extracting/combining uint64_t from uint128_t). | |
| constexpr std::uint64_t | nfx::datatypes::constants::UINT32_MAX_VALUE { 0xFFFFFFFFULL } |
| Maximum value for 32-bit unsigned integer (2^32 - 1). | |
| constexpr std::uint64_t | nfx::datatypes::constants::BIT_MASK_ONE { 1ULL } |
| Bit mask value 1 as unsigned 64-bit (used for bit operations). | |
| constexpr std::uint64_t | nfx::datatypes::constants::BIT_MASK_ZERO { 0ULL } |
| Bit mask value 0 as unsigned 64-bit (used for bit operations). | |
| constexpr int | nfx::datatypes::constants::BITS_PER_NIBBLE { 4 } |
| Bit shift amount for 4-bit operations. | |
| constexpr int | nfx::datatypes::constants::BITS_PER_PAIR { 2 } |
| Bit shift amount for 2-bit operations. | |
| constexpr std::uint64_t | nfx::datatypes::constants::BIT_MASK_UPPER_32 { 0xFFFFFFFF00000000ULL } |
| Mask for testing upper 32 bits of 64-bit value. | |
| constexpr std::uint64_t | nfx::datatypes::constants::BIT_MASK_UPPER_16 { 0xFFFF000000000000ULL } |
| Mask for testing upper 16 bits of upper 32 bits. | |
| constexpr std::uint64_t | nfx::datatypes::constants::BIT_MASK_UPPER_8 { 0xFF00000000000000ULL } |
| Mask for testing upper 8 bits of upper 16 bits. | |
| constexpr std::uint64_t | nfx::datatypes::constants::BIT_MASK_UPPER_4 { 0xF000000000000000ULL } |
| Mask for testing upper 4 bits of upper 8 bits. | |
| constexpr std::uint64_t | nfx::datatypes::constants::BIT_MASK_UPPER_2 { 0xC000000000000000ULL } |
| Mask for testing upper 2 bits of upper 4 bits. | |
| constexpr std::uint64_t | nfx::datatypes::constants::BIT_MASK_MSB { 0x8000000000000000ULL } |
| Mask for testing most significant bit. | |
| constexpr std::uint8_t | nfx::datatypes::constants::DOUBLE_DECIMAL_PRECISION { 15U } |
| Maximum decimal precision that IEEE 754 double can accurately represent. | |
| constexpr int | nfx::datatypes::constants::INT128_BASE { 10 } |
| Base for decimal digit conversion. | |
| constexpr int | nfx::datatypes::constants::INT128_MAX_BIT_INDEX { 127 } |
| Maximum bit index for 128-bit integers (0-127). | |
| constexpr std::uint64_t | nfx::datatypes::constants::INT128_MUL10_OVERFLOW_THRESHOLD { 0x1999999999999999ULL } |
| Maximum high 64-bit value before multiplying by 10 causes overflow (0xFFFFFFFFFFFFFFFF / 10). | |
| constexpr double | nfx::datatypes::constants::INT128_MAX_AS_DOUBLE { 1.7014118346046923e38 } |
| Double approximation of maximum positive Int128 value (2^127 - 1) for overflow checks. | |
| constexpr double | nfx::datatypes::constants::INT128_MIN_AS_DOUBLE { -1.7014118346046924e38 } |
| Double approximation of minimum negative Int128 value (-2^127) for overflow checks. | |
| constexpr std::uint64_t | nfx::datatypes::constants::INT128_MAX_POSITIVE_HIGH { 0x7FFFFFFFFFFFFFFFULL } |
| High 64 bits of maximum positive 128-bit signed integer (2^127 - 1). | |
| constexpr std::uint64_t | nfx::datatypes::constants::INT128_MAX_POSITIVE_LOW { 0xFFFFFFFFFFFFFFFFULL } |
| Low 64 bits of maximum positive 128-bit signed integer (2^127 - 1). | |
| constexpr std::uint64_t | nfx::datatypes::constants::INT128_MIN_NEGATIVE_HIGH { 0x8000000000000000ULL } |
| High 64 bits of minimum negative 128-bit signed integer (-2^127). | |
| constexpr std::uint64_t | nfx::datatypes::constants::INT128_MIN_NEGATIVE_LOW { 0x0000000000000000ULL } |
| Low 64 bits of minimum negative 128-bit signed integer (-2^127). | |
| constexpr size_t | nfx::datatypes::constants::INT128_MAX_DIGIT_COUNT { 39UL } |
| Maximum number of decimal digits in a 128-bit signed integer (2^127 - 1 has 39 digits). | |
| constexpr size_t | nfx::datatypes::constants::INT128_MAX_STRING_LENGTH { 64UL } |
| Maximum expected length for Int128 string representation. | |
| constexpr int | nfx::datatypes::constants::INT128_ISQRT_MAX_ITERATIONS { 100 } |
| Maximum iterations for Int128::isqrt() Heron's method. | |
| constexpr int | nfx::datatypes::constants::DECIMAL_SQRT_MAX_ITERATIONS { 10 } |
| Maximum iterations for Decimal::sqrt() Newton-Raphson refinement. | |
| constexpr std::string_view | nfx::datatypes::constants::INT128_MAX_POSITIVE_STRING { "170141183460469231731687303715884105727" } |
| Maximum positive value as decimal string (2^127 - 1). | |
| constexpr std::string_view | nfx::datatypes::constants::INT128_MAX_NEGATIVE_STRING { "170141183460469231731687303715884105728" } |
| Maximum negative value as decimal string (absolute value of -2^127). | |
| constexpr int | nfx::datatypes::constants::INT128_DIGITS { 127 } |
| Number of value bits in Int128 (excluding sign bit). | |
| constexpr int | nfx::datatypes::constants::INT128_DIGITS10 { 38 } |
| Number of decimal digits representable in Int128 (floor(127 * log10(2))). | |
| constexpr int | nfx::datatypes::constants::INT128_MAX_DIGITS10 { 0 } |
| Maximum decimal digits for Int128 (not applicable for integers). | |
| constexpr int | nfx::datatypes::constants::INT128_RADIX { 2 } |
| Numeric base for Int128 (binary base-2 system). | |
| constexpr std::uint64_t | nfx::datatypes::constants::DECIMAL_BASE { 10ULL } |
| Base for decimal digit conversion. | |
| constexpr std::uint64_t | nfx::datatypes::constants::DECIMAL_96BIT_MAX_LOW { 0xFFFFFFFFFFFFFFFFULL } |
| Maximum 96-bit mantissa value (2^96 - 1) as low 64 bits. | |
| constexpr std::uint64_t | nfx::datatypes::constants::DECIMAL_96BIT_MAX_HIGH { 0x00000000FFFFFFFFULL } |
| Maximum 96-bit mantissa value (2^96 - 1) as high 32 bits. | |
| constexpr int | nfx::datatypes::constants::DECIMAL_MANTISSA_BITS { 96 } |
| Number of bits in Decimal mantissa (96-bit mantissa). | |
| constexpr int | nfx::datatypes::constants::DECIMAL_DIGITS10 { 28 } |
| Number of decimal digits representable in Decimal (28 digits). | |
| constexpr int | nfx::datatypes::constants::DECIMAL_RADIX { 10 } |
| Numeric base for Decimal (base-10 decimal system). | |
| constexpr double | nfx::datatypes::constants::DECIMAL_FRACTIONAL_EPSILON { 1e-15 } |
| Negligibility threshold for fractional parts in double conversion (10^-15). | |
| constexpr std::uint32_t | nfx::datatypes::constants::DECIMAL_MAX_MANTISSA_0 { 0xFFFFFFFFU } |
| Lower 32 bits of maximum Decimal mantissa (2^96 - 1). | |
| constexpr std::uint32_t | nfx::datatypes::constants::DECIMAL_MAX_MANTISSA_1 { 0xFFFFFFFFU } |
| Middle 32 bits of maximum Decimal mantissa (2^96 - 1). | |
| constexpr std::uint32_t | nfx::datatypes::constants::DECIMAL_MAX_MANTISSA_2 { 0xFFFFFFFFU } |
| Upper 32 bits of maximum Decimal mantissa (2^96 - 1). | |
| constexpr std::uint32_t | nfx::datatypes::constants::DECIMAL_MIN_MANTISSA_0 { 1U } |
| Lower 32 bits of minimum positive Decimal mantissa (1 × 10^-28). | |
| constexpr std::uint32_t | nfx::datatypes::constants::DECIMAL_MIN_MANTISSA_1 { 0U } |
| Middle 32 bits of minimum positive Decimal mantissa (1 × 10^-28). | |
| constexpr std::uint32_t | nfx::datatypes::constants::DECIMAL_MIN_MANTISSA_2 { 0U } |
| Upper 32 bits of minimum positive Decimal mantissa (1 × 10^-28). | |
| constexpr std::uint8_t | nfx::datatypes::constants::DECIMAL_MAXIMUM_PLACES { 28U } |
| Maximum number of decimal places supported. | |
| constexpr std::uint8_t | nfx::datatypes::constants::DECIMAL_DIVISION_EXTRA_PRECISION { 18U } |
| Extra precision digits added during division to maintain accuracy. | |
| constexpr std::uint8_t | nfx::datatypes::constants::DECIMAL_ROUNDING_THRESHOLD { 5U } |
| Rounding threshold value (round up if digit >= this value). | |
| constexpr int | nfx::datatypes::constants::DECIMAL_MANTISSA_ARRAY_SIZE { 3 } |
| Size of mantissa array in Decimal (3 x 32-bit words = 96 bits). | |
| constexpr std::string_view | nfx::datatypes::constants::DECIMAL_SQRT_EPSILON { "0.000001" } |
| Convergence epsilon for Newton-Raphson sqrt algorithm (10^-6 for reliable convergence). | |
| constexpr std::uint32_t | nfx::datatypes::constants::DECIMAL_SCALE_MASK { 0x00FF0000U } |
| Bit mask for extracting scale from flags field (bits 16-23). | |
| constexpr std::uint32_t | nfx::datatypes::constants::DECIMAL_SIGN_MASK { 0x80000000U } |
| Bit mask for sign detection (bit 31). | |
| constexpr std::uint8_t | nfx::datatypes::constants::DECIMAL_SCALE_SHIFT { 16U } |
| Bit position for scale field in flags. | |
| constexpr size_t | nfx::datatypes::constants::DECIMAL_MAX_STRING_LENGTH { 64UL } |
| Maximum expected length for decimal string representation. | |
| constexpr size_t | nfx::datatypes::constants::DECIMAL_STRING_BUFFER_SIZE { 64UL } |
| Reserved buffer size for string conversion to avoid reallocation. | |
| constexpr std::uint8_t | nfx::datatypes::constants::DECIMAL_POWER_TABLE_SIZE { 20U } |
| Power of 10 lookup table size for fast scaling operations (64-bit range). | |
| constexpr std::uint8_t | nfx::datatypes::constants::DECIMAL_EXTENDED_POWER_MIN { 20U } |
| Minimum power for extended 128-bit power-of-10 table (10^20 and above). | |
| constexpr std::uint8_t | nfx::datatypes::constants::DECIMAL_EXTENDED_POWER_MAX { 28U } |
| Maximum power for extended 128-bit power-of-10 table (10^28). | |
| constexpr std::array< std::uint64_t, DECIMAL_POWER_TABLE_SIZE > | nfx::datatypes::constants::DECIMAL_POWERS_OF_10 |
| Powers of 10 lookup table for efficient scaling operations (64-bit range: 10^0 to 10^19). | |
| constexpr std::array< std::pair< std::uint64_t, std::uint64_t >, 9 > | nfx::datatypes::constants::DECIMAL_EXTENDED_POWERS_OF_10 |
| Power-of-10 calculation constants for 128-bit arithmetic. | |
Internal constants for Decimal and Int128 implementations.
Defines precision limits, scale constraints, and internal masks
Definition in file Constants.h.
|
inlineconstexpr |
Mask for testing most significant bit.
Definition at line 94 of file Constants.h.
|
inlineconstexpr |
Bit mask value 1 as unsigned 64-bit (used for bit operations).
Definition at line 63 of file Constants.h.
|
inlineconstexpr |
Mask for testing upper 16 bits of upper 32 bits.
Definition at line 82 of file Constants.h.
|
inlineconstexpr |
Mask for testing upper 2 bits of upper 4 bits.
Definition at line 91 of file Constants.h.
|
inlineconstexpr |
Mask for testing upper 32 bits of 64-bit value.
Definition at line 79 of file Constants.h.
|
inlineconstexpr |
Mask for testing upper 4 bits of upper 8 bits.
Definition at line 88 of file Constants.h.
|
inlineconstexpr |
Mask for testing upper 8 bits of upper 16 bits.
Definition at line 85 of file Constants.h.
|
inlineconstexpr |
Bit mask value 0 as unsigned 64-bit (used for bit operations).
Definition at line 66 of file Constants.h.
|
inlineconstexpr |
Bit shift amount for 4-bit operations.
Definition at line 69 of file Constants.h.
|
inlineconstexpr |
Bit shift amount for 2-bit operations.
Definition at line 72 of file Constants.h.
|
inlineconstexpr |
Bit shift amount for 16-bit operations.
Definition at line 51 of file Constants.h.
|
inlineconstexpr |
Bit shift amount for 32-bit operations (used for extracting/combining uint32_t from uint64_t).
Definition at line 54 of file Constants.h.
|
inlineconstexpr |
Bit shift amount for 64-bit operations (used for extracting/combining uint64_t from uint128_t).
Definition at line 57 of file Constants.h.
|
inlineconstexpr |
Bit shift amount for 8-bit operations.
Definition at line 48 of file Constants.h.
|
inlineconstexpr |
Maximum 96-bit mantissa value (2^96 - 1) as high 32 bits.
Definition at line 207 of file Constants.h.
|
inlineconstexpr |
Maximum 96-bit mantissa value (2^96 - 1) as low 64 bits.
Definition at line 204 of file Constants.h.
|
inlineconstexpr |
Base for decimal digit conversion.
Definition at line 197 of file Constants.h.
|
inlineconstexpr |
Number of decimal digits representable in Decimal (28 digits).
Definition at line 217 of file Constants.h.
|
inlineconstexpr |
Extra precision digits added during division to maintain accuracy.
Definition at line 251 of file Constants.h.
|
inlineconstexpr |
Maximum power for extended 128-bit power-of-10 table (10^28).
Definition at line 292 of file Constants.h.
|
inlineconstexpr |
Minimum power for extended 128-bit power-of-10 table (10^20 and above).
Definition at line 289 of file Constants.h.
|
inlineconstexpr |
Power-of-10 calculation constants for 128-bit arithmetic.
Pre-computed constants for powers that exceed 64-bit range. These are the low and high 64-bit components of 10^n where n > 19.
Definition at line 323 of file Constants.h.
|
inlineconstexpr |
Negligibility threshold for fractional parts in double conversion (10^-15).
Definition at line 223 of file Constants.h.
|
inlineconstexpr |
Size of mantissa array in Decimal (3 x 32-bit words = 96 bits).
Definition at line 257 of file Constants.h.
|
inlineconstexpr |
Number of bits in Decimal mantissa (96-bit mantissa).
Definition at line 214 of file Constants.h.
|
inlineconstexpr |
Lower 32 bits of maximum Decimal mantissa (2^96 - 1).
Definition at line 230 of file Constants.h.
|
inlineconstexpr |
Middle 32 bits of maximum Decimal mantissa (2^96 - 1).
Definition at line 233 of file Constants.h.
|
inlineconstexpr |
Upper 32 bits of maximum Decimal mantissa (2^96 - 1).
Definition at line 236 of file Constants.h.
|
inlineconstexpr |
Maximum expected length for decimal string representation.
Definition at line 276 of file Constants.h.
|
inlineconstexpr |
Maximum number of decimal places supported.
Definition at line 248 of file Constants.h.
|
inlineconstexpr |
Lower 32 bits of minimum positive Decimal mantissa (1 × 10^-28).
Definition at line 239 of file Constants.h.
|
inlineconstexpr |
Middle 32 bits of minimum positive Decimal mantissa (1 × 10^-28).
Definition at line 242 of file Constants.h.
|
inlineconstexpr |
Upper 32 bits of minimum positive Decimal mantissa (1 × 10^-28).
Definition at line 245 of file Constants.h.
|
inlineconstexpr |
Power of 10 lookup table size for fast scaling operations (64-bit range).
Definition at line 286 of file Constants.h.
|
inlineconstexpr |
Powers of 10 lookup table for efficient scaling operations (64-bit range: 10^0 to 10^19).
Definition at line 295 of file Constants.h.
|
inlineconstexpr |
Numeric base for Decimal (base-10 decimal system).
Definition at line 220 of file Constants.h.
|
inlineconstexpr |
Rounding threshold value (round up if digit >= this value).
Definition at line 254 of file Constants.h.
|
inlineconstexpr |
Bit mask for extracting scale from flags field (bits 16-23).
Definition at line 263 of file Constants.h.
|
inlineconstexpr |
Bit position for scale field in flags.
Definition at line 269 of file Constants.h.
|
inlineconstexpr |
Bit mask for sign detection (bit 31).
Definition at line 266 of file Constants.h.
|
inlineconstexpr |
Convergence epsilon for Newton-Raphson sqrt algorithm (10^-6 for reliable convergence).
Definition at line 260 of file Constants.h.
|
inlineconstexpr |
Maximum iterations for Decimal::sqrt() Newton-Raphson refinement.
Definition at line 164 of file Constants.h.
|
inlineconstexpr |
Reserved buffer size for string conversion to avoid reallocation.
Definition at line 279 of file Constants.h.
|
inlineconstexpr |
Maximum decimal precision that IEEE 754 double can accurately represent.
Definition at line 101 of file Constants.h.
|
inlineconstexpr |
Base for decimal digit conversion.
Definition at line 112 of file Constants.h.
|
inlineconstexpr |
Number of value bits in Int128 (excluding sign bit).
Definition at line 177 of file Constants.h.
|
inlineconstexpr |
Number of decimal digits representable in Int128 (floor(127 * log10(2))).
Definition at line 180 of file Constants.h.
|
inlineconstexpr |
Maximum iterations for Int128::isqrt() Heron's method.
Definition at line 161 of file Constants.h.
|
inlineconstexpr |
Double approximation of maximum positive Int128 value (2^127 - 1) for overflow checks.
Definition at line 129 of file Constants.h.
|
inlineconstexpr |
Maximum bit index for 128-bit integers (0-127).
Definition at line 119 of file Constants.h.
|
inlineconstexpr |
Maximum number of decimal digits in a 128-bit signed integer (2^127 - 1 has 39 digits).
Definition at line 155 of file Constants.h.
|
inlineconstexpr |
Maximum decimal digits for Int128 (not applicable for integers).
Definition at line 183 of file Constants.h.
|
inlineconstexpr |
Maximum negative value as decimal string (absolute value of -2^127).
Definition at line 170 of file Constants.h.
|
inlineconstexpr |
High 64 bits of maximum positive 128-bit signed integer (2^127 - 1).
Definition at line 139 of file Constants.h.
|
inlineconstexpr |
Low 64 bits of maximum positive 128-bit signed integer (2^127 - 1).
Definition at line 142 of file Constants.h.
|
inlineconstexpr |
Maximum positive value as decimal string (2^127 - 1).
Definition at line 167 of file Constants.h.
|
inlineconstexpr |
Maximum expected length for Int128 string representation.
Definition at line 158 of file Constants.h.
|
inlineconstexpr |
Double approximation of minimum negative Int128 value (-2^127) for overflow checks.
Definition at line 132 of file Constants.h.
|
inlineconstexpr |
High 64 bits of minimum negative 128-bit signed integer (-2^127).
Definition at line 145 of file Constants.h.
|
inlineconstexpr |
Low 64 bits of minimum negative 128-bit signed integer (-2^127).
Definition at line 148 of file Constants.h.
|
inlineconstexpr |
Maximum high 64-bit value before multiplying by 10 causes overflow (0xFFFFFFFFFFFFFFFF / 10).
Definition at line 126 of file Constants.h.
|
inlineconstexpr |
Numeric base for Int128 (binary base-2 system).
Definition at line 186 of file Constants.h.
|
inlineconstexpr |
Maximum value for 32-bit unsigned integer (2^32 - 1).
Definition at line 60 of file Constants.h.