From d700a9b0e62e1a18f26733d56a760c5cccc0af3d Mon Sep 17 00:00:00 2001 From: biouman Date: Sun, 29 Apr 2001 23:45:54 +0000 Subject: *** empty log message *** --- lib/polynom.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib') diff --git a/lib/polynom.c b/lib/polynom.c index aea2675..2514445 100644 --- a/lib/polynom.c +++ b/lib/polynom.c @@ -192,7 +192,7 @@ polynome ply_soustraction(polynome poly1, polynome poly2) polynome ply_multiplication(polynome poly1, polynome poly2) { /* multiplication de deux polynomes */ - polynome temp = NULL, t, resultat = NULL; + polynome temp = NULL, t, resultat = NULL, r, tempresult = NULL; while (poly1) { while (poly2) { @@ -200,17 +200,22 @@ polynome ply_multiplication(polynome poly1, polynome poly2) ply_constr(rat_multiplication(poly1->coef, poly2->coef), poly1->degre + poly2->degre); if (t) { - if (resultat) { + if (tempresult) { temp->suiv = t; temp = t; } else { - resultat = t; + tempresult = t; temp = t; } } poly2 = poly2->suiv; } poly1 = poly1->suiv; + r=ply_addition(tempresult,resultat); + ply_destruct(resultat); + resultat=r; + ply_destruct(tempresult); + tempresult=NULL; } return resultat; -- cgit v1.2.3