#!/bin/sh
#this is meant to be run in the directory containing an unmolested genius-0.4.3
# source distrbution. It fixes a small bug when raising numbers to negative
# integer powers. This can be executed or simply passed as an input file to
# the patch program. It can be reversed by simply running it again and answering
# yes to the Assume patch is reversed question.
# june 1, (c) 1999 jack schmidt <squeak@xirr.com> under the GPLv2.0
patch -d genius-0.4.3 -p1 << EOF
diff -u genius-0.4.3/src/mpwrap.c genius-0.4.3-mod/src/mpwrap.c
--- genius-0.4.3/src/mpwrap.c	Tue May 18 02:01:43 1999
+++ genius-0.4.3-mod/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);
EOF

