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