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