diff options
| author | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-02-02 22:10:06 -0500 |
|---|---|---|
| committer | Marshall Lochbaum <mwlochbaum@gmail.com> | 2022-02-02 22:10:06 -0500 |
| commit | 5065a21dec3843532faa54a011551afc927cff22 (patch) | |
| tree | e2382d08e7b3d1c3ac884502df7b323f460feeed /docs/spec/system.html | |
| parent | eee6b31635d742c86cd3c082556472e444cf448e (diff) | |
Short •math specification
Diffstat (limited to 'docs/spec/system.html')
| -rw-r--r-- | docs/spec/system.html | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/docs/spec/system.html b/docs/spec/system.html index aa3f5ff8..be185367 100644 --- a/docs/spec/system.html +++ b/docs/spec/system.html @@ -484,6 +484,11 @@ <p>The <a href="https://en.wikipedia.org/wiki/Unix_time">Unix epoch</a> is 1970-01-01 00:00:00 UTC, and <a href="https://en.wikipedia.org/wiki/Unix_time">Unix time</a> is the number of seconds since this epoch, with adjustments for leap seconds. <code><span class='Function'>•UnixTime</span></code> is intended for absolute time measurement and should use the source most accurate reflects Unix time when it's called. <code><span class='Function'>•MonoTime</span></code> is intended for relative measurement and should use the method that gives the most precise time differences over the course of the program. Its return value must never decrease between calls.</p> <p><code><span class='Modifier'>•_timed</span></code> returns the total time taken divided by the number of function calls (<code><span class='Value'>𝕨</span></code> if provided and 1 otherwise), including the overhead required for the outer loop that counts iterations (which will typically be negligible in comparison to the BQN code).</p> <p>More accurately the modifier <code><span class='Modifier2'>•_maxTime_</span></code> <em>may</em> fail if execution of <code><span class='Function'>𝔽</span></code> takes over <code><span class='Value'>𝕨</span><span class='Function'>𝔾</span><span class='Value'>𝕩</span></code> seconds, and should fail as quickly as it is practically able to. The most likely way to implement this modifier is to interrupt execution at the given time. If <code><span class='Function'>𝔽</span></code> completes before the interrupt there is no need to measure the amount of time it actually took.</p> +<h2 id="math"><a class="header" href="#math">Math</a></h2> +<p>System namespace <code><span class='Value'>•math</span></code> contains mathematical utilities that are not easily implemented with basic arithmetic, analogous to C's <code><span class='Value'>math.h</span></code>.</p> +<p>Constants <code><span class='Value'>ln10</span><span class='Gets'>⇐</span><span class='Function'>⋆</span><span class='Modifier'>⁼</span><span class='Number'>10</span></code>, <code><span class='Value'>ln2</span><span class='Gets'>⇐</span><span class='Function'>⋆</span><span class='Modifier'>⁼</span><span class='Number'>2</span></code>, <code><span class='Value'>log10e</span><span class='Gets'>⇐</span><span class='Function'>÷⋆</span><span class='Modifier'>⁼</span><span class='Number'>10</span></code>, <code><span class='Value'>log2e</span><span class='Gets'>⇐</span><span class='Function'>÷⋆</span><span class='Modifier'>⁼</span><span class='Number'>2</span></code> computed in full precision.</p> +<p>Other correctly-rounded arithmetic: monadic <code><span class='Function'>Cbrt</span><span class='Gets'>⇐</span><span class='Number'>3</span><span class='Modifier2'>⊸</span><span class='Function'>√</span></code>, <code><span class='Function'>Log2</span><span class='Gets'>⇐</span><span class='Number'>2</span><span class='Function'>⋆</span><span class='Modifier'>⁼</span><span class='Function'>⊢</span></code>, <code><span class='Function'>Log10</span><span class='Gets'>⇐</span><span class='Number'>10</span><span class='Function'>⋆</span><span class='Modifier'>⁼</span><span class='Function'>⊢</span></code>, <code><span class='Function'>Log1p</span><span class='Gets'>⇐</span><span class='Function'>⋆</span><span class='Modifier'>⁼</span><span class='Number'>1</span><span class='Modifier2'>⊸</span><span class='Function'>+</span></code>, <code><span class='Function'>Expm1</span><span class='Gets'>⇐</span><span class='Number'>1</span><span class='Function'>-</span><span class='Modifier'>˜</span><span class='Function'>⋆</span></code>; dyadic <code><span class='Function'>Hypot</span><span class='Gets'>⇐</span><span class='Function'>+</span><span class='Modifier2'>⌾</span><span class='Paren'>(</span><span class='Function'>×</span><span class='Modifier'>˜</span><span class='Paren'>)</span></code>.</p> +<p>Standard trigonometric functions <code><span class='Function'>Sin</span></code>, <code><span class='Function'>Cos</span></code>, <code><span class='Function'>Tan</span></code>, <code><span class='Function'>Sinh</span></code>, <code><span class='Function'>Cosh</span></code>, <code><span class='Function'>Tanh</span></code>, with inverses preceded by <code><span class='Value'>a</span></code> (<code><span class='Function'>ASin</span></code>, etc.) and accessable with <code><span class='Modifier'>⁼</span></code>. Additionally, the dyadic function <code><span class='Function'>ATan2</span></code> giving the angle of vector <code><span class='Value'>𝕨</span><span class='Ligature'>‿</span><span class='Value'>𝕩</span></code> relative to <code><span class='Number'>1</span><span class='Ligature'>‿</span><span class='Number'>0</span></code>. All trig functions measure angles in radians.</p> <h2 id="random-generation"><a class="header" href="#random-generation">Random generation</a></h2> <p><code><span class='Function'>•MakeRand</span></code> initializes a deterministic pseudorandom number generator with seed value <code><span class='Value'>𝕩</span></code>. <code><span class='Value'>•rand</span></code>, if it exists, is a globally accessible generator initialized at first use; this initialization should use randomness from an outside source if available. These random generators aren't required to be cryptographically secure and should always be treated as insecure. A random generator has the following member functions:</p> <table> |
