System Variable CT: Difference between revisions
From NARS2000
Jump to navigationJump to search
(new stub) |
(Set up ⎕CT - Comparison Tolerance) |
||
| Line 1: | Line 1: | ||
<h1>{quad}CT - | <h1>{quad}CT - Comparison Tolerance</h1> | ||
{{BoxStart|⎕CT | {{BoxStart|⎕CT | ||
| | | Value used by several primitive functions to determine whether two | ||
numbers should be considered equal; default for a CLEAR NARS workspace is 3E¯15. }} | |||
{{BoxEnd|⎕CT←'<i>VALUE</i>'}} | {{BoxEnd|⎕CT←'<i>VALUE</i>'}} | ||
Due to computer storage formats, real numbers are normally expressed as n-bits of information<br> | |||
and ''not necessarily an exact number''. NARS allows ⎕CT to vary between no larger than 1E¯10 and no smaller than 0. | |||
Examples: | |||
<pre> | |||
⎕CT ⍝ View ⎕CT for a CLEAR NARS workspace. | |||
3E¯15 ⍝ Default value. | |||
⎕CT←45 ⍝ Attempt to change Comparison Tolerance to [+/-] 45 (an exaggerated engineering +/- tolerance. | |||
⎕CT ⍝ View ⎕CT after attempting to set its value at 45. | |||
1E¯10 ⍝ This is the largest ⎕CT number NARS will allow = 1E¯10 (and NOT 45 as was attempted just above). | |||
4.0000000000005=4.0000000000008 ⍝ Comparison attempted. Are these two different numbers equal? (No, but...). | |||
1 ⍝ NARS/APL's Interpreter says YES(1), they ARE EQUAL - because the Comparison Tolerance is set high/large. | |||
⎕CT←1E¯64 ⍝ Set NARS comparison tolerance to a much smaller number (for greater precision comparisons). | |||
⎕CT ⍝ View ⎕CT | |||
1E¯64 | |||
4.0000000000005=4.0000000000008 ⍝ Are these two different [but the same as above] numbers NOW equal? (No). | |||
0 ⍝ NARS/APL's Interpreter says NO(0), they are NOT EQUAL - because the Comparison Tolerance is set below the threshold. | |||
⎕CT←1E¯10000 | |||
⎕CT | |||
0 | |||
⎕CT←3E¯15 ⍝ Reset ⎕CT to its default value. | |||
⎕CT | |||
3E¯15 | |||
</pre> | |||
It is useful to think of ⎕CT as an engineering tolerance +/- for computer science engineers in comparing numbers in APL - sometimes comparing results from '''different computer programs''' or comparing results from '''different methodologies or a standard'''. In Mechanical Engineering, tolerance is defined as the permissible deviation from a specified value of some dimension, often expressed as a percent, e.g. 0.0000001%.<br> | |||
{{System Variables}} | {{System Variables}} | ||
{{Article footer}} | {{Article footer}} | ||
{{stub}} | {{stub}} | ||
Revision as of 22:37, 11 February 2015
⎕CT - Comparison Tolerance
|
||||
| ⎕CT←'VALUE' |
Due to computer storage formats, real numbers are normally expressed as n-bits of information
and not necessarily an exact number. NARS allows ⎕CT to vary between no larger than 1E¯10 and no smaller than 0.
Examples:
⎕CT ⍝ View ⎕CT for a CLEAR NARS workspace.
3E¯15 ⍝ Default value.
⎕CT←45 ⍝ Attempt to change Comparison Tolerance to [+/-] 45 (an exaggerated engineering +/- tolerance.
⎕CT ⍝ View ⎕CT after attempting to set its value at 45.
1E¯10 ⍝ This is the largest ⎕CT number NARS will allow = 1E¯10 (and NOT 45 as was attempted just above).
4.0000000000005=4.0000000000008 ⍝ Comparison attempted. Are these two different numbers equal? (No, but...).
1 ⍝ NARS/APL's Interpreter says YES(1), they ARE EQUAL - because the Comparison Tolerance is set high/large.
⎕CT←1E¯64 ⍝ Set NARS comparison tolerance to a much smaller number (for greater precision comparisons).
⎕CT ⍝ View ⎕CT
1E¯64
4.0000000000005=4.0000000000008 ⍝ Are these two different [but the same as above] numbers NOW equal? (No).
0 ⍝ NARS/APL's Interpreter says NO(0), they are NOT EQUAL - because the Comparison Tolerance is set below the threshold.
⎕CT←1E¯10000
⎕CT
0
⎕CT←3E¯15 ⍝ Reset ⎕CT to its default value.
⎕CT
3E¯15
It is useful to think of ⎕CT as an engineering tolerance +/- for computer science engineers in comparing numbers in APL - sometimes comparing results from different computer programs or comparing results from different methodologies or a standard. In Mechanical Engineering, tolerance is defined as the permissible deviation from a specified value of some dimension, often expressed as a percent, e.g. 0.0000001%.
| System Variables (A value may be assigned to these except for ⎕DM) | |||||||||
|---|---|---|---|---|---|---|---|---|---|
| ⎕ALX | ⎕CT | ⎕DM | ⎕DT | ⎕ELX | ⎕FC | ⎕FEATURE | ⎕FPC | ⎕IC | ⎕IO |
| ⎕LR | ⎕LX | ⎕PP | ⎕PR | ⎕PW | ⎕RL | ⎕SA | ⎕WSID | ||
| Niladic System Functions (a value cannot be assigned to these) | |||||||||
| ⎕A | ⎕AV | ⎕EM | ⎕ET | ⎕LC | ⎕NNAMES | ⎕NNUMS | ⎕SI | ⎕SYSID | ⎕SYSVER |
| ⎕T | ⎕TC | ⎕TCBEL | ⎕TCBS | ⎕TCESC | ⎕TCFF | ⎕TCHT | ⎕TCLF | ⎕TCNL | ⎕TCNUL |
| ⎕TS | ⎕WA | ||||||||
| Monadic or dyadic system functions (a value cannot be assigned to these) | |||||||||
| ⎕AT | ⎕CR | ⎕DC | ⎕DFT | ⎕DL | ⎕DR | ⎕EA | ⎕EC | ⎕ERROR | ⎕ES |
| ⎕EX | ⎕FMT | ⎕FX | ⎕MF | ⎕NAPPEND | ⎕NC | ⎕NCREATE | ⎕NERASE | ⎕NINFO | ⎕NL |
| ⎕NLOCK | ⎕NREAD | ⎕NRENAME | ⎕NREPLACE | ⎕NRESIZE | ⎕NSIZE | ⎕NTIE | ⎕NUNTIE | ⎕STOP | ⎕TF |
| ⎕TRACE | ⎕UCS | ⎕VR | |||||||
| Note that quad functions and variables (except for the ⎕A family of functions) are case insensitive | |||||||||
| See Also | ||
| System Commands | System Variables and Functions | Operators |
| Keyboard | ||||||||||||||
| Alt+Shift | ⍪ | ≡ | ≢ | ⍒ | ⍋ | ⌽ | ⍉ | ⊖ | ⍟ | ⍱ | ⍲ | ⍠ | ⌹ | |
| Alt | ⋄ | ¨ | ¯ | < | ≤ | ∅ | ≥ | > | ≠ | ∨ | ∧ | × | ÷ | |
| Shift | ~ | ! | @ | # | $ | % | ^ | & | * | ( | ) | _ | + | |
| Key | ` | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 0 | - | = | |
| Alt+Shift | ⍷ | √ | ⍨ | ⍸ | ⍥ | ⍣ | ⍞ | ⍬ | ⊣ | |||||
| Alt | ? | ⍵ | ∊ | ⍴ | § | ↑ | ↓ | ⍳ | ○ | π | ← | → | ⊢ | |
| Shift | Q | W | E | R | T | Y | U | I | O | P | { | } | | | |
| Key | q | w | e | r | t | y | u | i | o | p | [ | ] | \ | |
| Alt+Shift | ∫ | ∂ | ⌻ | ⍢ | ⍙ | ⍤ | ⍫ | ⌷ | ||||||
| Alt | ⍺ | ⌈ | ⌊ | ∞ | ∇ | ∆ | ∘ | ‼ | ⎕ | ⍎ | ⍕ | |||
| Shift | A | S | D | F | G | H | J | K | L | : | " | |||
| Key | a | s | d | f | g | h | j | k | l | ; | ' | |||
| Alt+Shift | ⊆ | ⊇ | χ | ⍡ | ⍭ | ⊙ | ||||||||
| Alt | ⊂ | ⊃ | ∩ | ∪ | ⊥ | ⊤ | ⍦ | ⍝ | ⍀ | ⌿ | ||||
| Shift | Z | X | C | V | B | N | M | < | > | ? | ||||
| Key | z | x | c | v | b | n | m | , | . | / | ||||
| NARS 2000 Lang Tool Bar |
← | → | + | - | × | ÷ | * | ⍟ | ⌹ | ○ | ! | ? | √ | | | ⌈ | ⌊ | ⊥ | ⊤ | ⊣ | ⊢ | |||
| ≡ | ≢ | < | ≤ | = | ≥ | > | ≠ | ∨ | ∧ | ⍱ | ⍲ | ↑ | ↓ | ⊂ | ⊃ | ⌷ | ⍋ | ⍒ | |||||
| ⍳ | ∊ | ⍸ | ⍷ | ∪ | ∩ | ⊆ | ⊇ | ~ | § | π | .. | , | ⍪ | ⍴ | ⌽ | ⊖ | ⍉ | ||||||
| / | \ | ⌿ | ⍀ | ⊙ | ¨ | ⍨ | ⍤ | ⍣ | ⍡ | ⍥ | ⍦ | . | ∘ | ⍠ | ‼ | ⌻ | ∂ | ∫ | ⍞ | ⎕ | ⍎ | ⍕ | |
| ⋄ | ⍝ | ∇ | ∆ | ⍙ | _ | ⍺ | ⍵ | ¯ | ⍬ | ∞ | ∅ | ||||||||||||
| Second Row | i j k | i j k l | g | p | r | v | x | ||||||||||||||||
[[Category:Mouse Group {{{1}}}|{{{2}}}]]
- This NARS2000 article is a stub and needs further work.