]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/bc/manuals/dc/EP.1
Upgrade to version 3.1.4
[FreeBSD/FreeBSD.git] / contrib / bc / manuals / dc / EP.1
1 .\"
2 .\" SPDX-License-Identifier: BSD-2-Clause
3 .\"
4 .\" Copyright (c) 2018-2020 Gavin D. Howard and contributors.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions are met:
8 .\"
9 .\" * Redistributions of source code must retain the above copyright notice,
10 .\"   this list of conditions and the following disclaimer.
11 .\"
12 .\" * Redistributions in binary form must reproduce the above copyright notice,
13 .\"   this list of conditions and the following disclaimer in the documentation
14 .\"   and/or other materials provided with the distribution.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 .\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 .\" POSSIBILITY OF SUCH DAMAGE.
27 .\"
28 .TH "DC" "1" "July 2020" "Gavin D. Howard" "General Commands Manual"
29 .SH Name
30 .PP
31 dc \- arbitrary\-precision reverse\-Polish notation calculator
32 .SH SYNOPSIS
33 .PP
34 \f[B]dc\f[] [\f[B]\-hiPvVx\f[]] [\f[B]\-\-version\f[]]
35 [\f[B]\-\-help\f[]] [\f[B]\-\-interactive\f[]] [\f[B]\-\-no\-prompt\f[]]
36 [\f[B]\-\-extended\-register\f[]] [\f[B]\-e\f[] \f[I]expr\f[]]
37 [\f[B]\-\-expression\f[]=\f[I]expr\f[]...] [\f[B]\-f\f[]
38 \f[I]file\f[]...] [\f[B]\-file\f[]=\f[I]file\f[]...] [\f[I]file\f[]...]
39 .SH DESCRIPTION
40 .PP
41 dc(1) is an arbitrary\-precision calculator.
42 It uses a stack (reverse Polish notation) to store numbers and results
43 of computations.
44 Arithmetic operations pop arguments off of the stack and push the
45 results.
46 .PP
47 If no files are given on the command\-line as extra arguments (i.e., not
48 as \f[B]\-f\f[] or \f[B]\-\-file\f[] arguments), then dc(1) reads from
49 \f[B]stdin\f[].
50 Otherwise, those files are processed, and dc(1) will then exit.
51 .PP
52 This is different from the dc(1) on OpenBSD and possibly other dc(1)
53 implementations, where \f[B]\-e\f[] (\f[B]\-\-expression\f[]) and
54 \f[B]\-f\f[] (\f[B]\-\-file\f[]) arguments cause dc(1) to execute them
55 and exit.
56 The reason for this is that this dc(1) allows users to set arguments in
57 the environment variable \f[B]DC_ENV_ARGS\f[] (see the \f[B]ENVIRONMENT
58 VARIABLES\f[] section).
59 Any expressions given on the command\-line should be used to set up a
60 standard environment.
61 For example, if a user wants the \f[B]scale\f[] always set to
62 \f[B]10\f[], they can set \f[B]DC_ENV_ARGS\f[] to \f[B]\-e 10k\f[], and
63 this dc(1) will always start with a \f[B]scale\f[] of \f[B]10\f[].
64 .PP
65 If users want to have dc(1) exit after processing all input from
66 \f[B]\-e\f[] and \f[B]\-f\f[] arguments (and their equivalents), then
67 they can just simply add \f[B]\-e q\f[] as the last command\-line
68 argument or define the environment variable \f[B]DC_EXPR_EXIT\f[].
69 .SH OPTIONS
70 .PP
71 The following are the options that dc(1) accepts.
72 .TP
73 .B \f[B]\-h\f[], \f[B]\-\-help\f[]
74 Prints a usage message and quits.
75 .RS
76 .RE
77 .TP
78 .B \f[B]\-v\f[], \f[B]\-V\f[], \f[B]\-\-version\f[]
79 Print the version information (copyright header) and exit.
80 .RS
81 .RE
82 .TP
83 .B \f[B]\-i\f[], \f[B]\-\-interactive\f[]
84 Forces interactive mode.
85 (See the \f[B]INTERACTIVE MODE\f[] section.)
86 .RS
87 .PP
88 This is a \f[B]non\-portable extension\f[].
89 .RE
90 .TP
91 .B \f[B]\-P\f[], \f[B]\-\-no\-prompt\f[]
92 This option is a no\-op.
93 .RS
94 .PP
95 This is a \f[B]non\-portable extension\f[].
96 .RE
97 .TP
98 .B \f[B]\-x\f[] \f[B]\-\-extended\-register\f[]
99 Enables extended register mode.
100 See the \f[I]Extended Register Mode\f[] subsection of the
101 \f[B]REGISTERS\f[] section for more information.
102 .RS
103 .PP
104 This is a \f[B]non\-portable extension\f[].
105 .RE
106 .TP
107 .B \f[B]\-e\f[] \f[I]expr\f[], \f[B]\-\-expression\f[]=\f[I]expr\f[]
108 Evaluates \f[I]expr\f[].
109 If multiple expressions are given, they are evaluated in order.
110 If files are given as well (see below), the expressions and files are
111 evaluated in the order given.
112 This means that if a file is given before an expression, the file is
113 read in and evaluated first.
114 .RS
115 .PP
116 After processing all expressions and files, dc(1) will exit, unless
117 \f[B]\-\f[] (\f[B]stdin\f[]) was given as an argument at least once to
118 \f[B]\-f\f[] or \f[B]\-\-file\f[].
119 .PP
120 This is a \f[B]non\-portable extension\f[].
121 .RE
122 .TP
123 .B \f[B]\-f\f[] \f[I]file\f[], \f[B]\-\-file\f[]=\f[I]file\f[]
124 Reads in \f[I]file\f[] and evaluates it, line by line, as though it were
125 read through \f[B]stdin\f[].
126 If expressions are also given (see above), the expressions are evaluated
127 in the order given.
128 .RS
129 .PP
130 After processing all expressions and files, dc(1) will exit, unless
131 \f[B]\-\f[] (\f[B]stdin\f[]) was given as an argument at least once to
132 \f[B]\-f\f[] or \f[B]\-\-file\f[].
133 However, if any other \f[B]\-e\f[], \f[B]\-\-expression\f[],
134 \f[B]\-f\f[], or \f[B]\-\-file\f[] arguments are given after that, bc(1)
135 will give a fatal error and exit.
136 .PP
137 This is a \f[B]non\-portable extension\f[].
138 .RE
139 .PP
140 All long options are \f[B]non\-portable extensions\f[].
141 .SH STDOUT
142 .PP
143 Any non\-error output is written to \f[B]stdout\f[].
144 .PP
145 \f[B]Note\f[]: Unlike other dc(1) implementations, this dc(1) will issue
146 a fatal error (see the \f[B]EXIT STATUS\f[] section) if it cannot write
147 to \f[B]stdout\f[], so if \f[B]stdout\f[] is closed, as in \f[B]dc
148 >&\-\f[], it will quit with an error.
149 This is done so that dc(1) can report problems when \f[B]stdout\f[] is
150 redirected to a file.
151 .PP
152 If there are scripts that depend on the behavior of other dc(1)
153 implementations, it is recommended that those scripts be changed to
154 redirect \f[B]stdout\f[] to \f[B]/dev/null\f[].
155 .SH STDERR
156 .PP
157 Any error output is written to \f[B]stderr\f[].
158 .PP
159 \f[B]Note\f[]: Unlike other dc(1) implementations, this dc(1) will issue
160 a fatal error (see the \f[B]EXIT STATUS\f[] section) if it cannot write
161 to \f[B]stderr\f[], so if \f[B]stderr\f[] is closed, as in \f[B]dc
162 2>&\-\f[], it will quit with an error.
163 This is done so that dc(1) can exit with an error code when
164 \f[B]stderr\f[] is redirected to a file.
165 .PP
166 If there are scripts that depend on the behavior of other dc(1)
167 implementations, it is recommended that those scripts be changed to
168 redirect \f[B]stderr\f[] to \f[B]/dev/null\f[].
169 .SH SYNTAX
170 .PP
171 Each item in the input source code, either a number (see the
172 \f[B]NUMBERS\f[] section) or a command (see the \f[B]COMMANDS\f[]
173 section), is processed and executed, in order.
174 Input is processed immediately when entered.
175 .PP
176 \f[B]ibase\f[] is a register (see the \f[B]REGISTERS\f[] section) that
177 determines how to interpret constant numbers.
178 It is the "input" base, or the number base used for interpreting input
179 numbers.
180 \f[B]ibase\f[] is initially \f[B]10\f[].
181 The max allowable value for \f[B]ibase\f[] is \f[B]16\f[].
182 The min allowable value for \f[B]ibase\f[] is \f[B]2\f[].
183 The max allowable value for \f[B]ibase\f[] can be queried in dc(1)
184 programs with the \f[B]T\f[] command.
185 .PP
186 \f[B]obase\f[] is a register (see the \f[B]REGISTERS\f[] section) that
187 determines how to output results.
188 It is the "output" base, or the number base used for outputting numbers.
189 \f[B]obase\f[] is initially \f[B]10\f[].
190 The max allowable value for \f[B]obase\f[] is \f[B]DC_BASE_MAX\f[] and
191 can be queried with the \f[B]U\f[] command.
192 The min allowable value for \f[B]obase\f[] is \f[B]2\f[].
193 Values are output in the specified base.
194 .PP
195 The \f[I]scale\f[] of an expression is the number of digits in the
196 result of the expression right of the decimal point, and \f[B]scale\f[]
197 is a register (see the \f[B]REGISTERS\f[] section) that sets the
198 precision of any operations (with exceptions).
199 \f[B]scale\f[] is initially \f[B]0\f[].
200 \f[B]scale\f[] cannot be negative.
201 The max allowable value for \f[B]scale\f[] can be queried in dc(1)
202 programs with the \f[B]V\f[] command.
203 .SS Comments
204 .PP
205 Comments go from \f[B]#\f[] until, and not including, the next newline.
206 This is a \f[B]non\-portable extension\f[].
207 .SH NUMBERS
208 .PP
209 Numbers are strings made up of digits, uppercase letters up to
210 \f[B]F\f[], and at most \f[B]1\f[] period for a radix.
211 Numbers can have up to \f[B]DC_NUM_MAX\f[] digits.
212 Uppercase letters are equal to \f[B]9\f[] + their position in the
213 alphabet (i.e., \f[B]A\f[] equals \f[B]10\f[], or \f[B]9+1\f[]).
214 If a digit or letter makes no sense with the current value of
215 \f[B]ibase\f[], they are set to the value of the highest valid digit in
216 \f[B]ibase\f[].
217 .PP
218 Single\-character numbers (i.e., \f[B]A\f[] alone) take the value that
219 they would have if they were valid digits, regardless of the value of
220 \f[B]ibase\f[].
221 This means that \f[B]A\f[] alone always equals decimal \f[B]10\f[] and
222 \f[B]F\f[] alone always equals decimal \f[B]15\f[].
223 .SH COMMANDS
224 .PP
225 The valid commands are listed below.
226 .SS Printing
227 .PP
228 These commands are used for printing.
229 .TP
230 .B \f[B]p\f[]
231 Prints the value on top of the stack, whether number or string, and
232 prints a newline after.
233 .RS
234 .PP
235 This does not alter the stack.
236 .RE
237 .TP
238 .B \f[B]n\f[]
239 Prints the value on top of the stack, whether number or string, and pops
240 it off of the stack.
241 .RS
242 .RE
243 .TP
244 .B \f[B]P\f[]
245 Pops a value off the stack.
246 .RS
247 .PP
248 If the value is a number, it is truncated and the absolute value of the
249 result is printed as though \f[B]obase\f[] is \f[B]UCHAR_MAX+1\f[] and
250 each digit is interpreted as an ASCII character, making it a byte
251 stream.
252 .PP
253 If the value is a string, it is printed without a trailing newline.
254 .PP
255 This is a \f[B]non\-portable extension\f[].
256 .RE
257 .TP
258 .B \f[B]f\f[]
259 Prints the entire contents of the stack, in order from newest to oldest,
260 without altering anything.
261 .RS
262 .PP
263 Users should use this command when they get lost.
264 .RE
265 .SS Arithmetic
266 .PP
267 These are the commands used for arithmetic.
268 .TP
269 .B \f[B]+\f[]
270 The top two values are popped off the stack, added, and the result is
271 pushed onto the stack.
272 The \f[I]scale\f[] of the result is equal to the max \f[I]scale\f[] of
273 both operands.
274 .RS
275 .RE
276 .TP
277 .B \f[B]\-\f[]
278 The top two values are popped off the stack, subtracted, and the result
279 is pushed onto the stack.
280 The \f[I]scale\f[] of the result is equal to the max \f[I]scale\f[] of
281 both operands.
282 .RS
283 .RE
284 .TP
285 .B \f[B]*\f[]
286 The top two values are popped off the stack, multiplied, and the result
287 is pushed onto the stack.
288 If \f[B]a\f[] is the \f[I]scale\f[] of the first expression and
289 \f[B]b\f[] is the \f[I]scale\f[] of the second expression, the
290 \f[I]scale\f[] of the result is equal to
291 \f[B]min(a+b,max(scale,a,b))\f[] where \f[B]min()\f[] and \f[B]max()\f[]
292 return the obvious values.
293 .RS
294 .RE
295 .TP
296 .B \f[B]/\f[]
297 The top two values are popped off the stack, divided, and the result is
298 pushed onto the stack.
299 The \f[I]scale\f[] of the result is equal to \f[B]scale\f[].
300 .RS
301 .PP
302 The first value popped off of the stack must be non\-zero.
303 .RE
304 .TP
305 .B \f[B]%\f[]
306 The top two values are popped off the stack, remaindered, and the result
307 is pushed onto the stack.
308 .RS
309 .PP
310 Remaindering is equivalent to 1) Computing \f[B]a/b\f[] to current
311 \f[B]scale\f[], and 2) Using the result of step 1 to calculate
312 \f[B]a\-(a/b)*b\f[] to \f[I]scale\f[]
313 \f[B]max(scale+scale(b),scale(a))\f[].
314 .PP
315 The first value popped off of the stack must be non\-zero.
316 .RE
317 .TP
318 .B \f[B]~\f[]
319 The top two values are popped off the stack, divided and remaindered,
320 and the results (divided first, remainder second) are pushed onto the
321 stack.
322 This is equivalent to \f[B]x y / x y %\f[] except that \f[B]x\f[] and
323 \f[B]y\f[] are only evaluated once.
324 .RS
325 .PP
326 The first value popped off of the stack must be non\-zero.
327 .PP
328 This is a \f[B]non\-portable extension\f[].
329 .RE
330 .TP
331 .B \f[B]^\f[]
332 The top two values are popped off the stack, the second is raised to the
333 power of the first, and the result is pushed onto the stack.
334 .RS
335 .PP
336 The first value popped off of the stack must be an integer, and if that
337 value is negative, the second value popped off of the stack must be
338 non\-zero.
339 .RE
340 .TP
341 .B \f[B]v\f[]
342 The top value is popped off the stack, its square root is computed, and
343 the result is pushed onto the stack.
344 The \f[I]scale\f[] of the result is equal to \f[B]scale\f[].
345 .RS
346 .PP
347 The value popped off of the stack must be non\-negative.
348 .RE
349 .TP
350 .B \f[B]_\f[]
351 If this command \f[I]immediately\f[] precedes a number (i.e., no spaces
352 or other commands), then that number is input as a negative number.
353 .RS
354 .PP
355 Otherwise, the top value on the stack is popped and copied, and the copy
356 is negated and pushed onto the stack.
357 This behavior without a number is a \f[B]non\-portable extension\f[].
358 .RE
359 .TP
360 .B \f[B]b\f[]
361 The top value is popped off the stack, and if it is zero, it is pushed
362 back onto the stack.
363 Otherwise, its absolute value is pushed onto the stack.
364 .RS
365 .PP
366 This is a \f[B]non\-portable extension\f[].
367 .RE
368 .TP
369 .B \f[B]|\f[]
370 The top three values are popped off the stack, a modular exponentiation
371 is computed, and the result is pushed onto the stack.
372 .RS
373 .PP
374 The first value popped is used as the reduction modulus and must be an
375 integer and non\-zero.
376 The second value popped is used as the exponent and must be an integer
377 and non\-negative.
378 The third value popped is the base and must be an integer.
379 .PP
380 This is a \f[B]non\-portable extension\f[].
381 .RE
382 .TP
383 .B \f[B]G\f[]
384 The top two values are popped off of the stack, they are compared, and a
385 \f[B]1\f[] is pushed if they are equal, or \f[B]0\f[] otherwise.
386 .RS
387 .PP
388 This is a \f[B]non\-portable extension\f[].
389 .RE
390 .TP
391 .B \f[B]N\f[]
392 The top value is popped off of the stack, and if it a \f[B]0\f[], a
393 \f[B]1\f[] is pushed; otherwise, a \f[B]0\f[] is pushed.
394 .RS
395 .PP
396 This is a \f[B]non\-portable extension\f[].
397 .RE
398 .TP
399 .B \f[B](\f[]
400 The top two values are popped off of the stack, they are compared, and a
401 \f[B]1\f[] is pushed if the first is less than the second, or \f[B]0\f[]
402 otherwise.
403 .RS
404 .PP
405 This is a \f[B]non\-portable extension\f[].
406 .RE
407 .TP
408 .B \f[B]{\f[]
409 The top two values are popped off of the stack, they are compared, and a
410 \f[B]1\f[] is pushed if the first is less than or equal to the second,
411 or \f[B]0\f[] otherwise.
412 .RS
413 .PP
414 This is a \f[B]non\-portable extension\f[].
415 .RE
416 .TP
417 .B \f[B])\f[]
418 The top two values are popped off of the stack, they are compared, and a
419 \f[B]1\f[] is pushed if the first is greater than the second, or
420 \f[B]0\f[] otherwise.
421 .RS
422 .PP
423 This is a \f[B]non\-portable extension\f[].
424 .RE
425 .TP
426 .B \f[B]}\f[]
427 The top two values are popped off of the stack, they are compared, and a
428 \f[B]1\f[] is pushed if the first is greater than or equal to the
429 second, or \f[B]0\f[] otherwise.
430 .RS
431 .PP
432 This is a \f[B]non\-portable extension\f[].
433 .RE
434 .TP
435 .B \f[B]M\f[]
436 The top two values are popped off of the stack.
437 If they are both non\-zero, a \f[B]1\f[] is pushed onto the stack.
438 If either of them is zero, or both of them are, then a \f[B]0\f[] is
439 pushed onto the stack.
440 .RS
441 .PP
442 This is like the \f[B]&&\f[] operator in bc(1), and it is \f[I]not\f[] a
443 short\-circuit operator.
444 .PP
445 This is a \f[B]non\-portable extension\f[].
446 .RE
447 .TP
448 .B \f[B]m\f[]
449 The top two values are popped off of the stack.
450 If at least one of them is non\-zero, a \f[B]1\f[] is pushed onto the
451 stack.
452 If both of them are zero, then a \f[B]0\f[] is pushed onto the stack.
453 .RS
454 .PP
455 This is like the \f[B]||\f[] operator in bc(1), and it is \f[I]not\f[] a
456 short\-circuit operator.
457 .PP
458 This is a \f[B]non\-portable extension\f[].
459 .RE
460 .SS Stack Control
461 .PP
462 These commands control the stack.
463 .TP
464 .B \f[B]c\f[]
465 Removes all items from ("clears") the stack.
466 .RS
467 .RE
468 .TP
469 .B \f[B]d\f[]
470 Copies the item on top of the stack ("duplicates") and pushes the copy
471 onto the stack.
472 .RS
473 .RE
474 .TP
475 .B \f[B]r\f[]
476 Swaps ("reverses") the two top items on the stack.
477 .RS
478 .RE
479 .TP
480 .B \f[B]R\f[]
481 Pops ("removes") the top value from the stack.
482 .RS
483 .RE
484 .SS Register Control
485 .PP
486 These commands control registers (see the \f[B]REGISTERS\f[] section).
487 .TP
488 .B \f[B]s\f[]\f[I]r\f[]
489 Pops the value off the top of the stack and stores it into register
490 \f[I]r\f[].
491 .RS
492 .RE
493 .TP
494 .B \f[B]l\f[]\f[I]r\f[]
495 Copies the value in register \f[I]r\f[] and pushes it onto the stack.
496 This does not alter the contents of \f[I]r\f[].
497 .RS
498 .RE
499 .TP
500 .B \f[B]S\f[]\f[I]r\f[]
501 Pops the value off the top of the (main) stack and pushes it onto the
502 stack of register \f[I]r\f[].
503 The previous value of the register becomes inaccessible.
504 .RS
505 .RE
506 .TP
507 .B \f[B]L\f[]\f[I]r\f[]
508 Pops the value off the top of the stack for register \f[I]r\f[] and push
509 it onto the main stack.
510 The previous value in the stack for register \f[I]r\f[], if any, is now
511 accessible via the \f[B]l\f[]\f[I]r\f[] command.
512 .RS
513 .RE
514 .SS Parameters
515 .PP
516 These commands control the values of \f[B]ibase\f[], \f[B]obase\f[], and
517 \f[B]scale\f[].
518 Also see the \f[B]SYNTAX\f[] section.
519 .TP
520 .B \f[B]i\f[]
521 Pops the value off of the top of the stack and uses it to set
522 \f[B]ibase\f[], which must be between \f[B]2\f[] and \f[B]16\f[],
523 inclusive.
524 .RS
525 .PP
526 If the value on top of the stack has any \f[I]scale\f[], the
527 \f[I]scale\f[] is ignored.
528 .RE
529 .TP
530 .B \f[B]o\f[]
531 Pops the value off of the top of the stack and uses it to set
532 \f[B]obase\f[], which must be between \f[B]2\f[] and
533 \f[B]DC_BASE_MAX\f[], inclusive (see the \f[B]LIMITS\f[] section).
534 .RS
535 .PP
536 If the value on top of the stack has any \f[I]scale\f[], the
537 \f[I]scale\f[] is ignored.
538 .RE
539 .TP
540 .B \f[B]k\f[]
541 Pops the value off of the top of the stack and uses it to set
542 \f[B]scale\f[], which must be non\-negative.
543 .RS
544 .PP
545 If the value on top of the stack has any \f[I]scale\f[], the
546 \f[I]scale\f[] is ignored.
547 .RE
548 .TP
549 .B \f[B]I\f[]
550 Pushes the current value of \f[B]ibase\f[] onto the main stack.
551 .RS
552 .RE
553 .TP
554 .B \f[B]O\f[]
555 Pushes the current value of \f[B]obase\f[] onto the main stack.
556 .RS
557 .RE
558 .TP
559 .B \f[B]K\f[]
560 Pushes the current value of \f[B]scale\f[] onto the main stack.
561 .RS
562 .RE
563 .TP
564 .B \f[B]T\f[]
565 Pushes the maximum allowable value of \f[B]ibase\f[] onto the main
566 stack.
567 .RS
568 .PP
569 This is a \f[B]non\-portable extension\f[].
570 .RE
571 .TP
572 .B \f[B]U\f[]
573 Pushes the maximum allowable value of \f[B]obase\f[] onto the main
574 stack.
575 .RS
576 .PP
577 This is a \f[B]non\-portable extension\f[].
578 .RE
579 .TP
580 .B \f[B]V\f[]
581 Pushes the maximum allowable value of \f[B]scale\f[] onto the main
582 stack.
583 .RS
584 .PP
585 This is a \f[B]non\-portable extension\f[].
586 .RE
587 .SS Strings
588 .PP
589 The following commands control strings.
590 .PP
591 dc(1) can work with both numbers and strings, and registers (see the
592 \f[B]REGISTERS\f[] section) can hold both strings and numbers.
593 dc(1) always knows whether the contents of a register are a string or a
594 number.
595 .PP
596 While arithmetic operations have to have numbers, and will print an
597 error if given a string, other commands accept strings.
598 .PP
599 Strings can also be executed as macros.
600 For example, if the string \f[B][1pR]\f[] is executed as a macro, then
601 the code \f[B]1pR\f[] is executed, meaning that the \f[B]1\f[] will be
602 printed with a newline after and then popped from the stack.
603 .TP
604 .B \f[B][\f[]\f[I]characters\f[]\f[B]]\f[]
605 Makes a string containing \f[I]characters\f[] and pushes it onto the
606 stack.
607 .RS
608 .PP
609 If there are brackets (\f[B][\f[] and \f[B]]\f[]) in the string, then
610 they must be balanced.
611 Unbalanced brackets can be escaped using a backslash (\f[B]\\\f[])
612 character.
613 .PP
614 If there is a backslash character in the string, the character after it
615 (even another backslash) is put into the string verbatim, but the
616 (first) backslash is not.
617 .RE
618 .TP
619 .B \f[B]a\f[]
620 The value on top of the stack is popped.
621 .RS
622 .PP
623 If it is a number, it is truncated and its absolute value is taken.
624 The result mod \f[B]UCHAR_MAX+1\f[] is calculated.
625 If that result is \f[B]0\f[], push an empty string; otherwise, push a
626 one\-character string where the character is the result of the mod
627 interpreted as an ASCII character.
628 .PP
629 If it is a string, then a new string is made.
630 If the original string is empty, the new string is empty.
631 If it is not, then the first character of the original string is used to
632 create the new string as a one\-character string.
633 The new string is then pushed onto the stack.
634 .PP
635 This is a \f[B]non\-portable extension\f[].
636 .RE
637 .TP
638 .B \f[B]x\f[]
639 Pops a value off of the top of the stack.
640 .RS
641 .PP
642 If it is a number, it is pushed back onto the stack.
643 .PP
644 If it is a string, it is executed as a macro.
645 .PP
646 This behavior is the norm whenever a macro is executed, whether by this
647 command or by the conditional execution commands below.
648 .RE
649 .TP
650 .B \f[B]>\f[]\f[I]r\f[]
651 Pops two values off of the stack that must be numbers and compares them.
652 If the first value is greater than the second, then the contents of
653 register \f[I]r\f[] are executed.
654 .RS
655 .PP
656 For example, \f[B]0 1>a\f[] will execute the contents of register
657 \f[B]a\f[], and \f[B]1 0>a\f[] will not.
658 .PP
659 If either or both of the values are not numbers, dc(1) will raise an
660 error and reset (see the \f[B]RESET\f[] section).
661 .RE
662 .TP
663 .B \f[B]>\f[]\f[I]r\f[]\f[B]e\f[]\f[I]s\f[]
664 Like the above, but will execute register \f[I]s\f[] if the comparison
665 fails.
666 .RS
667 .PP
668 If either or both of the values are not numbers, dc(1) will raise an
669 error and reset (see the \f[B]RESET\f[] section).
670 .PP
671 This is a \f[B]non\-portable extension\f[].
672 .RE
673 .TP
674 .B \f[B]!>\f[]\f[I]r\f[]
675 Pops two values off of the stack that must be numbers and compares them.
676 If the first value is not greater than the second (less than or equal
677 to), then the contents of register \f[I]r\f[] are executed.
678 .RS
679 .PP
680 If either or both of the values are not numbers, dc(1) will raise an
681 error and reset (see the \f[B]RESET\f[] section).
682 .RE
683 .TP
684 .B \f[B]!>\f[]\f[I]r\f[]\f[B]e\f[]\f[I]s\f[]
685 Like the above, but will execute register \f[I]s\f[] if the comparison
686 fails.
687 .RS
688 .PP
689 If either or both of the values are not numbers, dc(1) will raise an
690 error and reset (see the \f[B]RESET\f[] section).
691 .PP
692 This is a \f[B]non\-portable extension\f[].
693 .RE
694 .TP
695 .B \f[B]<\f[]\f[I]r\f[]
696 Pops two values off of the stack that must be numbers and compares them.
697 If the first value is less than the second, then the contents of
698 register \f[I]r\f[] are executed.
699 .RS
700 .PP
701 If either or both of the values are not numbers, dc(1) will raise an
702 error and reset (see the \f[B]RESET\f[] section).
703 .RE
704 .TP
705 .B \f[B]<\f[]\f[I]r\f[]\f[B]e\f[]\f[I]s\f[]
706 Like the above, but will execute register \f[I]s\f[] if the comparison
707 fails.
708 .RS
709 .PP
710 If either or both of the values are not numbers, dc(1) will raise an
711 error and reset (see the \f[B]RESET\f[] section).
712 .PP
713 This is a \f[B]non\-portable extension\f[].
714 .RE
715 .TP
716 .B \f[B]!<\f[]\f[I]r\f[]
717 Pops two values off of the stack that must be numbers and compares them.
718 If the first value is not less than the second (greater than or equal
719 to), then the contents of register \f[I]r\f[] are executed.
720 .RS
721 .PP
722 If either or both of the values are not numbers, dc(1) will raise an
723 error and reset (see the \f[B]RESET\f[] section).
724 .RE
725 .TP
726 .B \f[B]!<\f[]\f[I]r\f[]\f[B]e\f[]\f[I]s\f[]
727 Like the above, but will execute register \f[I]s\f[] if the comparison
728 fails.
729 .RS
730 .PP
731 If either or both of the values are not numbers, dc(1) will raise an
732 error and reset (see the \f[B]RESET\f[] section).
733 .PP
734 This is a \f[B]non\-portable extension\f[].
735 .RE
736 .TP
737 .B \f[B]=\f[]\f[I]r\f[]
738 Pops two values off of the stack that must be numbers and compares them.
739 If the first value is equal to the second, then the contents of register
740 \f[I]r\f[] are executed.
741 .RS
742 .PP
743 If either or both of the values are not numbers, dc(1) will raise an
744 error and reset (see the \f[B]RESET\f[] section).
745 .RE
746 .TP
747 .B \f[B]=\f[]\f[I]r\f[]\f[B]e\f[]\f[I]s\f[]
748 Like the above, but will execute register \f[I]s\f[] if the comparison
749 fails.
750 .RS
751 .PP
752 If either or both of the values are not numbers, dc(1) will raise an
753 error and reset (see the \f[B]RESET\f[] section).
754 .PP
755 This is a \f[B]non\-portable extension\f[].
756 .RE
757 .TP
758 .B \f[B]!=\f[]\f[I]r\f[]
759 Pops two values off of the stack that must be numbers and compares them.
760 If the first value is not equal to the second, then the contents of
761 register \f[I]r\f[] are executed.
762 .RS
763 .PP
764 If either or both of the values are not numbers, dc(1) will raise an
765 error and reset (see the \f[B]RESET\f[] section).
766 .RE
767 .TP
768 .B \f[B]!=\f[]\f[I]r\f[]\f[B]e\f[]\f[I]s\f[]
769 Like the above, but will execute register \f[I]s\f[] if the comparison
770 fails.
771 .RS
772 .PP
773 If either or both of the values are not numbers, dc(1) will raise an
774 error and reset (see the \f[B]RESET\f[] section).
775 .PP
776 This is a \f[B]non\-portable extension\f[].
777 .RE
778 .TP
779 .B \f[B]?\f[]
780 Reads a line from the \f[B]stdin\f[] and executes it.
781 This is to allow macros to request input from users.
782 .RS
783 .RE
784 .TP
785 .B \f[B]q\f[]
786 During execution of a macro, this exits the execution of that macro and
787 the execution of the macro that executed it.
788 If there are no macros, or only one macro executing, dc(1) exits.
789 .RS
790 .RE
791 .TP
792 .B \f[B]Q\f[]
793 Pops a value from the stack which must be non\-negative and is used the
794 number of macro executions to pop off of the execution stack.
795 If the number of levels to pop is greater than the number of executing
796 macros, dc(1) exits.
797 .RS
798 .RE
799 .SS Status
800 .PP
801 These commands query status of the stack or its top value.
802 .TP
803 .B \f[B]Z\f[]
804 Pops a value off of the stack.
805 .RS
806 .PP
807 If it is a number, calculates the number of significant decimal digits
808 it has and pushes the result.
809 .PP
810 If it is a string, pushes the number of characters the string has.
811 .RE
812 .TP
813 .B \f[B]X\f[]
814 Pops a value off of the stack.
815 .RS
816 .PP
817 If it is a number, pushes the \f[I]scale\f[] of the value onto the
818 stack.
819 .PP
820 If it is a string, pushes \f[B]0\f[].
821 .RE
822 .TP
823 .B \f[B]z\f[]
824 Pushes the current stack depth (before execution of this command).
825 .RS
826 .RE
827 .SS Arrays
828 .PP
829 These commands manipulate arrays.
830 .TP
831 .B \f[B]:\f[]\f[I]r\f[]
832 Pops the top two values off of the stack.
833 The second value will be stored in the array \f[I]r\f[] (see the
834 \f[B]REGISTERS\f[] section), indexed by the first value.
835 .RS
836 .RE
837 .TP
838 .B \f[B];\f[]\f[I]r\f[]
839 Pops the value on top of the stack and uses it as an index into the
840 array \f[I]r\f[].
841 The selected value is then pushed onto the stack.
842 .RS
843 .RE
844 .SH REGISTERS
845 .PP
846 Registers are names that can store strings, numbers, and arrays.
847 (Number/string registers do not interfere with array registers.)
848 .PP
849 Each register is also its own stack, so the current register value is
850 the top of the stack for the register.
851 All registers, when first referenced, have one value (\f[B]0\f[]) in
852 their stack.
853 .PP
854 In non\-extended register mode, a register name is just the single
855 character that follows any command that needs a register name.
856 The only exception is a newline (\f[B]\[aq]\\n\[aq]\f[]); it is a parse
857 error for a newline to be used as a register name.
858 .SS Extended Register Mode
859 .PP
860 Unlike most other dc(1) implentations, this dc(1) provides nearly
861 unlimited amounts of registers, if extended register mode is enabled.
862 .PP
863 If extended register mode is enabled (\f[B]\-x\f[] or
864 \f[B]\-\-extended\-register\f[] command\-line arguments are given), then
865 normal single character registers are used \f[I]unless\f[] the character
866 immediately following a command that needs a register name is a space
867 (according to \f[B]isspace()\f[]) and not a newline
868 (\f[B]\[aq]\\n\[aq]\f[]).
869 .PP
870 In that case, the register name is found according to the regex
871 \f[B][a\-z][a\-z0\-9_]*\f[] (like bc(1) identifiers), and it is a parse
872 error if the next non\-space characters do not match that regex.
873 .SH RESET
874 .PP
875 When dc(1) encounters an error or a signal that it has a non\-default
876 handler for, it resets.
877 This means that several things happen.
878 .PP
879 First, any macros that are executing are stopped and popped off the
880 stack.
881 The behavior is not unlike that of exceptions in programming languages.
882 Then the execution point is set so that any code waiting to execute
883 (after all macros returned) is skipped.
884 .PP
885 Thus, when dc(1) resets, it skips any remaining code waiting to be
886 executed.
887 Then, if it is interactive mode, and the error was not a fatal error
888 (see the \f[B]EXIT STATUS\f[] section), it asks for more input;
889 otherwise, it exits with the appropriate return code.
890 .SH PERFORMANCE
891 .PP
892 Most dc(1) implementations use \f[B]char\f[] types to calculate the
893 value of \f[B]1\f[] decimal digit at a time, but that can be slow.
894 This dc(1) does something different.
895 .PP
896 It uses large integers to calculate more than \f[B]1\f[] decimal digit
897 at a time.
898 If built in a environment where \f[B]DC_LONG_BIT\f[] (see the
899 \f[B]LIMITS\f[] section) is \f[B]64\f[], then each integer has
900 \f[B]9\f[] decimal digits.
901 If built in an environment where \f[B]DC_LONG_BIT\f[] is \f[B]32\f[]
902 then each integer has \f[B]4\f[] decimal digits.
903 This value (the number of decimal digits per large integer) is called
904 \f[B]DC_BASE_DIGS\f[].
905 .PP
906 In addition, this dc(1) uses an even larger integer for overflow
907 checking.
908 This integer type depends on the value of \f[B]DC_LONG_BIT\f[], but is
909 always at least twice as large as the integer type used to store digits.
910 .SH LIMITS
911 .PP
912 The following are the limits on dc(1):
913 .TP
914 .B \f[B]DC_LONG_BIT\f[]
915 The number of bits in the \f[B]long\f[] type in the environment where
916 dc(1) was built.
917 This determines how many decimal digits can be stored in a single large
918 integer (see the \f[B]PERFORMANCE\f[] section).
919 .RS
920 .RE
921 .TP
922 .B \f[B]DC_BASE_DIGS\f[]
923 The number of decimal digits per large integer (see the
924 \f[B]PERFORMANCE\f[] section).
925 Depends on \f[B]DC_LONG_BIT\f[].
926 .RS
927 .RE
928 .TP
929 .B \f[B]DC_BASE_POW\f[]
930 The max decimal number that each large integer can store (see
931 \f[B]DC_BASE_DIGS\f[]) plus \f[B]1\f[].
932 Depends on \f[B]DC_BASE_DIGS\f[].
933 .RS
934 .RE
935 .TP
936 .B \f[B]DC_OVERFLOW_MAX\f[]
937 The max number that the overflow type (see the \f[B]PERFORMANCE\f[]
938 section) can hold.
939 Depends on \f[B]DC_LONG_BIT\f[].
940 .RS
941 .RE
942 .TP
943 .B \f[B]DC_BASE_MAX\f[]
944 The maximum output base.
945 Set at \f[B]DC_BASE_POW\f[].
946 .RS
947 .RE
948 .TP
949 .B \f[B]DC_DIM_MAX\f[]
950 The maximum size of arrays.
951 Set at \f[B]SIZE_MAX\-1\f[].
952 .RS
953 .RE
954 .TP
955 .B \f[B]DC_SCALE_MAX\f[]
956 The maximum \f[B]scale\f[].
957 Set at \f[B]DC_OVERFLOW_MAX\-1\f[].
958 .RS
959 .RE
960 .TP
961 .B \f[B]DC_STRING_MAX\f[]
962 The maximum length of strings.
963 Set at \f[B]DC_OVERFLOW_MAX\-1\f[].
964 .RS
965 .RE
966 .TP
967 .B \f[B]DC_NAME_MAX\f[]
968 The maximum length of identifiers.
969 Set at \f[B]DC_OVERFLOW_MAX\-1\f[].
970 .RS
971 .RE
972 .TP
973 .B \f[B]DC_NUM_MAX\f[]
974 The maximum length of a number (in decimal digits), which includes
975 digits after the decimal point.
976 Set at \f[B]DC_OVERFLOW_MAX\-1\f[].
977 .RS
978 .RE
979 .TP
980 .B Exponent
981 The maximum allowable exponent (positive or negative).
982 Set at \f[B]DC_OVERFLOW_MAX\f[].
983 .RS
984 .RE
985 .TP
986 .B Number of vars
987 The maximum number of vars/arrays.
988 Set at \f[B]SIZE_MAX\-1\f[].
989 .RS
990 .RE
991 .PP
992 These limits are meant to be effectively non\-existent; the limits are
993 so large (at least on 64\-bit machines) that there should not be any
994 point at which they become a problem.
995 In fact, memory should be exhausted before these limits should be hit.
996 .SH ENVIRONMENT VARIABLES
997 .PP
998 dc(1) recognizes the following environment variables:
999 .TP
1000 .B \f[B]DC_ENV_ARGS\f[]
1001 This is another way to give command\-line arguments to dc(1).
1002 They should be in the same format as all other command\-line arguments.
1003 These are always processed first, so any files given in
1004 \f[B]DC_ENV_ARGS\f[] will be processed before arguments and files given
1005 on the command\-line.
1006 This gives the user the ability to set up "standard" options and files
1007 to be used at every invocation.
1008 The most useful thing for such files to contain would be useful
1009 functions that the user might want every time dc(1) runs.
1010 Another use would be to use the \f[B]\-e\f[] option to set
1011 \f[B]scale\f[] to a value other than \f[B]0\f[].
1012 .RS
1013 .PP
1014 The code that parses \f[B]DC_ENV_ARGS\f[] will correctly handle quoted
1015 arguments, but it does not understand escape sequences.
1016 For example, the string \f[B]"/home/gavin/some dc file.dc"\f[] will be
1017 correctly parsed, but the string \f[B]"/home/gavin/some "dc"
1018 file.dc"\f[] will include the backslashes.
1019 .PP
1020 The quote parsing will handle either kind of quotes, \f[B]\[aq]\f[] or
1021 \f[B]"\f[].
1022 Thus, if you have a file with any number of single quotes in the name,
1023 you can use double quotes as the outside quotes, as in \f[B]"some
1024 \[aq]bc\[aq] file.bc"\f[], and vice versa if you have a file with double
1025 quotes.
1026 However, handling a file with both kinds of quotes in
1027 \f[B]DC_ENV_ARGS\f[] is not supported due to the complexity of the
1028 parsing, though such files are still supported on the command\-line
1029 where the parsing is done by the shell.
1030 .RE
1031 .TP
1032 .B \f[B]DC_LINE_LENGTH\f[]
1033 If this environment variable exists and contains an integer that is
1034 greater than \f[B]1\f[] and is less than \f[B]UINT16_MAX\f[]
1035 (\f[B]2^16\-1\f[]), dc(1) will output lines to that length, including
1036 the backslash newline combo.
1037 The default line length is \f[B]70\f[].
1038 .RS
1039 .RE
1040 .TP
1041 .B \f[B]DC_EXPR_EXIT\f[]
1042 If this variable exists (no matter the contents), dc(1) will exit
1043 immediately after executing expressions and files given by the
1044 \f[B]\-e\f[] and/or \f[B]\-f\f[] command\-line options (and any
1045 equivalents).
1046 .RS
1047 .RE
1048 .SH EXIT STATUS
1049 .PP
1050 dc(1) returns the following exit statuses:
1051 .TP
1052 .B \f[B]0\f[]
1053 No error.
1054 .RS
1055 .RE
1056 .TP
1057 .B \f[B]1\f[]
1058 A math error occurred.
1059 This follows standard practice of using \f[B]1\f[] for expected errors,
1060 since math errors will happen in the process of normal execution.
1061 .RS
1062 .PP
1063 Math errors include divide by \f[B]0\f[], taking the square root of a
1064 negative number, attempting to convert a negative number to a hardware
1065 integer, overflow when converting a number to a hardware integer, and
1066 attempting to use a non\-integer where an integer is required.
1067 .PP
1068 Converting to a hardware integer happens for the second operand of the
1069 power (\f[B]^\f[]) operator.
1070 .RE
1071 .TP
1072 .B \f[B]2\f[]
1073 A parse error occurred.
1074 .RS
1075 .PP
1076 Parse errors include unexpected \f[B]EOF\f[], using an invalid
1077 character, failing to find the end of a string or comment, and using a
1078 token where it is invalid.
1079 .RE
1080 .TP
1081 .B \f[B]3\f[]
1082 A runtime error occurred.
1083 .RS
1084 .PP
1085 Runtime errors include assigning an invalid number to \f[B]ibase\f[],
1086 \f[B]obase\f[], or \f[B]scale\f[]; give a bad expression to a
1087 \f[B]read()\f[] call, calling \f[B]read()\f[] inside of a
1088 \f[B]read()\f[] call, type errors, and attempting an operation when the
1089 stack has too few elements.
1090 .RE
1091 .TP
1092 .B \f[B]4\f[]
1093 A fatal error occurred.
1094 .RS
1095 .PP
1096 Fatal errors include memory allocation errors, I/O errors, failing to
1097 open files, attempting to use files that do not have only ASCII
1098 characters (dc(1) only accepts ASCII characters), attempting to open a
1099 directory as a file, and giving invalid command\-line options.
1100 .RE
1101 .PP
1102 The exit status \f[B]4\f[] is special; when a fatal error occurs, dc(1)
1103 always exits and returns \f[B]4\f[], no matter what mode dc(1) is in.
1104 .PP
1105 The other statuses will only be returned when dc(1) is not in
1106 interactive mode (see the \f[B]INTERACTIVE MODE\f[] section), since
1107 dc(1) resets its state (see the \f[B]RESET\f[] section) and accepts more
1108 input when one of those errors occurs in interactive mode.
1109 This is also the case when interactive mode is forced by the
1110 \f[B]\-i\f[] flag or \f[B]\-\-interactive\f[] option.
1111 .PP
1112 These exit statuses allow dc(1) to be used in shell scripting with error
1113 checking, and its normal behavior can be forced by using the
1114 \f[B]\-i\f[] flag or \f[B]\-\-interactive\f[] option.
1115 .SH INTERACTIVE MODE
1116 .PP
1117 Like bc(1), dc(1) has an interactive mode and a non\-interactive mode.
1118 Interactive mode is turned on automatically when both \f[B]stdin\f[] and
1119 \f[B]stdout\f[] are hooked to a terminal, but the \f[B]\-i\f[] flag and
1120 \f[B]\-\-interactive\f[] option can turn it on in other cases.
1121 .PP
1122 In interactive mode, dc(1) attempts to recover from errors (see the
1123 \f[B]RESET\f[] section), and in normal execution, flushes
1124 \f[B]stdout\f[] as soon as execution is done for the current input.
1125 .SH TTY MODE
1126 .PP
1127 If \f[B]stdin\f[], \f[B]stdout\f[], and \f[B]stderr\f[] are all
1128 connected to a TTY, dc(1) turns on "TTY mode."
1129 .PP
1130 TTY mode is required for history to be enabled (see the \f[B]COMMAND
1131 LINE HISTORY\f[] section).
1132 It is also required to enable special handling for \f[B]SIGINT\f[]
1133 signals.
1134 .PP
1135 TTY mode is different from interactive mode because interactive mode is
1136 required in the bc(1)
1137 specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
1138 and interactive mode requires only \f[B]stdin\f[] and \f[B]stdout\f[] to
1139 be connected to a terminal.
1140 .SH SIGNAL HANDLING
1141 .PP
1142 Sending a \f[B]SIGINT\f[] will cause dc(1) to stop execution of the
1143 current input.
1144 If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[] section), it will
1145 reset (see the \f[B]RESET\f[] section).
1146 Otherwise, it will clean up and exit.
1147 .PP
1148 Note that "current input" can mean one of two things.
1149 If dc(1) is processing input from \f[B]stdin\f[] in TTY mode, it will
1150 ask for more input.
1151 If dc(1) is processing input from a file in TTY mode, it will stop
1152 processing the file and start processing the next file, if one exists,
1153 or ask for input from \f[B]stdin\f[] if no other file exists.
1154 .PP
1155 This means that if a \f[B]SIGINT\f[] is sent to dc(1) as it is executing
1156 a file, it can seem as though dc(1) did not respond to the signal since
1157 it will immediately start executing the next file.
1158 This is by design; most files that users execute when interacting with
1159 dc(1) have function definitions, which are quick to parse.
1160 If a file takes a long time to execute, there may be a bug in that file.
1161 The rest of the files could still be executed without problem, allowing
1162 the user to continue.
1163 .PP
1164 \f[B]SIGTERM\f[] and \f[B]SIGQUIT\f[] cause dc(1) to clean up and exit,
1165 and it uses the default handler for all other signals.
1166 The one exception is \f[B]SIGHUP\f[]; in that case, when dc(1) is in TTY
1167 mode, a \f[B]SIGHUP\f[] will cause dc(1) to clean up and exit.
1168 .SH COMMAND LINE HISTORY
1169 .PP
1170 dc(1) supports interactive command\-line editing.
1171 If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[] section), history is
1172 enabled.
1173 Previous lines can be recalled and edited with the arrow keys.
1174 .PP
1175 \f[B]Note\f[]: tabs are converted to 8 spaces.
1176 .SH LOCALES
1177 .PP
1178 This dc(1) ships with support for adding error messages for different
1179 locales and thus, supports \f[B]LC_MESSAGS\f[].
1180 .SH SEE ALSO
1181 .PP
1182 bc(1)
1183 .SH STANDARDS
1184 .PP
1185 The dc(1) utility operators are compliant with the operators in the
1186 bc(1) IEEE Std 1003.1\-2017
1187 (“POSIX.1\-2017”) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
1188 specification.
1189 .SH BUGS
1190 .PP
1191 None are known.
1192 Report bugs at https://git.yzena.com/gavin/bc.
1193 .SH AUTHOR
1194 .PP
1195 Gavin D.
1196 Howard <yzena.tech@gmail.com> and contributors.