Page 1 of 1

Avoid Rouding Off in Parallel Job, 7.5.2 version

Posted: Mon Dec 06, 2010 8:09 pm
by horserider
I have a source data file (dataset) that has a column defined as varchar(17). The column contains decimal values (11 places after decimal). Example:

0.28765498765
1.98198765200
1936.27000000000

I want to sum up column values but without any rounding. Example below....

Example: A

1936.27000000000
1432.12340000000
----------------------
3368.39340000000

Example: B

0.28765498765
1.98198765200
----------------------
2.26964263965


I am not getting the sum value correctly. When I am summing it's rounding off. How can I get exact summed value?

Posted: Mon Dec 06, 2010 11:01 pm
by SBSA_DW2
you may want to do a search on this environment variable: APT_DECIMAL_INTERM_ROUND_MODE

APT_DECIMAL_INTERM_ROUND_MODE
Specifies the default rounding mode for any decimal intermediate
variables required in calculations. The default is round_inf.

Posted: Tue Dec 07, 2010 11:46 am
by horserider
SBSA_DW2 wrote:you may want to do a search on this environment variable: APT_DECIMAL_INTERM_ROUND_MODE

APT_DECIMAL_INTERM_ROUND_MODE
Specifies the default rounding mode for any decimal intermediate
variables required in calculations. The default is round_inf.
Here is what I did that seems to solve the issue.

(1) Added these 3 parameters to my job.

$APT_DECIMAL_INTERM_PRECISION = 38
$APT_DECIMAL_INTERM_ROUND_MODE = Round toward negative infinity
$APT_DECIMAL_INTERM_SCALE = 11

(2) In transformer, defined a column Decimal(17,11) and derived value using below formula

StringToDecimal((1936.27000000000,'floor')) *1/2,'floor') + StringToDecimal( (StringToDecimal(1432.12340000000 ,'floor')) *1/2,'floor')

(3) Then I moved the value of variable to another column defined as varchar 17.

All calculations seems to keep the precision of 11

Posted: Tue Dec 07, 2010 7:20 pm
by chulett
horserider wrote:$APT_DECIMAL_INTERM_ROUND_MODE = Round toward negative infinity
That doesn't look like any kind of valid APT value... perhaps "round_neg_inf"??? :?