This bug is present in genius-0.42 too. Whenever a number (int, rat, or
float) is raised to a negative integer power, something goes wrong.
Basically a typo: when raising a number to a small but negative integer
power the power was turned into a larger positive number since it was cast
to unsigned. Thus 5^-1 became 5^(2^32-1) (and then 1/ that).
Here is a patch to fix it.
diff -u -r genius-0.4.3/src/mpwrap.c genius-0.4.3-new/src/mpwrap.c
--- genius-0.4.3/src/mpwrap.c Tue May 18 02:01:43 1999
+++ genius-0.4.3-new/src/mpwrap.c Tue Jun 1 07:12:38 1999
@@ -2477,7 +2477,7 @@
else if(mpz_sgn(op2->data.ival)>0)
mpwl_pow_ui(rop,op1,mpz_get_ui(op2->data.ival),FALSE);
else
- mpwl_pow_ui(rop,op1,mpz_get_ui(op2->data.ival),TRUE);
+ mpwl_pow_ui(rop,op1,-mpz_get_ui(op2->data.ival),TRUE);
}
}
@@ -2531,7 +2531,7 @@
else if(op2->data.nval>0)
mpwl_pow_ui(rop,op1,op2->data.nval,FALSE);
else
- mpwl_pow_ui(rop,op1,op2->data.nval,TRUE);
+ mpwl_pow_ui(rop,op1,-op2->data.nval,TRUE);
break;
case MPW_FLOAT: return mpwl_pow_f(rop,op1,op2);
case MPW_RATIONAL: return mpwl_pow_q(rop,op1,op2);
Received on Tue Jun 01 1999 - 05:05:37 CDT
This archive was generated by hypermail 2.2.0 : Sun Apr 17 2011 - 21:00:02 CDT