Will the specification of the Decimal data-type apply to all calculations wrapped inside the Decimal data-type & each calculation inherit the accuracy specified by the parent Decimal type (26 decimal points in e.g.). I'm hoping it does because I have complex calculations which I do not want to obfuscate by specifying the nr of decimal points.
Or must one specify rounding to avoid memory truncation?
In the above I do not think it is necessary to specify the rounding on the final division by A as I interpret that the parent Decimal data-type (38,26) would apply here. But to clarify the question I leave it like that.
Code:
FUNCTION fnName
RETURNS Decimal (38,26)
BEGIN
RETURN
((A*B)+(C*D)) / A
END;
Or must one specify rounding to avoid memory truncation?
Code:
FUNCTION fnName
RETURNS Decimal (38,26)
BEGIN
RETURN
ROUND(
(ROUND(A*B,26)+ROUND(C*D,26)) / A
,26)
END;
Last edited: