summaryrefslogtreecommitdiff
path: root/strings
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2004-11-01 13:58:28 +0100
committerunknown <serg@serg.mylan>2004-11-01 13:58:28 +0100
commit8af37ddc6771d95045111fd04f8d6127db8ae963 (patch)
tree3a06ff3ab0540719fc946823b9b5334e5f15cb98 /strings
parent2cb55007e50787d6bbaa655dcd99c5a113226b93 (diff)
downloadmariadb-git-8af37ddc6771d95045111fd04f8d6127db8ae963.tar.gz
correct test for 1/3
more tests
Diffstat (limited to 'strings')
-rw-r--r--strings/decimal.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/strings/decimal.c b/strings/decimal.c
index a6c53f3a130..4ecabe01e9d 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -1318,7 +1318,7 @@ static int do_div_mod(decimal *from1, decimal *from2,
if ((scale_incr-= frac1 - from1->frac + frac2 - from2->frac) < 0)
scale_incr=0;
- if ((i=(prec1-frac1)-(prec2-frac2)+1) < 0) /* see below */
+ if ((i=(prec1-frac1)-(prec2-frac2)+(*buf1 > *buf2)) < 0) /* see below */
intg0=0;
else
intg0=ROUND_UP(i);
@@ -1940,6 +1940,8 @@ main()
test_dv("-12193185.1853376", "98765.4321");
test_dv("121931851853376", "987654321");
test_dv("0", "987");
+ test_dv("1", "3");
+ test_dv("1.000000000000", "3");
printf("==== decimal_round ====\n");
test_ro("15.1",0,HALF_UP);
@@ -1965,6 +1967,7 @@ main()
test_ro("5678.123451",4,TRUNCATE);
test_ro("5678.123451",5,TRUNCATE);
test_ro("5678.123451",6,TRUNCATE);
+ test_ro("-5678.123451",-4,TRUNCATE);
printf("==== decimal_mod ====\n");
test_md("234","10");