[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

fix for crash in genius for loop



it was treating GelETreeOperator as GelETreeComparison,
the pointer comp.args corresponds to the integer op.nargs!

also below is a patch adding the missing code for EulerPhi

diff -ur drgenius-0.5.7/genius/eval.c drgenius-0.5.7.new/genius/eval.c
--- drgenius-0.5.7/genius/eval.c	Thu May  4 02:55:44 2000
+++ drgenius-0.5.7.new/genius/eval.c	Wed Jun 21 08:02:26 2000
@@ -3776,12 +3776,12 @@
 	case E_FOR_CONS:
 	case E_FORBY_CONS:
 		GE_PUSH_STACK(ctx,n,GE_POST);
-		iter_push_args_no_last(ctx,n->comp.args->any.next);
+		iter_push_args_no_last(ctx,n->op.args->any.next);
 		break;
 
 	case E_FORIN_CONS:
 		GE_PUSH_STACK(ctx,n,GE_POST);
-		ctx->current = n->comp.args->any.next;
+		ctx->current = n->op.args->any.next;
 		ctx->post = FALSE;
 		break;
 
diff -ur drgenius-0.5.7/lib/number_theory/modulus.gel drgenius-0.5.7.new/lib/number_theory/modulus.gel
--- drgenius-0.5.7/lib/number_theory/modulus.gel	Thu Jan 27 00:38:28 2000
+++ drgenius-0.5.7.new/lib/number_theory/modulus.gel	Wed Jun 21 08:18:25 2000
@@ -6,9 +6,11 @@
 # Note that if the prime factorization of n is p_1^a_1 * ... p_r^a_r,
 # then EulerPhi(n)=n*(1-1/p_1)*...*(1-1/p_r). We use this to calculate
 # EulerPhi(n)
-# FIXME!!!
  (
-  return null
+  A = Factorize(n);
+  p = n;
+  for i = 2 to columns(A) do (p=p*(1-1/A@(1,i)));
+  return (p);
  )
 sethelp("EulerPhi","Compute phi(n), the Euler phi function");
 protect("EulerPhi");