Repository navigation
Fix swapped ln 2 constant names in TrigConstants - #11
Merged
Merged
Conversation
K_INV_LN_2 held ln 2 (0.693...) and K_LN_2 held 1/ln 2 (1.4427...). Swap the names so each matches its value, and update Log and Exp to use the renamed constants. Generated code is unchanged.
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.
Problem
In
TrigConstants(ToolSet/Generic/Trig.h) the two ln 2 constants had their names swapped:K_INV_LN_2held0.6931471805599453, which is ln 2.K_LN_2held1.4426950408889634, which is 1/ln 2.LogandExpused them consistently, so results were correct, but anyone reusing them would get the wrong value.Fix
Lognow usesK_LN_2andExpusesK_INV_LN_2.Same values at each call site, so the generated code doesn't change.
Testing
No other uses of either constant in the repo. Compiled a TU that includes
ToolSet.hwith g++ and printed both constants:K_LN_2 = 0.693147181,K_INV_LN_2 = 1.442695041.