Repository: trafodion Updated Branches: refs/heads/master 1b9cb1b85 -> 397fd2de8
[TRAFODION-3015] compare string to BIGNUM return no result Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/fac342d0 Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/fac342d0 Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/fac342d0 Branch: refs/heads/master Commit: fac342d0b06c1e248b6389c070ccb62ce37a60a9 Parents: 2e4cb9b Author: Liu Ming <[email protected]> Authored: Sat May 19 06:47:14 2018 -0400 Committer: Liu Ming <[email protected]> Committed: Sat May 19 06:47:14 2018 -0400 ---------------------------------------------------------------------- core/sql/exp/exp_bignum.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/trafodion/blob/fac342d0/core/sql/exp/exp_bignum.cpp ---------------------------------------------------------------------- diff --git a/core/sql/exp/exp_bignum.cpp b/core/sql/exp/exp_bignum.cpp index c0f0f69..957edf6 100644 --- a/core/sql/exp/exp_bignum.cpp +++ b/core/sql/exp/exp_bignum.cpp @@ -657,8 +657,15 @@ short BigNum::castFrom (Attributes * source, Lng32 scaleBy = getScale() + exponent; if (scaleBy < 0) { + Int8 roundMe= 0; for (i = 0; i < -scaleBy; i++) + { + roundMe = ( mantissa %10 ) > 4? 1:0; mantissa /= 10; + } + + if(roundMe == 1) //round it + mantissa++; scaleBy = 0; } @@ -761,8 +768,15 @@ short BigNum::castFrom (Attributes * source, Lng32 scaleBy = getScale() + exponent; if (scaleBy < 0) { + Int8 roundMe = 0; for (i = 0; i < -scaleBy; i++) + { + roundMe = ( mantissa %10 ) > 4? 1:0; mantissa /= 10; + } + + if(roundMe == 1) + mantissa++; scaleBy = 0; }
