Skip to content

Smarter comparisons #49

Closed
Closed
@maxbla

Description

@maxbla

Ratio{numer:0, denom:1} is not equal to Ratio{numer:0, denom:2}

The code that appears to deal with this is

// With equal numerators, the denominators can be inversely compared
if self.numer == other.numer {
    let ord = self.denom.cmp(&other.denom);
    return if self.numer < T::zero() {
        ord
    } else {
        ord.reverse()
    };
}

It seems like we could easily add a case for self.numer == T::zero(), but this ties in with #8 and I don't see a need to rush a fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions