Skip to content

Incorrect negate implementation for the Num Bit instance #2999

@MrDurion

Description

@MrDurion

Description

The negate function of the Num Bit instance here, uses the complement## as implementation.
However, this is incorrect if you test it against the definition of the negate function.

The negate should be the additive inverse of something, so a + negate a = 0.
For Bit, the (+) is correctly defined as xor##, which means that negate should cause xor## to return a 0 bit.
This is of course done by giving the same bit to xor twice, which means that negate should be the identity function, id, and not the complement.

Suggested edit

Change the line from
negate = complement##
to
negate = id.

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