aboutsummaryrefslogtreecommitdiff
path: root/py/mpz.h
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2017-07-25 11:49:22 +1000
committerDamien George <damien.p.george@gmail.com>2017-07-25 11:49:22 +1000
commit04552ff71b6c722b21597d93481f024c72457cef (patch)
treefdbc66843e079a78cbf964aa6308ab5db78a42d1 /py/mpz.h
parent4d1fb6107fdedb0dda8dfb1491c033bf731222c6 (diff)
py: Implement raising a big-int to a negative power.
Before this patch raising a big-int to a negative power would just return 0. Now it returns a floating-point number with the correct value.
Diffstat (limited to 'py/mpz.h')
-rw-r--r--py/mpz.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/py/mpz.h b/py/mpz.h
index 2ff404ffa..55967cc4c 100644
--- a/py/mpz.h
+++ b/py/mpz.h
@@ -112,6 +112,7 @@ size_t mpz_set_from_str(mpz_t *z, const char *str, size_t len, bool neg, unsigne
void mpz_set_from_bytes(mpz_t *z, bool big_endian, size_t len, const byte *buf);
static inline bool mpz_is_zero(const mpz_t *z) { return z->len == 0; }
+static inline bool mpz_is_neg(const mpz_t *z) { return z->len != 0 && z->neg != 0; }
int mpz_cmp(const mpz_t *lhs, const mpz_t *rhs);
void mpz_abs_inpl(mpz_t *dest, const mpz_t *z);