Hi Friends,
I have 3 decimal fields in report.
Say A, B and C where C = A + B.
For example: A = 50310.06; B = 3521.70; C = 53831.76
I am multiplying A, B and C with 1.235025 (ERV = exchange rate value) and the results are store in D,E and F respectively.
Then my answer should be: D = E + F. The problem I'm facing here is all these D, E, F fields are automatically rounding off. But I don't want those field to round-off. Instead I should get the exact value with 2 decimal places. How to proceed with it?
The code I wrote is as follows:
ERV := 1.235025;
D := ROUND((A * ERV),0.01,'<');
E := ROUND((B * ERV),0.01,'<');
F := ROUND((C * ERV),0.01,'<');
I'm getting the output as:
D := 62134.19 [50310.06 * 1.235025]
E := 4349.38 [3521.70 * 1.235025]
F := 66483.59. [53831.76 * 1.235025].
The right answer should be:
D := 62134.18
E := 4349.38
F := 66483.56
Comments
First some clarifications:
ERV = 1.238237 or 1.235025?
D = E + F or F = D + E?
Never stop learning
Van Vugt's dynamiXs
Dutch Dynamics Community
Microsoft Dynamics NAV Classic
D = 62.134,18
E = 4.349,38
F = 66.483,56
OK
So what's the problem?
BTW: this is the code I have created ina codeunit: with all variables of data type Decimal
Never stop learning
Van Vugt's dynamiXs
Dutch Dynamics Community
1. ERV := 1.235025;
2. F = D + E
Never stop learning
Van Vugt's dynamiXs
Dutch Dynamics Community
F = D + E and
F' = ROUND(C * ERV)
Are you sure, the values you gave us are the actual values or might this be the true values rounded for display?
The examples that I have given here are the real ones. This I am doing for Invoice. If even .02 difference occurs, it will be questioned in auditing.
Check this option also if the calculation in question is getting the values from table fields..