mkusamy Beginner
Joined: 07 Nov 2008 Posts: 9 Topics: 6
|
Posted: Mon Jan 12, 2009 6:22 am Post subject: PLI - How does Scaling factor is used in DIVIDE Built-in? |
|
|
Can any one please explain How the scaling factor is being used and affecting precision of DIVIDE Built-in?
Code: | DCL A FIXED BIN(31) INIT( 45800 );
DCL B FIXED BIN(31) INIT( 2 );
PUT SKIP LIST( DIVIDE(A,B,15,9) ); |
Above code abended with S0CA (FIXEDOVERFLOW) but ran fine when scaling factor was less than 7.
We are using PLI 3.5 and its Refernce manual states as below
Quote: | DIVIDE returns the quotient of x/y with a precision specified by p and q. The base, scale, and mode of the result follow the rules for expression evaluation unless overruled by the PRECTYPE compiler option.
DIVIDE(x,y,p[,q])
x Expression.
y Expression. If y = 0, the ZERODIVIDE condition is raised.
p Restricted expression specifying the number of digits to be maintained throughout the operation.
q Restricted expression specifying the scaling factor of the result. For a fixed-point result, if q is omitted, a scaling factor of zero is the default. For a floating-point result, q must be omitted. |
|
|