diff --git a/README.md b/README.md index 6f6746be..b5ab58b5 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,7 @@ Contributors (0.9.0): - Rémy Oudompheng (RO) - Agriya Khetarpal (AK) - Oscar Benjamin (OB) +- Daniel Simmons-Marengo (DSM) Changes (0.9.0): @@ -181,6 +182,9 @@ Changes (0.9.0): - [gh-312](https://github.com/flintlib/python-flint/pull/312), Add `discriminant` method to `fmpz_poly`, `fmpq_poly` and `nmod_poly`. (RO) +- [gh-336](https://github.com/flintlib/python-flint/pull/336), + Fixed a bug in `arb.neg()` which caused it to return its input + without negating it. (DSM) 0.8.0 ----- diff --git a/src/flint/test/test_all.py b/src/flint/test/test_all.py index e82c8f3a..4c87513b 100644 --- a/src/flint/test/test_all.py +++ b/src/flint/test/test_all.py @@ -1669,6 +1669,8 @@ def test_arb(): assert arb(3) <= arb("inf") assert arb(3) == arb(3) assert arb(3) != arb(2) + assert -arb(3) == arb(-3) + assert arb(3).neg() == arb(-3) assert not (arb("1.1") == arb("1.1")) assert arb(3).repr() == 'arb((0x3, 0x0))' diff --git a/src/flint/types/arb.pyx b/src/flint/types/arb.pyx index dab29f0e..d552dc7a 100644 --- a/src/flint/types/arb.pyx +++ b/src/flint/types/arb.pyx @@ -567,9 +567,9 @@ cdef class arb(flint_scalar): def neg(self, bint exact=False): res = arb.__new__(arb) if exact: - arb_set((res).val, (self).val) + arb_neg((res).val, (self).val) else: - arb_set_round((res).val, (self).val, getprec()) + arb_neg_round((res).val, (self).val, getprec()) return res def __abs__(self):