diff options
author | biouman <biouman> | 2001-04-30 01:21:20 +0000 |
---|---|---|
committer | biouman <biouman> | 2001-04-30 01:21:20 +0000 |
commit | 51a7864b4b789583ea445af47324a9b613336162 (patch) | |
tree | 3c786d88388db0a88f65f1fe7acbe9125280fa08 /lib/polynom.c | |
parent | a578580b607c8cadf22b457d51431042e3896271 (diff) |
*** empty log message ***
Diffstat (limited to 'lib/polynom.c')
-rw-r--r-- | lib/polynom.c | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/polynom.c b/lib/polynom.c index 4c789dd..aca2f6c 100644 --- a/lib/polynom.c +++ b/lib/polynom.c @@ -18,7 +18,7 @@ #define _(x) x #endif -/* FIXME: manque div et mod et poly_to_string */ +/* FIXME: manque div et mod */ polynome ply_constr(rationnel coef, int degre) { /* constructeur monome */ @@ -271,8 +271,9 @@ double ply_valuation(polynome poly, double point) char *ply_affichage(polynome poly) { /* routine d'affichage d'un polynome */ - char buf[BUFSIZ] = {0}, temp[BUFSIZ]; /* FIXME: pas glop comme routine, malloquer tout ca ? */ - + char buf[BUFSIZ] = {0}, temp[BUFSIZ]; + int count=0; + while (poly) { if (poly->degre != 0) { if (poly->coef.denom==1) @@ -285,11 +286,12 @@ char *ply_affichage(polynome poly) else sprintf(temp, "%+d/%d ", poly->coef.num , poly->coef.denom); } - strcat(buf, temp); /* FIXME: gerer le depassement de buf si po malloc */ + count+=strlen(temp); + if (count<BUFSIZ) + strcat(buf, temp); + else + exception(1,_("ply_affichage: strcat error, not enoug space in buffer")); poly=poly->suiv; - - - } return Estrdup(buf); } |