diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/polynom.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/polynom.c b/lib/polynom.c index dcd3b4f..aea2675 100644 --- a/lib/polynom.c +++ b/lib/polynom.c @@ -268,9 +268,15 @@ char *ply_affichage(polynome poly) while (poly) { if (poly->degre != 0) { - sprintf(temp, "%+f*%s^%u", rat_to_double(poly->coef), mute, poly->degre); + if (poly->coef.denom==1) + sprintf(temp, "%+d*%s^%u ", poly->coef.num, mute, poly->degre); + else + sprintf(temp, "%+d/%d*%s^%u ", poly->coef.num, poly->coef.denom, mute, poly->degre); } else { - sprintf(temp, "%+f", rat_to_double(poly->coef)); + if (poly->coef.denom==1) + sprintf(temp, "%+d ", poly->coef.num); + else + sprintf(temp, "%+d/%d ", poly->coef.num , poly->coef.denom); } strcat(buf, temp); /* FIXME: gerer le depassement de buf si po malloc */ poly=poly->suiv; |