8000 clean @math by FlyCloudC · Pull Request #2241 · moonbitlang/core · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

clean @math #2241

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 2 commits into from
Jun 11, 2025
Merged

clean @math #2241

merged 2 commits into from
Jun 11, 2025

Conversation

FlyCloudC
Copy link
Contributor
@FlyCloudC FlyCloudC commented Jun 10, 2025
  1. Change the forwarding function to fnalias.
    An added benefit: Some functions in @math now automatically include documentation (from @double).
  2. Remove duplicate tests from @double.
  3. Since @double contains more precise trigonometric tests, remove the double-related trigonometric tests from @math.

Copy link
peter-jerry-ye-code-review bot commented Jun 10, 2025
Using `fnalias` improves code readability and maintenance but some documentation is lost

Category
Maintainability
Code Snippet
pub fnalias Double::(sin, cos, tan, atan, asin, acos, atan2)
Recommendation
Consider keeping important documentation snippets in the math module, especially examples that show common usage patterns
Reasoning
While fnalias reduces code duplication, some of the removed documentation in @math contained valuable examples and edge cases that may be useful for users of the math module specifically

Added important test cases for fundamental mathematical constants

Category
Correctness
Code Snippet
let e = 2.718281828459045
inspect(e.ln(), content="1")
Recommendation
Additional validation could be added for more transcendental constants
Reasoning
Testing fundamental mathematical relationships like ln(e)=1 is crucial for validating the correctness of the implementation. Consider adding similar tests for other important constants.

Potential confusion between `PI` and `pi` constants

Category
Maintainability
Code Snippet
pub const PI = 0x3.243F6A8885A308CA8A54
pub let pi = 0x3.243F6A8885A308CA8A54
Recommendation
Consider keeping only one version of PI/pi or clearly document the difference between the two versions
Reasoning
Having two versions of the same constant with different cases could lead to confusion. If they serve different purposes, this should be documented.

@coveralls
Copy link
Collaborator
coveralls commented Jun 10, 2025

Pull Request Test Coverage Report for Build 7197

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.02%) to 93.086%

Totals Coverage Status
Change from base Build 7194: -0.02%
Covered Lines: 8549
Relevant Lines: 9184

💛 - Coveralls

@peter-jerry-ye
Copy link
Collaborator

We will be migrating these complicated computations from double to math.

@bobzhang bobzhang enabled auto-merge (rebase) June 11, 2025 05:47
@bobzhang bobzhang merged commit 7b74bdd into moonbitlang:main Jun 11, 2025
12 checks passed
@FlyCloudC FlyCloudC deleted the math-1 branch July 2, 2025 10:48
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.

4 participants
0