From 4ebdecaf0f3e20b4c6989600c117a458622ca522 Mon Sep 17 00:00:00 2001 From: biouman Date: Sat, 28 Apr 2001 23:16:36 +0000 Subject: *** empty log message *** --- lib/pile.c | 9 ++------- lib/scalaires.c | 12 +++++++++--- 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; } -- cgit v1.2.3