Why does this 4 divided by 3 result = 1.000 instead of 1.3333 ?
I need to add several fields together, then multiply the result by another field defined as 3,0 by 100 and put the result in another field.
All the fields are defined in DDS as packed numeric with 0 decimals
( ( Fld_A x Fld_B) + (Fld_C x Fld_D) ) all multiplied by ( 1 - ( Fld_E / 100) )
Example ... Fld_E needs to be converted from whole number 35 to .35 ( like 35 % )
Not complicated math, but can't find the correct syntax working with decimals.
EDIT: I think if I code FLOAT in the division, I will get what I want.
Code:
select cast(4/3 as decimal(8,4) ) from sysibm.sysdummy1
All the fields are defined in DDS as packed numeric with 0 decimals
( ( Fld_A x Fld_B) + (Fld_C x Fld_D) ) all multiplied by ( 1 - ( Fld_E / 100) )
Example ... Fld_E needs to be converted from whole number 35 to .35 ( like 35 % )
Not complicated math, but can't find the correct syntax working with decimals.
EDIT: I think if I code FLOAT in the division, I will get what I want.




Comment