Skip to content

v0.5.0: Tune estimated thresholds via accuracy search#4

Merged
GeEom merged 1 commit intomainfrom
threshold_tuning
Jan 11, 2026
Merged

v0.5.0: Tune estimated thresholds via accuracy search#4
GeEom merged 1 commit intomainfrom
threshold_tuning

Conversation

@GeEom
Copy link
Owner

@GeEom GeEom commented Jan 11, 2026

Saturation semantics for total functions, improved angle reduction, and threshold tuning

Saturation Over Errors:

  • Removed Error::Overflow variant entirely
  • Total functions (exp, pow2, sinh, cosh, tan) now saturate deterministically
  • exp/pow2: Saturate to T::MAX for large positive inputs, zero for large negative
  • sinh: Saturates to T::MAX or T::MIN based on sign
  • cosh/tan: Saturate to T::MAX near poles/overflow

sin/cos Large Angle Fix:

  • Replaced iterative angle reduction loop with direct quotient computation
  • Old approach hit iteration limits for angles near I16F16::MAX
  • New approach: reduced = angle - round(angle/2π) * 2π

Threshold Tuning:

  • Taylor/CORDIC crossover thresholds optimized via golden section search
  • High-precision (≥24 frac bits): 0.05 → 0.1366
  • Low-precision (<24 frac bits): 0.1 → 0.2776

Documentation & Cleanup:

  • Added saturation threshold tables to README
  • Comprehensive doc comments for overflow behavior
  • Made NormalizedLnArg and related helpers crate-private

@codecov-commenter
Copy link

codecov-commenter commented Jan 11, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 83.33333% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/ops/circular.rs 80.00% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

Replace Overflow error with silent saturation for total functions (exp, pow2,
sinh, cosh, tan). Fix sin/cos to handle extreme angles via direct quotient
computation. Tune Taylor thresholds for improved accuracy.
@GeEom GeEom merged commit 6e2eb93 into main Jan 11, 2026
11 checks passed
@GeEom GeEom deleted the threshold_tuning branch January 11, 2026 12:55
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.

2 participants