Skip to content

Conversation

@ohhmm
Copy link
Owner

@ohhmm ohhmm commented Jan 31, 2025

better coverage for irrational fractions equality comparison

@ohhmm ohhmm force-pushed the fraction branch 5 times, most recently from 198143f to 41f8efa Compare February 16, 2025 10:39
@ohhmm ohhmm force-pushed the fraction branch 3 times, most recently from d6b749b to 63c3257 Compare February 23, 2025 22:47
Comment on lines 78 to 84
auto bothAreRational = (IsRational() && fraction.IsRational()) == YesNoMaybe::Yes;
if (bothAreRational) {
equal = operator a_rational() == static_cast<a_rational>(fraction);
} else { // TODO: FIXME: both irrationals hangs on macos
//OptimizeOn on;
//equal = numerator() * fraction.denominator() == fraction.numerator() * denominator();
} else { // both are irrational
OptimizeOn on;
equal = numerator() * fraction.denominator() == fraction.numerator() * denominator();
Copy link
Contributor

Choose a reason for hiding this comment

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

Performance and Documentation Concerns:

  1. The code was previously commented out with a note about hanging on macOS (// TODO: FIXME: both irrationals hangs on macos). While enabling this code improves coverage for irrational fractions equality comparison, there's no explanation of why it's now safe to enable or what testing was done to verify it works correctly on macOS.

  2. The PR enables previously disabled code without adding any documentation explaining the change. This makes it difficult for future developers to understand why this code was previously problematic and what has changed to make it work now.

Recommendation:

  • Add documentation or comments explaining what changes have been made to resolve the hanging issue
  • Add information about what testing has been performed to verify this code now works correctly on all platforms including macOS
  • Consider adding unit tests that specifically verify this functionality works as expected

@ohhmm ohhmm force-pushed the fraction branch 3 times, most recently from 07256bf to b4aad0d Compare March 8, 2025 22:24
@ohhmm ohhmm force-pushed the fraction branch 3 times, most recently from e2ce1b3 to ea6e896 Compare March 21, 2025 20:56
@ohhmm ohhmm force-pushed the fraction branch 2 times, most recently from 76d7803 to 61632e7 Compare March 28, 2025 08:16
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Everything looks good! The implementation for irrational fractions equality comparison is now more robust with proper optimization strategies.

@ohhmm ohhmm force-pushed the fraction branch 3 times, most recently from f2b3b27 to 2486d0e Compare March 30, 2025 18:14
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