Skip to content

Trig functions in turns #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jun 3, 2025
Merged

Trig functions in turns #4

merged 8 commits into from
Jun 3, 2025

Conversation

jatinchowdhury18
Copy link
Contributor

No description provided.

@jatinchowdhury18 jatinchowdhury18 requested a review from Copilot June 3, 2025 02:02
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for trigonometric approximations using turns, extending the library’s sine and cosine functions to support sin(2πx)/cos(2πx) approximations. Key changes include:

  • Updates to the plotter module to incorporate new reference functions and adjusted parameter ranges/tolerances.
  • Addition of benchmark and test cases for the new trigonometric turn approximations.
  • Updates to build configuration and documentation to reflect the new feature.

Reviewed Changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tools/plotter/plotter.cpp Added include and function for sincospi; modified range, tolerance, and plotted function.
tools/plotter/CMakeLists.txt Added compile definition for math defines.
tools/bench/trig_turns_bench.cpp New benchmarks for various trigonometric approximations.
tools/bench/CMakeLists.txt Updated benchmark version and added new benchmark target.
test/src/trig_turns_approx_test.cpp New test cases for different order approximations.
test/src/test_helpers.hpp Adjusted relative error computation to add an epsilon bias.
test/src/reference/sincospi.hpp New reference implementation for sincospi functions.
test/CMakeLists.txt Included the new trigonometric approximation tests.
include/math_approx/src/trig_approx.hpp Added new namespace and functions for trigonometric turn approximations.
README.md Updated documentation to list sin(2πx)/cos(2πx) as supported.
Comments suppressed due to low confidence (1)

test/src/test_helpers.hpp:60

  • Consider verifying that adding epsilon to the denominator does not under-report relative errors for values near zero, ensuring the metric accurately reflects the approximation quality.
err[i] = (actual[i] - approx[i]) / (actual[i] + std::numeric_limits<float>::epsilon());

@jatinchowdhury18 jatinchowdhury18 merged commit 2497457 into main Jun 3, 2025
3 checks passed
@jatinchowdhury18 jatinchowdhury18 deleted the trig-turns branch June 3, 2025 07: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.

1 participant