summaryrefslogtreecommitdiff
path: root/lib/polynom.c
diff options
context:
space:
mode:
authorbiouman <biouman>2001-05-01 14:13:28 +0000
committerbiouman <biouman>2001-05-01 14:13:28 +0000
commit368207e46ca78ec42d77a3b1d3539cf4250617eb (patch)
tree970c2a961a119f0f736293ed1637a7535f3b90c5 /lib/polynom.c
parent25942bc0f89328a0585964b93a5d2f4e1df9eff7 (diff)
*** empty log message ***
Diffstat (limited to 'lib/polynom.c')
-rw-r--r--lib/polynom.c28
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;
}