Skip to content
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

better trigonometric functions' implementation #1559

Merged
merged 7 commits into from
Feb 5, 2025

Conversation

Kaida-Amethyst
Copy link
Contributor

@Kaida-Amethyst Kaida-Amethyst commented Jan 23, 2025

This PR aims to address the issue raised in #1488, where inconsistencies in trigonometric functions were identified. The current implementation shows deviations from JavaScript V8 and glibc, which could lead to precision-related issues in the future.

To resolve this, I have implemented custom versions of sin, cos, and tan based on the well-established fdlibm library. These implementations have undergone extensive testing in the Moonbit-Math repository, demonstrating high consistency with JavaScript V8's results.

References:

update in 01/31/25, add asin, acos, atan, atan2.
update in 02/01/25, add sin, cos, tan for floating-point

@coveralls
Copy link
Collaborator

coveralls commented Jan 23, 2025

Pull Request Test Coverage Report for Build 5167

Details

  • 175 of 227 (77.09%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.5%) to 85.401%

Changes Missing Coverage Covered Lines Changed/Added Lines %
math/trigonometric.mbt 0 7 0.0%
double/trig_nonjs.mbt 168 213 78.87%
Totals Coverage Status
Change from base Build 5161: -0.5%
Covered Lines: 5382
Relevant Lines: 6302

💛 - Coveralls

@Lampese Lampese self-requested a review January 23, 2025 09:14
@Lampese Lampese self-assigned this Jan 23, 2025
@Lampese
Copy link
Collaborator

Lampese commented Jan 23, 2025

  • sin
  • cos
  • tan
  • atan
  • asin
  • acos
  • atan2
  • move algorithm implements to double
  • move algorithm implements to float
  • add js api
  • add test result to ensure consistency

@Lampese Lampese merged commit 103c964 into moonbitlang:main Feb 5, 2025
16 checks passed
@Kaida-Amethyst Kaida-Amethyst deleted the better_trig_func_impl branch February 6, 2025 01:25
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.

5 participants