You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
<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>
289
289
<p>The API documentation can be built using the following:</p>
<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>
<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>
<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>
<spanid="cb2-3"><ahref="#cb2-3" aria-hidden="true" tabindex="-1"></a><spanclass="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
<spanid="cb6-15"><ahref="#cb6-15" aria-hidden="true" tabindex="-1"></a><spanclass="co">// call the other function, getting the object's max value</span></span>
434
434
<spanid="cb6-16"><ahref="#cb6-16" aria-hidden="true" tabindex="-1"></a><spanclass="co">// (will be 8)</span></span>
435
-
<spanid="cb6-17"><ahref="#cb6-17" aria-hidden="true" tabindex="-1"></a>res<spanclass="op">=</span> tep<spanclass="op">.</span>evaluate<spanclass="op">(</span><spanclass="st">"CellMax()"</span><spanclass="op">);</span></span></code><buttontitle="Copy to Clipboard" class="code-copy-button"><iclass="bi"></i></button></pre></div>
435
+
<spanid="cb6-17"><ahref="#cb6-17" aria-hidden="true" tabindex="-1"></a>result<spanclass="op">=</span> tep<spanclass="op">.</span>evaluate<spanclass="op">(</span><spanclass="st">"CellMax()"</span><spanclass="op">);</span></span></code><buttontitle="Copy to Clipboard" class="code-copy-button"><iclass="bi"></i></button></pre></div>
436
436
<divclass="notesection">
437
437
<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>
<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>
<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>
363
332
<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>
364
333
<p>Refer to <ahref="#compile-time-options">compile-time options</a> for flags that can provide optimization.</p>
<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>
420
391
<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
+
<divclass="minipage">
421
393
<p>For example, a custom function would be written as such:</p>
<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>
318
318
<divclass="sourceCode" id="cb1"><preclass="sourceCode cpp code-with-copy"><codeclass="sourceCode cpp"><spanid="cb1-1"><ahref="#cb1-1" aria-hidden="true" tabindex="-1"></a>ABS<spanclass="op">(((</span><spanclass="dv">5</span><spanclass="op">+</span><spanclass="dv">2</span><spanclass="op">)</span><spanclass="op">/</span><spanclass="op">(</span>ABS<spanclass="op">(-</span><spanclass="dv">2</span><spanclass="op">)))</span><spanclass="op">*</span><spanclass="op">-</span><spanclass="dv">9</span><spanclass="op">+</span><spanclass="dv">2</span><spanclass="op">)</span><spanclass="op">-</span><spanclass="dv">5</span><spanclass="op">^</span><spanclass="dv">2</span></span></code><buttontitle="Copy to Clipboard" class="code-copy-button"><iclass="bi"></i></button></pre></div>
319
319
<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>
0 commit comments