Skip to content

Fix swapped ln 2 constant names in TrigConstants - #11

Merged
Auburn merged 1 commit into
masterfrom
fix/ln2-constant-names
Oct 14, 2026
Merged

Auburn merged 1 commit into
masterfrom
fix/ln2-constant-names

Conversation

@Auburn

@Auburn Auburn commented Oct 14, 2026

Copy link
Copy Markdown
Owner

Problem

In TrigConstants (ToolSet/Generic/Trig.h) the two ln 2 constants had their names swapped:

  • K_INV_LN_2 held 0.6931471805599453, which is ln 2.
  • K_LN_2 held 1.4426950408889634, which is 1/ln 2.

Log and Exp used them consistently, so results were correct, but anyone reusing them would get the wrong value.

Fix

  • Swap the names so each matches its value.
  • Update the two callers: Log now uses K_LN_2 and Exp uses K_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.h with g++ and printed both constants: K_LN_2 = 0.693147181, K_INV_LN_2 = 1.442695041.

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.
@Auburn
Auburn merged commit f7e9ce6 into master Oct 14, 2026
8 checks passed
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