diff options
author | mbkma <[email protected]> | 2021-02-13 11:02:06 +0100 |
---|---|---|
committer | raveit65 <[email protected]> | 2021-03-18 22:34:32 +0100 |
commit | 2e4b911386a88cfb3d34e8578d0f728f684d13e5 (patch) | |
tree | 395017348c0360529a9dfd0527c01346222b8553 /src | |
parent | 5fac0d4fec1d22bb9124bf5f219148c66d368e09 (diff) | |
download | mate-calc-2e4b911386a88cfb3d34e8578d0f728f684d13e5.tar.bz2 mate-calc-2e4b911386a88cfb3d34e8578d0f728f684d13e5.tar.xz |
mp.c: mp_reciprocal: fix when calling it with same arguments.
Diffstat (limited to 'src')
-rw-r--r-- | src/mp.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -403,8 +403,11 @@ mp_invert_sign(const MPNumber *x, MPNumber *z) void mp_reciprocal(const MPNumber *x, MPNumber *z) { - mpc_set_si(z->num, 1, MPC_RNDNN); - mpc_fr_div(z->num, mpc_realref(z->num), x->num, MPC_RNDNN); + mpc_t temp; + mpc_init2(temp, PRECISION); + mpc_set_ui(temp, 1, MPC_RNDNN); + mpc_fr_div(z->num, mpc_realref(temp), x->num, MPC_RNDNN); + mpc_clear(temp); } void |