From 5c8155955bc11e2edcaf7a83c2065ef57b5c35e8 Mon Sep 17 00:00:00 2001 From: "serg@serg.mylan" <> Date: Sat, 30 Oct 2004 18:31:35 +0200 Subject: [PATCH] bugfix and test case --- strings/decimal.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/strings/decimal.c b/strings/decimal.c index c884b333414..5a109bfa3a7 100644 --- a/strings/decimal.c +++ b/strings/decimal.c @@ -206,7 +206,7 @@ int decimal2string(decimal *from, char *to, int *to_len) DBUG_ASSERT(*to_len > 2+from->sign); /* removing leading zeroes */ - i=intg % DIG_PER_DEC1; + i=((intg-1) % DIG_PER_DEC1)+1; while (intg > 0 && *buf0 == 0) { intg-=i; @@ -1874,6 +1874,7 @@ main() printf("==== do_add ====\n"); test_da(".00012345000098765" ,"123.45"); + test_da(".1" ,".45"); test_da("1234500009876.5" ,".00012345000098765"); test_da("9999909999999.5" ,".555"); test_da("99999999" ,"1");