System Functions
PRC( ) Round Number to Precision
   
Format PRC(num[,precision][,ERR=stmtref])
 
Where:
num Value to be rounded. Numeric expression.
precision Precision to which to round. Optional. Numeric expression. Integer from 0 to 14. If omitted, rounding is done to the current precision in effect.
stmtref Program line number or statement label to which to transfer control.
   
Returns Numeric value, rounded to a set precision.
   
Description The PRC( ) function returns a given numeric value (num) rounded to the set precision. If a precision parameter is supplied, the PRC( ) function rounds the value based on the new precision. If precision is not supplied, then the value is rounded to the current PRECISION in effect. .


*Note* There is one exception to the above. A ROUND ON directive will truncate longer values to the current PRECISION in effect.


  If you use an invalid value (e.g., >14), ProvideX returns Error #41: Invalid integer encountered (range error or non-integer).
   
See Also PRECISION Directive,
ROUND Directive
FLOATINGPOINT Directive
   
Example

0010 LET A=PRC(1.3456); PRINT A,
0020 LET A=PRC(1.3456,0); PRINT @(15),A,
0030 LET A=PRC(1.3456,3); PRINT @(25),A,
0040 LET A=PRC(1.3456,2); PRINT @(40),A,
-:run

The results will vary, depending on current precision and rounding:

PRECISION 2, ROUND OFF PRECISION 2, ROUND ON PRECISION -1
1.35 1.35 .13456E+0
1 1 1 .1E+01
1.346 1.35 .1346E+01
1.35- 1.35- .135E+01-