System Variable IC

From NARS2000
Revision as of 18:48, 8 June 2008 by WikiSysop (talk | contribs)
Jump to navigationJump to search

Indeterminate Control

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


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


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

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

The values in each element of <apll>⎕IC</apll> control the result of the calculation as follows:

<apll>⎕IC</apll> Value Result
0 <apll>0</apll>
1 <apll>1</apll>
2 <apll>DOMAIN ERROR</apll>
3 <apll>∞</apll>
4 <apll>¯∞</apll>

For example,

<apll>       ⎕IO←0
      ⎕IC
3 4 2 2 2 1 2 2 1 2 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 2 1
</apll>

Incomplete List of Indeterminates

That there may be other indeterminates not covered by this feature. Please let us know if you think there are other cases which should be included.