Skip to content

v2.0.0: Replace CORDIC rotation with polynomial evaluation#7

Merged
GeEom merged 2 commits intomainfrom
further_accuracy
Mar 16, 2026
Merged

v2.0.0: Replace CORDIC rotation with polynomial evaluation#7
GeEom merged 2 commits intomainfrom
further_accuracy

Conversation

@GeEom
Copy link
Owner

@GeEom GeEom commented Mar 16, 2026

Polynomial evaluation replaces CORDIC rotation mode for all forward functions

New evaluation strategy:

  • sin/cos: Minimax (Chebyshev) polynomials via Horner's method, with range reduction to avoid
    cancellation near π/2
  • sinh/cosh: Factored Taylor series (degree 9–14 depending on precision), replacing the CORDIC rotation +
    Taylor hybrid
  • exp: Factored Taylor series (degree 7–12) with single-step argument reduction, replacing the iterative
    reduction + sinh_cosh path
  • New chebyshev table module with Remez-generated coefficients and horner() evaluator

Removed public API (breaking):

  • cordic_scale_factor(), hyperbolic_gain(), hyperbolic_gain_inv()
  • circular_rotation(), hyperbolic_rotation()
  • CordicNumber::from_i2f62()
  • CIRCULAR_GAIN_INV, HYPERBOLIC_GAIN, HYPERBOLIC_GAIN_INV constants

Accuracy improvements:

  • tan: 2.8× mean, 4.7× median (I32F32)
  • sinh/cosh: ~7× mean, ~2.3× median (I32F32)
  • tanh: 7.3× mean (I32F32); coth: 2.8× mean (I32F32)
  • exp/pow2 median improves ~1.3–2.2×

Saturation threshold changes:

  • exp positive: 22.2 → 10.4 (I16F16), 44.4 → 21.5 (I32F32)
  • exp negative: -9.2 → -11.1 (I16F16), -16.2 → -22.2 (I32F32)
  • pow2 negative: -13.2 → -16.1 (I16F16), -23.3 → -32.1 (I32F32)
  • sinh/cosh saturation: 10.4 → 11.1 (I16F16), 21.5 → 22.2 (I32F32)

GeEom added 2 commits March 16, 2026 19:23
Breaking: removes rotation kernels and from_i2f62; bump to 2.0.0.
@codecov-commenter
Copy link

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

Codecov Report

❌ Patch coverage is 98.87640% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/ops/exponential.rs 96.55% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@GeEom GeEom merged commit 6952d0f into main Mar 16, 2026
12 checks passed
@GeEom GeEom deleted the further_accuracy branch March 16, 2026 19:59
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