# express17 man page

express17 — evaluate expressions

## Synopsis

**express17** [Options] EXPRESSION [TYPE NAME VALUE]...

## Description

**express17** prints the value of EXPRESSION to standard output. EXPRESSION may refer variables defined as a TYPE NAME VALUE triplet. TYPE may be one of *cardinal* (integral, positive), *integer* (integral), *real* (real) and *text* (string).

## Options

**-P**,**--print**- Print the parsed expression instead its value.
**-t**,**--type**- Print the expression type instead its value.
**--list**- List available functions and exit.
**--list-1**- List available unary operators and exit.
**--list-2**- List available binary operators and exit.
**--list-2h**- List available binary operators and exit.
**--help**- Print a usage message and exit with a status code indicating success.
**--version**- Print version information on standard output then exit.

## Syntax

The allowed expression syntax is similar to that of *C* expressions. It allows for prefix unary and common syntax binary operators, functions and variables. There are four supported types: *cardinal* (integral, positive), *integer* (integral), *real* (real) and *text* (string).

The available functions are mathematical or text generalities, among which:

*real***Gacos**(*real***x**);- is the in degrees specified arc cosine of
**x** *real***Gadiff**(*real***x**,*real***y**);- is the in degrees specified smallest angle between degrees
**x**and degrees**y**(or something) *real***Garccos**(*real***x**);- is same as
**Gacos**(**x**) *real***Garcctg2**(*real***x**,*real***y**);- is the in degrees specified arc tangent of
**y**/**x**, signs of both**x**and**y**being used to determine the quadrant of the result (same as**Gatan2**(**y**,**x**)) *real***Garcdiff**(*real***x**,*real***y**);- is same as
**Gadiff**(**x**,**y**) *real***Garcsin**(*real***x**);- is same as
**Gasin**(**x**) *real***Garctg**(*real***x**);- is same as
**Gatan**(**x**) *real***Garctg2**(*real***y**,*real***x**);- is same as
**Gatan2**(**y**,**x**) *real***Gasin**(*real***x**);- is the in degrees specified arc sine of
**x** *real***Gatan**(*real***x**);- is the in degrees specified arc tangent of
**x** *real***Gatan2**(*real***y**,*real***x**);- is the in degrees specified arc tangent of
**y**/**x**, signs of both**x**and**y**being used to determine the quadrant of the result *real***Gcos**(*real***x**);- is the cosine of degrees
**x** *real***Gparcctg2**(*real***x**,*real***y**);- is the positively defined, in radians specified arc tangent of
**y**/**x**, signs of both**x**and**y**being used to determine the quadrant of the result (same as**Gpatan2**(**y**,**x**)) *real***Gparctg2**(*real***y**,*real***x**);- is same as
**Gpatan2**(**y**,**x**) *real***Gpatan2**(*real***y**,*real***x**);- is the positively defined, in degrees specified arc tangent of
**y**/**x**, signs of both**x**and**y**being used to determine the quadrant of the result *real***Gsin**(*real***x**);- is the sine of degrees
**x** *real***Gtan**(*real***x**);- is the tangent of degrees
**x** *real***Gtg**(*real***x**);- is same as
**Gtan**(**x**) *integer***abs**(*integer***m**);- is the absolute value of
**m** *real***acos**(*real***x**);- is the in radians specified arc cosine of
**x** *real***adiff**(*real***x**,*real***y**);- is the in radians specified smallest angle between radians
**x**and radians**y**(or something) *real***arccos**(*real***x**);- is same as
**acos**(**x**) *real***arcctg2**(*real***x**,*real***y**);- is the in radians specified arc tangent of
**y**/**x**, signs of both**x**and**y**being used to determine the quadrant of the result (same as**atan2**(**y**,**x**)) *real***arcdiff**(*real***x**,*real***y**);- is same as
**adiff**(**x**,**y**) *real***arcsin**(*real***x**);- is same as
**asin**(**x**) *real***arctg**(*real***x**);- is same as
**atan**(**x**) *real***arctg2**(*real***y**,*real***x**);- is same as
**atan2**(**y**,**x**) *real***asin**(*real***x**);- is the in radians specified arc sine of
**x** *real***atan**(*real***x**);- is the in radians specified arc tangent of
**x** *real***atan2**(*real***y**,*real***x**);- is the in radians specified arc tangent of
**y**/**x**, signs of both**x**and**y**being used to determine the quadrant of the result *integer***base2**(*integer***m**);- is the greatest power of 2 less than or equal to
**m**if**m**is not less than zero, some undefined value otherwise *integer***bcount**(*integer***m**);- is the
**m**bit count (i.e. the number of bits set in**m**) *real***ceil**(*real***x**);- is the up rounded value of
**x** *cardinal***cardinal**(*cardinal***z**);- is
**z** *integer***character**(*text***s**,*integer***m**);- is the (positively defined value of the)
**m**th character of**s**, if such character exists, 0 otherwise (negative position indications are interpreted with respect to the end of string) *integer***compare**(*text***s**,*text***t**);- is 0 if
**s**is (case sensitive) same as**t**, less than 0 if**s**is less than**t**and greater than 0 if**s**is greater than**t** *real***cos**(*real***x**);- is the cosine of radians
**x** *integer***deck2**(*integer***m**);- is the lesser power of 2 greater than or equal to
**m**if**m**is not less than zero, some undefined value otherwise *integer***drand**(*integer***m**);- is a pseudo-random integer between inclusive 0 and
**m** *text***echo**(*text***s**);- is
**s** *real***exp**(*real***x**);- is the value of e (the base of natural logarithms) raised to the power of
**x** *real***exp2**(*real***x**);- is the value of 2 raised to the power of
**x** *real***fabs**(*real***x**);- is the absolute value of
**x** *real***fclip**(*real***min**,*real***x**,*real***max**);- is the minimum between
**max**and the maximum between**x**and**min** *integer***ffs**(*integer***m**);- is the 1 based position of the first (least significant) bit set in
**m**if any, 0 otherwise *real***floor**(*real***x**);- is the down rounded value of
**x** *integer***fls**(*integer***m**);- is the 1 based position of the last (most significant) bit set in
**m**if any, 0 otherwise *real***fmax**(*real***x**,*real***y**);- is the maximum of
**x**and**y** *real***fmin**(*real***x**,*real***y**);- is the minimum of
**x**and**y** *real***fmod**(*real***x**,*real***y**);- is the remainder of dividing
**x**by**y**, more specifically**x**-**n*****y**, where**n**is the quotient of**x**/**y**, rounded toward zero to an integer *real***fmodf**(*real***x**);- is the same sign as
**x**fractional part of**x** *integer***frame**(*text***s**,*integer***c**);- is the position of the last occurrence of the
**c**non zero character in the**s**string if any, -1 otherwise *real***frand**(*void*);- is a pseudo-random real between 0 and 1
*real***fsign**(*real***x**);- is -1 if
**x**is negative, 0 of**x**is zero, 1 otherwise *integer***gcd**(*integer***m**,*integer***n**);- is the greatest common denominator of
**m**and**n** *integer***iclip**(*integer***min**,*integer***m**,*integer***max**);- is the minimum between
**max**and the maximum between**m**and**min** *real***imodf**(*real***x**);- is the same sign as
**x**integral part of**x** *integer***index**(*text***s**,*integer***c**);- is the position of the first occurrence of the
**c**non zero character in the**s**string if any, -1 otherwise *integer***integer**(*integer***m**);- is
**m** *integer***irand**(*integer***m**,*integer***n**);- is a pseudo-random integer between inclusive
**m**and**n** *integer***length**(*text***s**);- is the length of
**s** *real***limit**(*real***x**);- is the away from zero rounded value of
**x** *real***ln**(*real***x**);- is same as
**log**(**x**) *real***log**(*real***x**);- is the natural logarithm of
**x** *real***log10**(*real***x**);- is the base 10 logarithm of
**x** *real***log2**(*real***x**);- is the base 2 logarithm of
**x** *real***lrand**(*void*);- is a pseudo-random real between -1 and 1
*integer***lz**(*integer***m**);- is the
**m**leading zero bits count, same as**xls**(**m**) *integer***match**(*text***s**,*text***t**);- is 0 if
**t**wild card (case sensitive) matches the**s**pattern (the***and*?*literal sign are interpreted as for their shell pattern equivalents), non 0 otherwise *integer***max**(*integer***m**,*integer***n**);- is the maximum of
**m**and**n** *integer***min**(*integer***m**,*integer***n**);- is the minimum of
**m**and**n** *real***modf**(*real***x**,*real &***y**);- is the same sign as
**x**fractional part of**x**,**y**is the same sign as**x**integral part of**x** *real***parcctg2**(*real***x**,*real***y**);- is the positively defined, in radians specified arc tangent of
**y**/**x**, signs of both**x**and**y**being used to determine the quadrant of the result (same as**patan2**(**y**,**x**)) *real***parctg2**(*real***y**,*real***y**);- is same as
**patan2**(**y**,**x**) *real***patan2**(*real***y**,*real***x**);- is the positively defined, in radians specified arc tangent of
**y**/**x**, signs of both**x**and**y**being used to determine the quadrant of the result *real***pow**(*real***x**,*real***y**);- is the value of
**x**raised to the power of**y** *text***project**(*text***s**,*integer***m**);- is
**s**after position**m**(negative position indications are interpreted with respect to the end of string) *real***real**(*real***x**);- is
**x** *real***round**(*real***x**);- is the towards nearest integer, half cases away from zero rounded value of
**x** *integer***sign**(*integer***m**);- is -1 if
**m**is negative, 0 of**m**is zero, 1 otherwise *integer***signed**(*cardinal***z**);- is
**z** *real***sin**(*real***x**);- is the sine of radians
**x** *real***sq**(*real***x**);- is the square of
**x** *real***sqrt**(*real***x**);- is the square root of
**x** *real***tan**(*real***x**);- is the tangent of radians
**x** *real***tg**(*real***x**);- is same as
**tan**(**x**) *real***track**(*real***x**);- is the towards zero rounded value of
**x** *integer***tz**(*integer***m**);- is the
**m**trailing zero bits count, same as**xfs**(**m**) *cardinal***unsigned**(*integer***m**);- is
**m** *integer***xfs**(*integer***m**);- is the 0 based position of the first (least significant) bit set in
**m**if any, the number of bits in**m**otherwise (same as**tz**(**m**)) *integer***xls**(*integer***m**);- is the 0 based position of the last (most significant) bit set in
**m**if any, the number of bits in**m**otherwise (same as**lz**(**m**))

Use **--list** to obtain the complete list of available functions.

Most of prefix unary and common syntax binary *C* operators are supported (including unary *!*, *+*, *-* and *~* and binary ***, */*, *%*, *+*, *-*, *<<*, *>>*, *<*, *>*, *!=*, *==*, *&*, *^*, *|*, *&&*, *||*, *=*, *+=*, *-=*, **=*, */=*, *%=*, *&=*, *^=*, *|=*, *<<=* and *>>=*), the semantics and precedence being the same or at least very close to those of their *C* counterparts.

Use **--list-1** to obtain the complete list of available unary operators.

Use **--list-2** or **--list-2h** to obtain the complete list of available binary operators.

## Authors

Ciprian Niculescu

## Referenced By

aime(1), logique44(1), logique48(1), logique49(1).