express17(1) General Commands Manual express17(1) NAME express17 - evaluate expressions SYNOPSISexpress17[OPTIONS] EXPRESSION [TYPE NAME VALUE]... DESCRIPTIONexpress17prints the value of EXPRESSION to standard output. EXPRESSION may refer variables defined as a TYPE NAME VALUE triplet. TYPE may be one ofcardinal(integral, positive),integer(integral),real(real) andtext(string). OPTIONS-P,-t,--typePrint the expression type instead its value.--listList functions and exit.--list-1List unary operators and exit.--list-2List binary operators and exit.--list-2hList binary operators and exit.--list-3List ternary operators and exit.--list-3hList ternary operators and exit.--helpPrint a usage message and exit with a status code indicating success.--versionPrint version information on standard output then exit. SYNTAX The allowed expression syntax is similar to that ofCexpressions. 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) andtext(string). The available functions are mathematical or text generalities, among which:realGacos(realx); is the in degrees specified arc cosine ofxrealGadiff(realx,realy); is the in degrees specified smallest angle between degreesxand degreesy(or something)realGarccos(realx); is same asGacos(x)realGarcctg2(realx,realy); is the in degrees specified arc tangent ofy/x, signs of bothxandybeing used to determine the quadrant of the result (same asGatan2(y,x))realGarcdiff(realx,realy); is same asGadiff(x,y)realGarcsin(realx); is same asGasin(x)realGarctg(realx); is same asGatan(x)realGarctg2(realy,realx); is same asGatan2(y,x)realGasin(realx); is the in degrees specified arc sine ofxrealGatan(realx); is the in degrees specified arc tangent ofxrealGatan2(realy,realx); is the in degrees specified arc tangent ofy/x, signs of bothxandybeing used to determine the quadrant of the resultrealGcos(realx); is the cosine of degreesxrealGparcctg2(realx,realy); is the positively defined, in radians specified arc tangent ofy/x, signs of bothxandybeing used to determine the quadrant of the result (same asGpatan2(y,x))realGparctg2(realy,realx); is same asGpatan2(y,x)realGpatan2(realy,realx); is the positively defined, in degrees specified arc tangent ofy/x, signs of bothxandybeing used to determine the quadrant of the resultrealGsin(realx); is the sine of degreesxrealGtan(realx); is the tangent of degreesxrealGtg(realx); is same asGtan(x)integerabs(integerm); is the absolute value ofmrealacos(realx); is the in radians specified arc cosine ofxrealadiff(realx,realy); is the in radians specified smallest angle between radiansxand radiansy(or something)realarccos(realx); is same asacos(x)realarcctg2(realx,realy); is the in radians specified arc tangent ofy/x, signs of bothxandybeing used to determine the quadrant of the result (same asatan2(y,x))realarcdiff(realx,realy); is same asadiff(x,y)realarcsin(realx); is same asasin(x)realarctg(realx); is same asatan(x)realarctg2(realy,realx); is same asatan2(y,x)realasin(realx); is the in radians specified arc sine ofxrealatan(realx); is the in radians specified arc tangent ofxrealatan2(realy,realx); is the in radians specified arc tangent ofy/x, signs of bothxandybeing used to determine the quadrant of the resultintegerbase2(integerm); is the greatest power of 2 less than or equal tomifmis not less than zero, some undefined value otherwiseintegerbcount(integerm); is thembit count (i.e. the number of bits set inm)realceil(realx); is the up rounded value ofxcardinalcardinal(cardinalz); iszintegercharacter(texts,integerm); is the (positively defined value of the)mth character ofs, if such character exists, 0 otherwise (negative position indications are interpreted with respect to the end of string)integercompare(texts,textt); is 0 ifsis (case sensitive) same ast, less than 0 ifsis less thantand greater than 0 ifsis greater thantrealcos(realx); is the cosine of radiansxintegerdeck2(integerm); is the lesser power of 2 greater than or equal tomifmis not less than zero, some undefined value otherwiseintegerdrand(integerm); is a pseudo-random integer between inclusive 0 andmtextecho(texts); issrealexp(realx); is the value of e (the base of natural logarithms) raised to the power ofxrealexp2(realx); is the value of 2 raised to the power ofxrealfabs(realx); is the absolute value ofxrealfclip(realmin,realx,realmax); is the minimum betweenmaxand the maximum betweenxandminintegerffs(integerm); is the 1 based position of the first (least significant) bit set inmif any, 0 otherwiserealfloor(realx); is the down rounded value ofxintegerfls(integerm); is the 1 based position of the last (most significant) bit set inmif any, 0 otherwiserealfmax(realx,realy); is the maximum ofxandyrealfmin(realx,realy); is the minimum ofxandyrealfmod(realx,realy); is the remainder of dividingxbyy, more specificallyx-n*y, wherenis the quotient ofx/y, rounded toward zero to an integerrealfmodf(realx); is the same sign asxfractional part ofxintegerframe(texts,integerc); is the position of the last occurrence of thecnon zero character in thesstring if any, -1 otherwiserealfrand(void); is a pseudo-random real between 0 and 1realfsign(realx); is -1 ifxis negative, 0 ofxis zero, 1 otherwiseintegergcd(integerm,integern); is the greatest common denominator ofmandnintegericlip(integermin,integerm,integermax); is the minimum betweenmaxand the maximum betweenmandminrealimodf(realx); is the same sign asxintegral part ofxintegerindex(texts,integerc); is the position of the first occurrence of thecnon zero character in thesstring if any, -1 otherwiseintegerinteger(integerm); ismintegerirand(integerm,integern); is a pseudo-random integer between inclusivemandnintegerlength(texts); is the length ofsreallimit(realx); is the away from zero rounded value ofxrealln(realx); is same aslog(x)reallog(realx); is the natural logarithm ofxreallog10(realx); is the base 10 logarithm ofxreallog2(realx); is the base 2 logarithm ofxreallrand(void); is a pseudo-random real between -1 and 1integerlz(integerm); is themleading zero bits count, same asxls(m)integermatch(texts,textt); is 0 iftwild card (case sensitive) matches thespattern (the*and?literal sign are interpreted as for their shell pattern equivalents), non 0 otherwiseintegermax(integerm,integern); is the maximum ofmandnintegermin(integerm,integern); is the minimum ofmandnrealmodf(realx,real &y); is the same sign asxfractional part ofx,yis the same sign asxintegral part ofxrealparcctg2(realx,realy); is the positively defined, in radians specified arc tangent ofy/x, signs of bothxandybeing used to determine the quadrant of the result (same aspatan2(y,x))realparctg2(realy,realy); is same aspatan2(y,x)realpatan2(realy,realx); is the positively defined, in radians specified arc tangent ofy/x, signs of bothxandybeing used to determine the quadrant of the resultrealpow(realx,realy); is the value ofxraised to the power ofytextproject(texts,integerm); issafter positionm(negative position indications are interpreted with respect to the end of string)realreal(realx); isxrealround(realx); is the towards nearest integer, half cases away from zero rounded value ofxintegersign(integerm); is -1 ifmis negative, 0 ofmis zero, 1 otherwiseintegersigned(cardinalz); iszrealsin(realx); is the sine of radiansxrealsq(realx); is the square ofxrealsqrt(realx); is the square root ofxrealtan(realx); is the tangent of radiansxrealtg(realx); is same astan(x)realtrack(realx); is the towards zero rounded value ofxintegertz(integerm); is themtrailing zero bits count, same asxfs(m)cardinalunsigned(integerm); ismintegerxfs(integerm); is the 0 based position of the first (least significant) bit set inmif any, the number of bits inmotherwise (same astz(m))integerxls(integerm); is the 0 based position of the last (most significant) bit set inmif any, the number of bits inmotherwise (same aslz(m)) Most of prefix unary and common syntax binaryCoperators are supported (including unary!,+,-and~and binary*,/,%,+,-,<<,>>,<,>,<=,>=,!=,==,&,^,|,&&,||,=,+=,-=,*=,/=,%=,&=,^=,|=,<<=and>>=), the semantics and precedence being the same or at least very close to those of theirCcounterparts. AUTHORS Ciprian Niculescu January 2018 express17(1)