Skip to content

Harden rational edge cases and bound intermediate searches - #33

Open
tusharmalpani20 wants to merge 3 commits into
begriffs:masterfrom
tusharmalpani20:fix/rational-edge-cases
Open

Harden rational edge cases and bound intermediate searches#33
tusharmalpani20 wants to merge 3 commits into
begriffs:masterfrom
tusharmalpani20:fix/rational-edge-cases

Conversation

@tusharmalpani20

Copy link
Copy Markdown

Summary

This PR improves safety and correctness for several rational-number edge cases.

Changes

  • Reject division by zero with a clear PostgreSQL error.
  • Correct comparisons when rational values have negative denominators.
  • Prevent unsafe integer overflow in gcd() and mediant calculations.
  • Reject NaN, Infinity, and out-of-range floating-point values safely.
  • Add an optional maximum search depth to rational_intermediate().
  • Add the 0.0.4 extension upgrade path.
  • Mark rational_intermediate() functions as parallel safe.
  • Add regression tests for all of the above cases.
  • Update the README with the new function behavior.

Testing

  • Normal PostgreSQL 18.4 build passed.
  • Full regression tests passed.
  • Upgrade from version 0.0.3 to 0.0.4 passed.
  • Undefined-behavior and float-cast sanitizer tests 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.

1 participant