1express17(1) General Commands Manual express17(1)
2
3
4
6 express17 - evaluate expressions
7
9 express17 [OPTIONS] EXPRESSION [TYPE NAME VALUE]...
10
12 express17 prints the value of EXPRESSION to standard output. EXPRES‐
13 SION may refer variables defined as a TYPE NAME VALUE triplet. TYPE
14 may be one of cardinal (integral, positive), integer (integral), real
15 (real) and text (string).
16
18 -P, --print
19 Print the parsed expression instead its value.
20
21 -t, --type
22 Print the expression type instead its value.
23
24 --list List functions and exit.
25
26 --list-1
27 List unary operators and exit.
28
29 --list-2
30 List binary operators and exit.
31
32 --list-2h
33 List binary operators and exit.
34
35 --list-3
36 List ternary operators and exit.
37
38 --list-3h
39 List ternary operators and exit.
40
41 --help Print a usage message and exit with a status code indicating
42 success.
43
44 --version
45 Print version information on standard output then exit.
46
48 The allowed expression syntax is similar to that of C expressions. It
49 allows for prefix unary and common syntax binary operators, functions
50 and variables. There are four supported types: cardinal (integral,
51 positive), integer (integral), real (real) and text (string).
52
53 The available functions are mathematical or text generalities, among
54 which:
55
56 real Gacos(real x);
57 is the in degrees specified arc cosine of x
58
59 real Gadiff(real x, real y);
60 is the in degrees specified smallest angle between degrees x and
61 degrees y (or something)
62
63 real Garccos(real x);
64 is same as Gacos(x)
65
66 real Garcctg2(real x, real y);
67 is the in degrees specified arc tangent of y / x, signs of both
68 x and y being used to determine the quadrant of the result (same
69 as Gatan2(y, x))
70
71 real Garcdiff(real x, real y);
72 is same as Gadiff(x, y)
73
74 real Garcsin(real x);
75 is same as Gasin(x)
76
77 real Garctg(real x);
78 is same as Gatan(x)
79
80 real Garctg2(real y, real x);
81 is same as Gatan2(y, x)
82
83 real Gasin(real x);
84 is the in degrees specified arc sine of x
85
86 real Gatan(real x);
87 is the in degrees specified arc tangent of x
88
89 real Gatan2(real y, real x);
90 is the in degrees specified arc tangent of y / x, signs of both
91 x and y being used to determine the quadrant of the result
92
93 real Gcos(real x);
94 is the cosine of degrees x
95
96 real Gparcctg2(real x, real y);
97 is the positively defined, in radians specified arc tangent of y
98 / x, signs of both x and y being used to determine the quadrant
99 of the result (same as Gpatan2(y, x))
100
101 real Gparctg2(real y, real x);
102 is same as Gpatan2(y, x)
103
104 real Gpatan2(real y, real x);
105 is the positively defined, in degrees specified arc tangent of y
106 / x, signs of both x and y being used to determine the quadrant
107 of the result
108
109 real Gsin(real x);
110 is the sine of degrees x
111
112 real Gtan(real x);
113 is the tangent of degrees x
114
115 real Gtg(real x);
116 is same as Gtan(x)
117
118 integer abs(integer m);
119 is the absolute value of m
120
121 real acos(real x);
122 is the in radians specified arc cosine of x
123
124 real adiff(real x, real y);
125 is the in radians specified smallest angle between radians x and
126 radians y (or something)
127
128 real arccos(real x);
129 is same as acos(x)
130
131 real arcctg2(real x, real y);
132 is the in radians specified arc tangent of y / x, signs of both
133 x and y being used to determine the quadrant of the result (same
134 as atan2(y, x))
135
136 real arcdiff(real x, real y);
137 is same as adiff(x, y)
138
139 real arcsin(real x);
140 is same as asin(x)
141
142 real arctg(real x);
143 is same as atan(x)
144
145 real arctg2(real y, real x);
146 is same as atan2(y, x)
147
148 real asin(real x);
149 is the in radians specified arc sine of x
150
151 real atan(real x);
152 is the in radians specified arc tangent of x
153
154 real atan2(real y, real x);
155 is the in radians specified arc tangent of y / x, signs of both
156 x and y being used to determine the quadrant of the result
157
158 integer base2(integer m);
159 is the greatest power of 2 less than or equal to m if m is not
160 less than zero, some undefined value otherwise
161
162 integer bcount(integer m);
163 is the m bit count (i.e. the number of bits set in m)
164
165 real ceil(real x);
166 is the up rounded value of x
167
168 cardinal cardinal(cardinal z);
169 is z
170
171 integer character(text s, integer m);
172 is the (positively defined value of the) mth character of s, if
173 such character exists, 0 otherwise (negative position indica‐
174 tions are interpreted with respect to the end of string)
175
176 integer compare(text s, text t);
177 is 0 if s is (case sensitive) same as t, less than 0 if s is
178 less than t and greater than 0 if s is greater than t
179
180 real cos(real x);
181 is the cosine of radians x
182
183 integer deck2(integer m);
184 is the lesser power of 2 greater than or equal to m if m is not
185 less than zero, some undefined value otherwise
186
187 integer drand(integer m);
188 is a pseudo-random integer between inclusive 0 and m
189
190 text echo(text s);
191 is s
192
193 real exp(real x);
194 is the value of e (the base of natural logarithms) raised to the
195 power of x
196
197 real exp2(real x);
198 is the value of 2 raised to the power of x
199
200 real fabs(real x);
201 is the absolute value of x
202
203 real fclip(real min, real x, real max);
204 is the minimum between max and the maximum between x and min
205
206 integer ffs(integer m);
207 is the 1 based position of the first (least significant) bit set
208 in m if any, 0 otherwise
209
210 real floor(real x);
211 is the down rounded value of x
212
213 integer fls(integer m);
214 is the 1 based position of the last (most significant) bit set
215 in m if any, 0 otherwise
216
217 real fmax(real x, real y);
218 is the maximum of x and y
219
220 real fmin(real x, real y);
221 is the minimum of x and y
222
223 real fmod(real x, real y);
224 is the remainder of dividing x by y, more specifically x - n *
225 y, where n is the quotient of x / y, rounded toward zero to an
226 integer
227
228 real fmodf(real x);
229 is the same sign as x fractional part of x
230
231 integer frame(text s, integer c);
232 is the position of the last occurrence of the c non zero charac‐
233 ter in the s string if any, -1 otherwise
234
235 real frand(void);
236 is a pseudo-random real between 0 and 1
237
238 real frexp(real x, integer &e);
239 is the (-1; -0.5], [0.5; 1) normalized fraction that multiplied
240 by the power of two to which e is set retrieves x
241
242 real fsign(real x);
243 is -1 if x is negative, 0 of x is zero, 1 otherwise
244
245 integer gcd(integer m, integer n);
246 is the greatest common denominator of m and n
247
248 integer iclip(integer min, integer m, integer max);
249 is the minimum between max and the maximum between m and min
250
251 real imodf(real x);
252 is the same sign as x integral part of x
253
254 integer index(text s, integer c);
255 is the position of the first occurrence of the c non zero char‐
256 acter in the s string if any, -1 otherwise
257
258 integer integer(integer m);
259 is m
260
261 integer irand(integer m, integer n);
262 is a pseudo-random integer between inclusive m and n
263
264 integer kfs(integer m, integer k);
265 is the 0 based position of the first kth (least significant) bit
266 set in m if any, the number of bits in m otherwise (kfs(m, 0) is
267 equivalent with xfs(m))
268
269 integer kls(integer m, integer k);
270 is the 0 based position of the last kth (most significant) bit
271 set in m if any, the number of bits in m otherwise (kls(m, 0) is
272 equivalent with xls(m))
273
274 integer length(text s);
275 is the length of s
276
277 real limit(real x);
278 is the away from zero rounded value of x
279
280 real ln(real x);
281 is same as log(x)
282
283 real log(real x);
284 is the natural logarithm of x
285
286 real log10(real x);
287 is the base 10 logarithm of x
288
289 real log2(real x);
290 is the base 2 logarithm of x
291
292 real lrand(void);
293 is a pseudo-random real between -1 and 1
294
295 integer lz(integer m);
296 is the m leading zero bits count, same as xls(m)
297
298 integer match(text s, text t);
299 is 0 if t wild card (case sensitive) matches the s pattern (the
300 * and ? literal sign are interpreted as for their shell pattern
301 equivalents), non 0 otherwise
302
303 integer max(integer m, integer n);
304 is the maximum of m and n
305
306 integer min(integer m, integer n);
307 is the minimum of m and n
308
309 real modf(real x, real &y);
310 is the same sign as x fractional part of x, y is the same sign
311 as x integral part of x
312
313 real parcctg2(real x, real y);
314 is the positively defined, in radians specified arc tangent of y
315 / x, signs of both x and y being used to determine the quadrant
316 of the result (same as patan2(y, x))
317
318 real parctg2(real y, real y);
319 is same as patan2(y, x)
320
321 real patan2(real y, real x);
322 is the positively defined, in radians specified arc tangent of y
323 / x, signs of both x and y being used to determine the quadrant
324 of the result
325
326 real pow(real x, real y);
327 is the value of x raised to the power of y
328
329 text project(text s, integer m);
330 is s after position m (negative position indications are inter‐
331 preted with respect to the end of string)
332
333 real real(real x);
334 is x
335
336 real round(real x);
337 is the towards nearest integer, half cases away from zero
338 rounded value of x
339
340 integer sign(integer m);
341 is -1 if m is negative, 0 of m is zero, 1 otherwise
342
343 integer signed(cardinal z);
344 is z
345
346 real sin(real x);
347 is the sine of radians x
348
349 real sq(real x);
350 is the square of x
351
352 real sqrt(real x);
353 is the square root of x
354
355 real tan(real x);
356 is the tangent of radians x
357
358 real tg(real x);
359 is same as tan(x)
360
361 real track(real x);
362 is the towards zero rounded value of x
363
364 integer tz(integer m);
365 is the m trailing zero bits count, same as xfs(m)
366
367 cardinal unsigned(integer m);
368 is m
369
370 integer xfs(integer m);
371 is the 0 based position of the first (least significant) bit set
372 in m if any, the number of bits in m otherwise (same as tz(m))
373
374 integer xls(integer m);
375 is the 0 based position of the last (most significant) bit set
376 in m if any, the number of bits in m otherwise (same as lz(m))
377
378 Most of prefix unary and common syntax binary C operators are supported
379 (including unary !, +, - and ~ and binary *, /, %, +, -, <<, >>, <, >,
380 <=, >=, !=, ==, &, ^, |, &&, ||, =, +=, -=, *=, /=, %=, &=, ^=, |=, <<=
381 and >>=), the semantics and precedence being the same or at least very
382 close to those of their C counterparts.
383
385 Ciprian Niculescu
386
387
388
389 October 2018 express17(1)