aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rat2canon.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/rat2canon.c b/rat2canon.c
index 88b72b3..872a286 100644
--- a/rat2canon.c
+++ b/rat2canon.c
@@ -128,10 +128,18 @@ int main(argc,argv)
if (looking==1 && !zero(num)){
copy(num0,num);
+
+ if (negative(num)) {
+ changesign(num0);
+ itomp(-1,An[i][j]);
+ } else {
+ itomp(1,An[i][j]);
+ }
+
copy(den0,den);
- itomp(1,An[i][j]);
itomp(1,Ad[i][j]);
+
looking=0;
} else {