The Number.halfAdjust function () API allows you half adjust or round a numeric value to a number provided to the functionspecific number of decimal positions.
Parameters
- Numeric value
- Number
- Decimals
...
- of decimals in result value
Return Value
Rounded value
Example
Code Block | ||
---|---|---|
| ||
pjs.define("result2num", { type: 'packed decimal', length: 15, decimals: 5 }); pjs.define("c15b", { type: 'char', length: 15, initValue: ' + 9 , 8 7 6 ' }); result2 = pjs.dech(c15b, 5 num = 9.876; num = Number.halfAdjust(num, 2); return result2num; //9.88 |