summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mp.c2
-rw-r--r--src/test-mp-equation.c1
2 files changed, 3 insertions, 0 deletions
diff --git a/src/mp.c b/src/mp.c
index 30f69f4..7b224c6 100644
--- a/src/mp.c
+++ b/src/mp.c
@@ -435,6 +435,8 @@ mp_root(const MPNumber *x, int64_t n, MPNumber *z)
if (n < 0)
{
+ mpc_ui_div(z->num, 1, x->num, MPC_RNDNN);
+
if (n == INT64_MIN)
p = (uint64_t) INT64_MAX + 1;
else
diff --git a/src/test-mp-equation.c b/src/test-mp-equation.c
index adf6c06..3e1d993 100644
--- a/src/test-mp-equation.c
+++ b/src/test-mp-equation.c
@@ -476,6 +476,7 @@ test_equations(void)
test("2^0.5", "1.414213562", 0);
test("₃√−8", "−2", 0);
test("(−8)^(1÷3)", "−2", 0);
+ test("e^-2^-5", "0.969233234", 0);
test("0 mod 7", "0", 0);
test("6 mod 7", "6", 0);