Index: calctool.c
===================================================================
RCS file: /cvs/gnome/gcalctool/gcalctool/calctool.c,v
retrieving revision 1.108
diff -u -r1.108 calctool.c
--- calctool.c	6 Sep 2006 15:02:34 -0000	1.108
+++ calctool.c	12 Sep 2006 21:12:03 -0000
@@ -388,7 +388,7 @@
     { GDK_percent, 0 },
     '%',
     M_NONE,
-    do_calc,  
+    do_percent,  
     NULL,
     immediate
 },
Index: calctool.h
===================================================================
RCS file: /cvs/gnome/gcalctool/gcalctool/calctool.h,v
retrieving revision 1.81
diff -u -r1.81 calctool.h
--- calctool.h	6 Sep 2006 15:02:34 -0000	1.81
+++ calctool.h	12 Sep 2006 21:12:03 -0000
@@ -439,6 +439,7 @@
 void do_portion();
 void do_trig();
 void do_trigtype(enum trig_type);
+void do_percent();
 void doerr(char *);
 void exp_del();
 void get_constant(int);
Index: ce_parser.y
===================================================================
RCS file: /cvs/gnome/gcalctool/gcalctool/ce_parser.y,v
retrieving revision 1.14
diff -u -r1.14 ce_parser.y
--- ce_parser.y	1 May 2006 17:26:26 -0000	1.14
+++ ce_parser.y	12 Sep 2006 21:12:03 -0000
@@ -194,13 +194,13 @@
 term:
   number {cp($1, $$);}
 | rcl {cp($1, $$);}
-| term '%' term {calc_percent($1, $3, $$);}
 | term '/' term {mpdiv($1, $3, $$);}
 | term '*' term {mpmul($1, $3, $$);}
 | term '^' term {calc_xpowy($1, $3, $$);}
 | 'e' '^' term {calc_epowy($3, $$);} 
 | term '!' {do_factorial($1 ,$$);}
 | term 'e' term %prec MED {calc_xtimestenpowx($1, $3, $$);}
+| term '%' {calc_percent($1, $$);}
 | '-' term %prec NEG {mpneg($2, $$);}
 | '+' term %prec POS {cp($2, $$);}
 
Index: functions.c
===================================================================
RCS file: /cvs/gnome/gcalctool/gcalctool/functions.c,v
retrieving revision 1.82
diff -u -r1.82 functions.c
--- functions.c	9 Aug 2006 16:54:01 -0000	1.82
+++ functions.c	12 Sep 2006 21:12:04 -0000
@@ -604,11 +604,6 @@
         mpmul(MP1, v->MPdisp_val, MP2);
         mpsub(v->MPresult, MP2, v->MPresult);
 
-    } else if (IS_KEY(v->cur_op, KEY_PER.value[0])) {     /* % */
-        mpmul(v->MPresult, v->MPdisp_val, v->MPresult);
-        MPstr_to_num("0.01", DEC, MP1);
-        mpmul(v->MPresult, MP1, v->MPresult);
-
     } else if (IS_KEY(v->cur_op, KEY_YTOX.value[0])) {    /* y^x */
         calc_xpowy(v->MPresult, v->MPdisp_val, v->MPresult);
 
@@ -690,6 +685,14 @@
     mpstr(v->MPresult, v->MPdisp_val);
 }
 
+
+void
+do_percent()
+{
+  calc_percent(v->MPdisp_val, v->MPresult);
+  show_display(v->MPresult);
+  mpstr(v->MPresult, v->MPdisp_val);
+}
 
 int
 do_tfunc(int s[MP_SIZE], int t[MP_SIZE], enum trig_func tfunc)
Index: lr_parser.y
===================================================================
RCS file: /cvs/gnome/gcalctool/gcalctool/lr_parser.y,v
retrieving revision 1.8
diff -u -r1.8 lr_parser.y
--- lr_parser.y	9 Jan 2006 16:30:20 -0000	1.8
+++ lr_parser.y	12 Sep 2006 21:12:04 -0000
@@ -170,6 +170,7 @@
 | exp '[' {calc_u32($1, $$);}
 | exp '}' {calc_tenpowx($1, $$);}
 | exp '{' {mpexp($1, $$);}
+| exp '%' {calc_percent($1, $$);}
 
 | func {cp($1, $$);}
 ;
Index: mpmath.c
===================================================================
RCS file: /cvs/gnome/gcalctool/gcalctool/mpmath.c,v
retrieving revision 1.13
diff -u -r1.13 mpmath.c
--- mpmath.c	28 Mar 2006 19:23:33 -0000	1.13
+++ mpmath.c	12 Sep 2006 21:12:04 -0000
@@ -225,16 +225,13 @@
 }
 
 void
-calc_percent(int s1[MP_SIZE], int s2[MP_SIZE], int t1[MP_SIZE])
+calc_percent(int s1[MP_SIZE], int t1[MP_SIZE])
 {
     int MP1[MP_SIZE];
-    int MP2[MP_SIZE];
 
-    mpmul(s1, s2, MP1);
-    MPstr_to_num("0.01", DEC, MP2);
-    mpmul(MP1, MP2, t1);
+    MPstr_to_num("0.01", DEC, MP1);
+    mpmul(s1, MP1, t1);
 }
-
 
 void
 do_zero(int t1[MP_SIZE])
Index: mpmath.h
===================================================================
RCS file: /cvs/gnome/gcalctool/gcalctool/mpmath.h,v
retrieving revision 1.11
diff -u -r1.11 mpmath.h
--- mpmath.h	28 Mar 2006 19:23:33 -0000	1.11
+++ mpmath.h	12 Sep 2006 21:12:04 -0000
@@ -42,7 +42,7 @@
 void calc_rand(int t[MP_SIZE]);
 void calc_u32(int s1[MP_SIZE], int t1[MP_SIZE]);
 void calc_u16(int s1[MP_SIZE], int t1[MP_SIZE]);
-void calc_percent(int s1[MP_SIZE], int s2[MP_SIZE], int t1[MP_SIZE]);
+void calc_percent(int s1[MP_SIZE], int t1[MP_SIZE]);
 void calc_inv(int s1[MP_SIZE], int t1[MP_SIZE]);
 void calc_tenpowx(int s1[MP_SIZE], int t1[MP_SIZE]);
 void calc_xpowy(int MPx[MP_SIZE], int MPy[MP_SIZE], int MPres[MP_SIZE]);
