Details
-
Task
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
6.1.1
Description
This code:
return Decimal(value, |
scale,
|
precision,
|
(div.quot < 0) ? div.quot-- : div.quot++); |
looks wrong. The increment and decrement happens AFTER the value is passed to the constructor. So the supposed rounding does not actually happen.
The intended code was most likely as follows:
return Decimal(value, |
scale,
|
precision,
|
(div.quot < 0) ? div.quot - 1 : div.quot + 1); |
However, there is a chance that the entire Decimal::integralWideRound() is a dead code.
This method is used only once in functioncolumn.h in FunctionColumn::getDecimalVal(). This is a snippet:
if (scaleMultiplier > 1) |
{
|
if (scaleDiff > 0) |
{
|
// WIP MCOL-641 Unconditional overflow check |
datatypes::MultiplicationNoOverflowCheck mul;
|
mul(decimal.s128Value, scaleMultiplier, decimal.s128Value);
|
}
|
else |
{
|
decimal = decimal.integralWideRound();
|
tntnatbry and bar could not find an SQL script which would make the execution enter the branch calling integralWideRound().
The code should be further analysed what we should do:
- either remove the redundant method
- or fix it to perform rounding correctly
Attachments
Issue Links
- is part of
-
MCOL-4820 Umbrella for tasks related to the decimal(38) work that needs to be done
- Open