Commit 104771de authored by Sergei Golubchik's avatar Sergei Golubchik

decimal: *correct* implementation of ROUND_UP at last

parent c1a4f0c5
...@@ -1994,3 +1994,6 @@ select 0.000000000000000000000000000000000000000000000000001 mod 1; ...@@ -1994,3 +1994,6 @@ select 0.000000000000000000000000000000000000000000000000001 mod 1;
select 0.0000000001 mod 1; select 0.0000000001 mod 1;
0.0000000001 mod 1 0.0000000001 mod 1
0.0000000001 0.0000000001
select 0.01 mod 1;
0.01 mod 1
0.01
...@@ -1579,3 +1579,5 @@ select 0.000000000000000000000000000000000000000000000000001 mod 1; ...@@ -1579,3 +1579,5 @@ select 0.000000000000000000000000000000000000000000000000001 mod 1;
# incorrect result # incorrect result
# #
select 0.0000000001 mod 1; select 0.0000000001 mod 1;
select 0.01 mod 1;
...@@ -137,7 +137,7 @@ static const dec1 frac_max[DIG_PER_DEC1-1]={ ...@@ -137,7 +137,7 @@ static const dec1 frac_max[DIG_PER_DEC1-1]={
static inline int ROUND_UP(int x) 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 #ifdef HAVE_valgrind
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment