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

add some float utils functions #1454

Merged
merged 3 commits into from
Jan 10, 2025
Merged

Conversation

tonyfettes
Copy link
Contributor

Copy link

peter-jerry-ye-code-review bot commented Jan 9, 2025

‼️ This code review is generated by a bot. Please verify the content before trusting it.

Here are three potential issues or observations from the provided git diff output:

  1. Inconsistent Test Naming:

    • In the test cases, there is inconsistency in naming conventions. For example:
      • test "Float::is_inf/special_values" uses a forward slash (/) to separate the function name and the test category.
      • test "@float.Float::is_pos_inf/special_values" uses a dot (.) and a forward slash (/).
      • test "@float.Float::is_neg_inf" uses a dot (.) but no forward slash.
    • This inconsistency might make it harder to organize and maintain tests. Consider standardizing the naming convention, such as using a consistent separator (e.g., :: or /).
  2. Potential Issue in is_pos_inf Implementation:

    • The implementation of is_pos_inf checks if self > max_value. However, this logic might not correctly identify positive infinity in all cases, depending on how max_value is defined. If max_value is the largest finite floating-point number, then this logic should work. But if max_value is not properly defined or if there are edge cases (e.g., NaN), this might lead to incorrect results. Ensure that max_value is correctly defined and that the logic handles all edge cases.
  3. Potential Issue in is_neg_inf Implementation:

    • Similarly, the implementation of is_neg_inf checks if self < min_value. This logic assumes that min_value is the smallest finite floating-point number. However, if min_value is not properly defined or if there are edge cases (e.g., NaN), this might lead to incorrect results. Ensure that min_value is correctly defined and that the logic handles all edge cases.

These issues should be reviewed and addressed to ensure the correctness and maintainability of the code.

@coveralls
Copy link
Collaborator

coveralls commented Jan 9, 2025

Pull Request Test Coverage Report for Build 4678

Details

  • 4 of 4 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.01%) to 83.193%

Totals Coverage Status
Change from base Build 4671: 0.01%
Covered Lines: 4727
Relevant Lines: 5682

💛 - Coveralls

@bobzhang bobzhang merged commit 2161d20 into moonbitlang:main Jan 10, 2025
14 checks passed
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.

3 participants