Lines Matching +full:- +full:b
2 .\" SPDX-License-Identifier: BSD-2-Clause
4 .\" Copyright (c) 2018-2021 Gavin D. Howard and contributors.
31 bc - arbitrary-precision decimal arithmetic language and calculator
34 \f[B]bc\f[R] [\f[B]-ghilPqRsvVw\f[R]] [\f[B]--global-stacks\f[R]]
35 [\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
36 [\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
37 [\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
38 [\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
39 [\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
48 somewhat C-like, but there are differences.
52 the command line and executes them before reading from \f[B]stdin\f[R].
54 This bc(1) is a drop-in replacement for \f[I]any\f[R] bc(1), including
60 \f[B]-g\f[R], \f[B]--global-stacks\f[R]
70 Thus, a hypothetical function named **output(x,b)** that simply printed
71 **x** in base **b** could be written like this:
73 define void output(x, b) {
74 obase=b
80 define void output(x, b) {
83 obase=b
99 alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
100 alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
111 If **-s**, **-w**, or any equivalents are used, this option is ignored.
113 This is a **non-portable extension**.
117 \f[B]-h\f[R], \f[B]--help\f[R]
121 \f[B]-i\f[R], \f[B]--interactive\f[R]
124 (See the \f[B]INTERACTIVE MODE\f[R] section.)
128 This is a **non-portable extension**.
132 \f[B]-l\f[R], \f[B]--mathlib\f[R]
134 : Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to
135 \f[B]20\f[R] and loads the included math library before running any
144 \f[B]-P\f[R], \f[B]--no-prompt\f[R]
146 : This option is a no-op.
150 This is a **non-portable extension**.
154 \f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
157 no-op.
161 This is a **non-portable extension**.
165 \f[B]-q\f[R], \f[B]--quiet\f[R]
168 bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
171 \f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
175 This is a **non-portable extension**.
179 \f[B]-s\f[R], \f[B]--standard\f[R]
187 This is a **non-portable extension**.
191 \f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
197 This is a **non-portable extension**.
201 \f[B]-w\f[R], \f[B]--warn\f[R]
203 : Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
204 not errors) are printed for non-standard extensions and execution
209 This is a **non-portable extension**.
213 \f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
224 If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
226 expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
227 as an argument at least once to **-f** or **-\[rs]-file**, whether on the
228 command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
229 **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
232 This is a **non-portable extension**.
236 \f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
239 were read through \f[B]stdin\f[R].
245 If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
247 expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
248 as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
249 **-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
250 **-f-** or equivalent is given, bc(1) will give a fatal error and exit.
252 This is a **non-portable extension**.
256 All long options are \f[B]non-portable extensions\f[R].
259 Any non-error output is written to \f[B]stdout\f[R].
260 In addition, if history (see the \f[B]HISTORY\f[R] section) and the
261 prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
262 to \f[B]stdout\f[R].
264 \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
265 issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
266 write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
267 \f[B]bc >&-\f[R], it will quit with an error.
268 This is done so that bc(1) can report problems when \f[B]stdout\f[R] is
273 redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
276 Any error output is written to \f[B]stderr\f[R].
278 \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
279 issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
280 write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
281 \f[B]bc 2>&-\f[R], it will quit with an error.
283 \f[B]stderr\f[R] is redirected to a file.
287 redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
290 The syntax for bc(1) programs is mostly C-like, with some differences.
298 In the sections below, \f[B]E\f[R] means expression, \f[B]S\f[R] means
299 statement, and \f[B]I\f[R] means identifier.
301 Identifiers (\f[B]I\f[R]) start with a lowercase letter and can be
302 followed by any number (up to \f[B]BC_NAME_MAX-1\f[R]) of lowercase
303 letters (\f[B]a-z\f[R]), digits (\f[B]0-9\f[R]), and underscores
304 (\f[B]_\f[R]).
305 The regex is \f[B][a-z][a-z0-9_]*\f[R].
307 \f[B]non-portable extension\f[R].
309 \f[B]ibase\f[R] is a global variable determining how to interpret
313 \f[B]ibase\f[R] is initially \f[B]10\f[R].
314 If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
315 (\f[B]--warn\f[R]) flags were not given on the command line, the max
316 allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
317 Otherwise, it is \f[B]16\f[R].
318 The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
319 The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
320 programs with the \f[B]maxibase()\f[R] built-in function.
322 \f[B]obase\f[R] is a global variable determining how to output results.
325 \f[B]obase\f[R] is initially \f[B]10\f[R].
326 The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
327 can be queried in bc(1) programs with the \f[B]maxobase()\f[R] built-in
329 The min allowable value for \f[B]obase\f[R] is \f[B]2\f[R].
333 result of the expression right of the decimal point, and \f[B]scale\f[R]
336 \f[B]scale\f[R] is initially \f[B]0\f[R].
337 \f[B]scale\f[R] cannot be negative.
338 The max allowable value for \f[B]scale\f[R] is \f[B]BC_SCALE_MAX\f[R]
339 and can be queried in bc(1) programs with the \f[B]maxscale()\f[R]
340 built-in function.
344 parameters or are introduced in the \f[B]auto\f[R] list of a function
345 (see the \f[B]FUNCTIONS\f[R] section).
347 \f[B]auto\f[R] list, it is assumed to be \f[I]global\f[R].
362 \f[B]last\f[R].
363 A single dot (\f[B].\f[R]) may also be used as a synonym for
364 \f[B]last\f[R].
365 These are \f[B]non-portable extensions\f[R].
372 Block comments are enclosed in \f[B]/*\f[R] and \f[B]*/\f[R].
374 Line comments go from \f[B]#\f[R] until, and not including, the next
376 This is a \f[B]non-portable extension\f[R].
381 Variables: \f[B]I\f[R]
383 Array Elements: \f[B]I[E]\f[R]
385 \f[B]ibase\f[R]
387 \f[B]obase\f[R]
389 \f[B]scale\f[R]
391 \f[B]last\f[R] or a single dot (\f[B].\f[R])
393 Number 6 is a \f[B]non-portable extension\f[R].
397 This also applies to functions (see the \f[B]FUNCTIONS\f[R] section), so
403 \f[B]increment\f[R]/\f[B]decrement\f[R] operators and as the left side
404 of \f[B]assignment\f[R] operators (see the \f[I]Operators\f[R]
412 Array indices (\f[B]I[E]\f[R]).
414 \f[B](E)\f[R]: The value of \f[B]E\f[R] (used to change precedence).
416 \f[B]sqrt(E)\f[R]: The square root of \f[B]E\f[R].
417 \f[B]E\f[R] must be non-negative.
419 \f[B]length(E)\f[R]: The number of significant decimal digits in
420 \f[B]E\f[R].
422 \f[B]length(I[])\f[R]: The number of elements in the array \f[B]I\f[R].
423 This is a \f[B]non-portable extension\f[R].
425 \f[B]scale(E)\f[R]: The \f[I]scale\f[R] of \f[B]E\f[R].
427 \f[B]abs(E)\f[R]: The absolute value of \f[B]E\f[R].
428 This is a \f[B]non-portable extension\f[R].
430 \f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
431 \f[B]I\f[R] is an identifier for a non-\f[B]void\f[R] function (see the
432 \f[I]Void Functions\f[R] subsection of the \f[B]FUNCTIONS\f[R] section).
433 The \f[B]E\f[R] argument(s) may also be arrays of the form
434 \f[B]I[]\f[R], which will automatically be turned into array references
436 \f[B]FUNCTIONS\f[R] section) if the corresponding parameter in the
439 \f[B]read()\f[R]: Reads a line from \f[B]stdin\f[R] and uses that as an
441 The result of that expression is the result of the \f[B]read()\f[R]
443 This is a \f[B]non-portable extension\f[R].
445 \f[B]maxibase()\f[R]: The max allowable \f[B]ibase\f[R].
446 This is a \f[B]non-portable extension\f[R].
448 \f[B]maxobase()\f[R]: The max allowable \f[B]obase\f[R].
449 This is a \f[B]non-portable extension\f[R].
451 \f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
452 This is a \f[B]non-portable extension\f[R].
456 \f[B]1\f[R] period for a radix.
457 Numbers can have up to \f[B]BC_NUM_MAX\f[R] digits.
458 Uppercase letters are equal to \f[B]9\f[R] + their position in the
459 alphabet (i.e., \f[B]A\f[R] equals \f[B]10\f[R], or \f[B]9+1\f[R]).
461 \f[B]ibase\f[R], they are set to the value of the highest valid digit in
462 \f[B]ibase\f[R].
464 Single-character numbers (i.e., \f[B]A\f[R] alone) take the value that
466 \f[B]ibase\f[R].
467 This means that \f[B]A\f[R] alone always equals decimal \f[B]10\f[R] and
468 \f[B]Z\f[R] alone always equals decimal \f[B]35\f[R].
475 \f[B]++\f[R] \f[B]--\f[R]
487 \f[B]-\f[R] \f[B]!\f[R]
499 \f[B]\[ha]\f[R]
511 \f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
523 \f[B]+\f[R] \f[B]-\f[R]
535 \f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
536 \f[B]%=\f[R] \f[B]\[ha]=\f[R]
548 \f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
549 \f[B]>\f[R]
561 \f[B]&&\f[R]
573 \f[B]||\f[R]
587 \f[B]++\f[R] \f[B]--\f[R]
589 : The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
601 \f[B]-\f[R]
603 : The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
604 to negate any expression with the value \f[B]0\f[R].
607 \f[B]!\f[R]
609 : The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the
610 expression is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
614 This is a **non-portable extension**.
618 \f[B]\[ha]\f[R]
620 : The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
623 The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
628 negative, the first value must be non-zero.
632 \f[B]*\f[R]
634 : The \f[B]multiply\f[R] operator takes two expressions, multiplies
636 If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
637 \f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
639 \f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
640 \f[B]max()\f[R] return the obvious values.
642 \f[B]/\f[R]
644 : The \f[B]divide\f[R] operator takes two expressions, divides them, and
646 The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
650 The second expression must be non-zero.
654 \f[B]%\f[R]
656 : The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
657 \f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
658 \f[B]scale\f[R] and 2) Using the result of step 1 to calculate
659 \f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
660 \f[B]max(scale+scale(b),scale(a))\f[R].
664 The second expression must be non-zero.
668 \f[B]+\f[R]
670 : The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
671 \f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
672 max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
674 \f[B]-\f[R]
676 : The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
677 \f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
678 the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
680 \f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
681 \f[B]%=\f[R] \f[B]\[ha]=\f[R]
683 : The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R]
684 and \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the
689 For **=**, **b** is copied and the result is assigned to **a**. For all
690 others, **a** and **b** are applied as operands to the corresponding
695 \f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
696 \f[B]>\f[R]
698 : The \f[B]relational\f[R] operators compare two expressions,
699 \f[B]a\f[R] and \f[B]b\f[R], and if the relation holds, according to C
700 language semantics, the result is \f[B]1\f[R].
701 Otherwise, it is \f[B]0\f[R].
706 **assignment** operators, which means that **a=b\[rs]>c** is interpreted as
707 **(a=b)\[rs]>c**.
711 **non-portable extension**.
715 \f[B]&&\f[R]
717 : The \f[B]boolean and\f[R] operator takes two expressions and returns
718 \f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
722 This is *not* a short-circuit operator.
724 This is a **non-portable extension**.
728 \f[B]||\f[R]
730 : The \f[B]boolean or\f[R] operator takes two expressions and returns
731 \f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
736 This is *not* a short-circuit operator.
738 This is a **non-portable extension**.
745 \f[B]E\f[R]
747 \f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] ...
748 \f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
750 \f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
752 \f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
753 \f[B]else\f[R] \f[B]S\f[R]
755 \f[B]while\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
757 \f[B]for\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B];\f[R] \f[B]E\f[R]
758 \f[B];\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
762 \f[B]break\f[R]
764 \f[B]continue\f[R]
766 \f[B]quit\f[R]
768 \f[B]halt\f[R]
770 \f[B]limits\f[R]
774 \f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] ...
775 \f[B],\f[R] \f[B]E\f[R]
777 \f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
778 \f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
779 \f[I]Void Functions\f[R] subsection of the \f[B]FUNCTIONS\f[R] section).
780 The \f[B]E\f[R] argument(s) may also be arrays of the form
781 \f[B]I[]\f[R], which will automatically be turned into array references
783 \f[B]FUNCTIONS\f[R] section) if the corresponding parameter in the
786 Numbers 4, 9, 11, 12, 14, and 15 are \f[B]non-portable extensions\f[R].
788 Also, as a \f[B]non-portable extension\f[R], any or all of the
791 constant \f[B]1\f[R].
793 The \f[B]break\f[R] statement causes a loop to stop iterating and resume
797 The \f[B]continue\f[R] statement causes a loop iteration to stop early
802 The \f[B]if\f[R] \f[B]else\f[R] statement does the same thing as in C.
804 The \f[B]quit\f[R] statement causes bc(1) to quit, even if it is on a
805 branch that will not be executed (it is a compile-time command).
807 The \f[B]halt\f[R] statement causes bc(1) to quit, if it is executed.
808 (Unlike \f[B]quit\f[R] if it is on a branch of an \f[B]if\f[R] statement
811 The \f[B]limits\f[R] statement prints the limits that this bc(1) is
813 This is like the \f[B]quit\f[R] statement in that it is a compile-time
819 The \[dq]expressions\[dq] in a \f[B]print\f[R] statement may also be
828 \f[B]\[rs]a\f[R] \f[B]\[rs]a\f[R] \f[B]\[rs]b\f[R] \f[B]\[rs]b\f[R]
829 \f[B]\[rs]\[rs]\f[R] \f[B]\[rs]\f[R] \f[B]\[rs]e\f[R] \f[B]\[rs]\f[R]
830 \f[B]\[rs]f\f[R] \f[B]\[rs]f\f[R] \f[B]\[rs]n\f[R] \f[B]\[rs]n\f[R]
831 \f[B]\[rs]q\f[R] \f[B]\[dq]\f[R] \f[B]\[rs]r\f[R] \f[B]\[rs]r\f[R]
832 \f[B]\[rs]t\f[R] \f[B]\[rs]t\f[R]
837 character to be printed as-is.
839 Any non-string expression in a print statement shall be assigned to
840 \f[B]last\f[R], like any other expression that is printed.
845 This means, for example, assuming that \f[B]i\f[R] is equal to
846 \f[B]0\f[R], in the expression
854 the first (or 0th) element of \f[B]a\f[R] is set to \f[B]1\f[R], and
855 \f[B]i\f[R] is equal to \f[B]2\f[R] at the end of the expression.
858 Thus, assuming \f[B]i\f[R] is equal to \f[B]0\f[R], this means that in
867 the first argument passed to \f[B]x()\f[R] is \f[B]0\f[R], and the
868 second argument is \f[B]1\f[R], while \f[B]i\f[R] is equal to
869 \f[B]2\f[R] before the function starts executing.
884 Any \f[B]I\f[R] in the parameter list or \f[B]auto\f[R] list may be
885 replaced with \f[B]I[]\f[R] to make a parameter or \f[B]auto\f[R] var an
886 array, and any \f[B]I\f[R] in the parameter list may be replaced with
887 \f[B]*I[]\f[R] to make a parameter an array reference.
889 asterisk in the call; they must be called with just \f[B]I[]\f[R] like
893 As a \f[B]non-portable extension\f[R], the opening brace of a
894 \f[B]define\f[R] statement may appear on the next line.
896 As a \f[B]non-portable extension\f[R], the return statement may also be
899 \f[B]return\f[R]
901 \f[B]return\f[R] \f[B](\f[R] \f[B])\f[R]
903 \f[B]return\f[R] \f[B]E\f[R]
905 The first two, or not specifying a \f[B]return\f[R] statement, is
906 equivalent to \f[B]return (0)\f[R], unless the function is a
907 \f[B]void\f[R] function (see the \f[I]Void Functions\f[R] subsection
911 Functions can also be \f[B]void\f[R] functions, defined as follows:
926 Void functions can only use the first two \f[B]return\f[R] statements
931 possible to have variables, arrays, and functions named \f[B]void\f[R].
933 \f[B]define\f[R] keyword.
935 This is a \f[B]non-portable extension\f[R].
947 it is a \f[B]reference\f[R].
953 This is a \f[B]non-portable extension\f[R].
956 All of the functions below are available when the \f[B]-l\f[R] or
957 \f[B]--mathlib\f[R] command-line flags are given.
964 \f[B]s(x)\f[R]
966 : Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
975 \f[B]c(x)\f[R]
977 : Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
986 \f[B]a(x)\f[R]
988 : Returns the arctangent of \f[B]x\f[R], in radians.
997 \f[B]l(x)\f[R]
999 : Returns the natural logarithm of \f[B]x\f[R].
1008 \f[B]e(x)\f[R]
1010 : Returns the mathematical constant \f[B]e\f[R] raised to the power of
1011 \f[B]x\f[R].
1020 \f[B]j(x, n)\f[R]
1022 : Returns the bessel integer order \f[B]n\f[R] (truncated) of
1023 \f[B]x\f[R].
1041 functions with the precision (\f[B]scale\f[R]) set to at least 1 higher
1044 precision (\f[B]scale\f[R]) and then truncate.
1048 \f[B]s(x)\f[R]
1050 \f[B]c(x)\f[R]
1052 \f[B]a(x)\f[R]
1054 \f[B]l(x)\f[R]
1056 \f[B]e(x)\f[R]
1058 \f[B]j(x, n)\f[R]
1061 When bc(1) encounters an error or a signal that it has a non-default
1074 (see the \f[B]EXIT STATUS\f[R] section), it asks for more input;
1082 Most bc(1) implementations use \f[B]char\f[R] types to calculate the
1083 value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
1086 It uses large integers to calculate more than \f[B]1\f[R] decimal digit
1088 If built in a environment where \f[B]BC_LONG_BIT\f[R] (see the
1089 \f[B]LIMITS\f[R] section) is \f[B]64\f[R], then each integer has
1090 \f[B]9\f[R] decimal digits.
1091 If built in an environment where \f[B]BC_LONG_BIT\f[R] is \f[B]32\f[R]
1092 then each integer has \f[B]4\f[R] decimal digits.
1094 \f[B]BC_BASE_DIGS\f[R].
1096 The actual values of \f[B]BC_LONG_BIT\f[R] and \f[B]BC_BASE_DIGS\f[R]
1097 can be queried with the \f[B]limits\f[R] statement.
1101 This integer type depends on the value of \f[B]BC_LONG_BIT\f[R], but is
1107 \f[B]BC_LONG_BIT\f[R]
1109 : The number of bits in the \f[B]long\f[R] type in the environment where
1112 integer (see the \f[B]PERFORMANCE\f[R] section).
1114 \f[B]BC_BASE_DIGS\f[R]
1117 \f[B]PERFORMANCE\f[R] section).
1118 Depends on \f[B]BC_LONG_BIT\f[R].
1120 \f[B]BC_BASE_POW\f[R]
1123 \f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
1124 Depends on \f[B]BC_BASE_DIGS\f[R].
1126 \f[B]BC_OVERFLOW_MAX\f[R]
1128 : The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
1130 Depends on \f[B]BC_LONG_BIT\f[R].
1132 \f[B]BC_BASE_MAX\f[R]
1135 Set at \f[B]BC_BASE_POW\f[R].
1137 \f[B]BC_DIM_MAX\f[R]
1140 Set at \f[B]SIZE_MAX-1\f[R].
1142 \f[B]BC_SCALE_MAX\f[R]
1144 : The maximum \f[B]scale\f[R].
1145 Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
1147 \f[B]BC_STRING_MAX\f[R]
1150 Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
1152 \f[B]BC_NAME_MAX\f[R]
1155 Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
1157 \f[B]BC_NUM_MAX\f[R]
1161 Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
1166 Set at \f[B]BC_OVERFLOW_MAX\f[R].
1171 Set at \f[B]SIZE_MAX-1\f[R].
1173 The actual values can be queried with the \f[B]limits\f[R] statement.
1175 These limits are meant to be effectively non-existent; the limits are so
1176 large (at least on 64-bit machines) that there should not be any point
1183 \f[B]POSIXLY_CORRECT\f[R]
1186 the \f[B]-s\f[R] option was given.
1188 \f[B]BC_ENV_ARGS\f[R]
1190 : This is another way to give command-line arguments to bc(1).
1191 They should be in the same format as all other command-line arguments.
1193 \f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
1194 on the command-line.
1213 command-line where the parsing is done by the shell.
1217 \f[B]BC_LINE_LENGTH\f[R]
1220 greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
1221 (\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
1222 including the backslash (\f[B]\[rs]\f[R]).
1223 The default line length is \f[B]70\f[R].
1228 \f[B]0\f[R]
1232 \f[B]1\f[R]
1235 This follows standard practice of using \f[B]1\f[R] for expected errors,
1243 use a non-integer where an integer is required.
1250 \f[B]2\f[R]
1264 variable as a reference, and using any extensions when the option **-s** or
1269 \f[B]3\f[R]
1283 \f[B]4\f[R]
1292 and giving invalid command-line options.
1296 The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
1297 always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
1300 interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
1301 bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
1304 \f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
1308 \f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
1313 bc(1) has an interactive mode and a non-interactive mode.
1314 Interactive mode is turned on automatically when both \f[B]stdin\f[R]
1315 and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
1316 and \f[B]--interactive\f[R] option can turn it on in other cases.
1319 \f[B]RESET\f[R] section), and in normal execution, flushes
1320 \f[B]stdout\f[R] as soon as execution is done for the current input.
1323 If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
1326 TTY mode is required for history to be enabled (see the \f[B]COMMAND
1328 It is also required to enable special handling for \f[B]SIGINT\f[R]
1334 and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
1338 Sending a \f[B]SIGINT\f[R] will cause bc(1) to stop execution of the
1340 If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
1341 reset (see the \f[B]RESET\f[R] section).
1345 If bc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
1349 or ask for input from \f[B]stdin\f[R] if no other file exists.
1351 This means that if a \f[B]SIGINT\f[R] is sent to bc(1) as it is
1360 \f[B]SIGTERM\f[R] and \f[B]SIGQUIT\f[R] cause bc(1) to clean up and
1362 The one exception is \f[B]SIGHUP\f[R]; in that case, when bc(1) is in
1363 TTY mode, a \f[B]SIGHUP\f[R] will cause bc(1) to clean up and exit.
1366 bc(1) supports interactive command-line editing.
1367 If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), history is
1371 \f[B]Note\f[R]: tabs are converted to 8 spaces.
1377 bc(1) is compliant with the IEEE Std 1003.1-2017
1378 (\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
1380 The flags \f[B]-efghiqsvVw\f[R], all long options, and the extensions
1384 numbers that use a period (\f[B].\f[R]) as a radix point, regardless of
1385 the value of \f[B]LC_NUMERIC\f[R].