summaryrefslogtreecommitdiff
path: root/lib/polynom.c
diff options
context:
space:
mode:
authorPixel <Pixel>2001-05-01 17:33:28 +0000
committerPixel <Pixel>2001-05-01 17:33:28 +0000
commitfb8495ceb3e1ac078d3963b26f7bd5cae94249d3 (patch)
tree2c48eae7bb951182b5aa340a175ec2d9803a68e9 /lib/polynom.c
parentb44d595ac1be31d01c568b0bd0386a1c60715ac6 (diff)
Pouet
Diffstat (limited to 'lib/polynom.c')
-rw-r--r--lib/polynom.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/polynom.c b/lib/polynom.c
index dbb4334..859ae48 100644
--- a/lib/polynom.c
+++ b/lib/polynom.c
@@ -273,28 +273,30 @@ char *ply_affichage(polynome poly)
{ /* routine d'affichage d'un polynome */
static char buf[BUFSIZ];
char temp[BUFSIZ];
+ char * rat;
int count = 0;
int first = 1;
buf[0] = '\0';
if (!poly) {
- sprintf(buf, "%s ", rat_to_string(rat_constr(0,1)));
- } else {
+ sprintf(buf, "%s ", rat_to_string(rat_constr(0,1), 1));
+ } else {
while (poly) {
if (poly->degre != 0) {
if (smartprint) {
+ rat = (rat_to_double(poly->coef) == 1) ? (first ? "" : "+ ") : rat_to_double(poly->coef) == -1 ? (first ? "-" : "- ") : rat_to_string(poly->coef, first);
switch(poly->degre) {
case 1:
- sprintf(temp, "%s%s ", rat_to_string(poly->coef, first), mute);
+ sprintf(temp, "%s%s ", rat, mute);
break;
case 2:
- sprintf(temp, "%s%s² ", rat_to_string(poly->coef, first), mute);
+ sprintf(temp, "%s%s² ", rat, mute);
break;
case 3:
- sprintf(temp, "%s%s³ ", rat_to_string(poly->coef, first), mute);
+ sprintf(temp, "%s%s³ ", rat, mute);
break;
default:
- sprintf(temp, "%s%s^%u ", rat_to_string(poly->coef, first), mute, poly->degre);
+ sprintf(temp, "%s%s^%u ", rat, mute, poly->degre);
break;
}
} else {