Difference in calculation for decimal (38,10) fields.
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 56
- Joined: Fri Sep 21, 2007 9:10 am
- Location: Bangalore
Difference in calculation for decimal (38,10) fields.
Hi All,
I am doing calculation for decimal fields: (A-1)/(A*B)*C
In datastage the result is differing.
All input fileds i.e A,B,C are of datatype Numeric (38,10) & also o/p field.
Below are the values of i/p fields used for calculating;
A = 2.0789281794
B = 0.05
C = 49579862.4
The result datastage giving through Transformer = 514622017.1393123702
But the actual result should be = 514622017.2894397446
There is difference of 0.15; difference is in decimal field.
Any ideas or solutions are welcome.
Thanks in advance,
Yusuf.
-
- Participant
- Posts: 56
- Joined: Fri Sep 21, 2007 9:10 am
- Location: Bangalore
There are environment variables for handling decimal data:
APT_DECIMAL_INTERM_ROUND_MODE, descrption is it specifies the default rounding mode for any decimal intermediate variables required in calculations. The default is round_inf.
APT_DECIMAL_INTERM_SCALE Specifies the default scale value for any decimal intermediate variables required in calculations. Default value is 10.
Check the above env variables and set it accordingly
M
APT_DECIMAL_INTERM_ROUND_MODE, descrption is it specifies the default rounding mode for any decimal intermediate variables required in calculations. The default is round_inf.
APT_DECIMAL_INTERM_SCALE Specifies the default scale value for any decimal intermediate variables required in calculations. Default value is 10.
Check the above env variables and set it accordingly
M
I am not sure if datastage is rounding. But if you do those calculations step by step you get up to 20 decimal places. If datastage process the output each step as (38,10) then yes it will do some rounding to put it into that format before taking the next step. Though i always thought that datastage did the calcuation with no rounding then rounded the output to the specified format.yousuff1710 wrote: I am passing all these values as Numeric (38,10) without any rounding function.
Is datastage rounding these decimals internally.
If yes, then how to get correct result.
Please give a solution for this.
Regards,
Yusuf.
My only suggestion is to allow for more decimal places so that implicit rounding will not occur.
M - APT environment variables are not applicable in a Server question.go4it wrote:There are environment variables for handling decimal data:
APT_DECIMAL_INTERM_ROUND_MODE, descrption is it specifies the default rounding mode for any decimal intermediate variables required in calculations. The default is round_inf.
APT_DECIMAL_INTERM_SCALE Specifies the default scale value for any decimal intermediate variables required in calculations. Default value is 10.
Check the above env variables and set it accordingly
M
-craig
"You can never have too many knives" -- Logan Nine Fingers
"You can never have too many knives" -- Logan Nine Fingers
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
-
- Participant
- Posts: 56
- Joined: Fri Sep 21, 2007 9:10 am
- Location: Bangalore
-
- Participant
- Posts: 56
- Joined: Fri Sep 21, 2007 9:10 am
- Location: Bangalore