Commit 1bbe55c7 authored by Jan Wieck's avatar Jan Wieck

Just one more bugfix - this time in cmp_abs (cannot imagine that

taking a logarithm with a 400 digit precision worked with that bug
in place).

Jan
parent c1855793
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
* *
* 1998 Jan Wieck * 1998 Jan Wieck
* *
* $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.7 1999/01/04 12:53:23 wieck Exp $ * $Header: /cvsroot/pgsql/src/backend/utils/adt/numeric.c,v 1.8 1999/01/04 17:51:58 wieck Exp $
* *
* ---------- * ----------
*/ */
...@@ -3438,25 +3438,28 @@ cmp_abs(NumericVar *var1, NumericVar *var2) ...@@ -3438,25 +3438,28 @@ cmp_abs(NumericVar *var1, NumericVar *var2)
int w2 = var2->weight; int w2 = var2->weight;
int stat; int stat;
while (w1 > w2) while (w1 > w2 && i1 < var1->ndigits)
{ {
if (var1->digits[i1++] != 0) return 1; if (var1->digits[i1++] != 0) return 1;
w1--; w1--;
} }
while (w2 > w1) while (w2 > w1 && i2 < var2->ndigits)
{ {
if (var2->digits[i2++] != 0) return -1; if (var2->digits[i2++] != 0) return -1;
w2--; w2--;
} }
while (i1 < var1->ndigits && i2 < var2->ndigits) if (w1 == w2)
{ {
stat = var1->digits[i1++] - var2->digits[i2++]; while (i1 < var1->ndigits && i2 < var2->ndigits)
if (stat)
{ {
if (stat > 0) stat = var1->digits[i1++] - var2->digits[i2++];
return 1; if (stat)
return -1; {
if (stat > 0)
return 1;
return -1;
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment