Skip to content

Conversation

@forfudan
Copy link
Owner

@forfudan forfudan commented Jul 6, 2025

This pull request enhances the BigDecimal module by adding new trigonometric functions, improving precision handling, and updating test cases to ensure correctness. The most important changes include the addition of tangent, cotangent, cosecant, and secant functions, updates to the sin and cos functions for zero handling, and the inclusion of comprehensive test cases for the new functionality.

Enhancements to BigDecimal functionality:

  • Added new trigonometric functions: tan, cot, csc, and sec to the BigDecimal struct, enabling calculations for tangent, cotangent, cosecant, and secant with arbitrary precision. [1] [2]
  • Improved handling of zero values in sin and cos functions to use BigDecimal(BigUInt.ZERO) and BigDecimal(BigUInt.ONE) for better precision and consistency. [1] [2] [3]

Updates to test cases:

  • Added test cases for new trigonometric functions (tan, cot, csc, and sec) to the TOML test data file, covering edge cases and typical values.
  • Updated the run_test function to directly compare BigDecimal objects instead of converting them to strings for improved accuracy in assertions.
  • Expanded the test_bigdecimal_trigonometric function to include tests for cos, tan, and cot functions alongside existing tests for sin and arctan.

Codebase improvements:

  • Refactored import statements in trigonometric.mojo to include decimojo.bigdecimal.constants, ensuring access to constants like π for trigonometric calculations.

@forfudan forfudan merged commit 21ee99b into main Jul 6, 2025
1 check passed
@forfudan forfudan deleted the trig branch July 6, 2025 16:03
forfudan added a commit that referenced this pull request Jul 6, 2025
forfudan added a commit that referenced this pull request Jul 6, 2025
forfudan added a commit that referenced this pull request Jul 6, 2025
forfudan added a commit that referenced this pull request Jul 6, 2025
forfudan added a commit that referenced this pull request Jul 6, 2025
forfudan added a commit that referenced this pull request Jul 7, 2025
forfudan added a commit that referenced this pull request Jul 7, 2025
forfudan added a commit that referenced this pull request Jul 7, 2025
forfudan added a commit that referenced this pull request Jul 7, 2025
forfudan added a commit that referenced this pull request Jul 9, 2025
forfudan added a commit that referenced this pull request Jul 9, 2025
forfudan added a commit that referenced this pull request Jul 9, 2025
forfudan added a commit that referenced this pull request Jul 9, 2025
forfudan added a commit that referenced this pull request Jul 11, 2025
forfudan added a commit that referenced this pull request Jul 11, 2025
forfudan added a commit that referenced this pull request Jul 14, 2025
forfudan added a commit that referenced this pull request Jul 14, 2025
forfudan added a commit that referenced this pull request Jul 15, 2025
forfudan added a commit that referenced this pull request Jul 15, 2025
forfudan added a commit that referenced this pull request Jul 18, 2025
forfudan added a commit that referenced this pull request Jul 18, 2025
forfudan added a commit that referenced this pull request Jul 24, 2025
forfudan added a commit that referenced this pull request Jul 24, 2025
forfudan added a commit that referenced this pull request Jul 26, 2025
forfudan added a commit that referenced this pull request Jul 26, 2025
forfudan added a commit that referenced this pull request Jul 31, 2025
forfudan added a commit that referenced this pull request Jul 31, 2025
forfudan added a commit that referenced this pull request Aug 3, 2025
forfudan added a commit that referenced this pull request Aug 3, 2025
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