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

                           Allegro Dialogs Made Easy

                        Syntax of Numerical Expressions

                              by Shawn Hargreaves



Expressions

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.

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

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.

Binary operators:

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

Unary operators:

   -        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
Special values:
   rand     a random number between zero and one (inclusive)
   pi       3.14159...
   e        2.71828...
Operator precedence (lowest at the top):
   |  &
   <  >  ==  !=  <=  >=
   +  -
   *  /  %
   ^
   !  sqrt sin cos tan asin acos atan log ln ceil floor round abs
Differences from C syntax: