summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mp.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/mp.c b/src/mp.c
index 1f3965e..40aacdc 100644
--- a/src/mp.c
+++ b/src/mp.c
@@ -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