Lines Matching +full:- +full:r
2 .\" SPDX-License-Identifier: BSD-2-Clause
4 .\" Copyright (c) 2018-2024 Gavin D. Howard and contributors.
32 dc \- arbitrary\-precision decimal reverse\-Polish notation calculator
34 \f[B]dc\f[R] [\f[B]\-cChiPRvVx\f[R]] [\f[B]\-\-version\f[R]]
35 [\f[B]\-\-help\f[R]] [\f[B]\-\-digit\-clamp\f[R]]
36 [\f[B]\-\-no\-digit\-clamp\f[R]] [\f[B]\-\-interactive\f[R]]
37 [\f[B]\-\-no\-prompt\f[R]] [\f[B]\-\-no\-read\-prompt\f[R]]
38 [\f[B]\-\-extended\-register\f[R]] [\f[B]\-e\f[R] \f[I]expr\f[R]]
39 [\f[B]\-\-expression\f[R]=\f[I]expr\f[R]\&...]
40 [\f[B]\-f\f[R] \f[I]file\f[R]\&...]
41 [\f[B]\-\-file\f[R]=\f[I]file\f[R]\&...]
42 [\f[I]file\f[R]\&...]
43 [\f[B]\-I\f[R] \f[I]ibase\f[R]] [\f[B]\-\-ibase\f[R]=\f[I]ibase\f[R]]
44 [\f[B]\-O\f[R] \f[I]obase\f[R]] [\f[B]\-\-obase\f[R]=\f[I]obase\f[R]]
45 [\f[B]\-S\f[R] \f[I]scale\f[R]] [\f[B]\-\-scale\f[R]=\f[I]scale\f[R]]
46 [\f[B]\-E\f[R] \f[I]seed\f[R]] [\f[B]\-\-seed\f[R]=\f[I]seed\f[R]]
48 dc(1) is an arbitrary\-precision calculator.
54 If no files are given on the command\-line, then dc(1) reads from
55 \f[B]stdin\f[R] (see the \f[B]STDIN\f[R] section).
59 \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
60 For example, if a user wants the \f[B]scale\f[R] always set to
61 \f[B]10\f[R], they can set \f[B]DC_ENV_ARGS\f[R] to \f[B]\-e 10k\f[R],
62 and this dc(1) will always start with a \f[B]scale\f[R] of \f[B]10\f[R].
66 \f[B]\-C\f[R], \f[B]\-\-no\-digit\-clamp\f[R]
68 \f[B]ibase\f[R] when parsing numbers.
76 If this and/or the \f[B]\-c\f[R] or \f[B]\-\-digit\-clamp\f[R] options
79 This option overrides the \f[B]DC_DIGIT_CLAMP\f[R] environment variable
80 (see the \f[B]ENVIRONMENT VARIABLES\f[R] section) and the default, which
81 can be queried with the \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
83 This is a \f[B]non\-portable extension\f[R].
86 \f[B]\-c\f[R], \f[B]\-\-digit\-clamp\f[R]
88 \f[B]ibase\f[R] when parsing numbers.
97 If this and/or the \f[B]\-C\f[R] or \f[B]\-\-no\-digit\-clamp\f[R]
100 This option overrides the \f[B]DC_DIGIT_CLAMP\f[R] environment variable
101 (see the \f[B]ENVIRONMENT VARIABLES\f[R] section) and the default, which
102 can be queried with the \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
104 This is a \f[B]non\-portable extension\f[R].
107 \f[B]\-E\f[R] \f[I]seed\f[R], \f[B]\-\-seed\f[R]=\f[I]seed\f[R]
108 Sets the builtin variable \f[B]seed\f[R] to the value \f[I]seed\f[R]
109 assuming that \f[I]seed\f[R] is in base 10.
110 It is a fatal error if \f[I]seed\f[R] is not a valid number.
115 This is a \f[B]non\-portable extension\f[R].
118 \f[B]\-e\f[R] \f[I]expr\f[R], \f[B]\-\-expression\f[R]=\f[I]expr\f[R]
119 Evaluates \f[I]expr\f[R].
127 If this option is given on the command\-line (i.e., not in
128 \f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
130 \f[B]\-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
131 \f[B]\-f\f[R] or \f[B]\-\-file\f[R], whether on the command\-line or in
132 \f[B]DC_ENV_ARGS\f[R].
133 However, if any other \f[B]\-e\f[R], \f[B]\-\-expression\f[R],
134 \f[B]\-f\f[R], or \f[B]\-\-file\f[R] arguments are given after
135 \f[B]\-f\-\f[R] or equivalent is given, dc(1) will give a fatal error
138 This is a \f[B]non\-portable extension\f[R].
141 \f[B]\-f\f[R] \f[I]file\f[R], \f[B]\-\-file\f[R]=\f[I]file\f[R]
142 Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
143 were read through \f[B]stdin\f[R].
148 If this option is given on the command\-line (i.e., not in
149 \f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
151 \f[B]\-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
152 \f[B]\-f\f[R] or \f[B]\-\-file\f[R].
153 However, if any other \f[B]\-e\f[R], \f[B]\-\-expression\f[R],
154 \f[B]\-f\f[R], or \f[B]\-\-file\f[R] arguments are given after
155 \f[B]\-f\-\f[R] or equivalent is given, dc(1) will give a fatal error
158 This is a \f[B]non\-portable extension\f[R].
161 \f[B]\-h\f[R], \f[B]\-\-help\f[R]
164 \f[B]\-I\f[R] \f[I]ibase\f[R], \f[B]\-\-ibase\f[R]=\f[I]ibase\f[R]
165 Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
166 assuming that \f[I]ibase\f[R] is in base 10.
167 It is a fatal error if \f[I]ibase\f[R] is not a valid number.
172 This is a \f[B]non\-portable extension\f[R].
175 \f[B]\-i\f[R], \f[B]\-\-interactive\f[R]
177 (See the \f[B]INTERACTIVE MODE\f[R] section.)
180 This is a \f[B]non\-portable extension\f[R].
183 \f[B]\-L\f[R], \f[B]\-\-no\-line\-length\f[R]
186 In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
187 (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
190 This is a \f[B]non\-portable extension\f[R].
193 \f[B]\-O\f[R] \f[I]obase\f[R], \f[B]\-\-obase\f[R]=\f[I]obase\f[R]
194 Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
195 assuming that \f[I]obase\f[R] is in base 10.
196 It is a fatal error if \f[I]obase\f[R] is not a valid number.
201 This is a \f[B]non\-portable extension\f[R].
204 \f[B]\-P\f[R], \f[B]\-\-no\-prompt\f[R]
207 See the \f[B]TTY MODE\f[R] section.)
211 \f[B]DC_ENV_ARGS\f[R].
214 These options override the \f[B]DC_PROMPT\f[R] and \f[B]DC_TTY_MODE\f[R]
215 environment variables (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
217 This is a \f[B]non\-portable extension\f[R].
220 \f[B]\-R\f[R], \f[B]\-\-no\-read\-prompt\f[R]
223 See the \f[B]TTY MODE\f[R] section.)
227 \f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
233 is only used when the \f[B]?\f[R] command is used.
235 These options \f[I]do\f[R] override the \f[B]DC_PROMPT\f[R] and
236 \f[B]DC_TTY_MODE\f[R] environment variables (see the \f[B]ENVIRONMENT
237 VARIABLES\f[R] section), but only for the read prompt.
239 This is a \f[B]non\-portable extension\f[R].
242 \f[B]\-S\f[R] \f[I]scale\f[R], \f[B]\-\-scale\f[R]=\f[I]scale\f[R]
243 Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
244 assuming that \f[I]scale\f[R] is in base 10.
245 It is a fatal error if \f[I]scale\f[R] is not a valid number.
250 This is a \f[B]non\-portable extension\f[R].
253 \f[B]\-v\f[R], \f[B]\-V\f[R], \f[B]\-\-version\f[R]
256 \f[B]\-x\f[R] \f[B]\-\-extended\-register\f[R]
258 See the \f[I]Extended Register Mode\f[R] subsection of the
259 \f[B]REGISTERS\f[R] section for more information.
262 This is a \f[B]non\-portable extension\f[R].
265 \f[B]\-z\f[R], \f[B]\-\-leading\-zeroes\f[R]
266 Makes dc(1) print all numbers greater than \f[B]\-1\f[R] and less than
267 \f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
270 This is a \f[B]non\-portable extension\f[R].
273 All long options are \f[B]non\-portable extensions\f[R].
275 If no files are given on the command\-line and no files or expressions
276 are given by the \f[B]\-f\f[R], \f[B]\-\-file\f[R], \f[B]\-e\f[R], or
277 \f[B]\-\-expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
281 First, \f[B]stdin\f[R] is evaluated a line at a time.
287 Any non\-error output is written to \f[B]stdout\f[R].
288 In addition, if history (see the \f[B]HISTORY\f[R] section) and the
289 prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
290 to \f[B]stdout\f[R].
292 \f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
293 issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
294 write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
295 \f[B]dc >&\-\f[R], it will quit with an error.
296 This is done so that dc(1) can report problems when \f[B]stdout\f[R] is
301 redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
303 Any error output is written to \f[B]stderr\f[R].
305 \f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
306 issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
307 write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
308 \f[B]dc 2>&\-\f[R], it will quit with an error.
310 \f[B]stderr\f[R] is redirected to a file.
314 redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
317 \f[B]NUMBERS\f[R] section) or a command (see the \f[B]COMMANDS\f[R]
321 \f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
325 \f[B]ibase\f[R] is initially \f[B]10\f[R].
326 The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
327 The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
328 The max allowable value for \f[B]ibase\f[R] can be queried in dc(1)
329 programs with the \f[B]T\f[R] command.
331 \f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
335 \f[B]obase\f[R] is initially \f[B]10\f[R].
336 The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
337 can be queried with the \f[B]U\f[R] command.
338 The min allowable value for \f[B]obase\f[R] is \f[B]0\f[R].
339 If \f[B]obase\f[R] is \f[B]0\f[R], values are output in scientific
340 notation, and if \f[B]obase\f[R] is \f[B]1\f[R], values are output in
345 \f[B]non\-portable extensions\f[R].
347 The \f[I]scale\f[R] of an expression is the number of digits in the
348 result of the expression right of the decimal point, and \f[B]scale\f[R]
349 is a register (see the \f[B]REGISTERS\f[R] section) that sets the
351 \f[B]scale\f[R] is initially \f[B]0\f[R].
352 \f[B]scale\f[R] cannot be negative.
353 The max allowable value for \f[B]scale\f[R] can be queried in dc(1)
354 programs with the \f[B]V\f[R] command.
356 \f[B]seed\f[R] is a register containing the current seed for the
357 pseudo\-random number generator.
358 If the current value of \f[B]seed\f[R] is queried and stored, then if it
359 is assigned to \f[B]seed\f[R] later, the pseudo\-random number generator
360 is guaranteed to produce the same sequence of pseudo\-random numbers
361 that were generated after the value of \f[B]seed\f[R] was first queried.
363 Multiple values assigned to \f[B]seed\f[R] can produce the same sequence
364 of pseudo\-random numbers.
365 Likewise, when a value is assigned to \f[B]seed\f[R], it is not
366 guaranteed that querying \f[B]seed\f[R] immediately after will return
368 In addition, the value of \f[B]seed\f[R] will change after any call to
369 the \f[B]\[cq]\f[R] command or the \f[B]\[lq]\f[R] command that does not
370 get receive a value of \f[B]0\f[R] or \f[B]1\f[R].
371 The maximum integer returned by the \f[B]\[cq]\f[R] command can be
372 queried with the \f[B]W\f[R] command.
374 \f[B]Note\f[R]: The values returned by the pseudo\-random number
375 generator with the \f[B]\[cq]\f[R] and \f[B]\[lq]\f[R] commands are
376 guaranteed to \f[B]NOT\f[R] be cryptographically secure.
377 This is a consequence of using a seeded pseudo\-random number generator.
378 However, they \f[I]are\f[R] guaranteed to be reproducible with identical
379 \f[B]seed\f[R] values.
380 This means that the pseudo\-random values from dc(1) should only be used
381 where a reproducible stream of pseudo\-random numbers is
382 \f[I]ESSENTIAL\f[R].
383 In any other case, use a non\-seeded pseudo\-random number generator.
385 The pseudo\-random number generator, \f[B]seed\f[R], and all associated
386 operations are \f[B]non\-portable extensions\f[R].
388 Comments go from \f[B]#\f[R] until, and not including, the next newline.
389 This is a \f[B]non\-portable extension\f[R].
392 \f[B]F\f[R], and at most \f[B]1\f[R] period for a radix.
393 Numbers can have up to \f[B]DC_NUM_MAX\f[R] digits.
394 Uppercase letters are equal to \f[B]9\f[R] plus their position in the
395 alphabet (i.e., \f[B]A\f[R] equals \f[B]10\f[R], or \f[B]9+1\f[R]).
398 \f[B]ibase\f[R] (i.e., they are greater than or equal to the current
399 value of \f[B]ibase\f[R]), then the behavior depends on the existence of
400 the \f[B]\-c\f[R]/\f[B]\-\-digit\-clamp\f[R] or
401 \f[B]\-C\f[R]/\f[B]\-\-no\-digit\-clamp\f[R] options (see the
402 \f[B]OPTIONS\f[R] section), the existence and setting of the
403 \f[B]DC_DIGIT_CLAMP\f[R] environment variable (see the \f[B]ENVIRONMENT
404 VARIABLES\f[R] section), or the default, which can be queried with the
405 \f[B]\-h\f[R]/\f[B]\-\-help\f[R] option.
408 equal to the current value of \f[B]ibase\f[R] are not changed.
410 \f[B]ibase\f[R] and added into the number.
411 This means that, with an \f[B]ibase\f[R] of \f[B]3\f[R], the number
412 \f[B]AB\f[R] is equal to \f[B]3\[ha]1*A+3\[ha]0*B\f[R], which is
413 \f[B]3\f[R] times \f[B]10\f[R] plus \f[B]11\f[R], or \f[B]41\f[R].
416 to the current value of \f[B]ibase\f[R] are set to the value of the
417 highest valid digit in \f[B]ibase\f[R] before being multiplied by the
418 appropriate power of \f[B]ibase\f[R] and added into the number.
419 This means that, with an \f[B]ibase\f[R] of \f[B]3\f[R], the number
420 \f[B]AB\f[R] is equal to \f[B]3\[ha]1*2+3\[ha]0*2\f[R], which is
421 \f[B]3\f[R] times \f[B]2\f[R] plus \f[B]2\f[R], or \f[B]8\f[R].
423 There is one exception to clamping: single\-character numbers (i.e.,
424 \f[B]A\f[R] alone).
426 in the highest possible \f[B]ibase\f[R].
427 This means that \f[B]A\f[R] alone always equals decimal \f[B]10\f[R] and
428 \f[B]Z\f[R] alone always equals decimal \f[B]35\f[R].
431 \f[B]ibase\f[R] (with the \f[B]i\f[R] command) regardless of the current
432 value of \f[B]ibase\f[R].
435 leading zero, i.e., for \f[B]A\f[R], use \f[B]0A\f[R].
438 These have the form \f[B]<number>e<integer>\f[R].
439 The exponent (the portion after the \f[B]e\f[R]) must be an integer.
440 An example is \f[B]1.89237e9\f[R], which is equal to
441 \f[B]1892370000\f[R].
442 Negative exponents are also allowed, so \f[B]4.2890e_3\f[R] is equal to
443 \f[B]0.0042890\f[R].
445 \f[B]WARNING\f[R]: Both the number and the exponent in scientific
446 notation are interpreted according to the current \f[B]ibase\f[R], but
447 the number is still multiplied by \f[B]10\[ha]exponent\f[R] regardless
448 of the current \f[B]ibase\f[R].
449 For example, if \f[B]ibase\f[R] is \f[B]16\f[R] and dc(1) is given the
450 number string \f[B]FFeA\f[R], the resulting decimal number will be
451 \f[B]2550000000000\f[R], and if dc(1) is given the number string
452 \f[B]10e_4\f[R], the resulting decimal number will be \f[B]0.0016\f[R].
454 Accepting input as scientific notation is a \f[B]non\-portable
455 extension\f[R].
463 Scientific notation is activated by assigning \f[B]0\f[R] to
464 \f[B]obase\f[R] using \f[B]0o\f[R], and engineering notation is
465 activated by assigning \f[B]1\f[R] to \f[B]obase\f[R] using
466 \f[B]1o\f[R].
467 To deactivate them, just assign a different value to \f[B]obase\f[R].
470 \f[B]non\-portable extension\f[R].
472 \f[B]p\f[R]
480 \f[B]n\f[R]
484 \f[B]P\f[R]
489 result is printed as though \f[B]obase\f[R] is \f[B]256\f[R] and each
490 digit is interpreted as an 8\-bit ASCII character, making it a byte
495 This is a \f[B]non\-portable extension\f[R].
498 \f[B]f\f[R]
508 \f[B]+\f[R]
511 The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
514 \f[B]\-\f[R]
517 The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
520 \f[B]*\f[R]
523 If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
524 \f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
525 \f[I]scale\f[R] of the result is equal to
526 \f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
527 \f[B]max()\f[R] return the obvious values.
529 \f[B]/\f[R]
532 The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
535 The first value popped off of the stack must be non\-zero.
538 \f[B]%\f[R]
543 Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
544 \f[B]scale\f[R], and 2) Using the result of step 1 to calculate
545 \f[B]a\-(a/b)*b\f[R] to \f[I]scale\f[R]
546 \f[B]max(scale+scale(b),scale(a))\f[R].
548 The first value popped off of the stack must be non\-zero.
551 \f[B]\[ti]\f[R]
555 This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
556 \f[B]y\f[R] are only evaluated once.
559 The first value popped off of the stack must be non\-zero.
561 This is a \f[B]non\-portable extension\f[R].
564 \f[B]\[ha]\f[R]
567 The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
572 non\-zero.
575 \f[B]v\f[R]
578 The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
581 The value popped off of the stack must be non\-negative.
584 \f[B]_\f[R]
585 If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
591 This behavior without a number is a \f[B]non\-portable extension\f[R].
594 \f[B]b\f[R]
600 This is a \f[B]non\-portable extension\f[R].
603 \f[B]|\f[R]
609 integer and non\-zero.
611 and non\-negative.
614 This is a \f[B]non\-portable extension\f[R].
617 \f[B]$\f[R]
622 This is a \f[B]non\-portable extension\f[R].
625 \f[B]\[at]\f[R]
632 non\-negative.
634 This is a \f[B]non\-portable extension\f[R].
637 \f[B]H\f[R]
643 non\-negative.
645 This is a \f[B]non\-portable extension\f[R].
648 \f[B]h\f[R]
654 non\-negative.
656 This is a \f[B]non\-portable extension\f[R].
659 \f[B]G\f[R]
661 \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
664 This is a \f[B]non\-portable extension\f[R].
667 \f[B]N\f[R]
668 The top value is popped off of the stack, and if it a \f[B]0\f[R], a
669 \f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
672 This is a \f[B]non\-portable extension\f[R].
675 \f[B](\f[R]
677 \f[B]1\f[R] is pushed if the first is less than the second, or
678 \f[B]0\f[R] otherwise.
681 This is a \f[B]non\-portable extension\f[R].
684 \f[B]{\f[R]
686 \f[B]1\f[R] is pushed if the first is less than or equal to the second,
687 or \f[B]0\f[R] otherwise.
690 This is a \f[B]non\-portable extension\f[R].
693 \f[B])\f[R]
695 \f[B]1\f[R] is pushed if the first is greater than the second, or
696 \f[B]0\f[R] otherwise.
699 This is a \f[B]non\-portable extension\f[R].
702 \f[B]}\f[R]
704 \f[B]1\f[R] is pushed if the first is greater than or equal to the
705 second, or \f[B]0\f[R] otherwise.
708 This is a \f[B]non\-portable extension\f[R].
711 \f[B]M\f[R]
713 If they are both non\-zero, a \f[B]1\f[R] is pushed onto the stack.
714 If either of them is zero, or both of them are, then a \f[B]0\f[R] is
718 This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
719 a short\-circuit operator.
721 This is a \f[B]non\-portable extension\f[R].
724 \f[B]m\f[R]
726 If at least one of them is non\-zero, a \f[B]1\f[R] is pushed onto the
728 If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
731 This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
732 a short\-circuit operator.
734 This is a \f[B]non\-portable extension\f[R].
736 .SS Pseudo\-Random Number Generator
737 dc(1) has a built\-in pseudo\-random number generator.
738 These commands query the pseudo\-random number generator.
739 (See Parameters for more information about the \f[B]seed\f[R] value that
740 controls the pseudo\-random number generator.)
742 The pseudo\-random number generator is guaranteed to \f[B]NOT\f[R] be
745 \f[B]\[cq]\f[R]
746 Generates an integer between 0 and \f[B]DC_RAND_MAX\f[R], inclusive (see
747 the \f[B]LIMITS\f[R] section).
751 limitations of the pseudo\-random number generator.
753 This is a \f[B]non\-portable extension\f[R].
756 \f[B]\[lq]\f[R]
757 Pops a value off of the stack, which is used as an \f[B]exclusive\f[R]
759 If the bound is negative or is a non\-integer, an error is raised, and
760 dc(1) resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R]
762 If the bound is larger than \f[B]DC_RAND_MAX\f[R], the higher bound is
763 honored by generating several pseudo\-random integers, multiplying them
764 by appropriate powers of \f[B]DC_RAND_MAX+1\f[R], and adding them
768 Using this command will change the value of \f[B]seed\f[R], unless the
769 operand is \f[B]0\f[R] or \f[B]1\f[R].
770 In that case, \f[B]0\f[R] is pushed onto the stack, and \f[B]seed\f[R]
771 is \f[I]not\f[R] changed.
775 limitations of the pseudo\-random number generator.
777 This is a \f[B]non\-portable extension\f[R].
782 \f[B]c\f[R]
785 \f[B]d\f[R]
789 \f[B]r\f[R]
792 \f[B]R\f[R]
795 These commands control registers (see the \f[B]REGISTERS\f[R] section).
797 \f[B]s\f[R]\f[I]r\f[R]
799 \f[I]r\f[R].
801 \f[B]l\f[R]\f[I]r\f[R]
802 Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
803 This does not alter the contents of \f[I]r\f[R].
805 \f[B]S\f[R]\f[I]r\f[R]
807 stack of register \f[I]r\f[R].
810 \f[B]L\f[R]\f[I]r\f[R]
811 Pops the value off the top of the stack for register \f[I]r\f[R] and
813 The previous value in the stack for register \f[I]r\f[R], if any, is now
814 accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
816 These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
817 \f[B]scale\f[R], and \f[B]seed\f[R].
818 Also see the \f[B]SYNTAX\f[R] section.
820 \f[B]i\f[R]
822 \f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
826 If the value on top of the stack has any \f[I]scale\f[R], the
827 \f[I]scale\f[R] is ignored.
830 \f[B]o\f[R]
832 \f[B]obase\f[R], which must be between \f[B]0\f[R] and
833 \f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section and
834 the \f[B]NUMBERS\f[R] section).
837 If the value on top of the stack has any \f[I]scale\f[R], the
838 \f[I]scale\f[R] is ignored.
841 \f[B]k\f[R]
843 \f[B]scale\f[R], which must be non\-negative.
846 If the value on top of the stack has any \f[I]scale\f[R], the
847 \f[I]scale\f[R] is ignored.
850 \f[B]j\f[R]
852 \f[B]seed\f[R].
853 The meaning of \f[B]seed\f[R] is dependent on the current pseudo\-random
858 The \f[I]scale\f[R] and sign of the value may be significant.
860 If a previously used \f[B]seed\f[R] value is used again, the
861 pseudo\-random number generator is guaranteed to produce the same
862 sequence of pseudo\-random numbers as it did when the \f[B]seed\f[R]
865 The exact value assigned to \f[B]seed\f[R] is not guaranteed to be
866 returned if the \f[B]J\f[R] command is used.
867 However, if \f[B]seed\f[R] \f[I]does\f[R] return a different value, both
868 values, when assigned to \f[B]seed\f[R], are guaranteed to produce the
869 same sequence of pseudo\-random numbers.
870 This means that certain values assigned to \f[B]seed\f[R] will not
871 produce unique sequences of pseudo\-random numbers.
874 or \f[I]scale\f[R] of the value that can be assigned to \f[B]seed\f[R].
876 This is a \f[B]non\-portable extension\f[R].
879 \f[B]I\f[R]
880 Pushes the current value of \f[B]ibase\f[R] onto the main stack.
882 \f[B]O\f[R]
883 Pushes the current value of \f[B]obase\f[R] onto the main stack.
885 \f[B]K\f[R]
886 Pushes the current value of \f[B]scale\f[R] onto the main stack.
888 \f[B]J\f[R]
889 Pushes the current value of \f[B]seed\f[R] onto the main stack.
892 This is a \f[B]non\-portable extension\f[R].
895 \f[B]T\f[R]
896 Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
900 This is a \f[B]non\-portable extension\f[R].
903 \f[B]U\f[R]
904 Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
908 This is a \f[B]non\-portable extension\f[R].
911 \f[B]V\f[R]
912 Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
916 This is a \f[B]non\-portable extension\f[R].
919 \f[B]W\f[R]
921 \f[B]\[cq]\f[R] pseudo\-random number generator command.
924 This is a \f[B]non\-portable extension\f[R].
930 \f[B]REGISTERS\f[R] section) can hold both strings and numbers.
938 For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
939 the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
942 \f[B][\f[R]\f[I]characters\f[R]\f[B]]\f[R]
943 Makes a string containing \f[I]characters\f[R] and pushes it onto the
947 If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
949 Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
957 \f[B]a\f[R]
962 The result mod \f[B]256\f[R] is calculated.
963 If that result is \f[B]0\f[R], push an empty string; otherwise, push a
964 one\-character string where the character is the result of the mod
970 create the new string as a one\-character string.
973 This is a \f[B]non\-portable extension\f[R].
976 \f[B]x\f[R]
988 \f[B]>\f[R]\f[I]r\f[R]
991 register \f[I]r\f[R] are executed.
994 For example, \f[B]0 1>a\f[R] will execute the contents of register
995 \f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
998 error and reset (see the \f[B]RESET\f[R] section).
1001 \f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
1002 Like the above, but will execute register \f[I]s\f[R] if the comparison
1007 error and reset (see the \f[B]RESET\f[R] section).
1009 This is a \f[B]non\-portable extension\f[R].
1012 \f[B]!>\f[R]\f[I]r\f[R]
1015 to), then the contents of register \f[I]r\f[R] are executed.
1019 error and reset (see the \f[B]RESET\f[R] section).
1022 \f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
1023 Like the above, but will execute register \f[I]s\f[R] if the comparison
1028 error and reset (see the \f[B]RESET\f[R] section).
1030 This is a \f[B]non\-portable extension\f[R].
1033 \f[B]<\f[R]\f[I]r\f[R]
1036 register \f[I]r\f[R] are executed.
1040 error and reset (see the \f[B]RESET\f[R] section).
1043 \f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
1044 Like the above, but will execute register \f[I]s\f[R] if the comparison
1049 error and reset (see the \f[B]RESET\f[R] section).
1051 This is a \f[B]non\-portable extension\f[R].
1054 \f[B]!<\f[R]\f[I]r\f[R]
1057 to), then the contents of register \f[I]r\f[R] are executed.
1061 error and reset (see the \f[B]RESET\f[R] section).
1064 \f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
1065 Like the above, but will execute register \f[I]s\f[R] if the comparison
1070 error and reset (see the \f[B]RESET\f[R] section).
1072 This is a \f[B]non\-portable extension\f[R].
1075 \f[B]=\f[R]\f[I]r\f[R]
1078 \f[I]r\f[R] are executed.
1082 error and reset (see the \f[B]RESET\f[R] section).
1085 \f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
1086 Like the above, but will execute register \f[I]s\f[R] if the comparison
1091 error and reset (see the \f[B]RESET\f[R] section).
1093 This is a \f[B]non\-portable extension\f[R].
1096 \f[B]!=\f[R]\f[I]r\f[R]
1099 register \f[I]r\f[R] are executed.
1103 error and reset (see the \f[B]RESET\f[R] section).
1106 \f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
1107 Like the above, but will execute register \f[I]s\f[R] if the comparison
1112 error and reset (see the \f[B]RESET\f[R] section).
1114 This is a \f[B]non\-portable extension\f[R].
1117 \f[B]?\f[R]
1118 Reads a line from the \f[B]stdin\f[R] and executes it.
1121 \f[B]q\f[R]
1126 \f[B]Q\f[R]
1127 Pops a value from the stack which must be non\-negative and is used the
1132 \f[B],\f[R]
1136 to make dc(1) exit with the \f[B]Q\f[R] command, so the sequence
1137 \f[B],Q\f[R] will make dc(1) exit.
1140 This is a \f[B]non\-portable extension\f[R].
1145 \f[B]Z\f[R]
1151 It will push \f[B]1\f[R] if the argument is \f[B]0\f[R] with no decimal
1157 \f[B]X\f[R]
1161 If it is a number, pushes the \f[I]scale\f[R] of the value onto the
1164 If it is a string, pushes \f[B]0\f[R].
1167 \f[B]u\f[R]
1169 If the value is a number, this pushes \f[B]1\f[R] onto the stack.
1170 Otherwise (if it is a string), it pushes \f[B]0\f[R].
1173 This is a \f[B]non\-portable extension\f[R].
1176 \f[B]t\f[R]
1178 If the value is a string, this pushes \f[B]1\f[R] onto the stack.
1179 Otherwise (if it is a number), it pushes \f[B]0\f[R].
1182 This is a \f[B]non\-portable extension\f[R].
1185 \f[B]z\f[R]
1189 \f[B]y\f[R]\f[I]r\f[R]
1190 Pushes the current stack depth of the register \f[I]r\f[R] onto the main
1194 Because each register has a depth of \f[B]1\f[R] (with the value
1195 \f[B]0\f[R] in the top item) when dc(1) starts, dc(1) requires that each
1197 an error and reset otherwise (see the \f[B]RESET\f[R] section).
1198 This means that this command will never push \f[B]0\f[R].
1200 This is a \f[B]non\-portable extension\f[R].
1205 \f[B]:\f[R]\f[I]r\f[R]
1207 The second value will be stored in the array \f[I]r\f[R] (see the
1208 \f[B]REGISTERS\f[R] section), indexed by the first value.
1210 \f[B];\f[R]\f[I]r\f[R]
1212 array \f[I]r\f[R].
1215 \f[B]Y\f[R]\f[I]r\f[R]
1216 Pushes the length of the array \f[I]r\f[R] onto the stack.
1219 This is a \f[B]non\-portable extension\f[R].
1224 and all of them begin with the letter \f[B]g\f[R].
1225 Only the characters below are allowed after the character \f[B]g\f[R];
1226 any other character produces a parse error (see the \f[B]ERRORS\f[R]
1229 \f[B]gl\f[R]
1230 Pushes the line length set by \f[B]DC_LINE_LENGTH\f[R] (see the
1231 \f[B]ENVIRONMENT VARIABLES\f[R] section) onto the stack.
1233 \f[B]gx\f[R]
1234 Pushes \f[B]1\f[R] onto the stack if extended register mode is on,
1235 \f[B]0\f[R] otherwise.
1236 See the \f[I]Extended Register Mode\f[R] subsection of the
1237 \f[B]REGISTERS\f[R] section for more information.
1239 \f[B]gz\f[R]
1240 Pushes \f[B]0\f[R] onto the stack if the leading zero setting has not
1241 been enabled with the \f[B]\-z\f[R] or \f[B]\-\-leading\-zeroes\f[R]
1242 options (see the \f[B]OPTIONS\f[R] section), non\-zero otherwise.
1249 All registers, when first referenced, have one value (\f[B]0\f[R]) in
1253 In non\-extended register mode, a register name is just the single
1255 The only exceptions are: a newline (\f[B]`\[rs]n'\f[R]) and a left
1256 bracket (\f[B]`['\f[R]); it is a parse error for a newline or a left
1262 If extended register mode is enabled (\f[B]\-x\f[R] or
1263 \f[B]\-\-extended\-register\f[R] command\-line arguments are given),
1264 then normal single character registers are used \f[I]unless\f[R] the
1266 a space (according to \f[B]isspace()\f[R]) and not a newline
1267 (\f[B]`\[rs]n'\f[R]).
1270 \f[B][a\-z][a\-z0\-9_]*\f[R] (like bc(1) identifiers), and it is a parse
1271 error if the next non\-space characters do not match that regex.
1273 When dc(1) encounters an error or a signal that it has a non\-default
1283 However, the stack of values is \f[I]not\f[R] cleared; in interactive
1289 (see the \f[B]EXIT STATUS\f[R] section), it asks for more input;
1292 Most dc(1) implementations use \f[B]char\f[R] types to calculate the
1293 value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
1296 It uses large integers to calculate more than \f[B]1\f[R] decimal digit
1298 If built in a environment where \f[B]DC_LONG_BIT\f[R] (see the
1299 \f[B]LIMITS\f[R] section) is \f[B]64\f[R], then each integer has
1300 \f[B]9\f[R] decimal digits.
1301 If built in an environment where \f[B]DC_LONG_BIT\f[R] is \f[B]32\f[R]
1302 then each integer has \f[B]4\f[R] decimal digits.
1304 \f[B]DC_BASE_DIGS\f[R].
1308 This integer type depends on the value of \f[B]DC_LONG_BIT\f[R], but is
1313 \f[B]DC_LONG_BIT\f[R]
1314 The number of bits in the \f[B]long\f[R] type in the environment where
1317 integer (see the \f[B]PERFORMANCE\f[R] section).
1319 \f[B]DC_BASE_DIGS\f[R]
1321 \f[B]PERFORMANCE\f[R] section).
1322 Depends on \f[B]DC_LONG_BIT\f[R].
1324 \f[B]DC_BASE_POW\f[R]
1326 \f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
1327 Depends on \f[B]DC_BASE_DIGS\f[R].
1329 \f[B]DC_OVERFLOW_MAX\f[R]
1330 The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
1332 Depends on \f[B]DC_LONG_BIT\f[R].
1334 \f[B]DC_BASE_MAX\f[R]
1336 Set at \f[B]DC_BASE_POW\f[R].
1338 \f[B]DC_DIM_MAX\f[R]
1340 Set at \f[B]SIZE_MAX\-1\f[R].
1342 \f[B]DC_SCALE_MAX\f[R]
1343 The maximum \f[B]scale\f[R].
1344 Set at \f[B]DC_OVERFLOW_MAX\-1\f[R].
1346 \f[B]DC_STRING_MAX\f[R]
1348 Set at \f[B]DC_OVERFLOW_MAX\-1\f[R].
1350 \f[B]DC_NAME_MAX\f[R]
1352 Set at \f[B]DC_OVERFLOW_MAX\-1\f[R].
1354 \f[B]DC_NUM_MAX\f[R]
1357 Set at \f[B]DC_OVERFLOW_MAX\-1\f[R].
1359 \f[B]DC_RAND_MAX\f[R]
1360 The maximum integer (inclusive) returned by the \f[B]\[cq]\f[R] command,
1362 Set at \f[B]2\[ha]DC_LONG_BIT\-1\f[R].
1366 Set at \f[B]DC_OVERFLOW_MAX\f[R].
1370 Set at \f[B]SIZE_MAX\-1\f[R].
1372 These limits are meant to be effectively non\-existent; the limits are
1373 so large (at least on 64\-bit machines) that there should not be any
1377 As \f[B]non\-portable extensions\f[R], dc(1) recognizes the following
1380 \f[B]DC_ENV_ARGS\f[R]
1381 This is another way to give command\-line arguments to dc(1).
1382 They should be in the same format as all other command\-line arguments.
1384 \f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
1385 on the command\-line.
1390 Another use would be to use the \f[B]\-e\f[R] option to set
1391 \f[B]scale\f[R] to a value other than \f[B]0\f[R].
1394 The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
1396 For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
1398 \[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
1400 The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
1401 \f[B]\[lq]\f[R].
1404 `dc' file.dc\[rq]\f[R], and vice versa if you have a file with double
1407 \f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
1408 parsing, though such files are still supported on the command\-line
1412 \f[B]DC_LINE_LENGTH\f[R]
1414 greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
1415 (\f[B]2\[ha]16\-1\f[R]), dc(1) will output lines to that length,
1417 The default line length is \f[B]70\f[R].
1420 The special value of \f[B]0\f[R] will disable line length checking and
1425 \f[B]DC_SIGINT_RESET\f[R]
1426 If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
1428 exits on \f[B]SIGINT\f[R] when not in interactive mode.
1432 variable exists and contains an integer, a non\-zero value makes dc(1)
1433 reset on \f[B]SIGINT\f[R], rather than exit, and zero makes dc(1) exit.
1434 If this environment variable exists and is \f[I]not\f[R] an integer,
1435 then dc(1) will exit on \f[B]SIGINT\f[R].
1438 with the \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
1441 \f[B]DC_TTY_MODE\f[R]
1442 If TTY mode is \f[I]not\f[R] available (see the \f[B]TTY MODE\f[R]
1447 exists and contains an integer, then a non\-zero value makes dc(1) use
1451 with the \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
1454 \f[B]DC_PROMPT\f[R]
1455 If TTY mode is \f[I]not\f[R] available (see the \f[B]TTY MODE\f[R]
1460 exists and contains an integer, a non\-zero value makes dc(1) use a
1461 prompt, and zero or a non\-integer makes dc(1) not use a prompt.
1462 If this environment variable does not exist and \f[B]DC_TTY_MODE\f[R]
1463 does, then the value of the \f[B]DC_TTY_MODE\f[R] environment variable
1466 This environment variable and the \f[B]DC_TTY_MODE\f[R] environment
1468 \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
1471 \f[B]DC_EXPR_EXIT\f[R]
1472 If any expressions or expression files are given on the command\-line
1473 with \f[B]\-e\f[R], \f[B]\-\-expression\f[R], \f[B]\-f\f[R], or
1474 \f[B]\-\-file\f[R], then if this environment variable exists and
1475 contains an integer, a non\-zero value makes dc(1) exit after executing
1481 with the \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
1484 \f[B]DC_DIGIT_CLAMP\f[R]
1486 contains an integer, a non\-zero value makes dc(1) clamp digits that are
1487 greater than or equal to the current \f[B]ibase\f[R] so that all such
1488 digits are considered equal to the \f[B]ibase\f[R] minus 1, and a zero
1490 their value, which is multiplied by the power of the \f[B]ibase\f[R].
1493 This never applies to single\-digit numbers, as per the bc(1) standard
1494 (see the \f[B]STANDARDS\f[R] section).
1497 with the \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
1502 \f[B]0\f[R]
1505 \f[B]1\f[R]
1507 This follows standard practice of using \f[B]1\f[R] for expected errors,
1511 Math errors include divide by \f[B]0\f[R], taking the square root of a
1513 pseudo\-random number generator, attempting to convert a negative number
1516 to use a non\-integer where an integer is required.
1519 power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
1520 (\f[B]H\f[R]), and right shift (\f[B]h\f[R]) operators.
1523 \f[B]2\f[R]
1527 Parse errors include unexpected \f[B]EOF\f[R], using an invalid
1532 \f[B]3\f[R]
1537 (\f[B]ibase\f[R], \f[B]obase\f[R], or \f[B]scale\f[R]), giving a bad
1538 expression to a \f[B]read()\f[R] call, calling \f[B]read()\f[R] inside
1539 of a \f[B]read()\f[R] call, type errors (including attempting to execute
1544 \f[B]4\f[R]
1551 directory as a file, and giving invalid command\-line options.
1554 The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
1555 always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
1558 interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
1559 dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
1562 \f[B]\-i\f[R] flag or \f[B]\-\-interactive\f[R] option.
1566 \f[B]\-i\f[R] flag or \f[B]\-\-interactive\f[R] option.
1568 Like bc(1), dc(1) has an interactive mode and a non\-interactive mode.
1569 Interactive mode is turned on automatically when both \f[B]stdin\f[R]
1570 and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]\-i\f[R]
1571 flag and \f[B]\-\-interactive\f[R] option can turn it on in other
1575 \f[B]RESET\f[R] section), and in normal execution, flushes
1576 \f[B]stdout\f[R] as soon as execution is done for the current input.
1577 dc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
1578 the contents of, or default for, the \f[B]DC_SIGINT_RESET\f[R]
1579 environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
1581 If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
1586 If there is the environment variable \f[B]DC_TTY_MODE\f[R] in the
1587 environment (see the \f[B]ENVIRONMENT VARIABLES\f[R] section), then if
1588 that environment variable contains a non\-zero integer, dc(1) will turn
1589 on TTY mode when \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R]
1591 If the \f[B]DC_TTY_MODE\f[R] environment variable exists but is
1592 \f[I]not\f[R] a non\-zero integer, then dc(1) will not turn TTY mode on.
1594 If the environment variable \f[B]DC_TTY_MODE\f[R] does \f[I]not\f[R]
1596 The default setting can be queried with the \f[B]\-h\f[R] or
1597 \f[B]\-\-help\f[R] options.
1600 required in the bc(1) specification (see the \f[B]STANDARDS\f[R]
1601 section), and interactive mode requires only \f[B]stdin\f[R] and
1602 \f[B]stdout\f[R] to be connected to a terminal.
1603 .SS Command\-Line History
1604 Command\-line history is only enabled if TTY mode is, i.e., that
1605 \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are connected to
1606 a TTY and the \f[B]DC_TTY_MODE\f[R] environment variable (see the
1607 \f[B]ENVIRONMENT VARIABLES\f[R] section) and its default do not disable
1609 See the \f[B]COMMAND LINE HISTORY\f[R] section for more information.
1613 variable: \f[B]DC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
1616 If the environment variable \f[B]DC_PROMPT\f[R] exists and is a
1617 non\-zero integer, then the prompt is turned on when \f[B]stdin\f[R],
1618 \f[B]stdout\f[R], and \f[B]stderr\f[R] are connected to a TTY and the
1619 \f[B]\-P\f[R] and \f[B]\-\-no\-prompt\f[R] options were not used.
1621 the \f[B]\-R\f[R] and \f[B]\-\-no\-read\-prompt\f[R] options must also
1624 However, if \f[B]DC_PROMPT\f[R] does not exist, the prompt can be
1625 enabled or disabled with the \f[B]DC_TTY_MODE\f[R] environment variable,
1626 the \f[B]\-P\f[R] and \f[B]\-\-no\-prompt\f[R] options, and the
1627 \f[B]\-R\f[R] and \f[B]\-\-no\-read\-prompt\f[R] options.
1628 See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
1631 Sending a \f[B]SIGINT\f[R] will cause dc(1) to do one of two things.
1633 If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
1634 section), or the \f[B]DC_SIGINT_RESET\f[R] environment variable (see the
1635 \f[B]ENVIRONMENT VARIABLES\f[R] section), or its default, is either not
1639 \f[B]DC_SIGINT_RESET\f[R] or its default is an integer and non\-zero,
1641 \f[B]RESET\f[R] section) upon receiving a \f[B]SIGINT\f[R].
1644 If dc(1) is processing input from \f[B]stdin\f[R] in interactive mode,
1648 exists, or ask for input from \f[B]stdin\f[R] if no other file exists.
1650 This means that if a \f[B]SIGINT\f[R] is sent to dc(1) as it is
1659 \f[B]SIGTERM\f[R] and \f[B]SIGQUIT\f[R] cause dc(1) to clean up and
1661 The one exception is \f[B]SIGHUP\f[R]; in that case, and only when dc(1)
1662 is in TTY mode (see the \f[B]TTY MODE\f[R] section), a \f[B]SIGHUP\f[R]
1665 dc(1) supports interactive command\-line editing.
1667 If dc(1) can be in TTY mode (see the \f[B]TTY MODE\f[R] section),
1669 This means that command\-line history can only be enabled when
1670 \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
1674 variable \f[B]DC_TTY_MODE\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
1677 \f[B]Note\f[R]: tabs are converted to 8 spaces.
1680 locales and thus, supports \f[B]LC_MESSAGES\f[R].
1685 operators in the IEEE Std 1003.1\-2017 (\[lq]POSIX.1\-2017\[rq]) bc(1)