Updated June 2020
xcall MIAMEX, MX_ROUND, opcode, factor
MX_ROUND allows you to get or set the new variable rounding factor. Note that the setting persists across programs. For an in-depth discussion of the floating point rounding issue, see Rounding of Floating Point Variables.
Parameters
opcode (Num) [in]
0 to retrieve the rounding factor, 1 to set it
factor (B,4 or F4, F6, and F8) [in/out]
sets the level of precision you would like. 1 means round all variables to the nearest integer, .01 would be to the nearest hundredth. A setting of zero disables the feature, which effectively results in rounding to 48 bit precision, i.e. about 11 significant digits, in order to maintain backwards compatibility with original F,6 implementation. Values greater than one are disallowed. -1 (see History below) disables the 48 bit rounding, i.e. preserves the full 64 bit IEEE precision. In order to be effective, this also requires disabling the FPROUND option, e.g. SET NOFPROUND, and adding SIGNIFICANCE 16 to the program.
History
2020 June, A-Shell 6.5.1684: Several refinements and improvements:
• F4, F6, and F8 format now accepted for factor. Previously only F6 was recognized.
• Values for factor greater than one are now rejected, since they would otherwise interfere with certain floating point operations which assume at least integer precision, such as FOR/NEXT loops. Previously it was possible to accidentally set the MX_ROUND value to something crazy and produce seemingly inexplicable downstream errors.
• An attempt to set the MX_ROUND factor will be rejected if SCALE is in effect. The interaction between SCALE and MX_ROUND would be too complicated for anyone to make sense of; use one or the other, or neither.
• The SCALE statement now overrides and resets any prior MX_ROUND factor.
• All of the above will result in warnings in the ashlog.log file.