System Variable IC: Difference between revisions

From NARS2000
Jump to navigationJump to search
(New page: =Indeterminate Control= <table border="1" cellpadding="5" cellspacing="0" rules="none" summary=""> <tr> <td> <table border="0" cellpadding="5" cellspacing="0" summary=""> <tr> ...)
 
No edit summary
Line 28: Line 28:
       <td></td>
       <td></td>
       <td></td>
       <td></td>
       <td>sets all of the values of the Indeterminate Control Vector.</td>
       <td>sets all of the values of the Indeterminate Control Vector to <apll>R</apll>.</td>
     </tr>
     </tr>
     <tr>
     <tr>
Line 40: Line 40:
       <td></td>
       <td></td>
       <td></td>
       <td></td>
       <td>sets the indexed value of the Indeterminate Control Vector.</td>
       <td>sets the value(s) of the Indeterminate Control Vector indexed by <apll>L</apll> to <apll>R</apll>.</td>
     </tr>
     </tr>
     </table>
     </table>

Revision as of 11:16, 18 May 2008

Indeterminate Control

Z←⎕IC returns the current value of the Indeterminate Control Vector.
Z is an integer vector whose elements each control a separate aspect of how indeterminates are handled by the system.


⎕IC←R sets all of the values of the Indeterminate Control Vector to R.
⎕IC←⍬ sets all of the values of the Indeterminate Control Vector to their system default state.
⎕IC[L]←R sets the value(s) of the Indeterminate Control Vector indexed by L to R.


This experimental feature attempts to collect together in one place control of various indeterminate calculations such as 0÷0 and friends. The values of this multi-element vector each control a different calculation. In particular,

⎕IC Index
(origin-0)
Indeterminate
Calculation
Default
Result
0 ÷0
1 ⍟0 ¯∞
2 !N for integer N < 0 DOMAIN ERROR
3 0×∞ and ∞×0 DOMAIN ERROR
4 0ׯ∞ and ¯∞×0 DOMAIN ERROR
5 0÷0 1
6 ∞÷∞ (same sign) DOMAIN ERROR
7 ∞÷∞ (different sign) DOMAIN ERROR
8 0*0 1
9 0⍟0 DOMAIN ERROR
10 0⍟1 DOMAIN ERROR
11 1⍟0 DOMAIN ERROR
12 1⍟1 1

The values in each element of ⎕IC control the result of the calculation as follows:

⎕IC Value Result
0 0
1 1
2 DOMAIN ERROR
3
4 ¯∞

For example,

      ⎕IO←0
      ⎕IC
3 4 2 2 2 1 2 2 1 2 2 2 1
      0÷0
1
      ⎕IC[5]←2
      0÷0
DOMAIN ERROR
      0÷0
       ∧
      ⎕IC←⍬
      ⎕IC
3 4 2 2 2 1 2 2 1 2 2 2 1