decimal: *correct* implementation of ROUND_UP at last

This commit is contained in:
Sergei Golubchik 2014-10-08 00:46:10 +02:00
parent c1a4f0c5ab
commit 104771de9a
3 changed files with 6 additions and 1 deletions

View file

@ -1994,3 +1994,6 @@ select 0.000000000000000000000000000000000000000000000000001 mod 1;
select 0.0000000001 mod 1;
0.0000000001 mod 1
0.0000000001
select 0.01 mod 1;
0.01 mod 1
0.01

View file

@ -1579,3 +1579,5 @@ select 0.000000000000000000000000000000000000000000000000001 mod 1;
# incorrect result
#
select 0.0000000001 mod 1;
select 0.01 mod 1;

View file

@ -137,7 +137,7 @@ static const dec1 frac_max[DIG_PER_DEC1-1]={
static inline int ROUND_UP(int x)
{
return (x + (x > 0 ? 1 : -1) * (DIG_PER_DEC1 - 1)) / DIG_PER_DEC1;
return (x + (x > 0 ? DIG_PER_DEC1 - 1 : 0)) / DIG_PER_DEC1;
}
#ifdef HAVE_valgrind