Skip to content

Comments

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
chimchim89:docs/exponent-mapping-edge-case-assumptions
Open

docs: document why map_to_index assumes value is not 0, inf, or NaN#4930
chimchim89 wants to merge 1 commit intoopen-telemetry:mainfrom
chimchim89:docs/exponent-mapping-edge-case-assumptions

Conversation

@chimchim89
Copy link

@chimchim89 chimchim89 commented Feb 22, 2026

Description

Replaces the FIXME comment in ExponentMapping.map_to_index with a detailed explanation of why value can be assumed to not be 0, inf, or NaN.

Zero is represented in IEEE 754 with all exponent bits set to 0, giving get_ieee_754_exponent a 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, giving get_ieee_754_exponent a 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 the Mapping base class, callers must ensure that only finite, positive values are passed to map_to_index.

Type of change

  • This change requires a documentation update

How Has This Been Tested?

No tests required. This is a documentation-only change. No logic was modified.

  • Test A

Does This PR Require a Contrib Repo Change?

  • No.

Checklist:

  • Followed the style guidelines of this project
  • Changelogs have been updated
  • Unit tests have been added
  • Documentation has been updated

@chimchim89 chimchim89 requested a review from a team as a code owner February 22, 2026 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant