summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorunknown <serg@serg.mylan>2004-12-27 23:21:06 +0100
committerunknown <serg@serg.mylan>2004-12-27 23:21:06 +0100
commite3c7697431c144215af2f752d5c23b5b06e29982 (patch)
treebf9b9169b59aecb9c2c659e39f4a30d6c55d142d
parentd6e995bbabafface33de17f8796ce51554154847 (diff)
parent1fb2c0bcbe38ee41ba458bc52c80627e6fca4744 (diff)
downloadmariadb-git-e3c7697431c144215af2f752d5c23b5b06e29982.tar.gz
Merge bk-internal:/home/bk/mysql-5.0
into serg.mylan:/usr/home/serg/Abk/mysql-5.0
-rw-r--r--strings/decimal.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/strings/decimal.c b/strings/decimal.c
index c691bcb62fc..42e65c26ad1 100644
--- a/strings/decimal.c
+++ b/strings/decimal.c
@@ -14,6 +14,8 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
+#line __LINE__ "decimal.c"
+
/*
=======================================================================
NOTE: this library implements SQL standard "exact numeric" type
@@ -680,8 +682,12 @@ int decimal2bin(decimal *from, char *to, int precision, int frac)
/* frac1x part */
if (frac1x)
{
- int i=dig2bytes[frac1x];
- dec1 x=(*buf1 / powers10[DIG_PER_DEC1 - frac1x]) ^ mask;
+ dec1 x;
+ int i=dig2bytes[frac1x],
+ lim=(frac1 < frac0 ? DIG_PER_DEC1 : frac0x);
+ while (frac1x < lim && dig2bytes[frac1x] == i)
+ frac1x++;
+ x=(*buf1 / powers10[DIG_PER_DEC1 - frac1x]) ^ mask;
switch (i)
{
case 1: mi_int1store(to, x); break;
@@ -2087,6 +2093,8 @@ main()
test_d2b2d("-.000000012345000098765", 30, 20,"-.00000001234500009876");
test_d2b2d("1234500009876.5", 30, 5,"1234500009876.50000");
test_d2b2d("111111111.11", 10, 2,"11111111.11");
+ full=1;
+ test_d2b2d("123.4", 10, 2, "123.40");
printf("==== decimal_cmp ====\n");
test_dc("12","13",-1);