diff options
| -rw-r--r-- | lib/fonctions.c | 14 | ||||
| -rw-r--r-- | lib/pile.c | 8 | ||||
| -rw-r--r-- | lib/polynom.c | 2 | ||||
| -rw-r--r-- | lib/scalaires.c | 12 | 
4 files changed, 15 insertions, 21 deletions
| diff --git a/lib/fonctions.c b/lib/fonctions.c index 1a7da13..eca44cb 100644 --- a/lib/fonctions.c +++ b/lib/fonctions.c @@ -34,7 +34,6 @@ static func_t func_table[] = {  	{ derivn, "derivn", 2 },  	{ integ, "int", 1 },  	{ printvars, "printvars", 0 },  -	{ ans, "ans", 0 },  	{ help, "help", 0 },  	{ setdisplay, "setdisplay", 1 },  	{ reinit, "reinit", 0 }, @@ -132,18 +131,6 @@ void printvars(polynome p1, polynome p2, polynome p3)  	AfficheTableau(variables);  } -void ans(polynome p1, polynome p2, polynome p3) -{    	 -	polynome poly; -	int valid=0; -	 -	poly = return_last(&valid); -	if (valid) { -		push_pile_poly(poly); -	} - -} -  void help(polynome p1, polynome p2, polynome p3)  {  	printf(_("Available functions:\n" @@ -151,7 +138,6 @@ void help(polynome p1, polynome p2, polynome p3)  		 ". derivn(p, n); nth derivative of p\n"  		 ". integ(p); primitive of p\n"  		 ". printvars(); print all variables\n" -		 ". ans(); last result\n"  		 ". help(); this help message\n"  		 ". setdisplay(n); set integer display format\n"  			"\tn=1: DECIMAL, n=2: HEXA\n" @@ -149,6 +149,8 @@ void flush_pile(void)  void move_to_resultat_pile(void)  {	pile_elem temp; +	char valid; +	polynome t;  	pushcontext(_("move_to_resultat_pile()"));  	if (pile_ptr) { @@ -157,6 +159,12 @@ void move_to_resultat_pile(void)  			if (temp.type==T_POLY) {  				result_pile[result_pile_ptr]=temp;  				result_pile_ptr++; +				t = NomVarToVar("ANS", variables, &valid); +				if (valid) { +					ply_destruct(t); +					SupprimerDansTab(&variables, "ANS"); +				} +				InsererVarDansTab(&variables, CreerElement("ANS", (void *) (ply_copy(temp.poly))));  			} else {  				exception(1, _("move_to_resultat_pile: invalid argument type"));  			} diff --git a/lib/polynom.c b/lib/polynom.c index 8cdac59..b502849 100644 --- a/lib/polynom.c +++ b/lib/polynom.c @@ -265,7 +265,7 @@ polynome ply_division(polynome dividende, polynome diviseur)  polynome ply_modulo(polynome dividende, polynome diviseur)  {				/* reste de la division de deux  polynomes */  	polynome interdividende = ply_copy(dividende), interdiviseur = NULL, inter = NULL, reste = dividende, resultat = NULL, r = NULL; -	int b; +	int b = 0;  #ifdef DEBUG  	printf("On divise %s", ply_affichage(dividende)); diff --git a/lib/scalaires.c b/lib/scalaires.c index b9af70a..5dd6bb1 100644 --- a/lib/scalaires.c +++ b/lib/scalaires.c @@ -137,21 +137,21 @@ char *rat_to_string(rationnel rat, int first)  	switch(display) {  	case DEC:  		if (rat.denom==1) -			sprintf(temp,"%d", rat.num); +			sprintf(temp,"%qd", rat.num);  		else	 -			sprintf(temp,"%d/%d", rat.num, rat.denom); +			sprintf(temp,"%qd/%qd", rat.num, rat.denom);  		break;  	case HEX:  		if (rat.denom==1) -			sprintf(temp,"0x%x", rat.num); +			sprintf(temp,"0x%qx", rat.num);  		else -			sprintf(temp,"0x%x/0x%x",  rat.num, rat.denom); +			sprintf(temp,"0x%qx/0x%qx",  rat.num, rat.denom);  		break;  	case OCT:  		if (rat.denom==1) -			sprintf(temp,"0%o", rat.num); +			sprintf(temp,"0%qo", rat.num);  		else				  -			sprintf(temp,"0%o/0%o",  rat.num, rat.denom); +			sprintf(temp,"0%qo/0%qo",  rat.num, rat.denom);  		break;  	case FLT:  		sprintf(temp,"%g", rat_to_double(rat)); | 
