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