summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbiouman <biouman>2001-04-28 23:16:36 +0000
committerbiouman <biouman>2001-04-28 23:16:36 +0000
commit4ebdecaf0f3e20b4c6989600c117a458622ca522 (patch)
treee736bdb65dec40d5045c3b68411f71f29c6bfc09
parent842576279c3d573da0f82d06523864c34190ce56 (diff)
*** empty log message ***
-rw-r--r--lib/pile.c9
-rw-r--r--lib/scalaires.c12
2 files changed, 11 insertions, 10 deletions
diff --git a/lib/pile.c b/lib/pile.c
index 1fb1aff..6ad8c71 100644
--- a/lib/pile.c
+++ b/lib/pile.c
@@ -48,13 +48,8 @@ void push_pile(char *st)
popcontext();
} else if (valid3) { /* il s agit de x */
pushcontext("c est X");
- rat=rat_constr(1, 1);
- /*pushcontext("rat construit");
- poly=ply_constr(rat, 0);
- pushcontext("poly cstr");
- push_pile_poly(poly);
- pushcontext("poly push");
- popcontext();*/
+ push_pile_poly(ply_constr(rat_constr(1, 1), 0));
+ popcontext();
} else if (valid4) { /* il s agit d une variable */
pushcontext("c est une variable");
push_pile_poly(ply_copy(poly));
diff --git a/lib/scalaires.c b/lib/scalaires.c
index f94162a..10c9196 100644
--- a/lib/scalaires.c
+++ b/lib/scalaires.c
@@ -35,9 +35,15 @@ rationnel rat_constr(int num, int denom)
denom = -denom;
num = -num;
}
-
- temp.num = num / pgcd(num, denom);
- temp.denom = denom / pgcd(num, denom);
+ if (!num) {
+ temp.num=0;
+ temp.denom=1;
+ } else if (denom) {
+ temp.num = num / pgcd(num, denom);
+ temp.denom = denom / pgcd(num, denom);
+ } else {
+ exception(1,"rat_constr: division par zero");
+ }
return temp;
}