diff options
author | biouman <biouman> | 2001-05-01 14:13:28 +0000 |
---|---|---|
committer | biouman <biouman> | 2001-05-01 14:13:28 +0000 |
commit | 368207e46ca78ec42d77a3b1d3539cf4250617eb (patch) | |
tree | 970c2a961a119f0f736293ed1637a7535f3b90c5 /lib | |
parent | 25942bc0f89328a0585964b93a5d2f4e1df9eff7 (diff) |
*** empty log message ***
Diffstat (limited to 'lib')
-rw-r--r-- | lib/polynom.c | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/lib/polynom.c b/lib/polynom.c index dcd0386..ab0ac07 100644 --- a/lib/polynom.c +++ b/lib/polynom.c @@ -274,18 +274,22 @@ char *ply_affichage(polynome poly) int count = 0; buf[0] = '\0'; - while (poly) { - if (poly->degre != 0) { - sprintf(temp, "%s*%s^%u ", rat_to_string(poly->coef), mute, poly->degre); - } else { - sprintf(temp, "%s ", rat_to_string(poly->coef)); + if (!poly) { + sprintf(buf, "%s ", rat_to_string(rat_constr(0,1))); + } else { + while (poly) { + if (poly->degre != 0) { + sprintf(temp, "%s*%s^%u ", rat_to_string(poly->coef), mute, poly->degre); + } else { + sprintf(temp, "%s ", rat_to_string(poly->coef)); + } + count += strlen(temp); + if (count < BUFSIZ) + strcat(buf, temp); + else + exception(2, _("ply_affichage: strcat error, not enough space in buffer")); + poly = poly->suiv; } - count += strlen(temp); - if (count < BUFSIZ) - strcat(buf, temp); - else - exception(2, _("ply_affichage: strcat error, not enough space in buffer")); - poly = poly->suiv; - } + } return buf; } |