Skip to content

math/big: fast path for Cmp if same #30856

@TuomLarsen

Description

@TuomLarsen

I noticed that math/big.Int Cmp method does not have a fast path for the case if x and y are the same. Wouldn't it be beneficial to have there something along the lines:

if x == y {
    r = 0
    return
}

Mul seems to do similar.

Same applies for big.Rat and big.Float.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions