docs: document why map_to_index assumes value is not 0, inf, or NaN#4930
Open
chimchim89 wants to merge 1 commit intoopen-telemetry:mainfrom
Open
docs: document why map_to_index assumes value is not 0, inf, or NaN#4930chimchim89 wants to merge 1 commit intoopen-telemetry:mainfrom
chimchim89 wants to merge 1 commit intoopen-telemetry:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Replaces the FIXME comment in
ExponentMapping.map_to_indexwith a detailed explanation of whyvaluecan be assumed to not be0,inf, orNaN.Zero is represented in IEEE 754 with all exponent bits set to 0, giving
get_ieee_754_exponenta result of -1023. Since-1023 is less than
MIN_NORMAL_EXPONENT(-1022), zero is caught by the existing guard and returned early. Inf is represented in IEEE 754 with all 11 exponent bits set to 1 and a mantissa of 0, givingget_ieee_754_exponenta result of 1024 and correction a value of -1. NaN is represented in IEEE 754 with all 11 exponent bits set to 1 and a non-zero mantissa of unspecified bit pattern, producing an unspecified correction value. Inf and NaN are not caught by the guard above. As defined in theMappingbase class, callers must ensure that only finite, positive values are passed tomap_to_index.Type of change
How Has This Been Tested?
No tests required. This is a documentation-only change. No logic was modified.
Does This PR Require a Contrib Repo Change?
Checklist: