Skip to content

arb.neg() does nothing #335

@Maegereg

Description

@Maegereg

As currently implemented, arb.neg() returns a copy of the original arb, rather than its negation. You can see this pretty clearly:

from flint import arb

arb(1, 2) in arb(1, 2) # Returns true, as it should.
arb(1, 2).neg() in arb(1, 2) # Returns true, but should return false.
arb(1, 2).neg() in arb(-1, 2) # Returns false, should return true.
arb(1, 2).neg().mid() # Returns 1, should return -1

It looks like this is a pretty simple typo: here neg() calls arb_set() or arb_set_round() rather than arb_neg() or arb_neg_round(). __neg__() is implemented correctly, so if you replace arb(...).neg() with -arb(...) in the above, it will work.

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