summaryrefslogtreecommitdiff
path: root/lib/scalaires.c
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 /lib/scalaires.c
parent842576279c3d573da0f82d06523864c34190ce56 (diff)
*** empty log message ***
Diffstat (limited to 'lib/scalaires.c')
-rw-r--r--lib/scalaires.c12
1 files changed, 9 insertions, 3 deletions
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;
}