summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorunknown <holyfoot@hf-ibm.(none)>2005-05-07 14:41:00 +0500
committerunknown <holyfoot@hf-ibm.(none)>2005-05-07 14:41:00 +0500
commit77cb61d2cfc58e4af70aa57b98b882056529e93b (patch)
tree1ea6a6e97325395fbc2c087725413c57f9ec6ff0 /strings
parent0228f897259751242398164dd4be6689146b8377 (diff)
downloadmariadb-git-77cb61d2cfc58e4af70aa57b98b882056529e93b.tar.gz
Fix for bug #9527 (negative zero is a nonsence)
strings/decimal.c: added the check to make sure we don't ge -0.00
Diffstat (limited to 'strings')
-rw-r--r--strings/decimal.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/strings/decimal.c b/strings/decimal.c
index 7459b2f7dda..3fa06132cf1 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -1924,6 +1924,17 @@ int decimal_mul(decimal_t *from1, decimal_t *from2, decimal_t *to)
for (; carry; buf0--)
ADD(*buf0, *buf0, 0, carry);
}
+
+ /* Now we have to check for -0.000 case */
+ if (to->sign)
+ {
+ dec1 *buf= to->buf;
+ dec1 *end= to->buf + intg0 + frac0;
+ for (; (buf<end) && !*buf; buf++);
+ if (buf == end)
+ /* So we got decimal zero */
+ decimal_make_zero(to);
+ }
return error;
}