📄 exprtmpl.html
字号:
<html>
<head>
<title>Expression Help</title>
<style type="text/css">
.valid {
color: #00AA00;
}
.invalid {
color: #FF0000;
}
.excomment {
color: #0000FF;
}
.container {
margin-top: 10px;
margin-bottom: 10px;
padding-left: 4px;
padding-right: 4px;
border-top: 1px solid #000000;
border-right: 1px solid #000000;
border-bottom: 1px solid #000000;
border-left: 1px solid #000000;
background-color: #BBBBBB;
}
body {
background-color: #AAAAAA;
}
</style>
</head>
<body>
<div align="center">
<h1>Expression Help</h1>
<hr>
</div>
<div align="left" class="container">
<h2>Contents</h2>
<h3>
<u>
<li><a href="#Syntax">Expression Syntax</a></li>
<li><a href="#InternalFunc">ExprEval Internal Functions</a></li>
<li><a href="#InternalConst">ExprEval Internal Constants</a></li>
<li><a href="#AppFunc">Application Internal Functions</a></li>
<li><a href="#AppConst">Application Internal Constants</a></li>
<li><a href="#AppVar">Application Internal Variables</a></li>
</u>
</h3>
</div>
<div align="left" class="container">
<h2><a name="Syntax">Expression Syntax</a></h2>
<blockquote>
<p>Expressions have pretty much the same syntax as they
would have on paper, with the following exceptions:
<ul>
<li>Each expression must end with a semicolon. This
is because the expression string can actually
contain multiple expressions. The semicolon is
used to mark the end of the expression.<br>
<b>Examples:</b>
<ul>
<li>4*x+5;</li>
<li>y=5+2;g=4+6;</li>
<li>y=r*sin(a);x=r*cos(a);</li>
</ul>
</li>
<li>The asterisk '*' must be used to multiply.<br>
<b>Examples:</b>
<ul>
<li>y=5*6; <b class="valid">Valid</b></li>
<li>g=(x+1)*(x-1); <b class="valid">Valid</b></li>
<li>g=(x+1)(x-1); <b class="invalid">Invalid</b></li>
</ul>
</li>
</ul>
</p>
<p>More than one expression may be contained within an expression string.
As shown above, each expression must end with a semicolon, even if
only one expression is in the string. The value of an expression
string is the value of the last expression in the string.<br>
<b>Examlples:</b>
<ul>
<li>g=7; <b class="excomment">Value: 7</b></li>
<li>k=z+1; <b class="excomment">Value: z+1</b></li>
<li>r=4;k=6;o=9+r-k; <b class="excomment">Value: 9+r-k</b></li>
</ul>
</p>
<p>Some functions may take reference parameters. These parameters are
references to other variables. You can mix reference parameters
with normal parameters. The order of the normal parameters must
remain the same and the order of the reference parameters must
remain the same.<br>
<b>Examples:</b>
<ul>
<li>min(1,2,3,4,&mval); <b class="excomment">&mval is a reference to a variable mval</b></li>
<li>min(1,2,&mval,3,4); <b class="excomment">You may mix them inside like this.</b></li>
<li>min(1,2,(&mval),3,4); <b class="invalid">You may not nest reference parameters in any way</b></li>
</ul>
</p>
<p>Expressions may also be nested with parenthesis.<br>
<b>Examples:</b>
<ul>
<li>y=sin(x-cos(5+max(4,5,6*x)));</li>
<li>6+(5-2*(x+y));</li>
</ul>
</p>
<p>Expressions may also have whitespace characters and comments.
Whitespace characters such as newlines, linefeeds, carriage
returns, spaces, and tabs are ignored. Comments begin with
the less than-sign '<' and end with the greater than-sign
'>'. Comments may be nested as well.<br>
<b>Example:</b>
<ul>
<pre>
<Set the x value>
x = d * cos(r);
<Set the y value>
y = d * sin(r);
<Comment out this for now
<Flip the values>
t = x;
x = y;
y = x;
Stop commenting out>
</pre>
</ul>
</p>
<p>If a variable is used in an expression, but that variable does not exist,
it is considered zero. If it does exist then its value is used instead.
</p>
</blockquote>
</div>
<div align="left" class="container">
<h2><a name="InternalFunc">ExprEval Internal Functions</a></h2>
<blockquote>
The following functions are provided with ExprEval:
<table align="center" border="1" width="75%">
<tr>
<td align="center"><b>Function</b></td>
<td align="center"><b>Min. Args</b></td>
<td align="center"><b>Max. Args</b></td>
<td align="center"><b>Min. Ref Args</b></td>
<td align="center"><b>Max. Ref Args</b></td>
<td align="center"><b>Result/Comment</b></td>
</tr>
<tr>
<td>abs(v)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>Absolute value of v.<br>
abs(-4.3) returns 4.3</td>
</tr>
<tr>
<td>mod(v,d)</td>
<td>2</td>
<td>2</td>
<td>0</td>
<td>0</td>
<td>Remainder of v/d.<br>
mod(5.2,2.5) return 0.2</td>
</tr>
<tr>
<td>ipart(v)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>The integer part of v.<br>
ipart(3.2) returns 3</td>
</tr>
<tr>
<td>fpart(v)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>The fractional part of v.<br>
fpart(3.2) returns 0.2</td>
</tr>
<tr>
<td>min(v,...)</td>
<td>1</td>
<td>None</td>
<td>0</td>
<td>0</td>
<td>The minimum number passed.<br>
min(3,2,-5,-2,7) returns -5</td>
</tr>
<tr>
<td>max(v,...)</td>
<td>1</td>
<td>None</td>
<td>0</td>
<td>0</td>
<td>The maximum number passed.<br>
max(3,2,-5,-2,7) returns 7</td>
</tr>
<tr>
<td>pow(a,b)</td>
<td>2</td>
<td>2</td>
<td>0</td>
<td>0</td>
<td>The value a raised to the power b.<br>
pow(3.2,1.7) returns 3.2<sup>1.7</sup></td>
</tr>
<tr>
<td>sqrt(a)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>The square root of a.</br>
sqrt(16) returns 4</td>
</tr>
<tr>
<td>sin(a)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>The sine of a radians.<br>
sin(1.5) returns around 0.997</td>
</tr>
<tr>
<td>sinh(a)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>The hyperbolic sine of a.<br>
sinh(1.5) returns around 2.129</td>
</tr>
<tr>
<td>asin(a)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>The arc-sine of a in radians.<br>
asin(0.5) returns around 0.524</td>
</tr>
<tr>
<td>cos(a)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>The cosine of a radians.<br>
cos(1.5) returns around 0.0707</td>
</tr>
<tr>
<td>cosh(a)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>The hyperbolic cosine of a.</br>
cosh(1.5) returns around 2.352</td>
</tr>
<tr>
<td>acos(a)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>The arc-cosine of a in radians.<br>
acos(0.5) returns around 1.047</td>
</tr>
<tr>
<td>tan(a)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>The tangent of a radians.<br>
tan(1.5) returns around 14.101</td>
</tr>
<tr>
<td>tanh(a)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>The hyperbolic tangent of a.</br>
tanh(1.5) returns around 0.905</td>
</tr>
<tr>
<td>atan(a)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>The arc-tangent of a in radians.<br>
atan(0.3) returns about 0.291</td>
</tr>
<tr>
<td>atan2(y,x)</td>
<td>2</td>
<td>2</td>
<td>0</td>
<td>0</td>
<td>The arc-tangent of y/x, with quadrant correction.<br>
atan2(4,3) returns about 0.927</td>
</tr>
<tr>
<td>log(a)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>The base 10 logarithm of a.<br>
log(100) returns 2</td>
</tr>
<tr>
<td>pow10(a)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>10 raised to the power of a.<br>
pow10(2) returns 100</td>
</tr>
<tr>
<td>ln(a)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>The base e logarithm of a.<br>
ln(2.8) returns around 1.030</td>
</tr>
<tr>
<td>exp(a)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>e raised to the power of a.<br>
exp(2) returns around 7.389</td>
</tr>
<tr>
<td>logn(a,b)</td>
<td>2</td>
<td>2</td>
<td>0</td>
<td>0</td>
<td>The base b logarithm of a.<br>
logn(16,2) returns 4</td>
</tr>
<tr>
<td>ceil(a)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>Rounds a up to the nearest integer.<br>
ceil(3.2) returns 4</td>
</tr>
<tr>
<td>floor(a)</td>
<td>1</td>
<td>1</td>
<td>0</td>
<td>0</td>
<td>Rounds a down to the nearest integer.<br>
floor(3.2) returns 3</td>
</tr>
<tr>
<td>rand()</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>Returns a number between 0 up to but not including 1.</td>
</tr>
<tr>
<td>random(a,b)</td>
<td>2</td>
<td>2</td>
<td>0</td>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -