Skip to content

PartialEq doesn't work correctly on numbers with large exponents #220

@Indy2222

Description

@Indy2222

self.mantissa.wrapping_mul(power) == other.mantissa

When either the mantissa or the exponent is too large, the multiplication used before comparison wraps which may result both in true positive and true negative result.

This could be solved with checked_mul() - error from this method means that the number with larger exponent (i.e. whose mantissa is multiplied) must be larger (i.e. not equal) than the one with smaller exponent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions