Module: OpenTelemetry::SDK::Metrics::Aggregation::ExponentialHistogram::IEEE754
- Defined in:
- lib/opentelemetry/sdk/metrics/aggregation/exponential_histogram/ieee_754.rb
Overview
IEEE754 standard for floating-point calculation
Constant Summary collapse
- MANTISSA_WIDTH =
52- EXPONENT_WIDTH =
11- MANTISSA_MASK =
(1 << MANTISSA_WIDTH) - 1
- EXPONENT_BIAS =
(2**(EXPONENT_WIDTH - 1)) - 1
- EXPONENT_MASK =
((1 << EXPONENT_WIDTH) - 1) << MANTISSA_WIDTH
- SIGN_MASK =
1 << (EXPONENT_WIDTH + MANTISSA_WIDTH)
- MIN_NORMAL_EXPONENT =
-EXPONENT_BIAS + 1
- MAX_NORMAL_EXPONENT =
EXPONENT_BIAS- MIN_NORMAL_VALUE =
Float::MIN
- MAX_NORMAL_VALUE =
Float::MAX
Class Method Summary collapse
-
.get_ieee_754_exponent(value) ⇒ Object
Returns the unbiased IEEE 754 exponent of value.
-
.get_ieee_754_mantissa(value) ⇒ Object
Returns the IEEE 754 mantissa bits of value.
Class Method Details
.get_ieee_754_exponent(value) ⇒ Object
Returns the unbiased IEEE 754 exponent of value.
29 30 31 32 |
# File 'lib/opentelemetry/sdk/metrics/aggregation/exponential_histogram/ieee_754.rb', line 29 def self.get_ieee_754_exponent(value) bits = [value].pack('d').unpack1('Q') ((bits & EXPONENT_MASK) >> MANTISSA_WIDTH) - EXPONENT_BIAS end |
.get_ieee_754_mantissa(value) ⇒ Object
Returns the IEEE 754 mantissa bits of value.
35 36 37 38 |
# File 'lib/opentelemetry/sdk/metrics/aggregation/exponential_histogram/ieee_754.rb', line 35 def self.get_ieee_754_mantissa(value) bits = [value].pack('d').unpack1('Q') bits & MANTISSA_MASK end |