Sophie

Sophie

distrib > Fedora > 15 > i386 > by-pkgid > 91bcabdccb824ec72a416086efeaaf0e > files > 18

adime-devel-2.2.1-10.fc15.i686.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" "http://www.w3.org/TR/REC-html40/loose.dtd">
<html><head><title>
Adime - Syntax of Numerical Expressions
</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head><body bgcolor=white text=black link="#0000ee" alink="#ff0000" vlink="#551a8b">
<pre>

                              _      _ _
                             /_\  __| (_)_ __  ___
                            / _ \/ _` | | '  \/ -_)
                           /_/ \_\__,_|_|_|_|_\___|

                           Allegro Dialogs Made Easy

                        Syntax of Numerical Expressions

                              by Shawn Hargreaves


</pre>



<p><br>
<h1><a name="Expressions">Expressions</a></h1>

<p>
This section completely describes the expressions that can be typed in the
input fields for "%cint", "%cfloat" and "%cdouble" formats. See also the
Authors section in readme.txt and the adime_evaluate() function in adime.txt.

<p>
The whole section is cut from the EGG system by Shawn Hargreaves. For more
info, see the the authors section in readme.txt.

<p>
Numbers may be written in decimal (e.g. 42, 1.2345) or in hex (e.g.
0xDEADBEEF). Boolean logic works identically to C, with zero representing
false and nonzero being true.

<p>
Binary operators:
<pre>
   +        addition
   -        subtraction (may be unary negation, depending on context)
   *        multiplication
   /        division
   ^        raising to a power
   %        integer modulus (remainder after division)
   |        logical 'or'
   &amp;        logical 'and'
   ==       equality test
   !=       inequality test
   &lt;        less than test
   &lt;=       less than or equal to test
   &gt;        greater than test
   &gt;=       greater than or equal to test
</pre>

<p>
Unary operators:
<pre>
   -        negation (may be binary subtraction, depending on context)
   !        logical 'not'
   sqrt     square root
   sin      sine (angle in degrees)
   cos      cosine (angle in degrees)
   tan      tangent (angle in degrees)
   asin     inverse sine (angle in degrees)
   acos     inverse cosine (angle in degrees)
   atan     inverse tangent (angle in degrees)
   log      base 10 logarithm
   ln       natural logarithm
   ceil     round up to the next larger integer
   floor    round down to the next smaller integer
   round    round to the closest integer
   abs      absolute value
</pre>
Special values:
<pre>
   rand     a random number between zero and one (inclusive)
   pi       3.14159...
   e        2.71828...
</pre>
Operator precedence (lowest at the top):
<pre>
   |  &amp;
   &lt;  &gt;  ==  !=  &lt;=  &gt;=
   +  -
   *  /  %
   ^
   !  sqrt sin cos tan asin acos atan log ln ceil floor round abs
</pre>
Differences from C syntax:
<ul><li>
   The ^ operator raises a number to a power. There is no XOR facility.
<li>
   The boolean logic operators are written with single | and &amp; character,
   rather than || and &amp;&amp;. There are no binary logical operators.
<li>
   The trig routines work with angles in degrees, rather than radians.
<li>
   The 'log' routine returns a base 10 logarithm, and 'ln' returns a
   natural logarithm, unlike C where 'log' is a natural logarithm and
   'log10' is a base 10 logarithm.
<li>
   EGG does not explicitly support function calls. Instead, what look
   like functions are implemented as high priority unary operators. This
   has an almost identical effect, but it means that it is technically
   possible to omit the usual brackets from these, allowing you to write
   "sqrt 10" in the place of "sqrt(10)".
</ul>


</body>
</html>