-
Notifications
You must be signed in to change notification settings - Fork 0
/
HELP
764 lines (521 loc) · 18.9 KB
/
HELP
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
Help (short reference) file for the sm_calculator (SM Calculator) solution.
----------------------------------------
NAME
sm_calculator
SYNOPSIS
SM Calculator
Please, see README and INSTALL files for more info, examples, build instructions.
Lexemes of SM Calculator expressions:
--------------------
Available keywords:
f_precision i_format a_unit
pi exp gamma phi
rad deg grad
grad2rad rad2grad
rad2deg deg2rad
grad2deg deg2grad
dec oct hex bin
dec2oct dec2hex dec2bin
oct2dec hex2dec bin2dec
sin cos tan
asin acos atan
ln lg log
inv sqrt rand
pow
pow_exp^ pow_10^ pow_2^ pow_^2
abs mod mod2
and or not
nand nor xor
config help echo
quit exit
Available operators:
+ - * / = !
<a< >a> <l< >l> <c< >c>
Available delimiters:
, ( ) ; \n (new line)
Commands (from available keywords):
f_precision i_format a_unit
dec oct hex bin
rad deg grad
rand
config help
quit exit
Constants (from available keywords):
pi exp gamma phi
Output functions:
echo
Converting functions (from available keywords):
grad2rad rad2grad
rad2deg deg2rad
grad2deg deg2grad
dec2oct dec2hex dec2bin
oct2dec hex2dec bin2dec
Trigonometric functions (from available keywords):
sin cos tan
asin acos atan
Logarithm functions (from available keywords):
ln lg log
Exponentiation functions:
pow
pow_exp^ pow_10^ pow_2^ pow_^2
Bit functions (from available keywords):
and or not
nand nor xor
Bit operators (from available operators):
<a< >a>
<l< >l>
<c< >c>
--------------------
Constants Reference:
--------------------
--------------------
'pi' :
--------------------
Constant returns float value 3.14159265358979323846.
--------------------
'exp' :
--------------------
Constant returns float value 2.71828182845904523536.
--------------------
'gamma' :
--------------------
Constant returns float value 0.57721566490153286060.
--------------------
'phi' :
--------------------
Constant returns float value 1.61803398874989484820.
--------------------
Operators Reference:
--------------------
--------------------
'+' :
--------------------
Operator, that returns sum of arguments:
arg1 + arg2[;]
, where arg1 and arg2 - integer or float value.
--------------------
'-' :
--------------------
Operator, that returns subtraction of arguments:
arg1 - arg2[;]
, where arg1 and arg2 - integer or float value.
--------------------
'*' :
--------------------
Operator, that returns multiplication of arguments:
arg1 * arg2[;]
, where arg1 and arg2 - integer or float value.
--------------------
'/' :
--------------------
Operator, that returns division of arguments:
arg1 / arg2[;]
, where arg1 and arg2 - integer or float value. arg2 should be != 0.
--------------------
'=' :
--------------------
Assign values by commands f_precision, a_unit, i_format:
f_precision=<[0,20]|exp>[;]
a_unit=<rad|deg|grad>[;]
i_format=<dec|hex|oct|bin>[;]
--------------------
'!' :
--------------------
Operator, that returns factorial of argument:
arg!
, where arg - integer value. arg should be >= 0;
--------------------
<a< :
--------------------
Operator, that returns left arithmetic shift of argument:
arg <a< n[;]
, where arg - integer argument, n - number bits of shift. n should be >= 0.
--------------------
>a> :
--------------------
Operator, that returns right arithmetic shift of argument:
arg >a> n[;]
, where arg - integer argument, n - number bits of shift. n should be >= 0.
This operator ('>a>') saves sign of negative value during shift.
--------------------
<l< :
--------------------
Operator, that returns left logical shift of argument:
arg <l< n[;]
, where arg - integer argument, n - number bits of shift. n should be >= 0.
--------------------
>l> :
--------------------
Operator, that returns right logical shift of argument:
arg >l> n[;]
, where arg - integer argument, n - number bits of shift. n should be >= 0.
This operator ('>l>') doesn't save sign of negative value during shift.
--------------------
<c< :
--------------------
Operator, that returns left circular shift of argument:
arg <c< n[;]
, where arg - integer argument, n - number bits of shift. n should be >= 0.
--------------------
>c> :
--------------------
Operator, that returns right circular shift of argument:
arg >c> n[;]
, where arg - integer argument, n - number bits of shift. n should be >= 0.
--------------------
Functions Reference:
--------------------
--------------------
grad2rad :
--------------------
Function, that returns converted value gradians -> radians
(from gradians unit for measuring of angles to radians).
grad2rad(arg)[;]
, where arg - integer or float argument.
--------------------
rad2grad :
--------------------
Function, that returns converted value radians -> gradians
(from radians unit for measuring of angles to gradians).
rad2grad(arg)[;]
, where arg - integer or float argument.
--------------------
rad2deg :
--------------------
Function, that returns converted value radians -> degrees
(from radians unit for measuring of angles to degrees).
rad2deg(arg)[;]
, where arg - integer or float argument.
--------------------
deg2rad :
--------------------
Function, that returns converted value degrees -> radians
(from degrees unit for measuring of angles to radians).
deg2rad(arg)[;]
, where arg - integer or float argument.
--------------------
grad2deg :
--------------------
Function, that returns converted value gradians -> degrees
(from gradians unit for measuring of angles to degrees).
grad2deg(arg)[;]
, where arg - integer or float argument.
--------------------
deg2grad :
--------------------
Function, that returns converted value degrees -> gradians
(from degrees unit for measuring of angles to gradians).
deg2grad(arg)[;]
, where arg - integer or float argument.
--------------------
dec2oct :
--------------------
Function, that returns converted value decimal ('dec') format -> octal ('oct') format.
dec2oct(arg)[;]
, where arg - integer argument.
--------------------
dec2hex :
--------------------
Function, that returns converted value decimal ('dec') format -> hexadecimal ('hex') format.
dec2hex(arg)[;]
, where arg - integer argument.
--------------------
dec2bin :
--------------------
Function, that returns converted value decimal ('dec') format -> binary ('bin') format.
dec2bin(arg)[;]
, where arg - integer argument.
--------------------
oct2dec :
--------------------
Function, that returns converted value octal ('oct') format -> decimal ('dec') format.
oct2dec(arg)[;]
, where arg - integer argument.
--------------------
hex2dec :
--------------------
Function, that returns converted value hexadecimal ('hex') format -> decimal ('dec') format.
hex2dec(arg)[;]
, where arg - integer argument.
--------------------
bin2dec :
--------------------
Function, that returns converted value hexadecimal ('bin') format -> decimal ('dec') format.
bin2dec(arg)[;]
, where arg - integer argument.
--------------------
sin :
--------------------
Trigonometric function, that calculates and returns the sine of argument.
sin(arg)[;]
, where arg - integer or float argument. Argument should be defined as value of
current unit for measuring of angles (deg|rad|grad).
--------------------
cos :
--------------------
Trigonometric function, that calculates and returns the cosine of argument.
cos(arg)[;]
, where arg - integer or float argument. Argument should be defined as value of
current unit for measuring of angles (deg|rad|grad).
--------------------
tan :
--------------------
Trigonometric function, that calculates and returns the tangent of argument.
tan(arg)[;]
, where arg - integer or float argument. Argument should be defined as value of
current unit for measuring of angles (deg|rad|grad).
--------------------
asin :
--------------------
Trigonometric function, that calculates and returns the arcsine of argument.
asin(arg)[;]
, where arg - integer or float argument. Result of this function is defined as value of
current unit for measuring of angles (deg|rad|grad).
--------------------
acos :
--------------------
Trigonometric function, that calculates and returns the arccosine of argument.
acos(arg)[;]
, where arg - integer or float argument. Result of this function is defined as value of
current unit for measuring of angles (deg|rad|grad).
--------------------
atan :
--------------------
Trigonometric function, that calculates and returns the arctangent of argument.
atan(arg)[;]
, where arg - integer or float argument. Result of this function is defined as value of
current unit for measuring of angles (deg|rad|grad).
--------------------
ln :
--------------------
Function, that calculates and returns the natural logarithm (base of the exp) of argument.
ln(arg)[;]
, where arg - integer or float argument. arg should be > 0.
--------------------
lg :
--------------------
Function, that calculates and returns the common logarithm (base of the 10) of argument.
lg(arg)[;]
, where arg - integer or float argument. arg should be > 0.
--------------------
log :
--------------------
Function, that calculates and returns the logarithm (base, defied as parameter) of argument.
log(base, arg)[;]
, where base and arg - integer or float arguments. base should be > 0, arg should be > 0.
--------------------
inv :
--------------------
Function, that calculates and returns inverse value (1/x) of argument.
inv(arg)[;]
, where arg - integer or float argument. arg should be != 0.
--------------------
sqrt :
--------------------
Function, that calculates and returns inverse square root of argument.
sqrt(arg)[;]
, where arg - integer or float argument. arg should be >= 0.
--------------------
pow :
--------------------
Function, that calculates and returns arg1 raised to the power of arg2.
pow(arg1, arg2)[;]
, where arg1 and arg2 - integer or float arguments.
--------------------
pow_exp^ :
--------------------
Function, that calculates and returns constant 'exp' raised to the power of arg.
pow_exp^(arg)[;]
, where arg - integer or float argument.
--------------------
pow_10^ :
--------------------
Function, that calculates and returns '10' raised to the power of arg.
pow_10^(arg)[;]
, where arg - integer or float argument. arg should be >= 0.
--------------------
pow_2^ :
--------------------
Function, that calculates and returns '2' raised to the power of arg.
pow_2^(arg)[;]
, where arg - integer or float argument. arg should be >= 0.
--------------------
pow_^2 :
--------------------
Function, that calculates and returns arg raised to the power of '2'.
pow_^2(arg)[;]
, where arg - integer or float argument.
--------------------
abs :
--------------------
Function, that calculates and returns absolute value of argument.
abs(arg)[;]
, where arg - integer or float argument.
--------------------
mod :
--------------------
Function, that calculates and returns remainder value of division arg1 / arg2 (often marked as arg1 % arg2).
mod(arg1, arg2)[;]
, where arg1, arg2 - integer arguments. arg2 should be != 0.
--------------------
mod2 :
--------------------
Function, that calculates and returns remainder value of division arg / 2 (often marked as arg % 2).
mod2(arg)[;]
, where arg - integer argument.
--------------------
and :
--------------------
Function (bitwise function), that calculates bitwise multiplication of arguments ( arg1 && arg2 ).
and(arg1, arg2)[;]
, where arg1 and arg2 - integer arguments.
--------------------
or :
--------------------
Function (bitwise function), that calculates bitwise addition of arguments ( arg1 || arg2 ).
or(arg1, arg2)[;]
, where arg1 and arg2 - integer arguments.
--------------------
not :
--------------------
Function (bitwise function), that calculates bitwise negation of argument ( !arg ).
not(arg)[;]
, where arg - integer argument.
--------------------
nand :
--------------------
Function (bitwise function), that calculates bitwise negation of bitwise multiplication of arguments ( !(arg1 && arg2) ).
nand(arg1, arg2)[;]
, where arg1 and arg2 - integer arguments.
--------------------
nor :
--------------------
Function (bitwise function), that calculates bitwise negation of bitwise addition of arguments ( !(arg1 || arg2) ).
nor(arg1, arg2)[;]
, where arg1 and arg2 - integer arguments.
--------------------
xor :
--------------------
Function (bitwise function), that calculates bitwise 'exclusive or' or 'exclusive disjunction' of arguments ( arg1 ^ arg2) ).
xor(arg1, arg2)[;]
, where arg1 and arg2 - integer arguments.
--------------------
echo :
--------------------
Function prints argument in current output file device.
echo(arg)[;]
arg[;]
, where arg - string argument ("string_value"|'string_value').
User can just enter string and this string will be printed in current output file device.
This function(ality) is useful during processing of files and allows to get formatted output.
--------------------
Commands Reference:
--------------------
--------------------
rand :
--------------------
Command, that returns pseudo-random value [0,1].
rand[;]
.
--------------------
f_precision :
--------------------
Command, that setup and returns current precision of float values.
f_precision = N[;]
f_precision[;]
, where N = [0,20]|exp. Also N can be defined as 'exp'. In this case float value will be printed in exponential format.
--------------------
i_format :
--------------------
Command, that setup and returns current output format of integers.
i_format = <dec|hex|oct|bin>[;]
i_format[;]
After applying of this command output of all integers is provided in defined format
(decimal 'dec', octal 'oct', hexadecimal 'hex', binary 'bin').
--------------------
dec :
--------------------
Command, that setup and returns current output format of integers as decimal ('dec').
dec[;]
After applying of this command output of all integers is provided in decimal 'dec' format.
The command 'dec[;]' does the same as 'i_format=dec[;]'.
--------------------
oct :
--------------------
Command, that setup and returns current output format of integers as octal ('oct').
oct[;]
After applying of this command output of all integers is provided in octal 'oct' format.
This command 'oct[;]' does the same as 'i_format=oct[;]'.
--------------------
hex :
--------------------
Command, that setup and returns current output format of integers as hexadecimal ('hex').
hex[;]
After applying of this command output of all integers is provided in hexadecimal 'hex' format.
The command 'hex[;]' does the same as 'i_format=hex[;]'.
--------------------
bin :
--------------------
Command, that setup and returns current output format of integers as binary ('bin').
bin[;]
After applying of this command output of all integers is provided in binary 'bin' format.
The command 'bin[;]' does the same as 'i_format=bin[;]'.
--------------------
a_unit :
--------------------
Command, that setup and returns current configuration of unit for measuring of angles.
a_unit=<deg|rad|grad>[;]
a_unit[;]
Current configuration of unit for measuring of angles defines, which unit of measuring should be used
by arguments of trigonometric functions (sin, cos, tan) and which unit of measuring of execution result
of trigonometric functions (asin, acos, atan).
--------------------
deg :
--------------------
Command, that returns and setup current configuration of unit for measuring of angles as degrees ('deg').
deg[;]
The command 'deg[;]' does the same as 'a_unit=deg[;]'.
--------------------
rad :
--------------------
Command, that returns and setup current configuration of unit for measuring of angles as radians ('deg').
rad[;]
The command 'rad[;]' does the same as 'a_unit=rad[;]'.
--------------------
grad :
--------------------
Command, that returns and setup current configuration of unit for measuring of angles as gradians ('grad').
grad[;]
The command 'grad[;]' does the same as 'a_unit=grad[;]'.
--------------------
config :
--------------------
Command returns current configuration (current double precision, current output format of integers,
unit of measurement of an angle):
config[;]
--------------------
help :
--------------------
Command prints help, reading file:
"*{SM_CALC_BIN}*\..\share\smansoft\doc\HELP" (Windows);
"*{SM_CALC_BIN}*/../share/smansoft/doc/HELP" (Linux),
where *{SM_CALC_BIN}* is a path (including /bin/), where sm_calc exec is deployed.
help[;]
As help is a multi-page document, user should press <Enter> key for printing all help from start till end.
--------------------
quit :
--------------------
Command provides closing/exit of SM Calculator application.
quit[;]
The command 'quit[;]' does the same as 'exit[;]'.
--------------------
exit :
--------------------
Command provides closing/exit of SM Calculator application.
exit[;]
The command 'exit[;]' does the same as 'quit[;]'.
--------------------
Please, see README and INSTALL files for more info, examples, build instructions.
--------------------
Copyright (C) 2020-2021 SManSoft <http://www.smansoft.com/>
Sergey Manoylo <[email protected]>