Skip to content

Conversation

@Siddapa
Copy link
Contributor

@Siddapa Siddapa commented Mar 27, 2025

Adds comparison methods to both Rational and BigRational structs for faster comparisons instead of converting to floats

Both return std.math.Order enums dictating the comparison order

fn cmp_(comptime T: type, comptime o: comptime_int, r: anytype, s: anytype) !std.math.Order {
switch (@typeInfo(T)) {
Int => {
r.reduce();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you want to lazily reduce in this function on overflow like the others, no?

Copy link
Contributor

Choose a reason for hiding this comment

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

you didnt remove the eager reduction?

@scheibo scheibo merged commit 84a5fc2 into pkmn:main Mar 28, 2025
34 checks passed
@scheibo
Copy link
Contributor

scheibo commented Mar 28, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants