System Variable FPC: Difference between revisions

From NARS2000
Jump to navigationJump to search
No edit summary
Paul Robinson (talk | contribs)
No edit summary
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
=Floating Point Control=
<h1><aplxx>⎕FPC</aplxx> - Floating Point Control</h1>
{{BoxStart|<apll>Z←⎕FPC</apll>
|returns the current value of the Floating Point Control precision.}}
{{BoxEnd|<apll>Z</apll> is an integer scalar that represents the current value of the number of bits of precision used for [[Rational and VFP Numbers|Multiple-Precision Floating Point numbers]].}}
<br />


<table border="1" cellpadding="5" cellspacing="0" rules="none" summary="">
{| border="1" cellpadding="5" cellspacing="0" rules="none" summary=""
<tr>
|-
  <td>
||<apll>⎕FPC←R</apll>
    <table border="0" cellpadding="5" cellspacing="0" summary="">
||sets the value of the Floating Point Control precision to <apll>R</apll>.
    <tr>
|-
      <td valign="top"><apll>Z←⎕FPC</apll></td>
||<apll>⎕FPC←⍬</apll>
      <td></td>
||sets the value of the Floating Point Control precision to its system default state.
      <td></td>
|}
      <td>returns the current value of the Floating Point Control precision.</td>
    </tr>
    </table>
  </td>
</tr>
<tr>
  <td><apll>Z</apll> is an integer scalar that represents the current value of the number of bits of precision used for [[Rational and VFP Numbers|VFP numbers]].</td>
</tr>
</table>
<br />
<br />


<table border="1" cellpadding="5" cellspacing="0" rules="none" summary="">
<p>
<tr>
The approximate number of digits of precision for a given value of <apll>⎕FPC</apll> is about <apll>10⍟2*⎕FPC</apll>. The value of <apll>⎕FPC</apll> for a given required precision is about <apll>⌈2⍟10*digits</apll>.
  <td>
</p>
    <table border="0" cellpadding="5" cellspacing="0" summary="">
    <tr>
      <td valign="top"><apll>⎕FPC←R</apll></td>
      <td></td>
      <td></td>
      <td>sets the value of the Floating Point Control precision to <apll>R</apll>.</td>
    </tr>
    <tr>
      <td valign="top"><apll>⎕FPC←⍬</apll></td>
      <td></td>
      <td></td>
      <td>sets the value of the Floating Point Control precision to its system default state.</td>
    </tr>
    </table>
  </td>
</tr>
</table>
<br />


<p>The minimum value for <apll>⎕FPC</apll> is <apll>53</apll>; the maximum value is the largest positive 32-bit integer <apll>2147483647</apll>.</p>
<p>The minimum value for <apll>⎕FPC</apll> is <apll>1</apll>; the maximum value is the integer <apll>1073741695 ←→ ¯129+2*30 ←→ 16<_b/>3FFFFF7F</apll>.</p>


<p>The system default value is <apll>128</apll>.</p>
<p>The system default value is <apll>128</apll>.</p>


<p>For example,</p>


<apll>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕PP←200<br />
<p>For example:</p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕FPC←64 &nbsp;⋄ *1x<br />
 
2.71828182845904523543<br />
<apll><pre>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕FPC←128 ⋄ *1x<br />
&ensp;&ensp;     ⎕PP←240
2.718281828459045235360287471352662497759<br />
&ensp;&ensp;     ⎕FPC←64  ⋄ *1<_x/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕FPC←256 ⋄ *1x<br />
&ensp;&ensp;2.7182818284590452354
2.718281828459045235360287471352662497757247093699959574966967627724076630353555<br />
&ensp;&ensp;     ⎕FPC←128  ⋄ *1<_x/>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;⎕FPC←512 ⋄ *1x<br />
&ensp;&ensp;2.71828182845904523536028747135266249776
2.71828182845904523536028747135266249775724709369995957496696762772407663035354759457138217852516642742746639193200305992181741359662904357290033429526059559</apll>
&ensp;&ensp;     ⎕FPC←256  ⋄ *1<_x/>
&ensp;&ensp;2.71828182845904523536028747135266249775724709369995957496696762
<_lc/>     772407663035355
&ensp;&ensp;     ⎕FPC←512  ⋄ *1<_x/>
&ensp;&ensp;2.71828182845904523536028747135266249775724709369995957496696762
<_lc/>     7724076630353547594571382178525166427427466391932003059921
<_lc/>     8174135966290435729003342952605956
&ensp;&ensp;     ⎕FPC←1024 ⋄ *1<_x/>
&ensp;&ensp;2.71828182845904523536028747135266249775724709369995957496696762
<_lc/>     7724076630353547594571382178525166427427466391932003059921
<_lc/>     8174135966290435729003342952605956307381323286279434907632
<_lc/>     3382988075319525101901157383418793070215408914993488416750
<_lc/>      924</pre></apll>


<p>Whereas, according to Wolfram Alpha, the exact value to 230 digits is</p>
<p>Whereas, according to Wolfram Alpha, the exact value to 230 digits is</p>


<apll>2.71828182845904523536028747135266249775724709369995957496696762772407663035354759457138217852516642742746639193200305992181741359662904357290033429526059563073813232862794349076323382988075319525101901157383418793070215408914993488...</apll><br />
<apll><pre>&ensp;&ensp;2.71828182845904523536028747135266249775724709369995957496696762
<_lc/>      7724076630353547594571382178525166427427466391932003059921
<_lc/>      8174135966290435729003342952605956307381323286279434907632
<_lc/>      3382988075319525101901157383418793070215408914993488...</pre></apll>
 
'''See Also: [[System_Variable_CT|Comparison Tolerance ⎕CT]]'''
 
 
{{System Variables}}
{{Article footer|0|NO}}
[[Category:System functions|FPC]] [[Category:Math functions|FPC]]

Latest revision as of 19:03, 13 October 2019

⎕FPC - Floating Point Control

Z←⎕FPC returns the current value of the Floating Point Control precision.
Z is an integer scalar that represents the current value of the number of bits of precision used for Multiple-Precision Floating Point numbers.


⎕FPC←R sets the value of the Floating Point Control precision to R.
⎕FPC←⍬ sets the value of the Floating Point Control precision to its system default state.


The approximate number of digits of precision for a given value of ⎕FPC is about 10⍟2*⎕FPC. The value of ⎕FPC for a given required precision is about ⌈2⍟10*digits.

The minimum value for ⎕FPC is 1; the maximum value is the integer 1073741695 ←→ ¯129+2*30 ←→ 16b3FFFFF7F.

The system default value is 128.


For example:

        ⎕PP←240 
        ⎕FPC←64   ⋄ *1x
  2.7182818284590452354 
        ⎕FPC←128  ⋄ *1x
  2.71828182845904523536028747135266249776 
        ⎕FPC←256  ⋄ *1x
  2.71828182845904523536028747135266249775724709369995957496696762 
➥      772407663035355
        ⎕FPC←512  ⋄ *1x
  2.71828182845904523536028747135266249775724709369995957496696762
➥      7724076630353547594571382178525166427427466391932003059921
➥      8174135966290435729003342952605956 
        ⎕FPC←1024 ⋄ *1x
  2.71828182845904523536028747135266249775724709369995957496696762
➥      7724076630353547594571382178525166427427466391932003059921
➥      8174135966290435729003342952605956307381323286279434907632
➥      3382988075319525101901157383418793070215408914993488416750
➥      924

Whereas, according to Wolfram Alpha, the exact value to 230 digits is

  2.71828182845904523536028747135266249775724709369995957496696762
➥      7724076630353547594571382178525166427427466391932003059921
➥      8174135966290435729003342952605956307381323286279434907632
➥      3382988075319525101901157383418793070215408914993488...

See Also: Comparison Tolerance ⎕CT


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
A+S ⍪ ≡ ≢ ⍒ ⍋ ⌽ ⍉ ⊖ ⍟ ⍱ ⍲ ⍠ ⌹
Alt ⋄ ¨ ¯ < ≤ ∅ ≥ > ≠ ∨ ∧ × ÷
Sh ~ ! @ # $ % ^ & * ( ) _ +
Key ` 1 2 3 4 5 6 7 8 9 0 - =
A+S ⍷ √ ⍨ ⍸ ⍥ ⍣ ⍞ ⍬ ⊣
Alt ? ⍵ ∊ ⍴ § ↑ ↓ ⍳ ○ π ← → ⊢
Sh Q W E R T Y U I O P { } |
Key q w e r t y u i o p [ ] \
A+S ∫ ∂ ⌻ ⍢ ⍙ ⍤ ⍫ ⌷
Alt ⍺ ⌈ ⌊ ∞ ∇ ∆ ∘ ‼ ⎕ ⍎ ⍕
Sh A S D F G H J K L : "
Key a s d f g h j k l ; '
A+S ⊆ ⊇ χ ⍡ ⍭ ⊙
Alt ⊂ ⊃ ∩ ∪ ⊥ ⊤ ⍦ ⍝ ⍀ ⌿
Sh Z X C V B N M < > ?
Key z x c v b n m , . /
{{#ifeq:0|4||title="match" style="border-width:thick; border-color:blue; background-color:yellow;"|≡ {{#ifeq:0|7||title="iota" style="border-width:thick; border-color:blue; background-color:yellow;" |⍳ {{#ifeq:0|9||title="slash" style="border-width:thick; border-color:blue; background-color:yellow;" |/ {{#ifeq:0|11||title="diamond" style="border-width:thick; border-color:blue; background-color:yellow;" |⋄ {{#switch: 0
NARS 2000 Lang
Tool
Bar

{{#ifeq:0|1||title="assign" style="border-width:thick; border-color:blue; background-color:yellow;" |←

→ bgcolor=cyan title="assign" |← → }}

{{#ifeq:0|2||title="plus" style="border-width:thick; border-color:blue; background-color:yellow;" |+

- × ÷ * ⍟ ⌹ ○ ! ? √ bgcolor=cyan title="plus" |+ - × ÷ * ⍟ ⌹ ○ ! ? √ }}

{{#ifeq:0|3||title="mod" style="border-width:thick; border-color:blue; background-color:yellow;" ||

⌈ ⌊ ⊥ ⊤ ⊣ ⊢
⌈ ⌊ ⊥ ⊤ ⊣ ⊢
≢ < ≤ = ≥ > ≠ bgcolor=cyan title="match" |≡ ≢ < ≤ = ≥ > ≠ }}

{{#ifeq:0|5||title="down caret" style="border-width:thick; border-color:blue; background-color:yellow;" |∨

∧ ⍱ ⍲ bgcolor=cyan title="down caret" |∨ ∧ ⍱ ⍲ }}

{{#ifeq:0|6||title="take" style="border-width:thick; border-color:blue; background-color:yellow;" |↑

↓ ⊂ ⊃ ⌷ ⍋ ⍒
↓ ⊂ ⊃ ⌷ ⍋ ⍒
∊ ⍸ ⍷ ∪ ∩ ⊆ ⊇ ~ § π .. bgcolor=cyan title="iota" |⍳ ∊ ⍸ ⍷ ∪ ∩ ⊆ ⊇ ~ § π .. }}

{{#ifeq:0|8||title="comma" style="border-width:thick; border-color:blue; background-color:yellow;" |,

⍪ ⍴ ⌽ ⊖ ⍉
⍪ ⍴ ⌽ ⊖ ⍉
\ ⌿ ⍀ ⊙ ¨ ⍨ ⍤ ⍡ ⍥ ⍦ . ∘ ⍠ ‼ ⌻ ∂ ∫ bgcolor=cyan title="slash" |/ \ ⌿ ⍀ ⊙ ¨ ⍨ ⍤ ⍣ ⍡ ⍥ ⍦ . ∘ ⍠ ‼ ⌻ ∂ ∫ }}

{{#ifeq:0|10||title="quotequad" style="border-width:thick; border-color:blue; background-color:yellow;" |⍞

⎕ ⍎ ⍕
⎕ ⍎ ⍕
⍝ ∇ ∆ ⍙ _ ⍺ ⍵ bgcolor=cyan title="diamond" |⋄ ⍝ ∇ ∆ ⍙ _ ⍺ ⍵ }}

{{#ifeq:0|12||title="neg" style="border-width:thick; border-color:blue; background-color:yellow;" |¯

⍬ ∞ title="neg" |¯ ⍬ ∞ ∅
colspan=8 |Second Row i j k a b e g p r v x z colspan=8 |Second Row i j k a b e g p r v x z colspan=8 |Second Row i j k a b e g p r v x z colspan=6 |Second Row i j k i j k l g p r v x

}}

{{#ifeq:0|0| |}}