Skip to content

math/big: Mention sign inversion in the (*Int).Not documentation #29949

@ainar-g

Description

@ainar-g

I would expect that this:

i = big.NewInt(-2)
log.Println(new(big.Int).Not(i).Text(2))

prints -1, but actually it prints 1. The (*Int).Not documentation simply says:

Not sets z = ^x and returns z.

I think that it's not obvious from this sentence that the sign is inverted.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DocumentationIssues describing a change to documentation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions