Two-argument form See also one-argument form Format
The right argument must be either a simple array, or have a maximum depth of 2 (no element higher rank than a vector).
Like the one-argument form, this version of
If the first number in the left argument is 0, the system uses the specified number of decimal places, and as many other characters as are needed. If a single number is used for the left argument, it is treated as two numbers with the first set to 0.
Scaled (or scientific) notation can be forced if the second number of a pair of numbers in the left argument is negative. In this case, the negative number specifies the number of digits before the E character.
To display each number on the right in a field which is 10 characters wide and has 2 decimal places:
10 2 ⍕ 13.8765390 6 87.213 23.1 13.88 6.00 87.21 23.10
TABLE 2.77 1.731 22.9 11 0.3301 2.3
To display each column in TABLE as a 5-character field with no decimal places:
5 0 ⍕ TABLE 3 2 23 11 0 2
To force scaled notation:
8 ¯2 ⍕ 7.1 7.1E000
To specify the number of decimal places while allowing the rest of the number as many character positions as it needs (including one leading space):
0 2 ⍕ 22.1987 999.1 22.20 999.10
⍴ 0 2 ⍕ 11.7 (Asks the size of the formatted number. 6 It has been allocated 2 positions after the point, plus the 4 positions needed for the 2 integers, the point itself and a leading space)
Note: the above examples show a single pair of numbers in the left argument being applied in turn to each number in the right argument. The left argument can instead contain a separate pair of numbers (ie separate instructions) for each term on the right.
10 2 8 3 ⍕ 279.5547 10.1234 279.55 10.123
Copyright © 1996-2010 MicroAPL Ltd