summaryrefslogtreecommitdiff
path: root/lib/polynom.c
diff options
context:
space:
mode:
authorbiouman <biouman>2001-04-29 23:45:54 +0000
committerbiouman <biouman>2001-04-29 23:45:54 +0000
commitd700a9b0e62e1a18f26733d56a760c5cccc0af3d (patch)
treeacd45ab39479db6f99be06f50470ee345ce78ba1 /lib/polynom.c
parent67cc2ba2e81241774373f4667f1bac71234ecf11 (diff)
*** empty log message ***
Diffstat (limited to 'lib/polynom.c')
-rw-r--r--lib/polynom.c11
1 files changed, 8 insertions, 3 deletions
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;