.PREC
FUNCTION
This Script-IV command determines how 4GL data names accept the results of floating point calculations.
SYNTAX
.PREC-OFF
.PREC-ONNOTES
- These commands must begin in the leftmost column of the script.
- The .PREC-ON command ensures that the value of a calculated data name matches the specifications for that data name. If necessary, the result is rounded.
- The .PREC-OFF command does not ensure that the value of a calculated data name matches the specification for that data name. The result is determined by the current value of the PRECISION command.
- .PREC-OFF is the default.
- These commands can be used to dynamically affect the results of calculations stored in data names.
EXAMPLES
DN TEST(10.4)MAIN-LINE PRECISION 6.PREC-ON LET TEST = 22/7 PRINT TEST.PREC-OFF LET TEST = 22/7 PRINT TEST INPUT *The DN statement specifies that the data name extends to four decimal places. The PRECISION statement enables six decimal places. The .PREC-ON command enforces the data name specification, so the result is 3.1429. The .PREC-OFF command overrides the data name specification, so the result of the same calculation is 3.142857.
SEE ALSO
LET, PRECISION, description of PRECISION in the Thoroughbred Basic Language Reference
From the Script-IV Language Reference, version 8.9.1. Open this page in the PDF