Returns a number in a specified format.
&NUMEDIT (xx,yy,zz) number
&NUMEDIT is a built-in function and must be used to the right of an assignment statement. After real number arithmetic calculations, the result is present in one or more variables held in a mathematical form. For example, 22.1 occurs as:
+.221000000000000E+02
&NUMEDIT lets you reformat this representation into a standard decimal number, so that it displays with the required number of decimal positions.
Operands:
Specifies the number of characters reserved for the integer portion of the result (that is, the section of the number to the left of the decimal point). The range is 0 to 15, and, if this operand is not specified, it defaults to 5. If 0 is specified, it defaults to 1.
If xx is greater than the number of characters in the integer portion, then the variable is padded with blanks to the left of the leading digit. If xx is less than the number of digits in the integer portion of the number, then truncation does not occur. The entire integer portion is preserved. This might cause misalignment if you are displaying columns of figures.
Specifies the number of significant decimal positions to be preserved; that is, the number of digits preserved to the right of the decimal point. The range is 0 to 15, and, if this operand is not specified, it defaults to 2. If 0 is specified, an integer value is returned.
If yy is greater than the number of significant decimal positions, then the variable is padded with zeros to the right of the last digit. If yy is less than the number of significant decimal positions, then the result is truncated or rounded (as indicated by the zz operand) to yy positions.
Indicates whether the result is truncated or rounded and whether the exponent format is maintained. Valid values for zz is as follows: 0 The default, meaning truncation and no exponent required R Meaning rounding and no exponent required E Meaning truncation and exponent required ER Meaning rounding and exponent required
If you specify E, then the number is presented with a single digit to the left of the decimal point, then the number of significant decimal places defined by yy, and the exponent to the right of the least significant decimal position.
For example, suppose the variable &RESULT contains the real number 38.9 with the format:
+.389000000000000E+02
After executing the statement:
&A = &NUMEDIT (0,4,E) &RESULT the value of &A is 3.8900E+01
The variable with the real number or integer that is to be reformatted.
Real numbers are manipulated as base 16 floating point numbers, so there is no exact representation for some decimal values. This can cause an apparent loss of precision in the 15th significant digit if more than 15 decimal digits were supplied as input.
Examples: &NUMEDIT
&RESULT = ( 27.993 * 4.882 ) -* &RESULT is set to
-* +.136661826000000E+03
&A = &NUMEDIT (0,5,0) &RESULT -* &A becomes 136.66182
| Copyright © 2011 CA. All rights reserved. | Tell Technical Publications how we can improve this information |