Page 1 of 1

Error in multiplication

Posted: Sun Jul 15, 2007 10:26 pm
by cosec
I have a column A with value ( 8.0000) and Column B ( 21.4300)

When I multiply Column A and B My value should be 171.44 but the answer I get is 171.50. The target column is (15,2)

If I substitute the input link by the real values the result is ok but otherwise no..how do i fix it

Posted: Sun Jul 15, 2007 10:33 pm
by ArndW
If you actually multiply the 2 numbers together you will get the correct answer (try writing a routine with the code

Code: Select all

Ans = "8.0000" * "21.4300"
and you can see that DS does the math correctly. So your rounding is happening somewhere outside of that statement. What is your target stage where you are seeing the rounded value?

Posted: Sun Jul 15, 2007 10:33 pm
by ray.wurlod
What are the SQL data types of the two input columns? Are you using Data Elements?

Have you used the Debugger or active stage tracing to ensure that the incoming values are what you believe them to be?

Please execute the following query from the Command window in Administrator:

Code: Select all

SELECT EVAL "8.0000 * 21.4300", 8.0000 * 21.4300 FROM VOC FIRST 1;

Re: Error in multiplication

Posted: Mon Jul 16, 2007 2:55 am
by sachin1
hello, i have used oracle datatype numeric format example of precision and scale, for example column A(length=5,precision=4) value=8.0000
column B(length=6,precision=4) value=21.4300.
and i am getting values as 171.44. (Length=15,scale=2)

with other formating of numeric fields, it works fine. please check your datatype and its length(precision).

Re: Error in multiplication

Posted: Mon Jul 16, 2007 3:48 am
by SURA
Hi Man,

Just increase the Target column length (in the file) Precision by 1.It will work in both the cases (15,3) or (16,3)

Thanks,
Ram.
cosec wrote:I have a column A with value ( 8.0000) and Column B ( 21.4300)

When I multiply Column A and B My value should be 171.44 but the answer I get is 171.50. The target column is (15,2)

If I substitute the input link by the real values the result is ok but otherwise no..how do i fix it

Posted: Mon Jul 16, 2007 6:44 pm
by ray.wurlod
The ark had come to dry land and Noah exhorted all the animals to go forth and multiply. He came upon two snakes who seemed to be unwilling to move. "Didn't you hear me tell all the animals to go forth and multiply," Noah asked them. "We can't," they said, "we're adders".
:lol: