Lines Matching +full:dc +full:- +full:to +full:- +full:dc
2 .\" SPDX-License-Identifier: BSD-2-Clause
4 .\" Copyright (c) 2018-2024 Gavin D. Howard and contributors.
17 .\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
28 .TH "DC" "1" "August 2024" "Gavin D. Howard" "General Commands Manual"
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]\&...]
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.
49 It uses a stack (reverse Polish notation) to store numbers and results
54 If no files are given on the command\-line, then dc(1) reads from
56 Otherwise, those files are processed, and dc(1) will then exit.
58 If a user wants to set up a standard environment, they can use
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].
64 The following are the options that dc(1) accepts.
66 \f[B]\-C\f[R], \f[B]\-\-no\-digit\-clamp\f[R]
67 Disables clamping of digits greater than or equal to the current
71 This means that the value added to a number from a digit is always that
72 digit\[cq]s value multiplied by the value of ibase raised to the power
76 If this and/or the \f[B]\-c\f[R] or \f[B]\-\-digit\-clamp\f[R] options
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]
87 Enables clamping of digits greater than or equal to the current
91 This means that digits that the value added to a number from a digit
92 that is greater than or equal to the ibase is the value of ibase minus 1
93 all multiplied by the value of ibase raised to the power of the
97 If this and/or the \f[B]\-C\f[R] or \f[B]\-\-no\-digit\-clamp\f[R]
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]
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]
127 If this option is given on the command\-line (i.e., not in
129 then after processing all expressions and files, dc(1) will exit, unless
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
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]
148 If this option is given on the command\-line (i.e., not in
150 then after processing all expressions and files, dc(1) will exit, unless
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]
172 This is a \f[B]non\-portable extension\f[R].
175 \f[B]\-i\f[R], \f[B]\-\-interactive\f[R]
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]
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]
201 This is a \f[B]non\-portable extension\f[R].
204 \f[B]\-P\f[R], \f[B]\-\-no\-prompt\f[R]
209 to having them in dc(1).
210 Most of those users would want to put this option in
217 This is a \f[B]non\-portable extension\f[R].
220 \f[B]\-R\f[R], \f[B]\-\-no\-read\-prompt\f[R]
225 used to having them in dc(1).
226 Most of those users would want to put this option in
228 This option is also useful in hash bang lines of dc(1) scripts that
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]
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]
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].
279 However, there is a caveat to this.
282 The only exception to this is if a string has been finished, but not
285 balanced before dc(1) parses and executes.
287 Any non\-error output is written to \f[B]stdout\f[R].
292 \f[B]Note\f[R]: Unlike other dc(1) implementations, this dc(1) will
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
297 redirected to a file.
299 If there are scripts that depend on the behavior of other dc(1)
300 implementations, it is recommended that those scripts be changed to
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
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.
309 This is done so that dc(1) can exit with an error code when
310 \f[B]stderr\f[R] is redirected to a file.
312 If there are scripts that depend on the behavior of other dc(1)
313 implementations, it is recommended that those scripts be changed to
314 redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
322 determines how to interpret constant numbers.
328 The max allowable value for \f[B]ibase\f[R] can be queried in dc(1)
332 determines how to output results.
345 \f[B]non\-portable extensions\f[R].
353 The max allowable value for \f[B]scale\f[R] can be queried in dc(1)
357 pseudo\-random number generator.
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
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
368 In addition, the value of \f[B]seed\f[R] will change after any call to
374 \f[B]Note\f[R]: The values returned by the pseudo\-random number
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
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
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].
389 This is a \f[B]non\-portable extension\f[R].
391 Numbers are strings made up of digits, uppercase letters up to
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
398 \f[B]ibase\f[R] (i.e., they are greater than or equal to the current
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
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.
412 \f[B]AB\f[R] is equal to \f[B]3\[ha]1*A+3\[ha]0*B\f[R], which is
416 to the current value of \f[B]ibase\f[R] are set to the value of the
420 \f[B]AB\f[R] is equal to \f[B]3\[ha]1*2+3\[ha]0*2\f[R], which is
423 There is one exception to clamping: single\-character numbers (i.e.,
430 section) and is meant to provide an easy way to set the current
437 In addition, dc(1) accepts numbers in scientific notation.
440 An example is \f[B]1.89237e9\f[R], which is equal to
442 Negative exponents are also allowed, so \f[B]4.2890e_3\f[R] is equal to
446 notation are interpreted according to the current \f[B]ibase\f[R], but
449 For example, if \f[B]ibase\f[R] is \f[B]16\f[R] and dc(1) is given the
451 \f[B]2550000000000\f[R], and if dc(1) is given the number string
454 Accepting input as scientific notation is a \f[B]non\-portable
463 Scientific notation is activated by assigning \f[B]0\f[R] to
465 activated by assigning \f[B]1\f[R] to \f[B]obase\f[R] using
467 To deactivate them, just assign a different value to \f[B]obase\f[R].
470 \f[B]non\-portable extension\f[R].
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].
499 Prints the entire contents of the stack, in order from newest to oldest,
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
525 \f[I]scale\f[R] of the result is equal to
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.
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]
548 The first value popped off of the stack must be non\-zero.
555 This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
559 The first value popped off of the stack must be non\-zero.
561 This is a \f[B]non\-portable extension\f[R].
565 The top two values are popped off the stack, the second is raised to the
567 The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
572 non\-zero.
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.
591 This behavior without a number is a \f[B]non\-portable extension\f[R].
600 This is a \f[B]non\-portable extension\f[R].
609 integer and non\-zero.
611 and non\-negative.
614 This is a \f[B]non\-portable extension\f[R].
622 This is a \f[B]non\-portable extension\f[R].
627 second is set to the value of the first, whether by truncation or
632 non\-negative.
634 This is a \f[B]non\-portable extension\f[R].
639 left (radix shifted right) to the value of the first.
643 non\-negative.
645 This is a \f[B]non\-portable extension\f[R].
650 right (radix shifted left) to the value of the first.
654 non\-negative.
656 This is a \f[B]non\-portable extension\f[R].
664 This is a \f[B]non\-portable extension\f[R].
672 This is a \f[B]non\-portable extension\f[R].
681 This is a \f[B]non\-portable extension\f[R].
686 \f[B]1\f[R] is pushed if the first is less than or equal to the second,
690 This is a \f[B]non\-portable extension\f[R].
699 This is a \f[B]non\-portable extension\f[R].
704 \f[B]1\f[R] is pushed if the first is greater than or equal to the
708 This is a \f[B]non\-portable extension\f[R].
713 If they are both non\-zero, a \f[B]1\f[R] is pushed onto the stack.
719 a short\-circuit operator.
721 This is a \f[B]non\-portable extension\f[R].
726 If at least one of them is non\-zero, a \f[B]1\f[R] is pushed onto the
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.
740 controls the pseudo\-random number generator.)
742 The pseudo\-random number generator is guaranteed to \f[B]NOT\f[R] be
750 The generated integer is made as unbiased as possible, subject to the
751 limitations of the pseudo\-random number generator.
753 This is a \f[B]non\-portable extension\f[R].
759 If the bound is negative or is a non\-integer, an error is raised, and
763 honored by generating several pseudo\-random integers, multiplying them
774 The generated integer is made as unbiased as possible, subject to the
775 limitations of the pseudo\-random number generator.
777 This is a \f[B]non\-portable extension\f[R].
821 Pops the value off of the top of the stack and uses it to set
831 Pops the value off of the top of the stack and uses it to set
842 Pops the value off of the top of the stack and uses it to set
843 \f[B]scale\f[R], which must be non\-negative.
851 Pops the value off of the top of the stack and uses it to set
853 The meaning of \f[B]seed\f[R] is dependent on the current pseudo\-random
854 number generator but is guaranteed to not change except for new major
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
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.
873 There is no limit to the length (number of significant decimal digits)
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].
892 This is a \f[B]non\-portable extension\f[R].
900 This is a \f[B]non\-portable extension\f[R].
908 This is a \f[B]non\-portable extension\f[R].
916 This is a \f[B]non\-portable extension\f[R].
921 \f[B]\[cq]\f[R] pseudo\-random number generator command.
924 This is a \f[B]non\-portable extension\f[R].
934 While arithmetic operations have to have numbers, and will print an
964 one\-character string where the character is the result of the mod
969 If it is not, then the first character of the original string is used to
970 create the new string as a one\-character string.
973 This is a \f[B]non\-portable extension\f[R].
997 If either or both of the values are not numbers, dc(1) will raise an
1006 If either or both of the values are not numbers, dc(1) will raise an
1009 This is a \f[B]non\-portable extension\f[R].
1018 If either or both of the values are not numbers, dc(1) will raise an
1027 If either or both of the values are not numbers, dc(1) will raise an
1030 This is a \f[B]non\-portable extension\f[R].
1039 If either or both of the values are not numbers, dc(1) will raise an
1048 If either or both of the values are not numbers, dc(1) will raise an
1051 This is a \f[B]non\-portable extension\f[R].
1060 If either or both of the values are not numbers, dc(1) will raise an
1069 If either or both of the values are not numbers, dc(1) will raise an
1072 This is a \f[B]non\-portable extension\f[R].
1077 If the first value is equal to the second, then the contents of register
1081 If either or both of the values are not numbers, dc(1) will raise an
1090 If either or both of the values are not numbers, dc(1) will raise an
1093 This is a \f[B]non\-portable extension\f[R].
1098 If the first value is not equal to the second, then the contents of
1102 If either or both of the values are not numbers, dc(1) will raise an
1111 If either or both of the values are not numbers, dc(1) will raise an
1114 This is a \f[B]non\-portable extension\f[R].
1119 This is to allow macros to request input from users.
1124 If there are no macros, or only one macro executing, dc(1) exits.
1127 Pops a value from the stack which must be non\-negative and is used the
1128 number of macro executions to pop off of the execution stack.
1129 If the number of levels to pop is greater than the number of executing
1130 macros, dc(1) exits.
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].
1173 This is a \f[B]non\-portable extension\f[R].
1182 This is a \f[B]non\-portable extension\f[R].
1195 \f[B]0\f[R] in the top item) when dc(1) starts, dc(1) requires that each
1196 register\[cq]s stack must always have at least one item; dc(1) will give
1200 This is a \f[B]non\-portable extension\f[R].
1219 This is a \f[B]non\-portable extension\f[R].
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.
1250 their stack, and it is a runtime error to attempt to pop that item off
1253 In non\-extended register mode, a register name is just the single
1257 bracket to be used as a register name.
1259 Unlike most other dc(1) implentations, this dc(1) provides nearly
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),
1266 a space (according to \f[B]isspace()\f[R]) and not a newline
1269 In that case, the register name is found according to the regex
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
1280 Then the execution point is set so that any code waiting to execute
1286 Thus, when dc(1) resets, it skips any remaining code waiting to be
1292 Most dc(1) implementations use \f[B]char\f[R] types to calculate the
1294 This dc(1) does something different.
1296 It uses large integers to calculate more than \f[B]1\f[R] decimal digit
1306 In addition, this dc(1) uses an even larger integer for overflow
1309 always at least twice as large as the integer type used to store digits.
1311 The following are the limits on dc(1):
1340 Set at \f[B]SIZE_MAX\-1\f[R].
1344 Set at \f[B]DC_OVERFLOW_MAX\-1\f[R].
1348 Set at \f[B]DC_OVERFLOW_MAX\-1\f[R].
1352 Set at \f[B]DC_OVERFLOW_MAX\-1\f[R].
1357 Set at \f[B]DC_OVERFLOW_MAX\-1\f[R].
1361 if dc(1).
1362 Set at \f[B]2\[ha]DC_LONG_BIT\-1\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
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.
1385 on the command\-line.
1386 This gives the user the ability to set up \[lq]standard\[rq] options and
1387 files to be used at every invocation.
1388 The most useful thing for such files to contain would be useful
1389 functions that the user might want every time dc(1) runs.
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].
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.
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
1415 (\f[B]2\[ha]16\-1\f[R]), dc(1) will output lines to that length,
1421 print numbers without regard to line length and without backslashes and
1426 If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
1427 section), then this environment variable has no effect because dc(1)
1431 However, when dc(1) is in interactive mode, then if this environment
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.
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.
1447 exists and contains an integer, then a non\-zero value makes dc(1) use
1448 TTY mode, and zero makes dc(1) not use TTY mode.
1451 with the \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
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.
1468 \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
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
1476 the expressions and expression files, and a zero value makes dc(1) not
1481 with the \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
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
1489 value disables such clamping so that those digits are always equal to
1493 This never applies to single\-digit numbers, as per the bc(1) standard
1497 with the \f[B]\-h\f[R] or \f[B]\-\-help\f[R] options.
1513 pseudo\-random number generator, attempting to convert a negative number
1514 to a hardware integer, overflow when converting a number to a hardware
1516 to use a non\-integer where an integer is required.
1518 Converting to a hardware integer happens for the second operand of the
1528 character, failing to find the end of a string or comment, and using a
1536 Runtime errors include assigning an invalid number to any global
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
1548 Fatal errors include memory allocation errors, I/O errors, failing to
1549 open files, attempting to use files that do not have only ASCII
1550 characters (dc(1) only accepts ASCII characters), attempting to open a
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.
1557 The other statuses will only be returned when dc(1) is not in
1562 \f[B]\-i\f[R] flag or \f[B]\-\-interactive\f[R] option.
1564 These exit statuses allow dc(1) to be used in shell scripting with error
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.
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
1574 In interactive mode, dc(1) attempts to recover from errors (see the
1582 connected to a TTY, then \[lq]TTY mode\[rq] is considered to be
1583 available, and thus, dc(1) can turn on TTY mode, subject to some
1588 that environment variable contains a non\-zero integer, dc(1) will turn
1590 are all connected to a TTY.
1592 \f[I]not\f[R] a non\-zero integer, then dc(1) will not turn TTY mode on.
1596 The default setting can be queried with the \f[B]\-h\f[R] or
1597 \f[B]\-\-help\f[R] options.
1602 \f[B]stdout\f[R] to be connected to a terminal.
1610 non\-zero integer, then the prompt is turned on when \f[B]stdin\f[R],
1611 \f[B]stdout\f[R], and \f[B]stderr\f[R] are connected to a TTY and the
1612 \f[B]\-P\f[R] and \f[B]\-\-no\-prompt\f[R] options were not used.
1614 the \f[B]\-R\f[R] and \f[B]\-\-no\-read\-prompt\f[R] options must also
1619 the \f[B]\-P\f[R] and \f[B]\-\-no\-prompt\f[R] options, and the
1620 \f[B]\-R\f[R] and \f[B]\-\-no\-read\-prompt\f[R] options.
1624 Sending a \f[B]SIGINT\f[R] will cause dc(1) to do one of two things.
1626 If dc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
1629 an integer or it is zero, dc(1) will exit.
1631 However, if dc(1) is in interactive mode, and the
1632 \f[B]DC_SIGINT_RESET\f[R] or its default is an integer and non\-zero,
1633 then dc(1) will stop executing the current input and reset (see the
1637 If dc(1) is processing input from \f[B]stdin\f[R] in interactive mode,
1639 If dc(1) is processing input from a file in interactive mode, it will
1643 This means that if a \f[B]SIGINT\f[R] is sent to dc(1) as it is
1644 executing a file, it can seem as though dc(1) did not respond to the
1647 dc(1) have function definitions, which are quick to parse.
1648 If a file takes a long time to execute, there may be a bug in that file.
1650 the user to continue.
1652 \f[B]SIGTERM\f[R] and \f[B]SIGQUIT\f[R] cause dc(1) to clean up and
1657 The dc(1) utility operators and some behavior are compliant with the
1658 operators in the IEEE Std 1003.1\-2017 (\[lq]POSIX.1\-2017\[rq]) bc(1)