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 real gclip(real x, real min, real max);
249 is the minimum between max and the maximum between x and min
250
251 integer iclip(integer min, integer m, integer max);
252 is the minimum between max and the maximum between m and min
253
254 real imodf(real x);
255 is the same sign as x integral part of x
256
257 integer integer(integer m);
258 is m
259
260 integer irand(integer m, integer n);
261 is a pseudo-random integer between inclusive m and n
262
263 integer jclip(integer m, integer min, integer max);
264 is the minimum between max and the maximum between m and min
265
266 integer kfs(integer m, integer k);
267 is the 0 based position of the first kth (least significant) bit
268 set in m if any, the number of bits in m otherwise (kfs(m, 0) is
269 equivalent with xfs(m))
270
271 integer kls(integer m, integer k);
272 is the 0 based position of the last kth (most significant) bit
273 set in m if any, the number of bits in m otherwise (kls(m, 0) is
274 equivalent with xls(m))
275
276 integer length(text s);
277 is the length of s
278
279 real limit(real x);
280 is the away from zero rounded value of x
281
282 real ln(real x);
283 is same as log(x)
284
285 real log(real x);
286 is the natural logarithm of x
287
288 real log10(real x);
289 is the base 10 logarithm of x
290
291 real log2(real x);
292 is the base 2 logarithm of x
293
294 real lrand(void);
295 is a pseudo-random real between -1 and 1
296
297 integer lz(integer m);
298 is the m leading zero bits count, same as xls(m)
299
300 integer match(text s, text t);
301 is 0 if t wild card (case sensitive) matches the s pattern (the
302 * and ? literal sign are interpreted as for their shell pattern
303 equivalents), non 0 otherwise
304
305 integer max(integer m, integer n);
306 is the maximum of m and n
307
308 integer min(integer m, integer n);
309 is the minimum of m and n
310
311 real modf(real x, real &y);
312 is the same sign as x fractional part of x, y is the same sign
313 as x integral part of x
314
315 real parcctg2(real x, real y);
316 is the positively defined, in radians specified arc tangent of y
317 / x, signs of both x and y being used to determine the quadrant
318 of the result (same as patan2(y, x))
319
320 real parctg2(real y, real y);
321 is same as patan2(y, x)
322
323 real patan2(real y, real x);
324 is the positively defined, in radians specified arc tangent of y
325 / x, signs of both x and y being used to determine the quadrant
326 of the result
327
328 integer place(text s, integer c);
329 is the position of the first occurrence of the c non zero char‐
330 acter in the s string if any, -1 otherwise
331
332 real pow(real x, real y);
333 is the value of x raised to the power of y
334
335 text project(text s, integer m);
336 is s after position m (negative position indications are inter‐
337 preted with respect to the end of string)
338
339 real real(real x);
340 is x
341
342 real round(real x);
343 is the towards nearest integer, half cases away from zero
344 rounded value of x
345
346 integer sign(integer m);
347 is -1 if m is negative, 0 of m is zero, 1 otherwise
348
349 integer signed(cardinal z);
350 is z
351
352 real sin(real x);
353 is the sine of radians x
354
355 real sq(real x);
356 is the square of x
357
358 real sqrt(real x);
359 is the square root of x
360
361 real tan(real x);
362 is the tangent of radians x
363
364 real tg(real x);
365 is same as tan(x)
366
367 real track(real x);
368 is the towards zero rounded value of x
369
370 integer tz(integer m);
371 is the m trailing zero bits count, same as xfs(m)
372
373 cardinal unsigned(integer m);
374 is m
375
376 integer xfs(integer m);
377 is the 0 based position of the first (least significant) bit set
378 in m if any, the number of bits in m otherwise (same as tz(m))
379
380 integer xls(integer m);
381 is the 0 based position of the last (most significant) bit set
382 in m if any, the number of bits in m otherwise (same as lz(m))
383
384 Most of prefix unary and common syntax binary C operators are supported
385 (including unary !, +, - and ~ and binary *, /, %, +, -, <<, >>, <, >,
386 <=, >=, !=, ==, &, ^, |, &&, ||, =, +=, -=, *=, /=, %=, &=, ^=, |=, <<=
387 and >>=), the semantics and precedence being the same or at least very
388 close to those of their C counterparts.
389
391 Ciprian Niculescu
392
393
394
395 May 2019 express17(1)