Skip to content

Commit 8f3568f

Browse files
committed
Update online and PDF manuals
1 parent 0ee024c commit 8f3568f

13 files changed

+97
-98
lines changed

docs/TinyExpr++ReferenceManual.pdf

7.91 KB
Binary file not shown.

docs/building.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -285,12 +285,12 @@ <h1 class="title"><span class="chapter-number">6</span>&nbsp; <span class="chapt
285285
</header>
286286

287287

288-
<p><em>TinyExpr++</em> is self-contained in two files: “tinyexpr.cpp” and “tinyexpr.h”. To use <em>TinyExpr++</em>, add those files to your project.</p>
288+
<p><em>TinyExpr++</em> is self-contained in two files: “tinyexpr.cpp” and “tinyexpr.h”. To use it, add those files to your project.</p>
289289
<p>The API documentation can be built using the following:</p>
290290
<pre><code>doxygen docs/Doxyfile</code></pre>
291291
<section id="requirements" class="level2 unnumbered">
292292
<h2 class="unnumbered anchored" data-anchor-id="requirements">Requirements</h2>
293-
<p><em>TinyExpr++</em> must be compiled as C++17. (Some additional features require C++20.)</p>
293+
<p><em>TinyExpr++</em> must be compiled as C++20.</p>
294294
<p>MSVC, GCC, and Clang compilers are supported.</p>
295295

296296

docs/compile-time-options.html

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ <h2 id="toc-title">Table of contents</h2>
267267
<li><a href="#te_brackets_as_parens" id="toc-te_brackets_as_parens" class="nav-link" data-scroll-target="#te_brackets_as_parens"><code>TE_BRACKETS_AS_PARENS</code></a></li>
268268
<li><a href="#te_no_bookkeeping" id="toc-te_no_bookkeeping" class="nav-link" data-scroll-target="#te_no_bookkeeping"><code>TE_NO_BOOKKEEPING</code></a></li>
269269
<li><a href="#te_pow_from_right" id="toc-te_pow_from_right" class="nav-link" data-scroll-target="#te_pow_from_right"><code>TE_POW_FROM_RIGHT</code></a></li>
270-
<li><a href="#c20-features" id="toc-c20-features" class="nav-link" data-scroll-target="#c20-features">C++20 Features</a></li>
270+
<li><a href="#rotation-features" id="toc-rotation-features" class="nav-link" data-scroll-target="#rotation-features">Rotation Features</a></li>
271271
</ul>
272272
</nav>
273273
</div>
@@ -304,11 +304,11 @@ <h2 class="unnumbered anchored" data-anchor-id="te-float"><code>TE_FLOAT</code><
304304
<section id="te_long_double" class="level2 unnumbered">
305305
<h2 class="unnumbered anchored" data-anchor-id="te_long_double"><code>TE_LONG_DOUBLE</code></h2>
306306
<p>Compile with <code>TE_LONG_DOUBLE</code> defined to use <code>long double</code> as the default data type.</p>
307-
<p>Depending on the compiler, this may provide support for handling <code>uint64_t</code> values. Call <code>te_parser::supports_64bit()</code> (or <code>SUPPORTS64BIT()</code> in an expression at runtime) to confirm this.</p>
307+
<p>Depending on the compiler, this may provide sufficient mantissa precision to represent <code>uint64_t</code> values exactly. Call <code>te_parser::supports_64bit()</code> (or <code>SUPPORTS64BIT()</code> in an expression at runtime) to confirm this.</p>
308308
</section>
309309
<section id="te_rand_seed" class="level2 unnumbered">
310310
<h2 class="unnumbered anchored" data-anchor-id="te_rand_seed"><code>TE_RAND_SEED</code></h2>
311-
<p>Define this as an unsigned integer to seed the random number generator with. This will affect the function <code>RAND()</code>, causing it to produce a deterministic series of numbers.</p>
311+
<p>Define this as an unsigned integer to seed the random number generator. This will affect the function <code>RAND()</code>, causing it to produce a deterministic series of numbers.</p>
312312
</section>
313313
<section id="te_rand_seed_time" class="level2 unnumbered">
314314
<h2 class="unnumbered anchored" data-anchor-id="te_rand_seed_time"><code>TE_RAND_SEED_TIME</code></h2>
@@ -340,9 +340,9 @@ <h2 class="unnumbered anchored" data-anchor-id="te_pow_from_right"><code>TE_POW_
340340
<p>Symbols can be defined by passing them to your compiler’s command line (or in a <em>CMake</em> configuration) as such: <code>-DTE_POW_FROM_RIGHT</code></p>
341341
</div>
342342
</section>
343-
<section id="c20-features" class="level2 unnumbered">
344-
<h2 class="unnumbered anchored" data-anchor-id="c20-features">C++20 Features</h2>
345-
<p>If compiling as C++20 (and <code>TE_FLOAT</code> is not defined), then the following functions and operators will be available:</p>
343+
<section id="rotation-features" class="level2 unnumbered">
344+
<h2 class="unnumbered anchored" data-anchor-id="rotation-features">Rotation Features</h2>
345+
<p>If <code>TE_FLOAT</code> is not defined, then the following functions and operators will be available:</p>
346346
<ul>
347347
<li><code>BITLROTATE8</code></li>
348348
<li><code>BITLROTATE16</code></li>

docs/custom-extensions.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,7 +363,7 @@ <h2 class="unnumbered anchored" data-anchor-id="custom-variables">Binding to Cus
363363
</section>
364364
<section id="binding-to-custom-functions" class="level2 unnumbered minipage">
365365
<h2 class="unnumbered anchored" data-anchor-id="binding-to-custom-functions">Binding to Custom Functions</h2>
366-
<p><em>TinyExpr++</em> can call custom functions also. Here is a short example:</p>
366+
<p><em>TinyExpr++</em> can also call custom functions. Here is a short example:</p>
367367
<div class="sourceCode" id="cb2"><pre class="sourceCode cpp code-with-copy"><code class="sourceCode cpp"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a><span class="dt">te_type</span> my_sum<span class="op">(</span><span class="dt">te_type</span> a<span class="op">,</span> <span class="dt">te_type</span> b<span class="op">)</span></span>
368368
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="op">{</span></span>
369369
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="co">/* Example function that adds two numbers together. */</span></span>
@@ -432,7 +432,7 @@ <h2 class="unnumbered anchored" data-anchor-id="custom-classes">Binding to Custo
432432
<span id="cb6-14"><a href="#cb6-14" aria-hidden="true" tabindex="-1"></a></span>
433433
<span id="cb6-15"><a href="#cb6-15" aria-hidden="true" tabindex="-1"></a><span class="co">// call the other function, getting the object's max value</span></span>
434434
<span id="cb6-16"><a href="#cb6-16" aria-hidden="true" tabindex="-1"></a><span class="co">// (will be 8)</span></span>
435-
<span id="cb6-17"><a href="#cb6-17" aria-hidden="true" tabindex="-1"></a>res <span class="op">=</span> tep<span class="op">.</span>evaluate<span class="op">(</span><span class="st">"CellMax()"</span><span class="op">);</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
435+
<span id="cb6-17"><a href="#cb6-17" aria-hidden="true" tabindex="-1"></a>result <span class="op">=</span> tep<span class="op">.</span>evaluate<span class="op">(</span><span class="st">"CellMax()"</span><span class="op">);</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
436436
<div class="notesection">
437437
<p>Valid variable and function names consist of a letter or underscore followed by any combination of: letters <code>a–z</code> or <code>A–Z</code>, digits <code>0–9</code>, periods, and underscores.</p>
438438
</div>

docs/embedded-programming.html

Lines changed: 5 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -328,38 +328,7 @@ <h1 class="title"><span class="chapter-number">13</span>&nbsp; <span class="chap
328328
<p>The following section discusses topics related to using <em>TinyExpr++</em> in an embedded environment.</p>
329329
<section id="performance" class="level2 unnumbered">
330330
<h2 class="unnumbered anchored" data-anchor-id="performance">Performance</h2>
331-
<p><em>TinyExpr++</em> is fairly fast compared to compiled C when the expression is short or does hard calculations (e.g., exponentiation). <em>TinyExpr++</em> is slower compared to C when the expression is long and involves only basic arithmetic.</p>
332-
<p>Here are some example benchmarks:</p>
333-
<table class="caption-top table">
334-
<thead>
335-
<tr class="header">
336-
<th style="text-align: left;">Expression</th>
337-
<th style="text-align: right;"><em>TinyExpr++</em></th>
338-
<th style="text-align: right;">Native C</th>
339-
<th style="text-align: right;">Comparison</th>
340-
</tr>
341-
</thead>
342-
<tbody>
343-
<tr class="odd">
344-
<td style="text-align: left;">sqrt(a<sup>1.5+a</sup>2.5)</td>
345-
<td style="text-align: right;">1,707 ns</td>
346-
<td style="text-align: right;">58.25 ns</td>
347-
<td style="text-align: right;">29% slower</td>
348-
</tr>
349-
<tr class="even">
350-
<td style="text-align: left;">a+5</td>
351-
<td style="text-align: right;">535 ns</td>
352-
<td style="text-align: right;">0.67 ns</td>
353-
<td style="text-align: right;">798% slower</td>
354-
</tr>
355-
<tr class="odd">
356-
<td style="text-align: left;">(1/(a+1)+2/(a+2)+3/(a+3))</td>
357-
<td style="text-align: right;">3,388 ns</td>
358-
<td style="text-align: right;">3.941 ns</td>
359-
<td style="text-align: right;">859% slower</td>
360-
</tr>
361-
</tbody>
362-
</table>
331+
<p><em>TinyExpr++</em> is fairly fast compared to compiled C when the expression is short or does hard calculations (e.g., exponentiation). It is slower compared to C when the expression is long and involves only basic arithmetic.</p>
363332
<p>Note that <em>TinyExpr++</em> is slower compared to <em>TinyExpr</em> because of additional type safety checks (e.g., the use of <code>std::variant</code> instead of unions), case insensitivity, and bookkeeping operations.</p>
364333
<p>Refer to <a href="#compile-time-options">compile-time options</a> for flags that can provide optimization.</p>
365334
</section>
@@ -377,13 +346,15 @@ <h2 class="unnumbered anchored" data-anchor-id="volatility">Volatility</h2>
377346
<span id="cb2-2"><a href="#cb2-2" aria-hidden="true" tabindex="-1"></a> <span class="op">{</span></span>
378347
<span id="cb2-3"><a href="#cb2-3" aria-hidden="true" tabindex="-1"></a> <span class="at">volatile</span> te_parser<span class="op">&amp;</span> vTep <span class="op">=</span> tep<span class="op">;</span></span>
379348
<span id="cb2-4"><a href="#cb2-4" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
349+
<div class="minipage">
380350
<p>Functions in <code>te_parser</code> which have <code>volatile</code> overloads can then be called directly:</p>
381351
<div class="sourceCode" id="cb3"><pre class="sourceCode cpp code-with-copy"><code class="sourceCode cpp"><span id="cb3-1"><a href="#cb3-1" aria-hidden="true" tabindex="-1"></a><span class="dt">void</span> OnInterrupt<span class="op">()</span></span>
382352
<span id="cb3-2"><a href="#cb3-2" aria-hidden="true" tabindex="-1"></a> <span class="op">{</span></span>
383353
<span id="cb3-3"><a href="#cb3-3" aria-hidden="true" tabindex="-1"></a> <span class="at">volatile</span> te_parser<span class="op">&amp;</span> vTep <span class="op">=</span> tep<span class="op">;</span></span>
384354
<span id="cb3-4"><a href="#cb3-4" aria-hidden="true" tabindex="-1"></a> vTep<span class="op">.</span>set_list_separator<span class="op">(</span><span class="ch">','</span><span class="op">);</span></span>
385355
<span id="cb3-5"><a href="#cb3-5" aria-hidden="true" tabindex="-1"></a> vTep<span class="op">.</span>set_decimal_separator<span class="op">(</span><span class="ch">'.'</span><span class="op">);</span></span>
386356
<span id="cb3-6"><a href="#cb3-6" aria-hidden="true" tabindex="-1"></a> <span class="op">}</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
357+
</div>
387358
<p>The following functions in the <code>te_parser</code> class have <code>volatile</code> overloads:</p>
388359
<ul>
389360
<li><code>get_result()</code></li>
@@ -418,6 +389,7 @@ <h2 class="unnumbered anchored" data-anchor-id="volatility">Volatility</h2>
418389
<h2 class="unnumbered anchored" data-anchor-id="fp-numbers">Floating-point Numbers</h2>
419390
<p><code>double</code> is the default data type used for the parser’s variable types, parameters, and return types. For embedded environments that require <code>float</code>, compile with <code>TE_FLOAT</code> defined to use <code>float</code> instead.</p>
420391
<p>When using this option, it is recommended to use the helper typedef <code>te_type</code>. This will map to either <code>float</code> or <code>double</code> (depending on whether <code>TE_FLOAT</code> is defined). By defining your functions and variables with <code>te_type</code>, you won’t need to replace <code>double</code> and <code>float</code> if needing to change this compiler flag.</p>
392+
<div class="minipage">
421393
<p>For example, a custom function would be written as such:</p>
422394
<div class="sourceCode" id="cb5"><pre class="sourceCode cpp code-with-copy"><code class="sourceCode cpp"><span id="cb5-1"><a href="#cb5-1" aria-hidden="true" tabindex="-1"></a><span class="co">// Regular function.</span></span>
423395
<span id="cb5-2"><a href="#cb5-2" aria-hidden="true" tabindex="-1"></a><span class="dt">te_type</span> my_sum<span class="op">(</span><span class="dt">te_type</span> a<span class="op">,</span> <span class="dt">te_type</span> b<span class="op">)</span></span>
@@ -437,6 +409,7 @@ <h2 class="unnumbered anchored" data-anchor-id="fp-numbers">Floating-point Numbe
437409
<span id="cb5-16"><a href="#cb5-16" aria-hidden="true" tabindex="-1"></a> <span class="op">[](</span><span class="dt">te_type</span> a<span class="op">,</span> <span class="dt">te_type</span> b<span class="op">)</span> <span class="kw">noexcept</span></span>
438410
<span id="cb5-17"><a href="#cb5-17" aria-hidden="true" tabindex="-1"></a> <span class="op">{</span> <span class="cf">return</span> a <span class="op">+</span> b<span class="op">;</span> <span class="op">}</span> <span class="op">}</span></span>
439411
<span id="cb5-18"><a href="#cb5-18" aria-hidden="true" tabindex="-1"></a> <span class="op">});</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
412+
</div>
440413
</section>
441414
<section id="exception-handling" class="level2 unnumbered">
442415
<h2 class="unnumbered anchored" data-anchor-id="exception-handling">Exception Handling</h2>

docs/end-user-usage.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ <h1 class="title"><span class="chapter-number">1</span>&nbsp; <span class="chapt
314314
</header>
315315

316316

317-
<p><em>TinyExpr++</em> is a formula-solving library which accepts math and logic expressions such as:</p>
317+
<p><em>TinyExpr++</em> is an expression-evaluation library which accepts math and logic expressions such as:</p>
318318
<div class="sourceCode" id="cb1"><pre class="sourceCode cpp code-with-copy"><code class="sourceCode cpp"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a>ABS<span class="op">(((</span><span class="dv">5</span><span class="op">+</span><span class="dv">2</span><span class="op">)</span> <span class="op">/</span> <span class="op">(</span>ABS<span class="op">(-</span><span class="dv">2</span><span class="op">)))</span> <span class="op">*</span> <span class="op">-</span><span class="dv">9</span> <span class="op">+</span> <span class="dv">2</span><span class="op">)</span> <span class="op">-</span> <span class="dv">5</span><span class="op">^</span><span class="dv">2</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>
319319
<p>Applications using <em>TinyExpr++</em> may provide context-specific variables that you can use in your expressions. For example, in a spreadsheet application, values representing cells such as <code>C1</code> and <code>D2</code> may be available. This would enable the use of expressions such as:</p>
320320
<div class="sourceCode" id="cb2"><pre class="sourceCode cpp code-with-copy"><code class="sourceCode cpp"><span id="cb2-1"><a href="#cb2-1" aria-hidden="true" tabindex="-1"></a>SUM<span class="op">(</span>C1<span class="op">,</span> C2<span class="op">,</span> C3<span class="op">,</span> D1<span class="op">,</span> D2<span class="op">,</span> D3<span class="op">)</span></span></code><button title="Copy to Clipboard" class="code-copy-button"><i class="bi"></i></button></pre></div>

0 commit comments

Comments
 (0)