aboutsummaryrefslogtreecommitdiff
path: root/contrib/bc/manuals
diff options
context:
space:
mode:
authorStefan Eßer <se@FreeBSD.org>2021-04-06 08:48:09 +0000
committerStefan Eßer <se@FreeBSD.org>2021-04-06 08:48:09 +0000
commit7e5c51e523ae2a0b4f00cf5d6b9168e053d8eed1 (patch)
tree2e2c2be3547a2d6ce49e86f63a6ef950df2ce695 /contrib/bc/manuals
parent42cd37dfbd1b2feff8f7aba32d2577e08b058231 (diff)
parent7a590c074ceede12b2b6e794f8703d6fa5749918 (diff)
downloadsrc-7e5c51e523ae2a0b4f00cf5d6b9168e053d8eed1.tar.gz
src-7e5c51e523ae2a0b4f00cf5d6b9168e053d8eed1.zip
Merge commit '7a590c074ceede12b2b6e794f8703d6fa5749918'
Update to version 4.0.0 This version fixes an issue (missing pop of top-of-stack value in the "P" command of the dc program). This issue did not affect the bc program, since it does not use dc as an back-end to actually perform the calculations as was the case with the traditional bc and dc programs. The major number has been bumped due to Windows support that has been added to this version. It does not correspond to a major change that might affect FreeBSD.
Diffstat (limited to 'contrib/bc/manuals')
-rw-r--r--contrib/bc/manuals/bc.1.md.in23
-rw-r--r--contrib/bc/manuals/bc/A.11899
-rw-r--r--contrib/bc/manuals/bc/A.1.md18
-rw-r--r--contrib/bc/manuals/bc/E.1905
-rw-r--r--contrib/bc/manuals/bc/E.1.md18
-rw-r--r--contrib/bc/manuals/bc/EH.1905
-rw-r--r--contrib/bc/manuals/bc/EH.1.md18
-rw-r--r--contrib/bc/manuals/bc/EHN.1905
-rw-r--r--contrib/bc/manuals/bc/EHN.1.md18
-rw-r--r--contrib/bc/manuals/bc/EHNP.1894
-rw-r--r--contrib/bc/manuals/bc/EHNP.1.md8
-rw-r--r--contrib/bc/manuals/bc/EHP.1894
-rw-r--r--contrib/bc/manuals/bc/EHP.1.md8
-rw-r--r--contrib/bc/manuals/bc/EN.1905
-rw-r--r--contrib/bc/manuals/bc/EN.1.md18
-rw-r--r--contrib/bc/manuals/bc/ENP.1894
-rw-r--r--contrib/bc/manuals/bc/ENP.1.md8
-rw-r--r--contrib/bc/manuals/bc/EP.1894
-rw-r--r--contrib/bc/manuals/bc/EP.1.md8
-rw-r--r--contrib/bc/manuals/bc/H.11899
-rw-r--r--contrib/bc/manuals/bc/H.1.md18
-rw-r--r--contrib/bc/manuals/bc/HN.11899
-rw-r--r--contrib/bc/manuals/bc/HN.1.md18
-rw-r--r--contrib/bc/manuals/bc/HNP.11884
-rw-r--r--contrib/bc/manuals/bc/HNP.1.md8
-rw-r--r--contrib/bc/manuals/bc/HP.11884
-rw-r--r--contrib/bc/manuals/bc/HP.1.md8
-rw-r--r--contrib/bc/manuals/bc/N.11899
-rw-r--r--contrib/bc/manuals/bc/N.1.md18
-rw-r--r--contrib/bc/manuals/bc/NP.11884
-rw-r--r--contrib/bc/manuals/bc/NP.1.md8
-rw-r--r--contrib/bc/manuals/bc/P.11884
-rw-r--r--contrib/bc/manuals/bc/P.1.md8
-rw-r--r--contrib/bc/manuals/bcl.31751
-rw-r--r--contrib/bc/manuals/build.md121
-rw-r--r--contrib/bc/manuals/dc.1.md.in61
-rw-r--r--contrib/bc/manuals/dc/A.11386
-rw-r--r--contrib/bc/manuals/dc/A.1.md56
-rw-r--r--contrib/bc/manuals/dc/E.11197
-rw-r--r--contrib/bc/manuals/dc/E.1.md56
-rw-r--r--contrib/bc/manuals/dc/EH.11197
-rw-r--r--contrib/bc/manuals/dc/EH.1.md56
-rw-r--r--contrib/bc/manuals/dc/EHN.11197
-rw-r--r--contrib/bc/manuals/dc/EHN.1.md56
-rw-r--r--contrib/bc/manuals/dc/EHNP.11185
-rw-r--r--contrib/bc/manuals/dc/EHNP.1.md46
-rw-r--r--contrib/bc/manuals/dc/EHP.11185
-rw-r--r--contrib/bc/manuals/dc/EHP.1.md46
-rw-r--r--contrib/bc/manuals/dc/EN.11197
-rw-r--r--contrib/bc/manuals/dc/EN.1.md56
-rw-r--r--contrib/bc/manuals/dc/ENP.11185
-rw-r--r--contrib/bc/manuals/dc/ENP.1.md46
-rw-r--r--contrib/bc/manuals/dc/EP.11185
-rw-r--r--contrib/bc/manuals/dc/EP.1.md46
-rw-r--r--contrib/bc/manuals/dc/H.11386
-rw-r--r--contrib/bc/manuals/dc/H.1.md56
-rw-r--r--contrib/bc/manuals/dc/HN.11386
-rw-r--r--contrib/bc/manuals/dc/HN.1.md56
-rw-r--r--contrib/bc/manuals/dc/HNP.11374
-rw-r--r--contrib/bc/manuals/dc/HNP.1.md46
-rw-r--r--contrib/bc/manuals/dc/HP.11374
-rw-r--r--contrib/bc/manuals/dc/HP.1.md46
-rw-r--r--contrib/bc/manuals/dc/N.11386
-rw-r--r--contrib/bc/manuals/dc/N.1.md56
-rw-r--r--contrib/bc/manuals/dc/NP.11374
-rw-r--r--contrib/bc/manuals/dc/NP.1.md46
-rw-r--r--contrib/bc/manuals/dc/P.11374
-rw-r--r--contrib/bc/manuals/dc/P.1.md46
-rw-r--r--contrib/bc/manuals/header_bc.txt2
-rw-r--r--contrib/bc/manuals/header_bcl.txt2
-rw-r--r--contrib/bc/manuals/header_dc.txt2
71 files changed, 26045 insertions, 19837 deletions
diff --git a/contrib/bc/manuals/bc.1.md.in b/contrib/bc/manuals/bc.1.md.in
index 661fcdd45ae4..d182dd7ab411 100644
--- a/contrib/bc/manuals/bc.1.md.in
+++ b/contrib/bc/manuals/bc.1.md.in
@@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -181,7 +181,7 @@ The following are the options that bc(1) accepts.
{{ A E H N EH EN HN EHN }}
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
@@ -192,6 +192,25 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+{{ A E H N EH EN HN EHN }}
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in bc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of bc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **read()** built-in function is called.
+{{ end }}
+{{ P EP HP NP EHP ENP HNP EHNP }}
+: Because bc(1) was built without support for prompts, this option is a no-op.
+{{ end }}
+
+ This is a **non-portable extension**.
+
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
diff --git a/contrib/bc/manuals/bc/A.1 b/contrib/bc/manuals/bc/A.1
index b38d8d35e71b..2cb0a11943cc 100644
--- a/contrib/bc/manuals/bc/A.1
+++ b/contrib/bc/manuals/bc/A.1
@@ -25,19 +25,19 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+\f[B]bc\f[R] [\f[B]-ghilPqRsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
-[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
-[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
+[\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
@@ -58,210 +58,233 @@ implementations.
.SH OPTIONS
.PP
The following are the options that bc(1) accepts.
-.TP
+.PP
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
-Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
-\f[B]seed\f[R] into stacks.
-.RS
.PP
-This has the effect that a copy of the current value of all four are
-pushed onto a stack for every function call, as well as popped when
-every function returns.
-This means that functions can assign to any and all of those globals
-without worrying that the change will affect other functions.
-Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply
-printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this:
+: Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R],
+and \f[B]seed\f[R] into stacks.
.IP
.nf
\f[C]
-define void output(x, b) {
- obase=b
- x
-}
+This has the effect that a copy of the current value of all four are pushed
+onto a stack for every function call, as well as popped when every function
+returns. This means that functions can assign to any and all of those
+globals without worrying that the change will affect other functions.
+Thus, a hypothetical function named **output(x,b)** that simply printed
+**x** in base **b** could be written like this:
+
+ define void output(x, b) {
+ obase=b
+ x
+ }
+
+instead of like this:
+
+ define void output(x, b) {
+ auto c
+ c=obase
+ obase=b
+ x
+ obase=c
+ }
+
+This makes writing functions much easier.
+
+(**Note**: the function **output(x,b)** exists in the extended math library.
+ See the **LIBRARY** section.)
+
+However, since using this flag means that functions cannot set **ibase**,
+**obase**, **scale**, or **seed** globally, functions that are made to do so
+cannot work anymore. There are two possible use cases for that, and each has
+a solution.
+
+First, if a function is called on startup to turn bc(1) into a number
+converter, it is possible to replace that capability with various shell
+aliases. Examples:
+
+ alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
+ alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
+
+Second, if the purpose of a function is to set **ibase**, **obase**,
+**scale**, or **seed** globally for any other purpose, it could be split
+into one to four functions (based on how many globals it sets) and each of
+those functions could return the desired value for a global.
+
+For functions that set **seed**, the value assigned to **seed** is not
+propagated to parent functions. This means that the sequence of
+pseudo-random numbers that they see will not be the same sequence of
+pseudo-random numbers that any parent sees. This is only the case once
+**seed** has been set.
+
+If a function desires to not affect the sequence of pseudo-random numbers
+of its parents, but wants to use the same **seed**, it can use the following
+line:
+
+ seed = seed
+
+If the behavior of this option is desired for every run of bc(1), then users
+could make sure to define **BC_ENV_ARGS** and include this option (see the
+**ENVIRONMENT VARIABLES** section for more details).
+
+If **-s**, **-w**, or any equivalents are used, this option is ignored.
+
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-instead of like this:
+\f[B]-h\f[R], \f[B]--help\f[R]
+.PP
+: Prints a usage message and quits.
+.PP
+\f[B]-i\f[R], \f[B]--interactive\f[R]
+.PP
+: Forces interactive mode.
+(See the \f[B]INTERACTIVE MODE\f[R] section.)
.IP
.nf
\f[C]
-define void output(x, b) {
- auto c
- c=obase
- obase=b
- x
- obase=c
-}
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-This makes writing functions much easier.
-.PP
-(\f[B]Note\f[R]: the function \f[B]output(x,b)\f[R] exists in the
-extended math library.
-See the \f[B]LIBRARY\f[R] section.)
-.PP
-However, since using this flag means that functions cannot set
-\f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R]
-globally, functions that are made to do so cannot work anymore.
-There are two possible use cases for that, and each has a solution.
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
.PP
-First, if a function is called on startup to turn bc(1) into a number
-converter, it is possible to replace that capability with various shell
-aliases.
-Examples:
+: Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to
+\f[B]20\f[R] and loads the included math library and the extended math
+library before running any code, including any expressions or files
+specified on the command line.
.IP
.nf
\f[C]
-alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
-alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
+To learn what is in the libraries, see the **LIBRARY** section.
\f[R]
.fi
.PP
-Second, if the purpose of a function is to set \f[B]ibase\f[R],
-\f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R] globally for any
-other purpose, it could be split into one to four functions (based on
-how many globals it sets) and each of those functions could return the
-desired value for a global.
-.PP
-For functions that set \f[B]seed\f[R], the value assigned to
-\f[B]seed\f[R] is not propagated to parent functions.
-This means that the sequence of pseudo-random numbers that they see will
-not be the same sequence of pseudo-random numbers that any parent sees.
-This is only the case once \f[B]seed\f[R] has been set.
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
.PP
-If a function desires to not affect the sequence of pseudo-random
-numbers of its parents, but wants to use the same \f[B]seed\f[R], it can
-use the following line:
+: Disables the prompt in TTY mode.
+(The prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a prompt or are not used to having them in bc(1).
+Most of those users would want to put this option in
+\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.IP
.nf
\f[C]
-seed = seed
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-If the behavior of this option is desired for every run of bc(1), then
-users could make sure to define \f[B]BC_ENV_ARGS\f[R] and include this
-option (see the \f[B]ENVIRONMENT VARIABLES\f[R] section for more
-details).
-.PP
-If \f[B]-s\f[R], \f[B]-w\f[R], or any equivalents are used, this option
-is ignored.
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
-\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
-(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]-l\f[R], \f[B]--mathlib\f[R]
-Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
-and loads the included math library and the extended math library before
-running any code, including any expressions or files specified on the
-command line.
-.RS
-.PP
-To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
-.RE
-.TP
-\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-Disables the prompt in TTY mode.
-(The prompt is only enabled in TTY mode.
-See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
-do not want a prompt or are not used to having them in bc(1).
+: Disables the read prompt in TTY mode.
+(The read prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a read prompt or are not used to having them in bc(1).
Most of those users would want to put this option in
\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
-.RS
+This option is also useful in hash bang lines of bc(1) scripts that
+prompt for user input.
+.IP
+.nf
+\f[C]
+This option does not disable the regular prompt because the read prompt is
+only used when the **read()** built-in function is called.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
+.PP
+: This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-s\f[R], \f[B]--standard\f[R]
-Process exactly the language defined by the
+.PP
+: Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Print the version information (copyright header) and exit.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-w\f[R], \f[B]--warn\f[R]
-Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
+.PP
+: Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]BC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -318,7 +341,7 @@ Identifiers with more than one character (letter) are a
.PP
\f[B]ibase\f[R] is a global variable determining how to interpret
constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
@@ -330,7 +353,7 @@ The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
programs with the \f[B]maxibase()\f[R] built-in function.
.PP
\f[B]obase\f[R] is a global variable determining how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
@@ -502,7 +525,7 @@ This is a \f[B]non-portable extension\f[R].
.IP "15." 4
\f[B]irand(E)\f[R]: A pseudo-random integer between \f[B]0\f[R]
(inclusive) and the value of \f[B]E\f[R] (exclusive).
-If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[cq]s
+If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[aq]s
\f[I]scale\f[R] is not \f[B]0\f[R]), an error is raised, and bc(1)
resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R] remains
unchanged.
@@ -580,301 +603,377 @@ extension\f[R].
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-Type: Prefix and Postfix
-.RS
.PP
+: Type: Prefix and Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **increment**, **decrement**
+\f[R]
+.fi
.PP
-Description: \f[B]increment\f[R], \f[B]decrement\f[R]
-.RE
-.TP
\f[B]-\f[R] \f[B]!\f[R]
-Type: Prefix
-.RS
.PP
+: Type: Prefix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **negation**, **boolean not**
+\f[R]
+.fi
.PP
-Description: \f[B]negation\f[R], \f[B]boolean not\f[R]
-.RE
-.TP
\f[B]$\f[R]
-Type: Postfix
-.RS
.PP
+: Type: Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **truncation**
+\f[R]
+.fi
.PP
-Description: \f[B]truncation\f[R]
-.RE
-.TP
\f[B]\[at]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **set precision**
+\f[R]
+.fi
.PP
-Description: \f[B]set precision\f[R]
-.RE
-.TP
\f[B]\[ha]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **power**
+\f[R]
+.fi
.PP
-Description: \f[B]power\f[R]
-.RE
-.TP
\f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **multiply**, **divide**, **modulus**
+\f[R]
+.fi
.PP
-Description: \f[B]multiply\f[R], \f[B]divide\f[R], \f[B]modulus\f[R]
-.RE
-.TP
\f[B]+\f[R] \f[B]-\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **add**, **subtract**
+\f[R]
+.fi
.PP
-Description: \f[B]add\f[R], \f[B]subtract\f[R]
-.RE
-.TP
\f[B]<<\f[R] \f[B]>>\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **shift left**, **shift right**
+\f[R]
+.fi
.PP
-Description: \f[B]shift left\f[R], \f[B]shift right\f[R]
-.RE
-.TP
-\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
-Type: Binary
-.RS
+\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R]
+\f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **assignment**
+\f[R]
+.fi
.PP
-Description: \f[B]assignment\f[R]
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-Type: Binary
-.RS
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **relational**
+\f[R]
+.fi
.PP
-Description: \f[B]relational\f[R]
-.RE
-.TP
\f[B]&&\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **boolean and**
+\f[R]
+.fi
.PP
-Description: \f[B]boolean and\f[R]
-.RE
-.TP
\f[B]||\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
-.PP
-Description: \f[B]boolean or\f[R]
-.RE
+
+Description: **boolean or**
+\f[R]
+.fi
.PP
The operators will be described in more detail below.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
+.PP
+: The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
subsection) as an operand.
-.RS
+.IP
+.nf
+\f[C]
+The prefix versions of these operators are more efficient; use them where
+possible.
+\f[R]
+.fi
.PP
-The prefix versions of these operators are more efficient; use them
-where possible.
-.RE
-.TP
\f[B]-\f[R]
-The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
+.PP
+: The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
to negate any expression with the value \f[B]0\f[R].
Otherwise, a copy of the expression with its sign flipped is returned.
-.TP
+.PP
\f[B]!\f[R]
-The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the expression
-is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the
+expression is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]$\f[R]
-The \f[B]truncation\f[R] operator returns a copy of the given expression
-with all of its \f[I]scale\f[R] removed.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]truncation\f[R] operator returns a copy of the given
+expression with all of its \f[I]scale\f[R] removed.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]\[at]\f[R]
-The \f[B]set precision\f[R] operator takes two expressions and returns a
-copy of the first with its \f[I]scale\f[R] equal to the value of the
+.PP
+: The \f[B]set precision\f[R] operator takes two expressions and returns
+a copy of the first with its \f[I]scale\f[R] equal to the value of the
second expression.
That could either mean that the number is returned without change (if
the \f[I]scale\f[R] of the first expression matches the value of the
second expression), extended (if it is less), or truncated (if it is
more).
-.RS
-.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
+.PP
+: The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
as it would be in C) takes two expressions and raises the first to the
power of the value of the second.
The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*), and if it is
+negative, the first value must be non-zero.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]), and if it
-is negative, the first value must be non-zero.
-.RE
-.TP
\f[B]*\f[R]
-The \f[B]multiply\f[R] operator takes two expressions, multiplies them,
-and returns the product.
+.PP
+: The \f[B]multiply\f[R] operator takes two expressions, multiplies
+them, and returns the product.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The \f[B]divide\f[R] operator takes two expressions, divides them, and
+.PP
+: The \f[B]divide\f[R] operator takes two expressions, divides them, and
returns the quotient.
The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]%\f[R]
-The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
\f[B]scale\f[R] and 2) Using the result of step 1 to calculate
\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
\f[B]max(scale+scale(b),scale(a))\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]+\f[R]
-The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]-\f[R]
-The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]<<\f[R]
-The \f[B]left shift\f[R] operator takes two expressions, \f[B]a\f[R] and
-\f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
-decimal point moved \f[B]b\f[R] places to the right.
-.RS
.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+: The \f[B]left shift\f[R] operator takes two expressions, \f[B]a\f[R]
+and \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
+decimal point moved \f[B]b\f[R] places to the right.
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]>>\f[R]
-The \f[B]right shift\f[R] operator takes two expressions, \f[B]a\f[R]
+.PP
+: The \f[B]right shift\f[R] operator takes two expressions, \f[B]a\f[R]
and \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
decimal point moved \f[B]b\f[R] places to the left.
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R]
+\f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
-The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R] and
-\f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the \f[I]Named
-Expressions\f[R] subsection).
-.RS
-.PP
-For \f[B]=\f[R], \f[B]b\f[R] is copied and the result is assigned to
-\f[B]a\f[R].
-For all others, \f[B]a\f[R] and \f[B]b\f[R] are applied as operands to
-the corresponding arithmetic operator and the result is assigned to
-\f[B]a\f[R].
-.PP
-The \f[B]assignment\f[R] operators that correspond to operators that are
-extensions are themselves \f[B]non-portable extensions\f[R].
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-The \f[B]relational\f[R] operators compare two expressions, \f[B]a\f[R]
-and \f[B]b\f[R], and if the relation holds, according to C language
-semantics, the result is \f[B]1\f[R].
-Otherwise, it is \f[B]0\f[R].
-.RS
+: The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R]
+and \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the
+\f[I]Named Expressions\f[R] subsection).
+.IP
+.nf
+\f[C]
+For **=**, **b** is copied and the result is assigned to **a**. For all
+others, **a** and **b** are applied as operands to the corresponding
+arithmetic operator and the result is assigned to **a**.
+
+The **assignment** operators that correspond to operators that are
+extensions are themselves **non-portable extensions**.
+\f[R]
+.fi
+.PP
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: The \f[B]relational\f[R] operators compare two expressions,
+\f[B]a\f[R] and \f[B]b\f[R], and if the relation holds, according to C
+language semantics, the result is \f[B]1\f[R].
+Otherwise, it is \f[B]0\f[R].
+.IP
+.nf
+\f[C]
Note that unlike in C, these operators have a lower precedence than the
-\f[B]assignment\f[R] operators, which means that \f[B]a=b>c\f[R] is
-interpreted as \f[B](a=b)>c\f[R].
+**assignment** operators, which means that **a=b\[rs]>c** is interpreted as
+**(a=b)\[rs]>c**.
+
+Also, unlike the [standard][1] requires, these operators can appear anywhere
+any other expressions can be used. This allowance is a
+**non-portable extension**.
+\f[R]
+.fi
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-requires, these operators can appear anywhere any other expressions can
-be used.
-This allowance is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]&&\f[R]
-The \f[B]boolean and\f[R] operator takes two expressions and returns
-\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
-.RS
.PP
-This is \f[I]not\f[R] a short-circuit operator.
+: The \f[B]boolean and\f[R] operator takes two expressions and returns
+\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]||\f[R]
-The \f[B]boolean or\f[R] operator takes two expressions and returns
+.PP
+: The \f[B]boolean or\f[R] operator takes two expressions and returns
\f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
otherwise.
-.RS
-.PP
-This is \f[I]not\f[R] a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Statements
.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
.IP " 2." 4
-\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] \&... \f[B];\f[R] \f[B]S\f[R]
-\f[B]}\f[R]
+\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] ...
+\f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
.IP " 3." 4
\f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
.IP " 4." 4
@@ -900,7 +999,8 @@ An empty statement
.IP "13." 4
A string of characters, enclosed in double quotes
.IP "14." 4
-\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] \&... \f[B],\f[R] \f[B]E\f[R]
+\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] ...
+\f[B],\f[R] \f[B]E\f[R]
.IP "15." 4
\f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
\f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
@@ -958,62 +1058,22 @@ Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
.SS Print Statement
.PP
-The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
+The \[dq]expressions\[dq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
specially.
What those sequences are, and what they cause to be printed, are shown
below:
.PP
-.TS
-tab(@);
-l l.
-T{
-\f[B]\[rs]a\f[R]
-T}@T{
-\f[B]\[rs]a\f[R]
-T}
-T{
-\f[B]\[rs]b\f[R]
-T}@T{
-\f[B]\[rs]b\f[R]
-T}
-T{
-\f[B]\[rs]\[rs]\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]e\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]f\f[R]
-T}@T{
-\f[B]\[rs]f\f[R]
-T}
-T{
-\f[B]\[rs]n\f[R]
-T}@T{
-\f[B]\[rs]n\f[R]
-T}
-T{
-\f[B]\[rs]q\f[R]
-T}@T{
-\f[B]\[dq]\f[R]
-T}
-T{
-\f[B]\[rs]r\f[R]
-T}@T{
-\f[B]\[rs]r\f[R]
-T}
-T{
-\f[B]\[rs]t\f[R]
-T}@T{
-\f[B]\[rs]t\f[R]
-T}
-.TE
+ * * * * *
+.PP
+\f[B]\[rs]a\f[R] \f[B]\[rs]a\f[R] \f[B]\[rs]b\f[R] \f[B]\[rs]b\f[R]
+\f[B]\[rs]\[rs]\f[R] \f[B]\[rs]\f[R] \f[B]\[rs]e\f[R] \f[B]\[rs]\f[R]
+\f[B]\[rs]f\f[R] \f[B]\[rs]f\f[R] \f[B]\[rs]n\f[R] \f[B]\[rs]n\f[R]
+\f[B]\[rs]q\f[R] \f[B]\[dq]\f[R] \f[B]\[rs]r\f[R] \f[B]\[rs]r\f[R]
+\f[B]\[rs]t\f[R] \f[B]\[rs]t\f[R]
+.PP
+ * * * * *
.PP
Any other character following a backslash causes the backslash and
character to be printed as-is.
@@ -1109,9 +1169,9 @@ Void functions can only use the first two \f[B]return\f[R] statements
listed above.
They can also omit the return statement entirely.
.PP
-The word \[lq]void\[rq] is not treated as a keyword; it is still
+The word \[dq]void\[dq] is not treated as a keyword; it is still
possible to have variables, arrays, and functions named \f[B]void\f[R].
-The word \[lq]void\[rq] is only treated specially right after the
+The word \[dq]void\[dq] is only treated specially right after the
\f[B]define\f[R] keyword.
.PP
This is a \f[B]non-portable extension\f[R].
@@ -1146,55 +1206,74 @@ are given.
The
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
-.TP
+.PP
\f[B]s(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]c(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l(x)\f[R]
-Returns the natural logarithm of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the natural logarithm of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]e(x)\f[R]
-Returns the mathematical constant \f[B]e\f[R] raised to the power of
+.PP
+: Returns the mathematical constant \f[B]e\f[R] raised to the power of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]j(x, n)\f[R]
-Returns the bessel integer order \f[B]n\f[R] (truncated) of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
+: Returns the bessel integer order \f[B]n\f[R] (truncated) of
+\f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
@@ -1203,99 +1282,126 @@ options are given since they are not part of the library defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
The extended library is a \f[B]non-portable extension\f[R].
-.TP
+.PP
\f[B]p(x, y)\f[R]
-Calculates \f[B]x\f[R] to the power of \f[B]y\f[R], even if \f[B]y\f[R]
-is not an integer, and returns the result to the current
-\f[B]scale\f[R].
-.RS
.PP
-It is an error if \f[B]y\f[R] is negative and \f[B]x\f[R] is
-\f[B]0\f[R].
+: Calculates \f[B]x\f[R] to the power of \f[B]y\f[R], even if
+\f[B]y\f[R] is not an integer, and returns the result to the current
+\f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+It is an error if **y** is negative and **x** is **0**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]r(x, p)\f[R]
-Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
+.PP
+: Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
the rounding mode round half away from
\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
-.TP
+.PP
\f[B]ceil(x, p)\f[R]
-Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
+.PP
+: Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
the rounding mode round away from
\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero).
-.TP
+.PP
\f[B]f(x)\f[R]
-Returns the factorial of the truncated absolute value of \f[B]x\f[R].
-.TP
+.PP
+: Returns the factorial of the truncated absolute value of \f[B]x\f[R].
+.PP
\f[B]perm(n, k)\f[R]
-Returns the permutation of the truncated absolute value of \f[B]n\f[R]
+.PP
+: Returns the permutation of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
If not, it returns \f[B]0\f[R].
-.TP
+.PP
\f[B]comb(n, k)\f[R]
-Returns the combination of the truncated absolute value of \f[B]n\f[R]
+.PP
+: Returns the combination of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
If not, it returns \f[B]0\f[R].
-.TP
+.PP
\f[B]l2(x)\f[R]
-Returns the logarithm base \f[B]2\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]2\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l10(x)\f[R]
-Returns the logarithm base \f[B]10\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]10\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]log(x, b)\f[R]
-Returns the logarithm base \f[B]b\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]b\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]cbrt(x)\f[R]
-Returns the cube root of \f[B]x\f[R].
-.TP
+.PP
+: Returns the cube root of \f[B]x\f[R].
+.PP
\f[B]root(x, n)\f[R]
-Calculates the truncated value of \f[B]n\f[R], \f[B]r\f[R], and returns
-the \f[B]r\f[R]th root of \f[B]x\f[R] to the current \f[B]scale\f[R].
-.RS
-.PP
-If \f[B]r\f[R] is \f[B]0\f[R] or negative, this raises an error and
-causes bc(1) to reset (see the \f[B]RESET\f[R] section).
-It also raises an error and causes bc(1) to reset if \f[B]r\f[R] is even
-and \f[B]x\f[R] is negative.
-.RE
-.TP
+.PP
+: Calculates the truncated value of \f[B]n\f[R], \f[B]r\f[R], and
+returns the \f[B]r\f[R]th root of \f[B]x\f[R] to the current
+\f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+If **r** is **0** or negative, this raises an error and causes bc(1) to
+reset (see the **RESET** section). It also raises an error and causes bc(1)
+to reset if **r** is even and **x** is negative.
+\f[R]
+.fi
+.PP
\f[B]pi(p)\f[R]
-Returns \f[B]pi\f[R] to \f[B]p\f[R] decimal places.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns \f[B]pi\f[R] to \f[B]p\f[R] decimal places.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]t(x)\f[R]
-Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a2(y, x)\f[R]
-Returns the arctangent of \f[B]y/x\f[R], in radians.
+.PP
+: Returns the arctangent of \f[B]y/x\f[R], in radians.
If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
@@ -1308,60 +1414,75 @@ If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
\f[B]0\f[R], it returns \f[B]pi/2\f[R].
If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
\f[B]0\f[R], it returns \f[B]-pi/2\f[R].
-.RS
-.PP
-This function is the same as the \f[B]atan2()\f[R] function in many
-programming languages.
+.IP
+.nf
+\f[C]
+This function is the same as the **atan2()** function in many programming
+languages.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]sin(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is an alias of \f[B]s(x)\f[R].
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **s(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]cos(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is an alias of \f[B]c(x)\f[R].
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **c(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]tan(x)\f[R]
-Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-If \f[B]x\f[R] is equal to \f[B]1\f[R] or \f[B]-1\f[R], this raises an
-error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
-.PP
-This is an alias of \f[B]t(x)\f[R].
+: Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+If **x** is equal to **1** or **-1**, this raises an error and causes bc(1)
+to reset (see the **RESET** section).
+
+This is an alias of **t(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]atan(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is an alias of \f[B]a(x)\f[R].
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **a(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]atan2(y, x)\f[R]
-Returns the arctangent of \f[B]y/x\f[R], in radians.
+.PP
+: Returns the arctangent of \f[B]y/x\f[R], in radians.
If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
@@ -1374,302 +1495,367 @@ If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
\f[B]0\f[R], it returns \f[B]pi/2\f[R].
If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
\f[B]0\f[R], it returns \f[B]-pi/2\f[R].
-.RS
-.PP
-This function is the same as the \f[B]atan2()\f[R] function in many
-programming languages.
-.PP
-This is an alias of \f[B]a2(y, x)\f[R].
+.IP
+.nf
+\f[C]
+This function is the same as the **atan2()** function in many programming
+languages.
+
+This is an alias of **a2(y, x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]r2d(x)\f[R]
-Converts \f[B]x\f[R] from radians to degrees and returns the result.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Converts \f[B]x\f[R] from radians to degrees and returns the result.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]d2r(x)\f[R]
-Converts \f[B]x\f[R] from degrees to radians and returns the result.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Converts \f[B]x\f[R] from degrees to radians and returns the result.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]frand(p)\f[R]
-Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
+.PP
+: Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
\f[B]1\f[R] (exclusive) with the number of decimal digits after the
decimal point equal to the truncated absolute value of \f[B]p\f[R].
If \f[B]p\f[R] is not \f[B]0\f[R], then calling this function will
change the value of \f[B]seed\f[R].
If \f[B]p\f[R] is \f[B]0\f[R], then \f[B]0\f[R] is returned, and
\f[B]seed\f[R] is \f[I]not\f[R] changed.
-.TP
+.PP
\f[B]ifrand(i, p)\f[R]
-Generates a pseudo-random number that is between \f[B]0\f[R] (inclusive)
-and the truncated absolute value of \f[B]i\f[R] (exclusive) with the
-number of decimal digits after the decimal point equal to the truncated
-absolute value of \f[B]p\f[R].
+.PP
+: Generates a pseudo-random number that is between \f[B]0\f[R]
+(inclusive) and the truncated absolute value of \f[B]i\f[R] (exclusive)
+with the number of decimal digits after the decimal point equal to the
+truncated absolute value of \f[B]p\f[R].
If the absolute value of \f[B]i\f[R] is greater than or equal to
\f[B]2\f[R], and \f[B]p\f[R] is not \f[B]0\f[R], then calling this
function will change the value of \f[B]seed\f[R]; otherwise, \f[B]0\f[R]
is returned and \f[B]seed\f[R] is not changed.
-.TP
+.PP
\f[B]srand(x)\f[R]
-Returns \f[B]x\f[R] with its sign flipped with probability
+.PP
+: Returns \f[B]x\f[R] with its sign flipped with probability
\f[B]0.5\f[R].
In other words, it randomizes the sign of \f[B]x\f[R].
-.TP
+.PP
\f[B]brand()\f[R]
-Returns a random boolean value (either \f[B]0\f[R] or \f[B]1\f[R]).
-.TP
+.PP
+: Returns a random boolean value (either \f[B]0\f[R] or \f[B]1\f[R]).
+.PP
\f[B]ubytes(x)\f[R]
-Returns the numbers of unsigned integer bytes required to hold the
+.PP
+: Returns the numbers of unsigned integer bytes required to hold the
truncated absolute value of \f[B]x\f[R].
-.TP
+.PP
\f[B]sbytes(x)\f[R]
-Returns the numbers of signed, two\[cq]s-complement integer bytes
+.PP
+: Returns the numbers of signed, two\[aq]s-complement integer bytes
required to hold the truncated value of \f[B]x\f[R].
-.TP
+.PP
\f[B]hex(x)\f[R]
-Outputs the hexadecimal (base \f[B]16\f[R]) representation of
+.PP
+: Outputs the hexadecimal (base \f[B]16\f[R]) representation of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]binary(x)\f[R]
-Outputs the binary (base \f[B]2\f[R]) representation of \f[B]x\f[R].
-.RS
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
+: Outputs the binary (base \f[B]2\f[R]) representation of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
+.PP
\f[B]output(x, b)\f[R]
-Outputs the base \f[B]b\f[R] representation of \f[B]x\f[R].
-.RS
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
+: Outputs the base \f[B]b\f[R] representation of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
+.PP
\f[B]uint(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in as few power of two bytes as possible.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or is negative, an error message is
-printed instead, but bc(1) is not reset (see the \f[B]RESET\f[R]
-section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in as few power of two bytes as possible.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or is negative, an error message is printed
+instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in as few power of two bytes as
-possible.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, an error message is printed instead,
-but bc(1) is not reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in as few power of two bytes
+as possible.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, an error message is printed instead, but bc(1)
+is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uintn(x, n)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]n\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]n\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]n\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **n** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]intn(x, n)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]n\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]n\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]n\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **n** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint8(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]1\f[R] byte.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]1\f[R] byte, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]1\f[R] byte.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **1** byte, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int8(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]1\f[R] byte.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]1\f[R] byte, an
-error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]1\f[R] byte.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **1** byte, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint16(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]2\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]2\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]2\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **2** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int16(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]2\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]2\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]2\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **2** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint32(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]4\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]4\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]4\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **4** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int32(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]4\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]4\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]4\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **4** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint64(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]8\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]8\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]8\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **8** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int64(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]8\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]8\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]8\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **8** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]hex_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in hexadecimal using \f[B]n\f[R]
bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]binary_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in binary using \f[B]n\f[R] bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]output_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in the current \f[B]obase\f[R] (see
the \f[B]SYNTAX\f[R] section) using \f[B]n\f[R] bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]output_byte(x, i)\f[R]
-Outputs byte \f[B]i\f[R] of the truncated absolute value of \f[B]x\f[R],
-where \f[B]0\f[R] is the least significant byte and \f[B]number_of_bytes
-- 1\f[R] is the most significant byte.
-.RS
-.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
+.PP
+: Outputs byte \f[B]i\f[R] of the truncated absolute value of
+\f[B]x\f[R], where \f[B]0\f[R] is the least significant byte and
+\f[B]number_of_bytes - 1\f[R] is the most significant byte.
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.SS Transcendental Functions
.PP
All transcendental functions can return slightly inaccurate results (up
@@ -1773,64 +1959,77 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on bc(1):
-.TP
+.PP
\f[B]BC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
bc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]BC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]BC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]BC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]BC_BASE_POW\f[R].
-.TP
+.PP
\f[B]BC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_RAND_MAX\f[R]
-The maximum integer (inclusive) returned by the \f[B]rand()\f[R]
+.PP
+: The maximum integer (inclusive) returned by the \f[B]rand()\f[R]
operand.
Set at \f[B]2\[ha]BC_LONG_BIT-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]BC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
The actual values can be queried with the \f[B]limits\f[R] statement.
@@ -1842,42 +2041,44 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
bc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]POSIXLY_CORRECT\f[R]
-If this variable exists (no matter the contents), bc(1) behaves as if
+.PP
+: If this variable exists (no matter the contents), bc(1) behaves as if
the \f[B]-s\f[R] option was given.
-.TP
+.PP
\f[B]BC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to bc(1).
+.PP
+: This is another way to give command-line arguments to bc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time bc(1) runs.
-.RS
-.PP
-The code that parses \f[B]BC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some bc file.bc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]bc\[dq] file.bc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]BC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **BC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some bc file.bc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]bc\[rs]\[dq] file.bc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]bc\[aq] file.bc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **BC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]BC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
including the backslash (\f[B]\[rs]\f[R]).
@@ -1885,68 +2086,76 @@ The default line length is \f[B]70\f[R].
.SH EXIT STATUS
.PP
bc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, using a negative number as a bound for the
-pseudo-random number generator, attempting to convert a negative number
-to a hardware integer, overflow when converting a number to a hardware
-integer, and attempting to use a non-integer where an integer is
-required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
-(\f[B]<<\f[R]), and right shift (\f[B]>>\f[R]) operators and their
-corresponding assignment operators.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, using a negative number as a bound for the pseudo-random number
+generator, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**), places (**\[rs]\[at]**), left shift (**\[rs]<\[rs]<**), and right shift (**\[rs]>\[rs]>**)
+operators and their corresponding assignment operators.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, using a token
-where it is invalid, giving an invalid expression, giving an invalid
-print statement, giving an invalid function definition, attempting to
-assign to an expression that is not a named expression (see the
-\f[I]Named Expressions\f[R] subsection of the \f[B]SYNTAX\f[R] section),
-giving an invalid \f[B]auto\f[R] list, having a duplicate
-\f[B]auto\f[R]/function parameter, failing to find the end of a code
-block, attempting to return a value from a \f[B]void\f[R] function,
-attempting to use a variable as a reference, and using any extensions
-when the option \f[B]-s\f[R] or any equivalents were given.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, using a token where it is invalid,
+giving an invalid expression, giving an invalid print statement, giving an
+invalid function definition, attempting to assign to an expression that is
+not a named expression (see the *Named Expressions* subsection of the
+**SYNTAX** section), giving an invalid **auto** list, having a duplicate
+**auto**/function parameter, failing to find the end of a code block,
+attempting to return a value from a **void** function, attempting to use a
+variable as a reference, and using any extensions when the option **-s** or
+any equivalents were given.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, passing the wrong number of
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, passing the wrong number of
arguments to functions, attempting to call an undefined function, and
-attempting to use a \f[B]void\f[R] function call as a value in an
-expression.
-.RE
-.TP
+attempting to use a **void** function call as a value in an expression.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (bc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (bc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
@@ -1976,7 +2185,7 @@ In interactive mode, bc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, bc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, bc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is required for history to be enabled (see the \f[B]COMMAND
LINE HISTORY\f[R] section).
@@ -1998,7 +2207,7 @@ If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If bc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If bc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/bc/A.1.md b/contrib/bc/manuals/bc/A.1.md
index 04f37c6bb724..847d7c312310 100644
--- a/contrib/bc/manuals/bc/A.1.md
+++ b/contrib/bc/manuals/bc/A.1.md
@@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -143,13 +143,27 @@ The following are the options that bc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in bc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of bc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **read()** built-in function is called.
+
+ This is a **non-portable extension**.
+
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
diff --git a/contrib/bc/manuals/bc/E.1 b/contrib/bc/manuals/bc/E.1
index 9023b07c6b87..6600e9da5eaa 100644
--- a/contrib/bc/manuals/bc/E.1
+++ b/contrib/bc/manuals/bc/E.1
@@ -25,19 +25,19 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+\f[B]bc\f[R] [\f[B]-ghilPqRsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
-[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
-[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
+[\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
@@ -113,117 +113,159 @@ If **-s**, **-w**, or any equivalents are used, this option is ignored.
This is a **non-portable extension**.
\f[R]
.fi
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-l\f[R], \f[B]--mathlib\f[R]
-Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
-and loads the included math library before running any code, including
-any expressions or files specified on the command line.
-.RS
-.PP
-To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
-.RE
-.TP
+.PP
+: Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to
+\f[B]20\f[R] and loads the included math library before running any
+code, including any expressions or files specified on the command line.
+.IP
+.nf
+\f[C]
+To learn what is in the library, see the **LIBRARY** section.
+\f[R]
+.fi
+.PP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-Disables the prompt in TTY mode.
+.PP
+: Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
-See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
do not want a prompt or are not used to having them in bc(1).
Most of those users would want to put this option in
\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: Disables the read prompt in TTY mode.
+(The read prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a read prompt or are not used to having them in bc(1).
+Most of those users would want to put this option in
+\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
+This option is also useful in hash bang lines of bc(1) scripts that
+prompt for user input.
+.IP
+.nf
+\f[C]
+This option does not disable the regular prompt because the read prompt is
+only used when the **read()** built-in function is called.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
+.PP
+: This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-s\f[R], \f[B]--standard\f[R]
-Process exactly the language defined by the
+.PP
+: Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Print the version information (copyright header) and exit.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-w\f[R], \f[B]--warn\f[R]
-Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
+.PP
+: Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]BC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -280,7 +322,7 @@ Identifiers with more than one character (letter) are a
.PP
\f[B]ibase\f[R] is a global variable determining how to interpret
constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
@@ -292,7 +334,7 @@ The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
programs with the \f[B]maxibase()\f[R] built-in function.
.PP
\f[B]obase\f[R] is a global variable determining how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
@@ -443,223 +485,281 @@ This means that \f[B]A\f[R] alone always equals decimal \f[B]10\f[R] and
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-Type: Prefix and Postfix
-.RS
.PP
+: Type: Prefix and Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **increment**, **decrement**
+\f[R]
+.fi
.PP
-Description: \f[B]increment\f[R], \f[B]decrement\f[R]
-.RE
-.TP
\f[B]-\f[R] \f[B]!\f[R]
-Type: Prefix
-.RS
.PP
+: Type: Prefix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **negation**, **boolean not**
+\f[R]
+.fi
.PP
-Description: \f[B]negation\f[R], \f[B]boolean not\f[R]
-.RE
-.TP
\f[B]\[ha]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **power**
+\f[R]
+.fi
.PP
-Description: \f[B]power\f[R]
-.RE
-.TP
\f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **multiply**, **divide**, **modulus**
+\f[R]
+.fi
.PP
-Description: \f[B]multiply\f[R], \f[B]divide\f[R], \f[B]modulus\f[R]
-.RE
-.TP
\f[B]+\f[R] \f[B]-\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **add**, **subtract**
+\f[R]
+.fi
.PP
-Description: \f[B]add\f[R], \f[B]subtract\f[R]
-.RE
-.TP
-\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R]
-Type: Binary
-.RS
+\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
+\f[B]%=\f[R] \f[B]\[ha]=\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **assignment**
+\f[R]
+.fi
.PP
-Description: \f[B]assignment\f[R]
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-Type: Binary
-.RS
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **relational**
+\f[R]
+.fi
.PP
-Description: \f[B]relational\f[R]
-.RE
-.TP
\f[B]&&\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **boolean and**
+\f[R]
+.fi
.PP
-Description: \f[B]boolean and\f[R]
-.RE
-.TP
\f[B]||\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
-.PP
-Description: \f[B]boolean or\f[R]
-.RE
+
+Description: **boolean or**
+\f[R]
+.fi
.PP
The operators will be described in more detail below.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
+.PP
+: The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
subsection) as an operand.
-.RS
+.IP
+.nf
+\f[C]
+The prefix versions of these operators are more efficient; use them where
+possible.
+\f[R]
+.fi
.PP
-The prefix versions of these operators are more efficient; use them
-where possible.
-.RE
-.TP
\f[B]-\f[R]
-The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
+.PP
+: The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
to negate any expression with the value \f[B]0\f[R].
Otherwise, a copy of the expression with its sign flipped is returned.
-.TP
+.PP
\f[B]!\f[R]
-The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the expression
-is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the
+expression is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]\[ha]\f[R]
-The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
+.PP
+: The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
as it would be in C) takes two expressions and raises the first to the
power of the value of the second.
The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*), and if it is
+negative, the first value must be non-zero.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]), and if it
-is negative, the first value must be non-zero.
-.RE
-.TP
\f[B]*\f[R]
-The \f[B]multiply\f[R] operator takes two expressions, multiplies them,
-and returns the product.
+.PP
+: The \f[B]multiply\f[R] operator takes two expressions, multiplies
+them, and returns the product.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The \f[B]divide\f[R] operator takes two expressions, divides them, and
+.PP
+: The \f[B]divide\f[R] operator takes two expressions, divides them, and
returns the quotient.
The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]%\f[R]
-The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
\f[B]scale\f[R] and 2) Using the result of step 1 to calculate
\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
\f[B]max(scale+scale(b),scale(a))\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]+\f[R]
-The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]-\f[R]
-The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
-\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R]
-The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R] and
-\f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the \f[I]Named
-Expressions\f[R] subsection).
-.RS
-.PP
-For \f[B]=\f[R], \f[B]b\f[R] is copied and the result is assigned to
-\f[B]a\f[R].
-For all others, \f[B]a\f[R] and \f[B]b\f[R] are applied as operands to
-the corresponding arithmetic operator and the result is assigned to
-\f[B]a\f[R].
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-The \f[B]relational\f[R] operators compare two expressions, \f[B]a\f[R]
-and \f[B]b\f[R], and if the relation holds, according to C language
-semantics, the result is \f[B]1\f[R].
-Otherwise, it is \f[B]0\f[R].
-.RS
.PP
+\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
+\f[B]%=\f[R] \f[B]\[ha]=\f[R]
+.PP
+: The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R]
+and \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the
+\f[I]Named Expressions\f[R] subsection).
+.IP
+.nf
+\f[C]
+For **=**, **b** is copied and the result is assigned to **a**. For all
+others, **a** and **b** are applied as operands to the corresponding
+arithmetic operator and the result is assigned to **a**.
+\f[R]
+.fi
+.PP
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
+.PP
+: The \f[B]relational\f[R] operators compare two expressions,
+\f[B]a\f[R] and \f[B]b\f[R], and if the relation holds, according to C
+language semantics, the result is \f[B]1\f[R].
+Otherwise, it is \f[B]0\f[R].
+.IP
+.nf
+\f[C]
Note that unlike in C, these operators have a lower precedence than the
-\f[B]assignment\f[R] operators, which means that \f[B]a=b>c\f[R] is
-interpreted as \f[B](a=b)>c\f[R].
+**assignment** operators, which means that **a=b\[rs]>c** is interpreted as
+**(a=b)\[rs]>c**.
+
+Also, unlike the [standard][1] requires, these operators can appear anywhere
+any other expressions can be used. This allowance is a
+**non-portable extension**.
+\f[R]
+.fi
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-requires, these operators can appear anywhere any other expressions can
-be used.
-This allowance is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]&&\f[R]
-The \f[B]boolean and\f[R] operator takes two expressions and returns
-\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
-.RS
.PP
-This is \f[I]not\f[R] a short-circuit operator.
+: The \f[B]boolean and\f[R] operator takes two expressions and returns
+\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]||\f[R]
-The \f[B]boolean or\f[R] operator takes two expressions and returns
+.PP
+: The \f[B]boolean or\f[R] operator takes two expressions and returns
\f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
otherwise.
-.RS
-.PP
-This is \f[I]not\f[R] a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Statements
.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
.IP " 2." 4
-\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] \&... \f[B];\f[R] \f[B]S\f[R]
-\f[B]}\f[R]
+\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] ...
+\f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
.IP " 3." 4
\f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
.IP " 4." 4
@@ -685,7 +785,8 @@ An empty statement
.IP "13." 4
A string of characters, enclosed in double quotes
.IP "14." 4
-\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] \&... \f[B],\f[R] \f[B]E\f[R]
+\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] ...
+\f[B],\f[R] \f[B]E\f[R]
.IP "15." 4
\f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
\f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
@@ -729,62 +830,22 @@ command.
An expression by itself is evaluated and printed, followed by a newline.
.SS Print Statement
.PP
-The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
+The \[dq]expressions\[dq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
specially.
What those sequences are, and what they cause to be printed, are shown
below:
.PP
-.TS
-tab(@);
-l l.
-T{
-\f[B]\[rs]a\f[R]
-T}@T{
-\f[B]\[rs]a\f[R]
-T}
-T{
-\f[B]\[rs]b\f[R]
-T}@T{
-\f[B]\[rs]b\f[R]
-T}
-T{
-\f[B]\[rs]\[rs]\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]e\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]f\f[R]
-T}@T{
-\f[B]\[rs]f\f[R]
-T}
-T{
-\f[B]\[rs]n\f[R]
-T}@T{
-\f[B]\[rs]n\f[R]
-T}
-T{
-\f[B]\[rs]q\f[R]
-T}@T{
-\f[B]\[dq]\f[R]
-T}
-T{
-\f[B]\[rs]r\f[R]
-T}@T{
-\f[B]\[rs]r\f[R]
-T}
-T{
-\f[B]\[rs]t\f[R]
-T}@T{
-\f[B]\[rs]t\f[R]
-T}
-.TE
+ * * * * *
+.PP
+\f[B]\[rs]a\f[R] \f[B]\[rs]a\f[R] \f[B]\[rs]b\f[R] \f[B]\[rs]b\f[R]
+\f[B]\[rs]\[rs]\f[R] \f[B]\[rs]\f[R] \f[B]\[rs]e\f[R] \f[B]\[rs]\f[R]
+\f[B]\[rs]f\f[R] \f[B]\[rs]f\f[R] \f[B]\[rs]n\f[R] \f[B]\[rs]n\f[R]
+\f[B]\[rs]q\f[R] \f[B]\[dq]\f[R] \f[B]\[rs]r\f[R] \f[B]\[rs]r\f[R]
+\f[B]\[rs]t\f[R] \f[B]\[rs]t\f[R]
+.PP
+ * * * * *
.PP
Any other character following a backslash causes the backslash and
character to be printed as-is.
@@ -880,9 +941,9 @@ Void functions can only use the first two \f[B]return\f[R] statements
listed above.
They can also omit the return statement entirely.
.PP
-The word \[lq]void\[rq] is not treated as a keyword; it is still
+The word \[dq]void\[dq] is not treated as a keyword; it is still
possible to have variables, arrays, and functions named \f[B]void\f[R].
-The word \[lq]void\[rq] is only treated specially right after the
+The word \[dq]void\[dq] is only treated specially right after the
\f[B]define\f[R] keyword.
.PP
This is a \f[B]non-portable extension\f[R].
@@ -913,55 +974,74 @@ All of the functions below are available when the \f[B]-l\f[R] or
The
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
-.TP
+.PP
\f[B]s(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]c(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l(x)\f[R]
-Returns the natural logarithm of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the natural logarithm of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]e(x)\f[R]
-Returns the mathematical constant \f[B]e\f[R] raised to the power of
+.PP
+: Returns the mathematical constant \f[B]e\f[R] raised to the power of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]j(x, n)\f[R]
-Returns the bessel integer order \f[B]n\f[R] (truncated) of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
+: Returns the bessel integer order \f[B]n\f[R] (truncated) of
+\f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.SS Transcendental Functions
.PP
All transcendental functions can return slightly inaccurate results (up
@@ -1037,59 +1117,71 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on bc(1):
-.TP
+.PP
\f[B]BC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
bc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]BC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]BC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]BC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]BC_BASE_POW\f[R].
-.TP
+.PP
\f[B]BC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]BC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
The actual values can be queried with the \f[B]limits\f[R] statement.
@@ -1101,42 +1193,44 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
bc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]POSIXLY_CORRECT\f[R]
-If this variable exists (no matter the contents), bc(1) behaves as if
+.PP
+: If this variable exists (no matter the contents), bc(1) behaves as if
the \f[B]-s\f[R] option was given.
-.TP
+.PP
\f[B]BC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to bc(1).
+.PP
+: This is another way to give command-line arguments to bc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time bc(1) runs.
-.RS
-.PP
-The code that parses \f[B]BC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some bc file.bc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]bc\[dq] file.bc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]BC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **BC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some bc file.bc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]bc\[rs]\[dq] file.bc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]bc\[aq] file.bc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **BC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]BC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
including the backslash (\f[B]\[rs]\f[R]).
@@ -1144,65 +1238,74 @@ The default line length is \f[B]70\f[R].
.SH EXIT STATUS
.PP
bc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, attempting to convert a negative number to a hardware
-integer, overflow when converting a number to a hardware integer, and
-attempting to use a non-integer where an integer is required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]) operator and the corresponding assignment
-operator.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**) operator and the corresponding assignment operator.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, using a token
-where it is invalid, giving an invalid expression, giving an invalid
-print statement, giving an invalid function definition, attempting to
-assign to an expression that is not a named expression (see the
-\f[I]Named Expressions\f[R] subsection of the \f[B]SYNTAX\f[R] section),
-giving an invalid \f[B]auto\f[R] list, having a duplicate
-\f[B]auto\f[R]/function parameter, failing to find the end of a code
-block, attempting to return a value from a \f[B]void\f[R] function,
-attempting to use a variable as a reference, and using any extensions
-when the option \f[B]-s\f[R] or any equivalents were given.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, using a token where it is invalid,
+giving an invalid expression, giving an invalid print statement, giving an
+invalid function definition, attempting to assign to an expression that is
+not a named expression (see the *Named Expressions* subsection of the
+**SYNTAX** section), giving an invalid **auto** list, having a duplicate
+**auto**/function parameter, failing to find the end of a code block,
+attempting to return a value from a **void** function, attempting to use a
+variable as a reference, and using any extensions when the option **-s** or
+any equivalents were given.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, passing the wrong number of
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, passing the wrong number of
arguments to functions, attempting to call an undefined function, and
-attempting to use a \f[B]void\f[R] function call as a value in an
-expression.
-.RE
-.TP
+attempting to use a **void** function call as a value in an expression.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (bc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (bc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
@@ -1232,7 +1335,7 @@ In interactive mode, bc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, bc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, bc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is required for history to be enabled (see the \f[B]COMMAND
LINE HISTORY\f[R] section).
@@ -1254,7 +1357,7 @@ If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If bc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If bc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/bc/E.1.md b/contrib/bc/manuals/bc/E.1.md
index 589050cb89b5..478f298eeeb2 100644
--- a/contrib/bc/manuals/bc/E.1.md
+++ b/contrib/bc/manuals/bc/E.1.md
@@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -127,13 +127,27 @@ The following are the options that bc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in bc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of bc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **read()** built-in function is called.
+
+ This is a **non-portable extension**.
+
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
diff --git a/contrib/bc/manuals/bc/EH.1 b/contrib/bc/manuals/bc/EH.1
index 53f95b2f7c09..696e25c5a657 100644
--- a/contrib/bc/manuals/bc/EH.1
+++ b/contrib/bc/manuals/bc/EH.1
@@ -25,19 +25,19 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+\f[B]bc\f[R] [\f[B]-ghilPqRsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
-[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
-[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
+[\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
@@ -110,117 +110,159 @@ If **-s**, **-w**, or any equivalents are used, this option is ignored.
This is a **non-portable extension**.
\f[R]
.fi
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-l\f[R], \f[B]--mathlib\f[R]
-Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
-and loads the included math library before running any code, including
-any expressions or files specified on the command line.
-.RS
-.PP
-To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
-.RE
-.TP
+.PP
+: Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to
+\f[B]20\f[R] and loads the included math library before running any
+code, including any expressions or files specified on the command line.
+.IP
+.nf
+\f[C]
+To learn what is in the library, see the **LIBRARY** section.
+\f[R]
+.fi
+.PP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-Disables the prompt in TTY mode.
+.PP
+: Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
-See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
do not want a prompt or are not used to having them in bc(1).
Most of those users would want to put this option in
\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: Disables the read prompt in TTY mode.
+(The read prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a read prompt or are not used to having them in bc(1).
+Most of those users would want to put this option in
+\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
+This option is also useful in hash bang lines of bc(1) scripts that
+prompt for user input.
+.IP
+.nf
+\f[C]
+This option does not disable the regular prompt because the read prompt is
+only used when the **read()** built-in function is called.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
+.PP
+: This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-s\f[R], \f[B]--standard\f[R]
-Process exactly the language defined by the
+.PP
+: Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Print the version information (copyright header) and exit.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-w\f[R], \f[B]--warn\f[R]
-Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
+.PP
+: Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]BC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -277,7 +319,7 @@ Identifiers with more than one character (letter) are a
.PP
\f[B]ibase\f[R] is a global variable determining how to interpret
constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
@@ -289,7 +331,7 @@ The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
programs with the \f[B]maxibase()\f[R] built-in function.
.PP
\f[B]obase\f[R] is a global variable determining how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
@@ -440,223 +482,281 @@ This means that \f[B]A\f[R] alone always equals decimal \f[B]10\f[R] and
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-Type: Prefix and Postfix
-.RS
.PP
+: Type: Prefix and Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **increment**, **decrement**
+\f[R]
+.fi
.PP
-Description: \f[B]increment\f[R], \f[B]decrement\f[R]
-.RE
-.TP
\f[B]-\f[R] \f[B]!\f[R]
-Type: Prefix
-.RS
.PP
+: Type: Prefix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **negation**, **boolean not**
+\f[R]
+.fi
.PP
-Description: \f[B]negation\f[R], \f[B]boolean not\f[R]
-.RE
-.TP
\f[B]\[ha]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **power**
+\f[R]
+.fi
.PP
-Description: \f[B]power\f[R]
-.RE
-.TP
\f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **multiply**, **divide**, **modulus**
+\f[R]
+.fi
.PP
-Description: \f[B]multiply\f[R], \f[B]divide\f[R], \f[B]modulus\f[R]
-.RE
-.TP
\f[B]+\f[R] \f[B]-\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **add**, **subtract**
+\f[R]
+.fi
.PP
-Description: \f[B]add\f[R], \f[B]subtract\f[R]
-.RE
-.TP
-\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R]
-Type: Binary
-.RS
+\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
+\f[B]%=\f[R] \f[B]\[ha]=\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **assignment**
+\f[R]
+.fi
.PP
-Description: \f[B]assignment\f[R]
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-Type: Binary
-.RS
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **relational**
+\f[R]
+.fi
.PP
-Description: \f[B]relational\f[R]
-.RE
-.TP
\f[B]&&\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **boolean and**
+\f[R]
+.fi
.PP
-Description: \f[B]boolean and\f[R]
-.RE
-.TP
\f[B]||\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
-.PP
-Description: \f[B]boolean or\f[R]
-.RE
+
+Description: **boolean or**
+\f[R]
+.fi
.PP
The operators will be described in more detail below.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
+.PP
+: The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
subsection) as an operand.
-.RS
+.IP
+.nf
+\f[C]
+The prefix versions of these operators are more efficient; use them where
+possible.
+\f[R]
+.fi
.PP
-The prefix versions of these operators are more efficient; use them
-where possible.
-.RE
-.TP
\f[B]-\f[R]
-The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
+.PP
+: The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
to negate any expression with the value \f[B]0\f[R].
Otherwise, a copy of the expression with its sign flipped is returned.
-.TP
+.PP
\f[B]!\f[R]
-The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the expression
-is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the
+expression is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]\[ha]\f[R]
-The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
+.PP
+: The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
as it would be in C) takes two expressions and raises the first to the
power of the value of the second.
The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*), and if it is
+negative, the first value must be non-zero.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]), and if it
-is negative, the first value must be non-zero.
-.RE
-.TP
\f[B]*\f[R]
-The \f[B]multiply\f[R] operator takes two expressions, multiplies them,
-and returns the product.
+.PP
+: The \f[B]multiply\f[R] operator takes two expressions, multiplies
+them, and returns the product.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The \f[B]divide\f[R] operator takes two expressions, divides them, and
+.PP
+: The \f[B]divide\f[R] operator takes two expressions, divides them, and
returns the quotient.
The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]%\f[R]
-The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
\f[B]scale\f[R] and 2) Using the result of step 1 to calculate
\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
\f[B]max(scale+scale(b),scale(a))\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]+\f[R]
-The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]-\f[R]
-The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
-\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R]
-The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R] and
-\f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the \f[I]Named
-Expressions\f[R] subsection).
-.RS
-.PP
-For \f[B]=\f[R], \f[B]b\f[R] is copied and the result is assigned to
-\f[B]a\f[R].
-For all others, \f[B]a\f[R] and \f[B]b\f[R] are applied as operands to
-the corresponding arithmetic operator and the result is assigned to
-\f[B]a\f[R].
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-The \f[B]relational\f[R] operators compare two expressions, \f[B]a\f[R]
-and \f[B]b\f[R], and if the relation holds, according to C language
-semantics, the result is \f[B]1\f[R].
-Otherwise, it is \f[B]0\f[R].
-.RS
.PP
+\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
+\f[B]%=\f[R] \f[B]\[ha]=\f[R]
+.PP
+: The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R]
+and \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the
+\f[I]Named Expressions\f[R] subsection).
+.IP
+.nf
+\f[C]
+For **=**, **b** is copied and the result is assigned to **a**. For all
+others, **a** and **b** are applied as operands to the corresponding
+arithmetic operator and the result is assigned to **a**.
+\f[R]
+.fi
+.PP
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
+.PP
+: The \f[B]relational\f[R] operators compare two expressions,
+\f[B]a\f[R] and \f[B]b\f[R], and if the relation holds, according to C
+language semantics, the result is \f[B]1\f[R].
+Otherwise, it is \f[B]0\f[R].
+.IP
+.nf
+\f[C]
Note that unlike in C, these operators have a lower precedence than the
-\f[B]assignment\f[R] operators, which means that \f[B]a=b>c\f[R] is
-interpreted as \f[B](a=b)>c\f[R].
+**assignment** operators, which means that **a=b\[rs]>c** is interpreted as
+**(a=b)\[rs]>c**.
+
+Also, unlike the [standard][1] requires, these operators can appear anywhere
+any other expressions can be used. This allowance is a
+**non-portable extension**.
+\f[R]
+.fi
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-requires, these operators can appear anywhere any other expressions can
-be used.
-This allowance is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]&&\f[R]
-The \f[B]boolean and\f[R] operator takes two expressions and returns
-\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
-.RS
.PP
-This is \f[I]not\f[R] a short-circuit operator.
+: The \f[B]boolean and\f[R] operator takes two expressions and returns
+\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]||\f[R]
-The \f[B]boolean or\f[R] operator takes two expressions and returns
+.PP
+: The \f[B]boolean or\f[R] operator takes two expressions and returns
\f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
otherwise.
-.RS
-.PP
-This is \f[I]not\f[R] a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Statements
.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
.IP " 2." 4
-\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] \&... \f[B];\f[R] \f[B]S\f[R]
-\f[B]}\f[R]
+\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] ...
+\f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
.IP " 3." 4
\f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
.IP " 4." 4
@@ -682,7 +782,8 @@ An empty statement
.IP "13." 4
A string of characters, enclosed in double quotes
.IP "14." 4
-\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] \&... \f[B],\f[R] \f[B]E\f[R]
+\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] ...
+\f[B],\f[R] \f[B]E\f[R]
.IP "15." 4
\f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
\f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
@@ -726,62 +827,22 @@ command.
An expression by itself is evaluated and printed, followed by a newline.
.SS Print Statement
.PP
-The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
+The \[dq]expressions\[dq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
specially.
What those sequences are, and what they cause to be printed, are shown
below:
.PP
-.TS
-tab(@);
-l l.
-T{
-\f[B]\[rs]a\f[R]
-T}@T{
-\f[B]\[rs]a\f[R]
-T}
-T{
-\f[B]\[rs]b\f[R]
-T}@T{
-\f[B]\[rs]b\f[R]
-T}
-T{
-\f[B]\[rs]\[rs]\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]e\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]f\f[R]
-T}@T{
-\f[B]\[rs]f\f[R]
-T}
-T{
-\f[B]\[rs]n\f[R]
-T}@T{
-\f[B]\[rs]n\f[R]
-T}
-T{
-\f[B]\[rs]q\f[R]
-T}@T{
-\f[B]\[dq]\f[R]
-T}
-T{
-\f[B]\[rs]r\f[R]
-T}@T{
-\f[B]\[rs]r\f[R]
-T}
-T{
-\f[B]\[rs]t\f[R]
-T}@T{
-\f[B]\[rs]t\f[R]
-T}
-.TE
+ * * * * *
+.PP
+\f[B]\[rs]a\f[R] \f[B]\[rs]a\f[R] \f[B]\[rs]b\f[R] \f[B]\[rs]b\f[R]
+\f[B]\[rs]\[rs]\f[R] \f[B]\[rs]\f[R] \f[B]\[rs]e\f[R] \f[B]\[rs]\f[R]
+\f[B]\[rs]f\f[R] \f[B]\[rs]f\f[R] \f[B]\[rs]n\f[R] \f[B]\[rs]n\f[R]
+\f[B]\[rs]q\f[R] \f[B]\[dq]\f[R] \f[B]\[rs]r\f[R] \f[B]\[rs]r\f[R]
+\f[B]\[rs]t\f[R] \f[B]\[rs]t\f[R]
+.PP
+ * * * * *
.PP
Any other character following a backslash causes the backslash and
character to be printed as-is.
@@ -877,9 +938,9 @@ Void functions can only use the first two \f[B]return\f[R] statements
listed above.
They can also omit the return statement entirely.
.PP
-The word \[lq]void\[rq] is not treated as a keyword; it is still
+The word \[dq]void\[dq] is not treated as a keyword; it is still
possible to have variables, arrays, and functions named \f[B]void\f[R].
-The word \[lq]void\[rq] is only treated specially right after the
+The word \[dq]void\[dq] is only treated specially right after the
\f[B]define\f[R] keyword.
.PP
This is a \f[B]non-portable extension\f[R].
@@ -910,55 +971,74 @@ All of the functions below are available when the \f[B]-l\f[R] or
The
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
-.TP
+.PP
\f[B]s(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]c(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l(x)\f[R]
-Returns the natural logarithm of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the natural logarithm of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]e(x)\f[R]
-Returns the mathematical constant \f[B]e\f[R] raised to the power of
+.PP
+: Returns the mathematical constant \f[B]e\f[R] raised to the power of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]j(x, n)\f[R]
-Returns the bessel integer order \f[B]n\f[R] (truncated) of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
+: Returns the bessel integer order \f[B]n\f[R] (truncated) of
+\f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.SS Transcendental Functions
.PP
All transcendental functions can return slightly inaccurate results (up
@@ -1034,59 +1114,71 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on bc(1):
-.TP
+.PP
\f[B]BC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
bc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]BC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]BC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]BC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]BC_BASE_POW\f[R].
-.TP
+.PP
\f[B]BC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]BC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
The actual values can be queried with the \f[B]limits\f[R] statement.
@@ -1098,42 +1190,44 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
bc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]POSIXLY_CORRECT\f[R]
-If this variable exists (no matter the contents), bc(1) behaves as if
+.PP
+: If this variable exists (no matter the contents), bc(1) behaves as if
the \f[B]-s\f[R] option was given.
-.TP
+.PP
\f[B]BC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to bc(1).
+.PP
+: This is another way to give command-line arguments to bc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time bc(1) runs.
-.RS
-.PP
-The code that parses \f[B]BC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some bc file.bc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]bc\[dq] file.bc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]BC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **BC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some bc file.bc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]bc\[rs]\[dq] file.bc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]bc\[aq] file.bc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **BC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]BC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
including the backslash (\f[B]\[rs]\f[R]).
@@ -1141,65 +1235,74 @@ The default line length is \f[B]70\f[R].
.SH EXIT STATUS
.PP
bc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, attempting to convert a negative number to a hardware
-integer, overflow when converting a number to a hardware integer, and
-attempting to use a non-integer where an integer is required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]) operator and the corresponding assignment
-operator.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**) operator and the corresponding assignment operator.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, using a token
-where it is invalid, giving an invalid expression, giving an invalid
-print statement, giving an invalid function definition, attempting to
-assign to an expression that is not a named expression (see the
-\f[I]Named Expressions\f[R] subsection of the \f[B]SYNTAX\f[R] section),
-giving an invalid \f[B]auto\f[R] list, having a duplicate
-\f[B]auto\f[R]/function parameter, failing to find the end of a code
-block, attempting to return a value from a \f[B]void\f[R] function,
-attempting to use a variable as a reference, and using any extensions
-when the option \f[B]-s\f[R] or any equivalents were given.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, using a token where it is invalid,
+giving an invalid expression, giving an invalid print statement, giving an
+invalid function definition, attempting to assign to an expression that is
+not a named expression (see the *Named Expressions* subsection of the
+**SYNTAX** section), giving an invalid **auto** list, having a duplicate
+**auto**/function parameter, failing to find the end of a code block,
+attempting to return a value from a **void** function, attempting to use a
+variable as a reference, and using any extensions when the option **-s** or
+any equivalents were given.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, passing the wrong number of
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, passing the wrong number of
arguments to functions, attempting to call an undefined function, and
-attempting to use a \f[B]void\f[R] function call as a value in an
-expression.
-.RE
-.TP
+attempting to use a **void** function call as a value in an expression.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (bc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (bc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
@@ -1229,7 +1332,7 @@ In interactive mode, bc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, bc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, bc(1) turns on \[dq]TTY mode.\[dq]
.PP
The prompt is enabled in TTY mode.
.PP
@@ -1246,7 +1349,7 @@ If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If bc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If bc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/bc/EH.1.md b/contrib/bc/manuals/bc/EH.1.md
index bfd08efb3830..51a9f93549fa 100644
--- a/contrib/bc/manuals/bc/EH.1.md
+++ b/contrib/bc/manuals/bc/EH.1.md
@@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -124,13 +124,27 @@ The following are the options that bc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in bc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of bc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **read()** built-in function is called.
+
+ This is a **non-portable extension**.
+
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
diff --git a/contrib/bc/manuals/bc/EHN.1 b/contrib/bc/manuals/bc/EHN.1
index 0870115dca2a..bbfeb207b35c 100644
--- a/contrib/bc/manuals/bc/EHN.1
+++ b/contrib/bc/manuals/bc/EHN.1
@@ -25,19 +25,19 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+\f[B]bc\f[R] [\f[B]-ghilPqRsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
-[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
-[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
+[\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
@@ -110,117 +110,159 @@ If **-s**, **-w**, or any equivalents are used, this option is ignored.
This is a **non-portable extension**.
\f[R]
.fi
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-l\f[R], \f[B]--mathlib\f[R]
-Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
-and loads the included math library before running any code, including
-any expressions or files specified on the command line.
-.RS
-.PP
-To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
-.RE
-.TP
+.PP
+: Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to
+\f[B]20\f[R] and loads the included math library before running any
+code, including any expressions or files specified on the command line.
+.IP
+.nf
+\f[C]
+To learn what is in the library, see the **LIBRARY** section.
+\f[R]
+.fi
+.PP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-Disables the prompt in TTY mode.
+.PP
+: Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
-See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
do not want a prompt or are not used to having them in bc(1).
Most of those users would want to put this option in
\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: Disables the read prompt in TTY mode.
+(The read prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a read prompt or are not used to having them in bc(1).
+Most of those users would want to put this option in
+\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
+This option is also useful in hash bang lines of bc(1) scripts that
+prompt for user input.
+.IP
+.nf
+\f[C]
+This option does not disable the regular prompt because the read prompt is
+only used when the **read()** built-in function is called.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
+.PP
+: This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-s\f[R], \f[B]--standard\f[R]
-Process exactly the language defined by the
+.PP
+: Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Print the version information (copyright header) and exit.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-w\f[R], \f[B]--warn\f[R]
-Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
+.PP
+: Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]BC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -277,7 +319,7 @@ Identifiers with more than one character (letter) are a
.PP
\f[B]ibase\f[R] is a global variable determining how to interpret
constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
@@ -289,7 +331,7 @@ The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
programs with the \f[B]maxibase()\f[R] built-in function.
.PP
\f[B]obase\f[R] is a global variable determining how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
@@ -440,223 +482,281 @@ This means that \f[B]A\f[R] alone always equals decimal \f[B]10\f[R] and
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-Type: Prefix and Postfix
-.RS
.PP
+: Type: Prefix and Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **increment**, **decrement**
+\f[R]
+.fi
.PP
-Description: \f[B]increment\f[R], \f[B]decrement\f[R]
-.RE
-.TP
\f[B]-\f[R] \f[B]!\f[R]
-Type: Prefix
-.RS
.PP
+: Type: Prefix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **negation**, **boolean not**
+\f[R]
+.fi
.PP
-Description: \f[B]negation\f[R], \f[B]boolean not\f[R]
-.RE
-.TP
\f[B]\[ha]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **power**
+\f[R]
+.fi
.PP
-Description: \f[B]power\f[R]
-.RE
-.TP
\f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **multiply**, **divide**, **modulus**
+\f[R]
+.fi
.PP
-Description: \f[B]multiply\f[R], \f[B]divide\f[R], \f[B]modulus\f[R]
-.RE
-.TP
\f[B]+\f[R] \f[B]-\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **add**, **subtract**
+\f[R]
+.fi
.PP
-Description: \f[B]add\f[R], \f[B]subtract\f[R]
-.RE
-.TP
-\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R]
-Type: Binary
-.RS
+\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
+\f[B]%=\f[R] \f[B]\[ha]=\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **assignment**
+\f[R]
+.fi
.PP
-Description: \f[B]assignment\f[R]
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-Type: Binary
-.RS
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **relational**
+\f[R]
+.fi
.PP
-Description: \f[B]relational\f[R]
-.RE
-.TP
\f[B]&&\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **boolean and**
+\f[R]
+.fi
.PP
-Description: \f[B]boolean and\f[R]
-.RE
-.TP
\f[B]||\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
-.PP
-Description: \f[B]boolean or\f[R]
-.RE
+
+Description: **boolean or**
+\f[R]
+.fi
.PP
The operators will be described in more detail below.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
+.PP
+: The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
subsection) as an operand.
-.RS
+.IP
+.nf
+\f[C]
+The prefix versions of these operators are more efficient; use them where
+possible.
+\f[R]
+.fi
.PP
-The prefix versions of these operators are more efficient; use them
-where possible.
-.RE
-.TP
\f[B]-\f[R]
-The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
+.PP
+: The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
to negate any expression with the value \f[B]0\f[R].
Otherwise, a copy of the expression with its sign flipped is returned.
-.TP
+.PP
\f[B]!\f[R]
-The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the expression
-is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the
+expression is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]\[ha]\f[R]
-The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
+.PP
+: The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
as it would be in C) takes two expressions and raises the first to the
power of the value of the second.
The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*), and if it is
+negative, the first value must be non-zero.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]), and if it
-is negative, the first value must be non-zero.
-.RE
-.TP
\f[B]*\f[R]
-The \f[B]multiply\f[R] operator takes two expressions, multiplies them,
-and returns the product.
+.PP
+: The \f[B]multiply\f[R] operator takes two expressions, multiplies
+them, and returns the product.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The \f[B]divide\f[R] operator takes two expressions, divides them, and
+.PP
+: The \f[B]divide\f[R] operator takes two expressions, divides them, and
returns the quotient.
The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]%\f[R]
-The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
\f[B]scale\f[R] and 2) Using the result of step 1 to calculate
\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
\f[B]max(scale+scale(b),scale(a))\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]+\f[R]
-The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]-\f[R]
-The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
-\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R]
-The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R] and
-\f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the \f[I]Named
-Expressions\f[R] subsection).
-.RS
-.PP
-For \f[B]=\f[R], \f[B]b\f[R] is copied and the result is assigned to
-\f[B]a\f[R].
-For all others, \f[B]a\f[R] and \f[B]b\f[R] are applied as operands to
-the corresponding arithmetic operator and the result is assigned to
-\f[B]a\f[R].
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-The \f[B]relational\f[R] operators compare two expressions, \f[B]a\f[R]
-and \f[B]b\f[R], and if the relation holds, according to C language
-semantics, the result is \f[B]1\f[R].
-Otherwise, it is \f[B]0\f[R].
-.RS
.PP
+\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
+\f[B]%=\f[R] \f[B]\[ha]=\f[R]
+.PP
+: The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R]
+and \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the
+\f[I]Named Expressions\f[R] subsection).
+.IP
+.nf
+\f[C]
+For **=**, **b** is copied and the result is assigned to **a**. For all
+others, **a** and **b** are applied as operands to the corresponding
+arithmetic operator and the result is assigned to **a**.
+\f[R]
+.fi
+.PP
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
+.PP
+: The \f[B]relational\f[R] operators compare two expressions,
+\f[B]a\f[R] and \f[B]b\f[R], and if the relation holds, according to C
+language semantics, the result is \f[B]1\f[R].
+Otherwise, it is \f[B]0\f[R].
+.IP
+.nf
+\f[C]
Note that unlike in C, these operators have a lower precedence than the
-\f[B]assignment\f[R] operators, which means that \f[B]a=b>c\f[R] is
-interpreted as \f[B](a=b)>c\f[R].
+**assignment** operators, which means that **a=b\[rs]>c** is interpreted as
+**(a=b)\[rs]>c**.
+
+Also, unlike the [standard][1] requires, these operators can appear anywhere
+any other expressions can be used. This allowance is a
+**non-portable extension**.
+\f[R]
+.fi
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-requires, these operators can appear anywhere any other expressions can
-be used.
-This allowance is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]&&\f[R]
-The \f[B]boolean and\f[R] operator takes two expressions and returns
-\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
-.RS
.PP
-This is \f[I]not\f[R] a short-circuit operator.
+: The \f[B]boolean and\f[R] operator takes two expressions and returns
+\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]||\f[R]
-The \f[B]boolean or\f[R] operator takes two expressions and returns
+.PP
+: The \f[B]boolean or\f[R] operator takes two expressions and returns
\f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
otherwise.
-.RS
-.PP
-This is \f[I]not\f[R] a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Statements
.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
.IP " 2." 4
-\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] \&... \f[B];\f[R] \f[B]S\f[R]
-\f[B]}\f[R]
+\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] ...
+\f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
.IP " 3." 4
\f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
.IP " 4." 4
@@ -682,7 +782,8 @@ An empty statement
.IP "13." 4
A string of characters, enclosed in double quotes
.IP "14." 4
-\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] \&... \f[B],\f[R] \f[B]E\f[R]
+\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] ...
+\f[B],\f[R] \f[B]E\f[R]
.IP "15." 4
\f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
\f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
@@ -726,62 +827,22 @@ command.
An expression by itself is evaluated and printed, followed by a newline.
.SS Print Statement
.PP
-The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
+The \[dq]expressions\[dq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
specially.
What those sequences are, and what they cause to be printed, are shown
below:
.PP
-.TS
-tab(@);
-l l.
-T{
-\f[B]\[rs]a\f[R]
-T}@T{
-\f[B]\[rs]a\f[R]
-T}
-T{
-\f[B]\[rs]b\f[R]
-T}@T{
-\f[B]\[rs]b\f[R]
-T}
-T{
-\f[B]\[rs]\[rs]\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]e\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]f\f[R]
-T}@T{
-\f[B]\[rs]f\f[R]
-T}
-T{
-\f[B]\[rs]n\f[R]
-T}@T{
-\f[B]\[rs]n\f[R]
-T}
-T{
-\f[B]\[rs]q\f[R]
-T}@T{
-\f[B]\[dq]\f[R]
-T}
-T{
-\f[B]\[rs]r\f[R]
-T}@T{
-\f[B]\[rs]r\f[R]
-T}
-T{
-\f[B]\[rs]t\f[R]
-T}@T{
-\f[B]\[rs]t\f[R]
-T}
-.TE
+ * * * * *
+.PP
+\f[B]\[rs]a\f[R] \f[B]\[rs]a\f[R] \f[B]\[rs]b\f[R] \f[B]\[rs]b\f[R]
+\f[B]\[rs]\[rs]\f[R] \f[B]\[rs]\f[R] \f[B]\[rs]e\f[R] \f[B]\[rs]\f[R]
+\f[B]\[rs]f\f[R] \f[B]\[rs]f\f[R] \f[B]\[rs]n\f[R] \f[B]\[rs]n\f[R]
+\f[B]\[rs]q\f[R] \f[B]\[dq]\f[R] \f[B]\[rs]r\f[R] \f[B]\[rs]r\f[R]
+\f[B]\[rs]t\f[R] \f[B]\[rs]t\f[R]
+.PP
+ * * * * *
.PP
Any other character following a backslash causes the backslash and
character to be printed as-is.
@@ -877,9 +938,9 @@ Void functions can only use the first two \f[B]return\f[R] statements
listed above.
They can also omit the return statement entirely.
.PP
-The word \[lq]void\[rq] is not treated as a keyword; it is still
+The word \[dq]void\[dq] is not treated as a keyword; it is still
possible to have variables, arrays, and functions named \f[B]void\f[R].
-The word \[lq]void\[rq] is only treated specially right after the
+The word \[dq]void\[dq] is only treated specially right after the
\f[B]define\f[R] keyword.
.PP
This is a \f[B]non-portable extension\f[R].
@@ -910,55 +971,74 @@ All of the functions below are available when the \f[B]-l\f[R] or
The
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
-.TP
+.PP
\f[B]s(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]c(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l(x)\f[R]
-Returns the natural logarithm of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the natural logarithm of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]e(x)\f[R]
-Returns the mathematical constant \f[B]e\f[R] raised to the power of
+.PP
+: Returns the mathematical constant \f[B]e\f[R] raised to the power of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]j(x, n)\f[R]
-Returns the bessel integer order \f[B]n\f[R] (truncated) of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
+: Returns the bessel integer order \f[B]n\f[R] (truncated) of
+\f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.SS Transcendental Functions
.PP
All transcendental functions can return slightly inaccurate results (up
@@ -1034,59 +1114,71 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on bc(1):
-.TP
+.PP
\f[B]BC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
bc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]BC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]BC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]BC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]BC_BASE_POW\f[R].
-.TP
+.PP
\f[B]BC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]BC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
The actual values can be queried with the \f[B]limits\f[R] statement.
@@ -1098,42 +1190,44 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
bc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]POSIXLY_CORRECT\f[R]
-If this variable exists (no matter the contents), bc(1) behaves as if
+.PP
+: If this variable exists (no matter the contents), bc(1) behaves as if
the \f[B]-s\f[R] option was given.
-.TP
+.PP
\f[B]BC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to bc(1).
+.PP
+: This is another way to give command-line arguments to bc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time bc(1) runs.
-.RS
-.PP
-The code that parses \f[B]BC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some bc file.bc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]bc\[dq] file.bc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]BC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **BC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some bc file.bc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]bc\[rs]\[dq] file.bc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]bc\[aq] file.bc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **BC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]BC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
including the backslash (\f[B]\[rs]\f[R]).
@@ -1141,65 +1235,74 @@ The default line length is \f[B]70\f[R].
.SH EXIT STATUS
.PP
bc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, attempting to convert a negative number to a hardware
-integer, overflow when converting a number to a hardware integer, and
-attempting to use a non-integer where an integer is required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]) operator and the corresponding assignment
-operator.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**) operator and the corresponding assignment operator.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, using a token
-where it is invalid, giving an invalid expression, giving an invalid
-print statement, giving an invalid function definition, attempting to
-assign to an expression that is not a named expression (see the
-\f[I]Named Expressions\f[R] subsection of the \f[B]SYNTAX\f[R] section),
-giving an invalid \f[B]auto\f[R] list, having a duplicate
-\f[B]auto\f[R]/function parameter, failing to find the end of a code
-block, attempting to return a value from a \f[B]void\f[R] function,
-attempting to use a variable as a reference, and using any extensions
-when the option \f[B]-s\f[R] or any equivalents were given.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, using a token where it is invalid,
+giving an invalid expression, giving an invalid print statement, giving an
+invalid function definition, attempting to assign to an expression that is
+not a named expression (see the *Named Expressions* subsection of the
+**SYNTAX** section), giving an invalid **auto** list, having a duplicate
+**auto**/function parameter, failing to find the end of a code block,
+attempting to return a value from a **void** function, attempting to use a
+variable as a reference, and using any extensions when the option **-s** or
+any equivalents were given.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, passing the wrong number of
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, passing the wrong number of
arguments to functions, attempting to call an undefined function, and
-attempting to use a \f[B]void\f[R] function call as a value in an
-expression.
-.RE
-.TP
+attempting to use a **void** function call as a value in an expression.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (bc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (bc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
@@ -1229,7 +1332,7 @@ In interactive mode, bc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, bc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, bc(1) turns on \[dq]TTY mode.\[dq]
.PP
The prompt is enabled in TTY mode.
.PP
@@ -1246,7 +1349,7 @@ If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If bc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If bc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/bc/EHN.1.md b/contrib/bc/manuals/bc/EHN.1.md
index 15b851ee19b0..aab79e932b04 100644
--- a/contrib/bc/manuals/bc/EHN.1.md
+++ b/contrib/bc/manuals/bc/EHN.1.md
@@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -124,13 +124,27 @@ The following are the options that bc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in bc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of bc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **read()** built-in function is called.
+
+ This is a **non-portable extension**.
+
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
diff --git a/contrib/bc/manuals/bc/EHNP.1 b/contrib/bc/manuals/bc/EHNP.1
index f6728d5b2221..ade3294dd49a 100644
--- a/contrib/bc/manuals/bc/EHNP.1
+++ b/contrib/bc/manuals/bc/EHNP.1
@@ -25,19 +25,19 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+\f[B]bc\f[R] [\f[B]-ghilPqRsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
-[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
-[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
+[\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
@@ -110,112 +110,145 @@ If **-s**, **-w**, or any equivalents are used, this option is ignored.
This is a **non-portable extension**.
\f[R]
.fi
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-l\f[R], \f[B]--mathlib\f[R]
-Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
-and loads the included math library before running any code, including
-any expressions or files specified on the command line.
-.RS
-.PP
-To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
-.RE
-.TP
+.PP
+: Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to
+\f[B]20\f[R] and loads the included math library before running any
+code, including any expressions or files specified on the command line.
+.IP
+.nf
+\f[C]
+To learn what is in the library, see the **LIBRARY** section.
+\f[R]
+.fi
+.PP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-This option is a no-op.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: Because bc(1) was built without support for prompts, this option is a
+no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
+.PP
+: This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-s\f[R], \f[B]--standard\f[R]
-Process exactly the language defined by the
+.PP
+: Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Print the version information (copyright header) and exit.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-w\f[R], \f[B]--warn\f[R]
-Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
+.PP
+: Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]BC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -272,7 +305,7 @@ Identifiers with more than one character (letter) are a
.PP
\f[B]ibase\f[R] is a global variable determining how to interpret
constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
@@ -284,7 +317,7 @@ The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
programs with the \f[B]maxibase()\f[R] built-in function.
.PP
\f[B]obase\f[R] is a global variable determining how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
@@ -435,223 +468,281 @@ This means that \f[B]A\f[R] alone always equals decimal \f[B]10\f[R] and
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-Type: Prefix and Postfix
-.RS
.PP
+: Type: Prefix and Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **increment**, **decrement**
+\f[R]
+.fi
.PP
-Description: \f[B]increment\f[R], \f[B]decrement\f[R]
-.RE
-.TP
\f[B]-\f[R] \f[B]!\f[R]
-Type: Prefix
-.RS
.PP
+: Type: Prefix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **negation**, **boolean not**
+\f[R]
+.fi
.PP
-Description: \f[B]negation\f[R], \f[B]boolean not\f[R]
-.RE
-.TP
\f[B]\[ha]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **power**
+\f[R]
+.fi
.PP
-Description: \f[B]power\f[R]
-.RE
-.TP
\f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **multiply**, **divide**, **modulus**
+\f[R]
+.fi
.PP
-Description: \f[B]multiply\f[R], \f[B]divide\f[R], \f[B]modulus\f[R]
-.RE
-.TP
\f[B]+\f[R] \f[B]-\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **add**, **subtract**
+\f[R]
+.fi
.PP
-Description: \f[B]add\f[R], \f[B]subtract\f[R]
-.RE
-.TP
-\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R]
-Type: Binary
-.RS
+\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
+\f[B]%=\f[R] \f[B]\[ha]=\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **assignment**
+\f[R]
+.fi
.PP
-Description: \f[B]assignment\f[R]
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-Type: Binary
-.RS
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **relational**
+\f[R]
+.fi
.PP
-Description: \f[B]relational\f[R]
-.RE
-.TP
\f[B]&&\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **boolean and**
+\f[R]
+.fi
.PP
-Description: \f[B]boolean and\f[R]
-.RE
-.TP
\f[B]||\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
-.PP
-Description: \f[B]boolean or\f[R]
-.RE
+
+Description: **boolean or**
+\f[R]
+.fi
.PP
The operators will be described in more detail below.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
+.PP
+: The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
subsection) as an operand.
-.RS
+.IP
+.nf
+\f[C]
+The prefix versions of these operators are more efficient; use them where
+possible.
+\f[R]
+.fi
.PP
-The prefix versions of these operators are more efficient; use them
-where possible.
-.RE
-.TP
\f[B]-\f[R]
-The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
+.PP
+: The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
to negate any expression with the value \f[B]0\f[R].
Otherwise, a copy of the expression with its sign flipped is returned.
-.TP
+.PP
\f[B]!\f[R]
-The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the expression
-is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the
+expression is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]\[ha]\f[R]
-The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
+.PP
+: The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
as it would be in C) takes two expressions and raises the first to the
power of the value of the second.
The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*), and if it is
+negative, the first value must be non-zero.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]), and if it
-is negative, the first value must be non-zero.
-.RE
-.TP
\f[B]*\f[R]
-The \f[B]multiply\f[R] operator takes two expressions, multiplies them,
-and returns the product.
+.PP
+: The \f[B]multiply\f[R] operator takes two expressions, multiplies
+them, and returns the product.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The \f[B]divide\f[R] operator takes two expressions, divides them, and
+.PP
+: The \f[B]divide\f[R] operator takes two expressions, divides them, and
returns the quotient.
The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]%\f[R]
-The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
\f[B]scale\f[R] and 2) Using the result of step 1 to calculate
\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
\f[B]max(scale+scale(b),scale(a))\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]+\f[R]
-The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]-\f[R]
-The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
-\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R]
-The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R] and
-\f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the \f[I]Named
-Expressions\f[R] subsection).
-.RS
-.PP
-For \f[B]=\f[R], \f[B]b\f[R] is copied and the result is assigned to
-\f[B]a\f[R].
-For all others, \f[B]a\f[R] and \f[B]b\f[R] are applied as operands to
-the corresponding arithmetic operator and the result is assigned to
-\f[B]a\f[R].
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-The \f[B]relational\f[R] operators compare two expressions, \f[B]a\f[R]
-and \f[B]b\f[R], and if the relation holds, according to C language
-semantics, the result is \f[B]1\f[R].
-Otherwise, it is \f[B]0\f[R].
-.RS
.PP
+\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
+\f[B]%=\f[R] \f[B]\[ha]=\f[R]
+.PP
+: The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R]
+and \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the
+\f[I]Named Expressions\f[R] subsection).
+.IP
+.nf
+\f[C]
+For **=**, **b** is copied and the result is assigned to **a**. For all
+others, **a** and **b** are applied as operands to the corresponding
+arithmetic operator and the result is assigned to **a**.
+\f[R]
+.fi
+.PP
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
+.PP
+: The \f[B]relational\f[R] operators compare two expressions,
+\f[B]a\f[R] and \f[B]b\f[R], and if the relation holds, according to C
+language semantics, the result is \f[B]1\f[R].
+Otherwise, it is \f[B]0\f[R].
+.IP
+.nf
+\f[C]
Note that unlike in C, these operators have a lower precedence than the
-\f[B]assignment\f[R] operators, which means that \f[B]a=b>c\f[R] is
-interpreted as \f[B](a=b)>c\f[R].
+**assignment** operators, which means that **a=b\[rs]>c** is interpreted as
+**(a=b)\[rs]>c**.
+
+Also, unlike the [standard][1] requires, these operators can appear anywhere
+any other expressions can be used. This allowance is a
+**non-portable extension**.
+\f[R]
+.fi
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-requires, these operators can appear anywhere any other expressions can
-be used.
-This allowance is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]&&\f[R]
-The \f[B]boolean and\f[R] operator takes two expressions and returns
-\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
-.RS
.PP
-This is \f[I]not\f[R] a short-circuit operator.
+: The \f[B]boolean and\f[R] operator takes two expressions and returns
+\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]||\f[R]
-The \f[B]boolean or\f[R] operator takes two expressions and returns
+.PP
+: The \f[B]boolean or\f[R] operator takes two expressions and returns
\f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
otherwise.
-.RS
-.PP
-This is \f[I]not\f[R] a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Statements
.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
.IP " 2." 4
-\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] \&... \f[B];\f[R] \f[B]S\f[R]
-\f[B]}\f[R]
+\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] ...
+\f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
.IP " 3." 4
\f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
.IP " 4." 4
@@ -677,7 +768,8 @@ An empty statement
.IP "13." 4
A string of characters, enclosed in double quotes
.IP "14." 4
-\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] \&... \f[B],\f[R] \f[B]E\f[R]
+\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] ...
+\f[B],\f[R] \f[B]E\f[R]
.IP "15." 4
\f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
\f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
@@ -721,62 +813,22 @@ command.
An expression by itself is evaluated and printed, followed by a newline.
.SS Print Statement
.PP
-The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
+The \[dq]expressions\[dq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
specially.
What those sequences are, and what they cause to be printed, are shown
below:
.PP
-.TS
-tab(@);
-l l.
-T{
-\f[B]\[rs]a\f[R]
-T}@T{
-\f[B]\[rs]a\f[R]
-T}
-T{
-\f[B]\[rs]b\f[R]
-T}@T{
-\f[B]\[rs]b\f[R]
-T}
-T{
-\f[B]\[rs]\[rs]\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]e\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]f\f[R]
-T}@T{
-\f[B]\[rs]f\f[R]
-T}
-T{
-\f[B]\[rs]n\f[R]
-T}@T{
-\f[B]\[rs]n\f[R]
-T}
-T{
-\f[B]\[rs]q\f[R]
-T}@T{
-\f[B]\[dq]\f[R]
-T}
-T{
-\f[B]\[rs]r\f[R]
-T}@T{
-\f[B]\[rs]r\f[R]
-T}
-T{
-\f[B]\[rs]t\f[R]
-T}@T{
-\f[B]\[rs]t\f[R]
-T}
-.TE
+ * * * * *
+.PP
+\f[B]\[rs]a\f[R] \f[B]\[rs]a\f[R] \f[B]\[rs]b\f[R] \f[B]\[rs]b\f[R]
+\f[B]\[rs]\[rs]\f[R] \f[B]\[rs]\f[R] \f[B]\[rs]e\f[R] \f[B]\[rs]\f[R]
+\f[B]\[rs]f\f[R] \f[B]\[rs]f\f[R] \f[B]\[rs]n\f[R] \f[B]\[rs]n\f[R]
+\f[B]\[rs]q\f[R] \f[B]\[dq]\f[R] \f[B]\[rs]r\f[R] \f[B]\[rs]r\f[R]
+\f[B]\[rs]t\f[R] \f[B]\[rs]t\f[R]
+.PP
+ * * * * *
.PP
Any other character following a backslash causes the backslash and
character to be printed as-is.
@@ -872,9 +924,9 @@ Void functions can only use the first two \f[B]return\f[R] statements
listed above.
They can also omit the return statement entirely.
.PP
-The word \[lq]void\[rq] is not treated as a keyword; it is still
+The word \[dq]void\[dq] is not treated as a keyword; it is still
possible to have variables, arrays, and functions named \f[B]void\f[R].
-The word \[lq]void\[rq] is only treated specially right after the
+The word \[dq]void\[dq] is only treated specially right after the
\f[B]define\f[R] keyword.
.PP
This is a \f[B]non-portable extension\f[R].
@@ -905,55 +957,74 @@ All of the functions below are available when the \f[B]-l\f[R] or
The
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
-.TP
+.PP
\f[B]s(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]c(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l(x)\f[R]
-Returns the natural logarithm of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the natural logarithm of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]e(x)\f[R]
-Returns the mathematical constant \f[B]e\f[R] raised to the power of
+.PP
+: Returns the mathematical constant \f[B]e\f[R] raised to the power of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]j(x, n)\f[R]
-Returns the bessel integer order \f[B]n\f[R] (truncated) of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
+: Returns the bessel integer order \f[B]n\f[R] (truncated) of
+\f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.SS Transcendental Functions
.PP
All transcendental functions can return slightly inaccurate results (up
@@ -1029,59 +1100,71 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on bc(1):
-.TP
+.PP
\f[B]BC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
bc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]BC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]BC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]BC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]BC_BASE_POW\f[R].
-.TP
+.PP
\f[B]BC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]BC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
The actual values can be queried with the \f[B]limits\f[R] statement.
@@ -1093,42 +1176,44 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
bc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]POSIXLY_CORRECT\f[R]
-If this variable exists (no matter the contents), bc(1) behaves as if
+.PP
+: If this variable exists (no matter the contents), bc(1) behaves as if
the \f[B]-s\f[R] option was given.
-.TP
+.PP
\f[B]BC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to bc(1).
+.PP
+: This is another way to give command-line arguments to bc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time bc(1) runs.
-.RS
-.PP
-The code that parses \f[B]BC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some bc file.bc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]bc\[dq] file.bc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]BC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **BC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some bc file.bc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]bc\[rs]\[dq] file.bc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]bc\[aq] file.bc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **BC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]BC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
including the backslash (\f[B]\[rs]\f[R]).
@@ -1136,65 +1221,74 @@ The default line length is \f[B]70\f[R].
.SH EXIT STATUS
.PP
bc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, attempting to convert a negative number to a hardware
-integer, overflow when converting a number to a hardware integer, and
-attempting to use a non-integer where an integer is required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]) operator and the corresponding assignment
-operator.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**) operator and the corresponding assignment operator.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, using a token
-where it is invalid, giving an invalid expression, giving an invalid
-print statement, giving an invalid function definition, attempting to
-assign to an expression that is not a named expression (see the
-\f[I]Named Expressions\f[R] subsection of the \f[B]SYNTAX\f[R] section),
-giving an invalid \f[B]auto\f[R] list, having a duplicate
-\f[B]auto\f[R]/function parameter, failing to find the end of a code
-block, attempting to return a value from a \f[B]void\f[R] function,
-attempting to use a variable as a reference, and using any extensions
-when the option \f[B]-s\f[R] or any equivalents were given.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, using a token where it is invalid,
+giving an invalid expression, giving an invalid print statement, giving an
+invalid function definition, attempting to assign to an expression that is
+not a named expression (see the *Named Expressions* subsection of the
+**SYNTAX** section), giving an invalid **auto** list, having a duplicate
+**auto**/function parameter, failing to find the end of a code block,
+attempting to return a value from a **void** function, attempting to use a
+variable as a reference, and using any extensions when the option **-s** or
+any equivalents were given.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, passing the wrong number of
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, passing the wrong number of
arguments to functions, attempting to call an undefined function, and
-attempting to use a \f[B]void\f[R] function call as a value in an
-expression.
-.RE
-.TP
+attempting to use a **void** function call as a value in an expression.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (bc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (bc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
@@ -1224,7 +1318,7 @@ In interactive mode, bc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, bc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, bc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is different from interactive mode because interactive mode is
required in the bc(1)
@@ -1239,7 +1333,7 @@ If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If bc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If bc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/bc/EHNP.1.md b/contrib/bc/manuals/bc/EHNP.1.md
index a0e1b71f8d38..d7afa1ccc1af 100644
--- a/contrib/bc/manuals/bc/EHNP.1.md
+++ b/contrib/bc/manuals/bc/EHNP.1.md
@@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -127,6 +127,12 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Because bc(1) was built without support for prompts, this option is a no-op.
+
+ This is a **non-portable extension**.
+
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
diff --git a/contrib/bc/manuals/bc/EHP.1 b/contrib/bc/manuals/bc/EHP.1
index dc3476f68b92..b5cfe948d5e8 100644
--- a/contrib/bc/manuals/bc/EHP.1
+++ b/contrib/bc/manuals/bc/EHP.1
@@ -25,19 +25,19 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+\f[B]bc\f[R] [\f[B]-ghilPqRsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
-[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
-[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
+[\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
@@ -110,112 +110,145 @@ If **-s**, **-w**, or any equivalents are used, this option is ignored.
This is a **non-portable extension**.
\f[R]
.fi
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-l\f[R], \f[B]--mathlib\f[R]
-Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
-and loads the included math library before running any code, including
-any expressions or files specified on the command line.
-.RS
-.PP
-To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
-.RE
-.TP
+.PP
+: Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to
+\f[B]20\f[R] and loads the included math library before running any
+code, including any expressions or files specified on the command line.
+.IP
+.nf
+\f[C]
+To learn what is in the library, see the **LIBRARY** section.
+\f[R]
+.fi
+.PP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-This option is a no-op.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: Because bc(1) was built without support for prompts, this option is a
+no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
+.PP
+: This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-s\f[R], \f[B]--standard\f[R]
-Process exactly the language defined by the
+.PP
+: Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Print the version information (copyright header) and exit.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-w\f[R], \f[B]--warn\f[R]
-Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
+.PP
+: Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]BC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -272,7 +305,7 @@ Identifiers with more than one character (letter) are a
.PP
\f[B]ibase\f[R] is a global variable determining how to interpret
constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
@@ -284,7 +317,7 @@ The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
programs with the \f[B]maxibase()\f[R] built-in function.
.PP
\f[B]obase\f[R] is a global variable determining how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
@@ -435,223 +468,281 @@ This means that \f[B]A\f[R] alone always equals decimal \f[B]10\f[R] and
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-Type: Prefix and Postfix
-.RS
.PP
+: Type: Prefix and Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **increment**, **decrement**
+\f[R]
+.fi
.PP
-Description: \f[B]increment\f[R], \f[B]decrement\f[R]
-.RE
-.TP
\f[B]-\f[R] \f[B]!\f[R]
-Type: Prefix
-.RS
.PP
+: Type: Prefix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **negation**, **boolean not**
+\f[R]
+.fi
.PP
-Description: \f[B]negation\f[R], \f[B]boolean not\f[R]
-.RE
-.TP
\f[B]\[ha]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **power**
+\f[R]
+.fi
.PP
-Description: \f[B]power\f[R]
-.RE
-.TP
\f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **multiply**, **divide**, **modulus**
+\f[R]
+.fi
.PP
-Description: \f[B]multiply\f[R], \f[B]divide\f[R], \f[B]modulus\f[R]
-.RE
-.TP
\f[B]+\f[R] \f[B]-\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **add**, **subtract**
+\f[R]
+.fi
.PP
-Description: \f[B]add\f[R], \f[B]subtract\f[R]
-.RE
-.TP
-\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R]
-Type: Binary
-.RS
+\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
+\f[B]%=\f[R] \f[B]\[ha]=\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **assignment**
+\f[R]
+.fi
.PP
-Description: \f[B]assignment\f[R]
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-Type: Binary
-.RS
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **relational**
+\f[R]
+.fi
.PP
-Description: \f[B]relational\f[R]
-.RE
-.TP
\f[B]&&\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **boolean and**
+\f[R]
+.fi
.PP
-Description: \f[B]boolean and\f[R]
-.RE
-.TP
\f[B]||\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
-.PP
-Description: \f[B]boolean or\f[R]
-.RE
+
+Description: **boolean or**
+\f[R]
+.fi
.PP
The operators will be described in more detail below.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
+.PP
+: The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
subsection) as an operand.
-.RS
+.IP
+.nf
+\f[C]
+The prefix versions of these operators are more efficient; use them where
+possible.
+\f[R]
+.fi
.PP
-The prefix versions of these operators are more efficient; use them
-where possible.
-.RE
-.TP
\f[B]-\f[R]
-The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
+.PP
+: The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
to negate any expression with the value \f[B]0\f[R].
Otherwise, a copy of the expression with its sign flipped is returned.
-.TP
+.PP
\f[B]!\f[R]
-The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the expression
-is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the
+expression is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]\[ha]\f[R]
-The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
+.PP
+: The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
as it would be in C) takes two expressions and raises the first to the
power of the value of the second.
The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*), and if it is
+negative, the first value must be non-zero.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]), and if it
-is negative, the first value must be non-zero.
-.RE
-.TP
\f[B]*\f[R]
-The \f[B]multiply\f[R] operator takes two expressions, multiplies them,
-and returns the product.
+.PP
+: The \f[B]multiply\f[R] operator takes two expressions, multiplies
+them, and returns the product.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The \f[B]divide\f[R] operator takes two expressions, divides them, and
+.PP
+: The \f[B]divide\f[R] operator takes two expressions, divides them, and
returns the quotient.
The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]%\f[R]
-The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
\f[B]scale\f[R] and 2) Using the result of step 1 to calculate
\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
\f[B]max(scale+scale(b),scale(a))\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]+\f[R]
-The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]-\f[R]
-The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
-\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R]
-The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R] and
-\f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the \f[I]Named
-Expressions\f[R] subsection).
-.RS
-.PP
-For \f[B]=\f[R], \f[B]b\f[R] is copied and the result is assigned to
-\f[B]a\f[R].
-For all others, \f[B]a\f[R] and \f[B]b\f[R] are applied as operands to
-the corresponding arithmetic operator and the result is assigned to
-\f[B]a\f[R].
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-The \f[B]relational\f[R] operators compare two expressions, \f[B]a\f[R]
-and \f[B]b\f[R], and if the relation holds, according to C language
-semantics, the result is \f[B]1\f[R].
-Otherwise, it is \f[B]0\f[R].
-.RS
.PP
+\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
+\f[B]%=\f[R] \f[B]\[ha]=\f[R]
+.PP
+: The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R]
+and \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the
+\f[I]Named Expressions\f[R] subsection).
+.IP
+.nf
+\f[C]
+For **=**, **b** is copied and the result is assigned to **a**. For all
+others, **a** and **b** are applied as operands to the corresponding
+arithmetic operator and the result is assigned to **a**.
+\f[R]
+.fi
+.PP
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
+.PP
+: The \f[B]relational\f[R] operators compare two expressions,
+\f[B]a\f[R] and \f[B]b\f[R], and if the relation holds, according to C
+language semantics, the result is \f[B]1\f[R].
+Otherwise, it is \f[B]0\f[R].
+.IP
+.nf
+\f[C]
Note that unlike in C, these operators have a lower precedence than the
-\f[B]assignment\f[R] operators, which means that \f[B]a=b>c\f[R] is
-interpreted as \f[B](a=b)>c\f[R].
+**assignment** operators, which means that **a=b\[rs]>c** is interpreted as
+**(a=b)\[rs]>c**.
+
+Also, unlike the [standard][1] requires, these operators can appear anywhere
+any other expressions can be used. This allowance is a
+**non-portable extension**.
+\f[R]
+.fi
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-requires, these operators can appear anywhere any other expressions can
-be used.
-This allowance is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]&&\f[R]
-The \f[B]boolean and\f[R] operator takes two expressions and returns
-\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
-.RS
.PP
-This is \f[I]not\f[R] a short-circuit operator.
+: The \f[B]boolean and\f[R] operator takes two expressions and returns
+\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]||\f[R]
-The \f[B]boolean or\f[R] operator takes two expressions and returns
+.PP
+: The \f[B]boolean or\f[R] operator takes two expressions and returns
\f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
otherwise.
-.RS
-.PP
-This is \f[I]not\f[R] a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Statements
.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
.IP " 2." 4
-\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] \&... \f[B];\f[R] \f[B]S\f[R]
-\f[B]}\f[R]
+\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] ...
+\f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
.IP " 3." 4
\f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
.IP " 4." 4
@@ -677,7 +768,8 @@ An empty statement
.IP "13." 4
A string of characters, enclosed in double quotes
.IP "14." 4
-\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] \&... \f[B],\f[R] \f[B]E\f[R]
+\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] ...
+\f[B],\f[R] \f[B]E\f[R]
.IP "15." 4
\f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
\f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
@@ -721,62 +813,22 @@ command.
An expression by itself is evaluated and printed, followed by a newline.
.SS Print Statement
.PP
-The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
+The \[dq]expressions\[dq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
specially.
What those sequences are, and what they cause to be printed, are shown
below:
.PP
-.TS
-tab(@);
-l l.
-T{
-\f[B]\[rs]a\f[R]
-T}@T{
-\f[B]\[rs]a\f[R]
-T}
-T{
-\f[B]\[rs]b\f[R]
-T}@T{
-\f[B]\[rs]b\f[R]
-T}
-T{
-\f[B]\[rs]\[rs]\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]e\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]f\f[R]
-T}@T{
-\f[B]\[rs]f\f[R]
-T}
-T{
-\f[B]\[rs]n\f[R]
-T}@T{
-\f[B]\[rs]n\f[R]
-T}
-T{
-\f[B]\[rs]q\f[R]
-T}@T{
-\f[B]\[dq]\f[R]
-T}
-T{
-\f[B]\[rs]r\f[R]
-T}@T{
-\f[B]\[rs]r\f[R]
-T}
-T{
-\f[B]\[rs]t\f[R]
-T}@T{
-\f[B]\[rs]t\f[R]
-T}
-.TE
+ * * * * *
+.PP
+\f[B]\[rs]a\f[R] \f[B]\[rs]a\f[R] \f[B]\[rs]b\f[R] \f[B]\[rs]b\f[R]
+\f[B]\[rs]\[rs]\f[R] \f[B]\[rs]\f[R] \f[B]\[rs]e\f[R] \f[B]\[rs]\f[R]
+\f[B]\[rs]f\f[R] \f[B]\[rs]f\f[R] \f[B]\[rs]n\f[R] \f[B]\[rs]n\f[R]
+\f[B]\[rs]q\f[R] \f[B]\[dq]\f[R] \f[B]\[rs]r\f[R] \f[B]\[rs]r\f[R]
+\f[B]\[rs]t\f[R] \f[B]\[rs]t\f[R]
+.PP
+ * * * * *
.PP
Any other character following a backslash causes the backslash and
character to be printed as-is.
@@ -872,9 +924,9 @@ Void functions can only use the first two \f[B]return\f[R] statements
listed above.
They can also omit the return statement entirely.
.PP
-The word \[lq]void\[rq] is not treated as a keyword; it is still
+The word \[dq]void\[dq] is not treated as a keyword; it is still
possible to have variables, arrays, and functions named \f[B]void\f[R].
-The word \[lq]void\[rq] is only treated specially right after the
+The word \[dq]void\[dq] is only treated specially right after the
\f[B]define\f[R] keyword.
.PP
This is a \f[B]non-portable extension\f[R].
@@ -905,55 +957,74 @@ All of the functions below are available when the \f[B]-l\f[R] or
The
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
-.TP
+.PP
\f[B]s(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]c(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l(x)\f[R]
-Returns the natural logarithm of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the natural logarithm of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]e(x)\f[R]
-Returns the mathematical constant \f[B]e\f[R] raised to the power of
+.PP
+: Returns the mathematical constant \f[B]e\f[R] raised to the power of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]j(x, n)\f[R]
-Returns the bessel integer order \f[B]n\f[R] (truncated) of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
+: Returns the bessel integer order \f[B]n\f[R] (truncated) of
+\f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.SS Transcendental Functions
.PP
All transcendental functions can return slightly inaccurate results (up
@@ -1029,59 +1100,71 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on bc(1):
-.TP
+.PP
\f[B]BC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
bc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]BC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]BC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]BC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]BC_BASE_POW\f[R].
-.TP
+.PP
\f[B]BC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]BC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
The actual values can be queried with the \f[B]limits\f[R] statement.
@@ -1093,42 +1176,44 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
bc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]POSIXLY_CORRECT\f[R]
-If this variable exists (no matter the contents), bc(1) behaves as if
+.PP
+: If this variable exists (no matter the contents), bc(1) behaves as if
the \f[B]-s\f[R] option was given.
-.TP
+.PP
\f[B]BC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to bc(1).
+.PP
+: This is another way to give command-line arguments to bc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time bc(1) runs.
-.RS
-.PP
-The code that parses \f[B]BC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some bc file.bc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]bc\[dq] file.bc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]BC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **BC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some bc file.bc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]bc\[rs]\[dq] file.bc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]bc\[aq] file.bc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **BC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]BC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
including the backslash (\f[B]\[rs]\f[R]).
@@ -1136,65 +1221,74 @@ The default line length is \f[B]70\f[R].
.SH EXIT STATUS
.PP
bc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, attempting to convert a negative number to a hardware
-integer, overflow when converting a number to a hardware integer, and
-attempting to use a non-integer where an integer is required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]) operator and the corresponding assignment
-operator.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**) operator and the corresponding assignment operator.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, using a token
-where it is invalid, giving an invalid expression, giving an invalid
-print statement, giving an invalid function definition, attempting to
-assign to an expression that is not a named expression (see the
-\f[I]Named Expressions\f[R] subsection of the \f[B]SYNTAX\f[R] section),
-giving an invalid \f[B]auto\f[R] list, having a duplicate
-\f[B]auto\f[R]/function parameter, failing to find the end of a code
-block, attempting to return a value from a \f[B]void\f[R] function,
-attempting to use a variable as a reference, and using any extensions
-when the option \f[B]-s\f[R] or any equivalents were given.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, using a token where it is invalid,
+giving an invalid expression, giving an invalid print statement, giving an
+invalid function definition, attempting to assign to an expression that is
+not a named expression (see the *Named Expressions* subsection of the
+**SYNTAX** section), giving an invalid **auto** list, having a duplicate
+**auto**/function parameter, failing to find the end of a code block,
+attempting to return a value from a **void** function, attempting to use a
+variable as a reference, and using any extensions when the option **-s** or
+any equivalents were given.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, passing the wrong number of
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, passing the wrong number of
arguments to functions, attempting to call an undefined function, and
-attempting to use a \f[B]void\f[R] function call as a value in an
-expression.
-.RE
-.TP
+attempting to use a **void** function call as a value in an expression.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (bc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (bc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
@@ -1224,7 +1318,7 @@ In interactive mode, bc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, bc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, bc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is different from interactive mode because interactive mode is
required in the bc(1)
@@ -1239,7 +1333,7 @@ If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If bc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If bc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/bc/EHP.1.md b/contrib/bc/manuals/bc/EHP.1.md
index 976ae8eb11b7..e6338f70e396 100644
--- a/contrib/bc/manuals/bc/EHP.1.md
+++ b/contrib/bc/manuals/bc/EHP.1.md
@@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -127,6 +127,12 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Because bc(1) was built without support for prompts, this option is a no-op.
+
+ This is a **non-portable extension**.
+
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
diff --git a/contrib/bc/manuals/bc/EN.1 b/contrib/bc/manuals/bc/EN.1
index e6e7b3c5f145..3ea500b95b3f 100644
--- a/contrib/bc/manuals/bc/EN.1
+++ b/contrib/bc/manuals/bc/EN.1
@@ -25,19 +25,19 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+\f[B]bc\f[R] [\f[B]-ghilPqRsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
-[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
-[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
+[\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
@@ -113,117 +113,159 @@ If **-s**, **-w**, or any equivalents are used, this option is ignored.
This is a **non-portable extension**.
\f[R]
.fi
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-l\f[R], \f[B]--mathlib\f[R]
-Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
-and loads the included math library before running any code, including
-any expressions or files specified on the command line.
-.RS
-.PP
-To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
-.RE
-.TP
+.PP
+: Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to
+\f[B]20\f[R] and loads the included math library before running any
+code, including any expressions or files specified on the command line.
+.IP
+.nf
+\f[C]
+To learn what is in the library, see the **LIBRARY** section.
+\f[R]
+.fi
+.PP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-Disables the prompt in TTY mode.
+.PP
+: Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
-See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
do not want a prompt or are not used to having them in bc(1).
Most of those users would want to put this option in
\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: Disables the read prompt in TTY mode.
+(The read prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a read prompt or are not used to having them in bc(1).
+Most of those users would want to put this option in
+\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
+This option is also useful in hash bang lines of bc(1) scripts that
+prompt for user input.
+.IP
+.nf
+\f[C]
+This option does not disable the regular prompt because the read prompt is
+only used when the **read()** built-in function is called.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
+.PP
+: This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-s\f[R], \f[B]--standard\f[R]
-Process exactly the language defined by the
+.PP
+: Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Print the version information (copyright header) and exit.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-w\f[R], \f[B]--warn\f[R]
-Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
+.PP
+: Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]BC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -280,7 +322,7 @@ Identifiers with more than one character (letter) are a
.PP
\f[B]ibase\f[R] is a global variable determining how to interpret
constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
@@ -292,7 +334,7 @@ The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
programs with the \f[B]maxibase()\f[R] built-in function.
.PP
\f[B]obase\f[R] is a global variable determining how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
@@ -443,223 +485,281 @@ This means that \f[B]A\f[R] alone always equals decimal \f[B]10\f[R] and
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-Type: Prefix and Postfix
-.RS
.PP
+: Type: Prefix and Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **increment**, **decrement**
+\f[R]
+.fi
.PP
-Description: \f[B]increment\f[R], \f[B]decrement\f[R]
-.RE
-.TP
\f[B]-\f[R] \f[B]!\f[R]
-Type: Prefix
-.RS
.PP
+: Type: Prefix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **negation**, **boolean not**
+\f[R]
+.fi
.PP
-Description: \f[B]negation\f[R], \f[B]boolean not\f[R]
-.RE
-.TP
\f[B]\[ha]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **power**
+\f[R]
+.fi
.PP
-Description: \f[B]power\f[R]
-.RE
-.TP
\f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **multiply**, **divide**, **modulus**
+\f[R]
+.fi
.PP
-Description: \f[B]multiply\f[R], \f[B]divide\f[R], \f[B]modulus\f[R]
-.RE
-.TP
\f[B]+\f[R] \f[B]-\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **add**, **subtract**
+\f[R]
+.fi
.PP
-Description: \f[B]add\f[R], \f[B]subtract\f[R]
-.RE
-.TP
-\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R]
-Type: Binary
-.RS
+\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
+\f[B]%=\f[R] \f[B]\[ha]=\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **assignment**
+\f[R]
+.fi
.PP
-Description: \f[B]assignment\f[R]
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-Type: Binary
-.RS
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **relational**
+\f[R]
+.fi
.PP
-Description: \f[B]relational\f[R]
-.RE
-.TP
\f[B]&&\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **boolean and**
+\f[R]
+.fi
.PP
-Description: \f[B]boolean and\f[R]
-.RE
-.TP
\f[B]||\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
-.PP
-Description: \f[B]boolean or\f[R]
-.RE
+
+Description: **boolean or**
+\f[R]
+.fi
.PP
The operators will be described in more detail below.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
+.PP
+: The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
subsection) as an operand.
-.RS
+.IP
+.nf
+\f[C]
+The prefix versions of these operators are more efficient; use them where
+possible.
+\f[R]
+.fi
.PP
-The prefix versions of these operators are more efficient; use them
-where possible.
-.RE
-.TP
\f[B]-\f[R]
-The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
+.PP
+: The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
to negate any expression with the value \f[B]0\f[R].
Otherwise, a copy of the expression with its sign flipped is returned.
-.TP
+.PP
\f[B]!\f[R]
-The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the expression
-is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the
+expression is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]\[ha]\f[R]
-The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
+.PP
+: The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
as it would be in C) takes two expressions and raises the first to the
power of the value of the second.
The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*), and if it is
+negative, the first value must be non-zero.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]), and if it
-is negative, the first value must be non-zero.
-.RE
-.TP
\f[B]*\f[R]
-The \f[B]multiply\f[R] operator takes two expressions, multiplies them,
-and returns the product.
+.PP
+: The \f[B]multiply\f[R] operator takes two expressions, multiplies
+them, and returns the product.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The \f[B]divide\f[R] operator takes two expressions, divides them, and
+.PP
+: The \f[B]divide\f[R] operator takes two expressions, divides them, and
returns the quotient.
The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]%\f[R]
-The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
\f[B]scale\f[R] and 2) Using the result of step 1 to calculate
\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
\f[B]max(scale+scale(b),scale(a))\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]+\f[R]
-The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]-\f[R]
-The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
-\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R]
-The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R] and
-\f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the \f[I]Named
-Expressions\f[R] subsection).
-.RS
-.PP
-For \f[B]=\f[R], \f[B]b\f[R] is copied and the result is assigned to
-\f[B]a\f[R].
-For all others, \f[B]a\f[R] and \f[B]b\f[R] are applied as operands to
-the corresponding arithmetic operator and the result is assigned to
-\f[B]a\f[R].
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-The \f[B]relational\f[R] operators compare two expressions, \f[B]a\f[R]
-and \f[B]b\f[R], and if the relation holds, according to C language
-semantics, the result is \f[B]1\f[R].
-Otherwise, it is \f[B]0\f[R].
-.RS
.PP
+\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
+\f[B]%=\f[R] \f[B]\[ha]=\f[R]
+.PP
+: The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R]
+and \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the
+\f[I]Named Expressions\f[R] subsection).
+.IP
+.nf
+\f[C]
+For **=**, **b** is copied and the result is assigned to **a**. For all
+others, **a** and **b** are applied as operands to the corresponding
+arithmetic operator and the result is assigned to **a**.
+\f[R]
+.fi
+.PP
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
+.PP
+: The \f[B]relational\f[R] operators compare two expressions,
+\f[B]a\f[R] and \f[B]b\f[R], and if the relation holds, according to C
+language semantics, the result is \f[B]1\f[R].
+Otherwise, it is \f[B]0\f[R].
+.IP
+.nf
+\f[C]
Note that unlike in C, these operators have a lower precedence than the
-\f[B]assignment\f[R] operators, which means that \f[B]a=b>c\f[R] is
-interpreted as \f[B](a=b)>c\f[R].
+**assignment** operators, which means that **a=b\[rs]>c** is interpreted as
+**(a=b)\[rs]>c**.
+
+Also, unlike the [standard][1] requires, these operators can appear anywhere
+any other expressions can be used. This allowance is a
+**non-portable extension**.
+\f[R]
+.fi
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-requires, these operators can appear anywhere any other expressions can
-be used.
-This allowance is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]&&\f[R]
-The \f[B]boolean and\f[R] operator takes two expressions and returns
-\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
-.RS
.PP
-This is \f[I]not\f[R] a short-circuit operator.
+: The \f[B]boolean and\f[R] operator takes two expressions and returns
+\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]||\f[R]
-The \f[B]boolean or\f[R] operator takes two expressions and returns
+.PP
+: The \f[B]boolean or\f[R] operator takes two expressions and returns
\f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
otherwise.
-.RS
-.PP
-This is \f[I]not\f[R] a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Statements
.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
.IP " 2." 4
-\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] \&... \f[B];\f[R] \f[B]S\f[R]
-\f[B]}\f[R]
+\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] ...
+\f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
.IP " 3." 4
\f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
.IP " 4." 4
@@ -685,7 +785,8 @@ An empty statement
.IP "13." 4
A string of characters, enclosed in double quotes
.IP "14." 4
-\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] \&... \f[B],\f[R] \f[B]E\f[R]
+\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] ...
+\f[B],\f[R] \f[B]E\f[R]
.IP "15." 4
\f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
\f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
@@ -729,62 +830,22 @@ command.
An expression by itself is evaluated and printed, followed by a newline.
.SS Print Statement
.PP
-The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
+The \[dq]expressions\[dq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
specially.
What those sequences are, and what they cause to be printed, are shown
below:
.PP
-.TS
-tab(@);
-l l.
-T{
-\f[B]\[rs]a\f[R]
-T}@T{
-\f[B]\[rs]a\f[R]
-T}
-T{
-\f[B]\[rs]b\f[R]
-T}@T{
-\f[B]\[rs]b\f[R]
-T}
-T{
-\f[B]\[rs]\[rs]\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]e\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]f\f[R]
-T}@T{
-\f[B]\[rs]f\f[R]
-T}
-T{
-\f[B]\[rs]n\f[R]
-T}@T{
-\f[B]\[rs]n\f[R]
-T}
-T{
-\f[B]\[rs]q\f[R]
-T}@T{
-\f[B]\[dq]\f[R]
-T}
-T{
-\f[B]\[rs]r\f[R]
-T}@T{
-\f[B]\[rs]r\f[R]
-T}
-T{
-\f[B]\[rs]t\f[R]
-T}@T{
-\f[B]\[rs]t\f[R]
-T}
-.TE
+ * * * * *
+.PP
+\f[B]\[rs]a\f[R] \f[B]\[rs]a\f[R] \f[B]\[rs]b\f[R] \f[B]\[rs]b\f[R]
+\f[B]\[rs]\[rs]\f[R] \f[B]\[rs]\f[R] \f[B]\[rs]e\f[R] \f[B]\[rs]\f[R]
+\f[B]\[rs]f\f[R] \f[B]\[rs]f\f[R] \f[B]\[rs]n\f[R] \f[B]\[rs]n\f[R]
+\f[B]\[rs]q\f[R] \f[B]\[dq]\f[R] \f[B]\[rs]r\f[R] \f[B]\[rs]r\f[R]
+\f[B]\[rs]t\f[R] \f[B]\[rs]t\f[R]
+.PP
+ * * * * *
.PP
Any other character following a backslash causes the backslash and
character to be printed as-is.
@@ -880,9 +941,9 @@ Void functions can only use the first two \f[B]return\f[R] statements
listed above.
They can also omit the return statement entirely.
.PP
-The word \[lq]void\[rq] is not treated as a keyword; it is still
+The word \[dq]void\[dq] is not treated as a keyword; it is still
possible to have variables, arrays, and functions named \f[B]void\f[R].
-The word \[lq]void\[rq] is only treated specially right after the
+The word \[dq]void\[dq] is only treated specially right after the
\f[B]define\f[R] keyword.
.PP
This is a \f[B]non-portable extension\f[R].
@@ -913,55 +974,74 @@ All of the functions below are available when the \f[B]-l\f[R] or
The
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
-.TP
+.PP
\f[B]s(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]c(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l(x)\f[R]
-Returns the natural logarithm of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the natural logarithm of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]e(x)\f[R]
-Returns the mathematical constant \f[B]e\f[R] raised to the power of
+.PP
+: Returns the mathematical constant \f[B]e\f[R] raised to the power of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]j(x, n)\f[R]
-Returns the bessel integer order \f[B]n\f[R] (truncated) of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
+: Returns the bessel integer order \f[B]n\f[R] (truncated) of
+\f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.SS Transcendental Functions
.PP
All transcendental functions can return slightly inaccurate results (up
@@ -1037,59 +1117,71 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on bc(1):
-.TP
+.PP
\f[B]BC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
bc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]BC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]BC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]BC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]BC_BASE_POW\f[R].
-.TP
+.PP
\f[B]BC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]BC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
The actual values can be queried with the \f[B]limits\f[R] statement.
@@ -1101,42 +1193,44 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
bc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]POSIXLY_CORRECT\f[R]
-If this variable exists (no matter the contents), bc(1) behaves as if
+.PP
+: If this variable exists (no matter the contents), bc(1) behaves as if
the \f[B]-s\f[R] option was given.
-.TP
+.PP
\f[B]BC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to bc(1).
+.PP
+: This is another way to give command-line arguments to bc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time bc(1) runs.
-.RS
-.PP
-The code that parses \f[B]BC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some bc file.bc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]bc\[dq] file.bc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]BC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **BC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some bc file.bc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]bc\[rs]\[dq] file.bc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]bc\[aq] file.bc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **BC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]BC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
including the backslash (\f[B]\[rs]\f[R]).
@@ -1144,65 +1238,74 @@ The default line length is \f[B]70\f[R].
.SH EXIT STATUS
.PP
bc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, attempting to convert a negative number to a hardware
-integer, overflow when converting a number to a hardware integer, and
-attempting to use a non-integer where an integer is required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]) operator and the corresponding assignment
-operator.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**) operator and the corresponding assignment operator.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, using a token
-where it is invalid, giving an invalid expression, giving an invalid
-print statement, giving an invalid function definition, attempting to
-assign to an expression that is not a named expression (see the
-\f[I]Named Expressions\f[R] subsection of the \f[B]SYNTAX\f[R] section),
-giving an invalid \f[B]auto\f[R] list, having a duplicate
-\f[B]auto\f[R]/function parameter, failing to find the end of a code
-block, attempting to return a value from a \f[B]void\f[R] function,
-attempting to use a variable as a reference, and using any extensions
-when the option \f[B]-s\f[R] or any equivalents were given.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, using a token where it is invalid,
+giving an invalid expression, giving an invalid print statement, giving an
+invalid function definition, attempting to assign to an expression that is
+not a named expression (see the *Named Expressions* subsection of the
+**SYNTAX** section), giving an invalid **auto** list, having a duplicate
+**auto**/function parameter, failing to find the end of a code block,
+attempting to return a value from a **void** function, attempting to use a
+variable as a reference, and using any extensions when the option **-s** or
+any equivalents were given.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, passing the wrong number of
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, passing the wrong number of
arguments to functions, attempting to call an undefined function, and
-attempting to use a \f[B]void\f[R] function call as a value in an
-expression.
-.RE
-.TP
+attempting to use a **void** function call as a value in an expression.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (bc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (bc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
@@ -1232,7 +1335,7 @@ In interactive mode, bc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, bc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, bc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is required for history to be enabled (see the \f[B]COMMAND
LINE HISTORY\f[R] section).
@@ -1254,7 +1357,7 @@ If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If bc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If bc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/bc/EN.1.md b/contrib/bc/manuals/bc/EN.1.md
index 6dc19727c982..4e0a0f0fb8b4 100644
--- a/contrib/bc/manuals/bc/EN.1.md
+++ b/contrib/bc/manuals/bc/EN.1.md
@@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -127,13 +127,27 @@ The following are the options that bc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in bc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of bc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **read()** built-in function is called.
+
+ This is a **non-portable extension**.
+
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
diff --git a/contrib/bc/manuals/bc/ENP.1 b/contrib/bc/manuals/bc/ENP.1
index f96fe194cda1..e4452bd876f5 100644
--- a/contrib/bc/manuals/bc/ENP.1
+++ b/contrib/bc/manuals/bc/ENP.1
@@ -25,19 +25,19 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+\f[B]bc\f[R] [\f[B]-ghilPqRsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
-[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
-[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
+[\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
@@ -113,112 +113,145 @@ If **-s**, **-w**, or any equivalents are used, this option is ignored.
This is a **non-portable extension**.
\f[R]
.fi
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-l\f[R], \f[B]--mathlib\f[R]
-Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
-and loads the included math library before running any code, including
-any expressions or files specified on the command line.
-.RS
-.PP
-To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
-.RE
-.TP
+.PP
+: Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to
+\f[B]20\f[R] and loads the included math library before running any
+code, including any expressions or files specified on the command line.
+.IP
+.nf
+\f[C]
+To learn what is in the library, see the **LIBRARY** section.
+\f[R]
+.fi
+.PP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-This option is a no-op.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: Because bc(1) was built without support for prompts, this option is a
+no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
+.PP
+: This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-s\f[R], \f[B]--standard\f[R]
-Process exactly the language defined by the
+.PP
+: Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Print the version information (copyright header) and exit.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-w\f[R], \f[B]--warn\f[R]
-Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
+.PP
+: Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]BC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -275,7 +308,7 @@ Identifiers with more than one character (letter) are a
.PP
\f[B]ibase\f[R] is a global variable determining how to interpret
constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
@@ -287,7 +320,7 @@ The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
programs with the \f[B]maxibase()\f[R] built-in function.
.PP
\f[B]obase\f[R] is a global variable determining how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
@@ -438,223 +471,281 @@ This means that \f[B]A\f[R] alone always equals decimal \f[B]10\f[R] and
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-Type: Prefix and Postfix
-.RS
.PP
+: Type: Prefix and Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **increment**, **decrement**
+\f[R]
+.fi
.PP
-Description: \f[B]increment\f[R], \f[B]decrement\f[R]
-.RE
-.TP
\f[B]-\f[R] \f[B]!\f[R]
-Type: Prefix
-.RS
.PP
+: Type: Prefix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **negation**, **boolean not**
+\f[R]
+.fi
.PP
-Description: \f[B]negation\f[R], \f[B]boolean not\f[R]
-.RE
-.TP
\f[B]\[ha]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **power**
+\f[R]
+.fi
.PP
-Description: \f[B]power\f[R]
-.RE
-.TP
\f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **multiply**, **divide**, **modulus**
+\f[R]
+.fi
.PP
-Description: \f[B]multiply\f[R], \f[B]divide\f[R], \f[B]modulus\f[R]
-.RE
-.TP
\f[B]+\f[R] \f[B]-\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **add**, **subtract**
+\f[R]
+.fi
.PP
-Description: \f[B]add\f[R], \f[B]subtract\f[R]
-.RE
-.TP
-\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R]
-Type: Binary
-.RS
+\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
+\f[B]%=\f[R] \f[B]\[ha]=\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **assignment**
+\f[R]
+.fi
.PP
-Description: \f[B]assignment\f[R]
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-Type: Binary
-.RS
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **relational**
+\f[R]
+.fi
.PP
-Description: \f[B]relational\f[R]
-.RE
-.TP
\f[B]&&\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **boolean and**
+\f[R]
+.fi
.PP
-Description: \f[B]boolean and\f[R]
-.RE
-.TP
\f[B]||\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
-.PP
-Description: \f[B]boolean or\f[R]
-.RE
+
+Description: **boolean or**
+\f[R]
+.fi
.PP
The operators will be described in more detail below.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
+.PP
+: The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
subsection) as an operand.
-.RS
+.IP
+.nf
+\f[C]
+The prefix versions of these operators are more efficient; use them where
+possible.
+\f[R]
+.fi
.PP
-The prefix versions of these operators are more efficient; use them
-where possible.
-.RE
-.TP
\f[B]-\f[R]
-The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
+.PP
+: The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
to negate any expression with the value \f[B]0\f[R].
Otherwise, a copy of the expression with its sign flipped is returned.
-.TP
+.PP
\f[B]!\f[R]
-The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the expression
-is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the
+expression is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]\[ha]\f[R]
-The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
+.PP
+: The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
as it would be in C) takes two expressions and raises the first to the
power of the value of the second.
The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*), and if it is
+negative, the first value must be non-zero.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]), and if it
-is negative, the first value must be non-zero.
-.RE
-.TP
\f[B]*\f[R]
-The \f[B]multiply\f[R] operator takes two expressions, multiplies them,
-and returns the product.
+.PP
+: The \f[B]multiply\f[R] operator takes two expressions, multiplies
+them, and returns the product.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The \f[B]divide\f[R] operator takes two expressions, divides them, and
+.PP
+: The \f[B]divide\f[R] operator takes two expressions, divides them, and
returns the quotient.
The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]%\f[R]
-The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
\f[B]scale\f[R] and 2) Using the result of step 1 to calculate
\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
\f[B]max(scale+scale(b),scale(a))\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]+\f[R]
-The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]-\f[R]
-The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
-\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R]
-The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R] and
-\f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the \f[I]Named
-Expressions\f[R] subsection).
-.RS
-.PP
-For \f[B]=\f[R], \f[B]b\f[R] is copied and the result is assigned to
-\f[B]a\f[R].
-For all others, \f[B]a\f[R] and \f[B]b\f[R] are applied as operands to
-the corresponding arithmetic operator and the result is assigned to
-\f[B]a\f[R].
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-The \f[B]relational\f[R] operators compare two expressions, \f[B]a\f[R]
-and \f[B]b\f[R], and if the relation holds, according to C language
-semantics, the result is \f[B]1\f[R].
-Otherwise, it is \f[B]0\f[R].
-.RS
.PP
+\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
+\f[B]%=\f[R] \f[B]\[ha]=\f[R]
+.PP
+: The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R]
+and \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the
+\f[I]Named Expressions\f[R] subsection).
+.IP
+.nf
+\f[C]
+For **=**, **b** is copied and the result is assigned to **a**. For all
+others, **a** and **b** are applied as operands to the corresponding
+arithmetic operator and the result is assigned to **a**.
+\f[R]
+.fi
+.PP
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
+.PP
+: The \f[B]relational\f[R] operators compare two expressions,
+\f[B]a\f[R] and \f[B]b\f[R], and if the relation holds, according to C
+language semantics, the result is \f[B]1\f[R].
+Otherwise, it is \f[B]0\f[R].
+.IP
+.nf
+\f[C]
Note that unlike in C, these operators have a lower precedence than the
-\f[B]assignment\f[R] operators, which means that \f[B]a=b>c\f[R] is
-interpreted as \f[B](a=b)>c\f[R].
+**assignment** operators, which means that **a=b\[rs]>c** is interpreted as
+**(a=b)\[rs]>c**.
+
+Also, unlike the [standard][1] requires, these operators can appear anywhere
+any other expressions can be used. This allowance is a
+**non-portable extension**.
+\f[R]
+.fi
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-requires, these operators can appear anywhere any other expressions can
-be used.
-This allowance is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]&&\f[R]
-The \f[B]boolean and\f[R] operator takes two expressions and returns
-\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
-.RS
.PP
-This is \f[I]not\f[R] a short-circuit operator.
+: The \f[B]boolean and\f[R] operator takes two expressions and returns
+\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]||\f[R]
-The \f[B]boolean or\f[R] operator takes two expressions and returns
+.PP
+: The \f[B]boolean or\f[R] operator takes two expressions and returns
\f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
otherwise.
-.RS
-.PP
-This is \f[I]not\f[R] a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Statements
.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
.IP " 2." 4
-\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] \&... \f[B];\f[R] \f[B]S\f[R]
-\f[B]}\f[R]
+\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] ...
+\f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
.IP " 3." 4
\f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
.IP " 4." 4
@@ -680,7 +771,8 @@ An empty statement
.IP "13." 4
A string of characters, enclosed in double quotes
.IP "14." 4
-\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] \&... \f[B],\f[R] \f[B]E\f[R]
+\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] ...
+\f[B],\f[R] \f[B]E\f[R]
.IP "15." 4
\f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
\f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
@@ -724,62 +816,22 @@ command.
An expression by itself is evaluated and printed, followed by a newline.
.SS Print Statement
.PP
-The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
+The \[dq]expressions\[dq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
specially.
What those sequences are, and what they cause to be printed, are shown
below:
.PP
-.TS
-tab(@);
-l l.
-T{
-\f[B]\[rs]a\f[R]
-T}@T{
-\f[B]\[rs]a\f[R]
-T}
-T{
-\f[B]\[rs]b\f[R]
-T}@T{
-\f[B]\[rs]b\f[R]
-T}
-T{
-\f[B]\[rs]\[rs]\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]e\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]f\f[R]
-T}@T{
-\f[B]\[rs]f\f[R]
-T}
-T{
-\f[B]\[rs]n\f[R]
-T}@T{
-\f[B]\[rs]n\f[R]
-T}
-T{
-\f[B]\[rs]q\f[R]
-T}@T{
-\f[B]\[dq]\f[R]
-T}
-T{
-\f[B]\[rs]r\f[R]
-T}@T{
-\f[B]\[rs]r\f[R]
-T}
-T{
-\f[B]\[rs]t\f[R]
-T}@T{
-\f[B]\[rs]t\f[R]
-T}
-.TE
+ * * * * *
+.PP
+\f[B]\[rs]a\f[R] \f[B]\[rs]a\f[R] \f[B]\[rs]b\f[R] \f[B]\[rs]b\f[R]
+\f[B]\[rs]\[rs]\f[R] \f[B]\[rs]\f[R] \f[B]\[rs]e\f[R] \f[B]\[rs]\f[R]
+\f[B]\[rs]f\f[R] \f[B]\[rs]f\f[R] \f[B]\[rs]n\f[R] \f[B]\[rs]n\f[R]
+\f[B]\[rs]q\f[R] \f[B]\[dq]\f[R] \f[B]\[rs]r\f[R] \f[B]\[rs]r\f[R]
+\f[B]\[rs]t\f[R] \f[B]\[rs]t\f[R]
+.PP
+ * * * * *
.PP
Any other character following a backslash causes the backslash and
character to be printed as-is.
@@ -875,9 +927,9 @@ Void functions can only use the first two \f[B]return\f[R] statements
listed above.
They can also omit the return statement entirely.
.PP
-The word \[lq]void\[rq] is not treated as a keyword; it is still
+The word \[dq]void\[dq] is not treated as a keyword; it is still
possible to have variables, arrays, and functions named \f[B]void\f[R].
-The word \[lq]void\[rq] is only treated specially right after the
+The word \[dq]void\[dq] is only treated specially right after the
\f[B]define\f[R] keyword.
.PP
This is a \f[B]non-portable extension\f[R].
@@ -908,55 +960,74 @@ All of the functions below are available when the \f[B]-l\f[R] or
The
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
-.TP
+.PP
\f[B]s(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]c(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l(x)\f[R]
-Returns the natural logarithm of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the natural logarithm of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]e(x)\f[R]
-Returns the mathematical constant \f[B]e\f[R] raised to the power of
+.PP
+: Returns the mathematical constant \f[B]e\f[R] raised to the power of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]j(x, n)\f[R]
-Returns the bessel integer order \f[B]n\f[R] (truncated) of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
+: Returns the bessel integer order \f[B]n\f[R] (truncated) of
+\f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.SS Transcendental Functions
.PP
All transcendental functions can return slightly inaccurate results (up
@@ -1032,59 +1103,71 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on bc(1):
-.TP
+.PP
\f[B]BC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
bc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]BC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]BC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]BC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]BC_BASE_POW\f[R].
-.TP
+.PP
\f[B]BC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]BC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
The actual values can be queried with the \f[B]limits\f[R] statement.
@@ -1096,42 +1179,44 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
bc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]POSIXLY_CORRECT\f[R]
-If this variable exists (no matter the contents), bc(1) behaves as if
+.PP
+: If this variable exists (no matter the contents), bc(1) behaves as if
the \f[B]-s\f[R] option was given.
-.TP
+.PP
\f[B]BC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to bc(1).
+.PP
+: This is another way to give command-line arguments to bc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time bc(1) runs.
-.RS
-.PP
-The code that parses \f[B]BC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some bc file.bc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]bc\[dq] file.bc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]BC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **BC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some bc file.bc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]bc\[rs]\[dq] file.bc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]bc\[aq] file.bc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **BC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]BC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
including the backslash (\f[B]\[rs]\f[R]).
@@ -1139,65 +1224,74 @@ The default line length is \f[B]70\f[R].
.SH EXIT STATUS
.PP
bc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, attempting to convert a negative number to a hardware
-integer, overflow when converting a number to a hardware integer, and
-attempting to use a non-integer where an integer is required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]) operator and the corresponding assignment
-operator.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**) operator and the corresponding assignment operator.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, using a token
-where it is invalid, giving an invalid expression, giving an invalid
-print statement, giving an invalid function definition, attempting to
-assign to an expression that is not a named expression (see the
-\f[I]Named Expressions\f[R] subsection of the \f[B]SYNTAX\f[R] section),
-giving an invalid \f[B]auto\f[R] list, having a duplicate
-\f[B]auto\f[R]/function parameter, failing to find the end of a code
-block, attempting to return a value from a \f[B]void\f[R] function,
-attempting to use a variable as a reference, and using any extensions
-when the option \f[B]-s\f[R] or any equivalents were given.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, using a token where it is invalid,
+giving an invalid expression, giving an invalid print statement, giving an
+invalid function definition, attempting to assign to an expression that is
+not a named expression (see the *Named Expressions* subsection of the
+**SYNTAX** section), giving an invalid **auto** list, having a duplicate
+**auto**/function parameter, failing to find the end of a code block,
+attempting to return a value from a **void** function, attempting to use a
+variable as a reference, and using any extensions when the option **-s** or
+any equivalents were given.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, passing the wrong number of
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, passing the wrong number of
arguments to functions, attempting to call an undefined function, and
-attempting to use a \f[B]void\f[R] function call as a value in an
-expression.
-.RE
-.TP
+attempting to use a **void** function call as a value in an expression.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (bc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (bc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
@@ -1227,7 +1321,7 @@ In interactive mode, bc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, bc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, bc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is required for history to be enabled (see the \f[B]COMMAND
LINE HISTORY\f[R] section).
@@ -1247,7 +1341,7 @@ If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If bc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If bc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/bc/ENP.1.md b/contrib/bc/manuals/bc/ENP.1.md
index 20b60a7a9081..6c6dd2780e81 100644
--- a/contrib/bc/manuals/bc/ENP.1.md
+++ b/contrib/bc/manuals/bc/ENP.1.md
@@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -130,6 +130,12 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Because bc(1) was built without support for prompts, this option is a no-op.
+
+ This is a **non-portable extension**.
+
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
diff --git a/contrib/bc/manuals/bc/EP.1 b/contrib/bc/manuals/bc/EP.1
index 62ee57bfccc7..453b768082ed 100644
--- a/contrib/bc/manuals/bc/EP.1
+++ b/contrib/bc/manuals/bc/EP.1
@@ -25,19 +25,19 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+\f[B]bc\f[R] [\f[B]-ghilPqRsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
-[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
-[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
+[\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
@@ -113,112 +113,145 @@ If **-s**, **-w**, or any equivalents are used, this option is ignored.
This is a **non-portable extension**.
\f[R]
.fi
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-l\f[R], \f[B]--mathlib\f[R]
-Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
-and loads the included math library before running any code, including
-any expressions or files specified on the command line.
-.RS
-.PP
-To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
-.RE
-.TP
+.PP
+: Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to
+\f[B]20\f[R] and loads the included math library before running any
+code, including any expressions or files specified on the command line.
+.IP
+.nf
+\f[C]
+To learn what is in the library, see the **LIBRARY** section.
+\f[R]
+.fi
+.PP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-This option is a no-op.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: Because bc(1) was built without support for prompts, this option is a
+no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
+.PP
+: This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-s\f[R], \f[B]--standard\f[R]
-Process exactly the language defined by the
+.PP
+: Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Print the version information (copyright header) and exit.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-w\f[R], \f[B]--warn\f[R]
-Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
+.PP
+: Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]BC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -275,7 +308,7 @@ Identifiers with more than one character (letter) are a
.PP
\f[B]ibase\f[R] is a global variable determining how to interpret
constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
@@ -287,7 +320,7 @@ The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
programs with the \f[B]maxibase()\f[R] built-in function.
.PP
\f[B]obase\f[R] is a global variable determining how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
@@ -438,223 +471,281 @@ This means that \f[B]A\f[R] alone always equals decimal \f[B]10\f[R] and
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-Type: Prefix and Postfix
-.RS
.PP
+: Type: Prefix and Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **increment**, **decrement**
+\f[R]
+.fi
.PP
-Description: \f[B]increment\f[R], \f[B]decrement\f[R]
-.RE
-.TP
\f[B]-\f[R] \f[B]!\f[R]
-Type: Prefix
-.RS
.PP
+: Type: Prefix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **negation**, **boolean not**
+\f[R]
+.fi
.PP
-Description: \f[B]negation\f[R], \f[B]boolean not\f[R]
-.RE
-.TP
\f[B]\[ha]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **power**
+\f[R]
+.fi
.PP
-Description: \f[B]power\f[R]
-.RE
-.TP
\f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **multiply**, **divide**, **modulus**
+\f[R]
+.fi
.PP
-Description: \f[B]multiply\f[R], \f[B]divide\f[R], \f[B]modulus\f[R]
-.RE
-.TP
\f[B]+\f[R] \f[B]-\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **add**, **subtract**
+\f[R]
+.fi
.PP
-Description: \f[B]add\f[R], \f[B]subtract\f[R]
-.RE
-.TP
-\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R]
-Type: Binary
-.RS
+\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
+\f[B]%=\f[R] \f[B]\[ha]=\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **assignment**
+\f[R]
+.fi
.PP
-Description: \f[B]assignment\f[R]
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-Type: Binary
-.RS
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **relational**
+\f[R]
+.fi
.PP
-Description: \f[B]relational\f[R]
-.RE
-.TP
\f[B]&&\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **boolean and**
+\f[R]
+.fi
.PP
-Description: \f[B]boolean and\f[R]
-.RE
-.TP
\f[B]||\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
-.PP
-Description: \f[B]boolean or\f[R]
-.RE
+
+Description: **boolean or**
+\f[R]
+.fi
.PP
The operators will be described in more detail below.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
+.PP
+: The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
subsection) as an operand.
-.RS
+.IP
+.nf
+\f[C]
+The prefix versions of these operators are more efficient; use them where
+possible.
+\f[R]
+.fi
.PP
-The prefix versions of these operators are more efficient; use them
-where possible.
-.RE
-.TP
\f[B]-\f[R]
-The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
+.PP
+: The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
to negate any expression with the value \f[B]0\f[R].
Otherwise, a copy of the expression with its sign flipped is returned.
-.TP
+.PP
\f[B]!\f[R]
-The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the expression
-is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the
+expression is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]\[ha]\f[R]
-The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
+.PP
+: The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
as it would be in C) takes two expressions and raises the first to the
power of the value of the second.
The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*), and if it is
+negative, the first value must be non-zero.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]), and if it
-is negative, the first value must be non-zero.
-.RE
-.TP
\f[B]*\f[R]
-The \f[B]multiply\f[R] operator takes two expressions, multiplies them,
-and returns the product.
+.PP
+: The \f[B]multiply\f[R] operator takes two expressions, multiplies
+them, and returns the product.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The \f[B]divide\f[R] operator takes two expressions, divides them, and
+.PP
+: The \f[B]divide\f[R] operator takes two expressions, divides them, and
returns the quotient.
The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]%\f[R]
-The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
\f[B]scale\f[R] and 2) Using the result of step 1 to calculate
\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
\f[B]max(scale+scale(b),scale(a))\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]+\f[R]
-The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]-\f[R]
-The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
-\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R]
-The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R] and
-\f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the \f[I]Named
-Expressions\f[R] subsection).
-.RS
-.PP
-For \f[B]=\f[R], \f[B]b\f[R] is copied and the result is assigned to
-\f[B]a\f[R].
-For all others, \f[B]a\f[R] and \f[B]b\f[R] are applied as operands to
-the corresponding arithmetic operator and the result is assigned to
-\f[B]a\f[R].
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-The \f[B]relational\f[R] operators compare two expressions, \f[B]a\f[R]
-and \f[B]b\f[R], and if the relation holds, according to C language
-semantics, the result is \f[B]1\f[R].
-Otherwise, it is \f[B]0\f[R].
-.RS
.PP
+\f[B]=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R]
+\f[B]%=\f[R] \f[B]\[ha]=\f[R]
+.PP
+: The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R]
+and \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the
+\f[I]Named Expressions\f[R] subsection).
+.IP
+.nf
+\f[C]
+For **=**, **b** is copied and the result is assigned to **a**. For all
+others, **a** and **b** are applied as operands to the corresponding
+arithmetic operator and the result is assigned to **a**.
+\f[R]
+.fi
+.PP
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
+.PP
+: The \f[B]relational\f[R] operators compare two expressions,
+\f[B]a\f[R] and \f[B]b\f[R], and if the relation holds, according to C
+language semantics, the result is \f[B]1\f[R].
+Otherwise, it is \f[B]0\f[R].
+.IP
+.nf
+\f[C]
Note that unlike in C, these operators have a lower precedence than the
-\f[B]assignment\f[R] operators, which means that \f[B]a=b>c\f[R] is
-interpreted as \f[B](a=b)>c\f[R].
+**assignment** operators, which means that **a=b\[rs]>c** is interpreted as
+**(a=b)\[rs]>c**.
+
+Also, unlike the [standard][1] requires, these operators can appear anywhere
+any other expressions can be used. This allowance is a
+**non-portable extension**.
+\f[R]
+.fi
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-requires, these operators can appear anywhere any other expressions can
-be used.
-This allowance is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]&&\f[R]
-The \f[B]boolean and\f[R] operator takes two expressions and returns
-\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
-.RS
.PP
-This is \f[I]not\f[R] a short-circuit operator.
+: The \f[B]boolean and\f[R] operator takes two expressions and returns
+\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]||\f[R]
-The \f[B]boolean or\f[R] operator takes two expressions and returns
+.PP
+: The \f[B]boolean or\f[R] operator takes two expressions and returns
\f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
otherwise.
-.RS
-.PP
-This is \f[I]not\f[R] a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Statements
.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
.IP " 2." 4
-\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] \&... \f[B];\f[R] \f[B]S\f[R]
-\f[B]}\f[R]
+\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] ...
+\f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
.IP " 3." 4
\f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
.IP " 4." 4
@@ -680,7 +771,8 @@ An empty statement
.IP "13." 4
A string of characters, enclosed in double quotes
.IP "14." 4
-\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] \&... \f[B],\f[R] \f[B]E\f[R]
+\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] ...
+\f[B],\f[R] \f[B]E\f[R]
.IP "15." 4
\f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
\f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
@@ -724,62 +816,22 @@ command.
An expression by itself is evaluated and printed, followed by a newline.
.SS Print Statement
.PP
-The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
+The \[dq]expressions\[dq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
specially.
What those sequences are, and what they cause to be printed, are shown
below:
.PP
-.TS
-tab(@);
-l l.
-T{
-\f[B]\[rs]a\f[R]
-T}@T{
-\f[B]\[rs]a\f[R]
-T}
-T{
-\f[B]\[rs]b\f[R]
-T}@T{
-\f[B]\[rs]b\f[R]
-T}
-T{
-\f[B]\[rs]\[rs]\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]e\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]f\f[R]
-T}@T{
-\f[B]\[rs]f\f[R]
-T}
-T{
-\f[B]\[rs]n\f[R]
-T}@T{
-\f[B]\[rs]n\f[R]
-T}
-T{
-\f[B]\[rs]q\f[R]
-T}@T{
-\f[B]\[dq]\f[R]
-T}
-T{
-\f[B]\[rs]r\f[R]
-T}@T{
-\f[B]\[rs]r\f[R]
-T}
-T{
-\f[B]\[rs]t\f[R]
-T}@T{
-\f[B]\[rs]t\f[R]
-T}
-.TE
+ * * * * *
+.PP
+\f[B]\[rs]a\f[R] \f[B]\[rs]a\f[R] \f[B]\[rs]b\f[R] \f[B]\[rs]b\f[R]
+\f[B]\[rs]\[rs]\f[R] \f[B]\[rs]\f[R] \f[B]\[rs]e\f[R] \f[B]\[rs]\f[R]
+\f[B]\[rs]f\f[R] \f[B]\[rs]f\f[R] \f[B]\[rs]n\f[R] \f[B]\[rs]n\f[R]
+\f[B]\[rs]q\f[R] \f[B]\[dq]\f[R] \f[B]\[rs]r\f[R] \f[B]\[rs]r\f[R]
+\f[B]\[rs]t\f[R] \f[B]\[rs]t\f[R]
+.PP
+ * * * * *
.PP
Any other character following a backslash causes the backslash and
character to be printed as-is.
@@ -875,9 +927,9 @@ Void functions can only use the first two \f[B]return\f[R] statements
listed above.
They can also omit the return statement entirely.
.PP
-The word \[lq]void\[rq] is not treated as a keyword; it is still
+The word \[dq]void\[dq] is not treated as a keyword; it is still
possible to have variables, arrays, and functions named \f[B]void\f[R].
-The word \[lq]void\[rq] is only treated specially right after the
+The word \[dq]void\[dq] is only treated specially right after the
\f[B]define\f[R] keyword.
.PP
This is a \f[B]non-portable extension\f[R].
@@ -908,55 +960,74 @@ All of the functions below are available when the \f[B]-l\f[R] or
The
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
-.TP
+.PP
\f[B]s(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]c(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l(x)\f[R]
-Returns the natural logarithm of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the natural logarithm of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]e(x)\f[R]
-Returns the mathematical constant \f[B]e\f[R] raised to the power of
+.PP
+: Returns the mathematical constant \f[B]e\f[R] raised to the power of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]j(x, n)\f[R]
-Returns the bessel integer order \f[B]n\f[R] (truncated) of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
+: Returns the bessel integer order \f[B]n\f[R] (truncated) of
+\f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.SS Transcendental Functions
.PP
All transcendental functions can return slightly inaccurate results (up
@@ -1032,59 +1103,71 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on bc(1):
-.TP
+.PP
\f[B]BC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
bc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]BC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]BC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]BC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]BC_BASE_POW\f[R].
-.TP
+.PP
\f[B]BC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]BC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
The actual values can be queried with the \f[B]limits\f[R] statement.
@@ -1096,42 +1179,44 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
bc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]POSIXLY_CORRECT\f[R]
-If this variable exists (no matter the contents), bc(1) behaves as if
+.PP
+: If this variable exists (no matter the contents), bc(1) behaves as if
the \f[B]-s\f[R] option was given.
-.TP
+.PP
\f[B]BC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to bc(1).
+.PP
+: This is another way to give command-line arguments to bc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time bc(1) runs.
-.RS
-.PP
-The code that parses \f[B]BC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some bc file.bc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]bc\[dq] file.bc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]BC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **BC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some bc file.bc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]bc\[rs]\[dq] file.bc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]bc\[aq] file.bc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **BC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]BC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
including the backslash (\f[B]\[rs]\f[R]).
@@ -1139,65 +1224,74 @@ The default line length is \f[B]70\f[R].
.SH EXIT STATUS
.PP
bc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, attempting to convert a negative number to a hardware
-integer, overflow when converting a number to a hardware integer, and
-attempting to use a non-integer where an integer is required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]) operator and the corresponding assignment
-operator.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**) operator and the corresponding assignment operator.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, using a token
-where it is invalid, giving an invalid expression, giving an invalid
-print statement, giving an invalid function definition, attempting to
-assign to an expression that is not a named expression (see the
-\f[I]Named Expressions\f[R] subsection of the \f[B]SYNTAX\f[R] section),
-giving an invalid \f[B]auto\f[R] list, having a duplicate
-\f[B]auto\f[R]/function parameter, failing to find the end of a code
-block, attempting to return a value from a \f[B]void\f[R] function,
-attempting to use a variable as a reference, and using any extensions
-when the option \f[B]-s\f[R] or any equivalents were given.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, using a token where it is invalid,
+giving an invalid expression, giving an invalid print statement, giving an
+invalid function definition, attempting to assign to an expression that is
+not a named expression (see the *Named Expressions* subsection of the
+**SYNTAX** section), giving an invalid **auto** list, having a duplicate
+**auto**/function parameter, failing to find the end of a code block,
+attempting to return a value from a **void** function, attempting to use a
+variable as a reference, and using any extensions when the option **-s** or
+any equivalents were given.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, passing the wrong number of
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, passing the wrong number of
arguments to functions, attempting to call an undefined function, and
-attempting to use a \f[B]void\f[R] function call as a value in an
-expression.
-.RE
-.TP
+attempting to use a **void** function call as a value in an expression.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (bc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (bc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
@@ -1227,7 +1321,7 @@ In interactive mode, bc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, bc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, bc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is required for history to be enabled (see the \f[B]COMMAND
LINE HISTORY\f[R] section).
@@ -1247,7 +1341,7 @@ If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If bc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If bc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/bc/EP.1.md b/contrib/bc/manuals/bc/EP.1.md
index 9a36b99bcb1c..62530a4a9744 100644
--- a/contrib/bc/manuals/bc/EP.1.md
+++ b/contrib/bc/manuals/bc/EP.1.md
@@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -130,6 +130,12 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Because bc(1) was built without support for prompts, this option is a no-op.
+
+ This is a **non-portable extension**.
+
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
diff --git a/contrib/bc/manuals/bc/H.1 b/contrib/bc/manuals/bc/H.1
index fe9ac1556522..890630c4243b 100644
--- a/contrib/bc/manuals/bc/H.1
+++ b/contrib/bc/manuals/bc/H.1
@@ -25,19 +25,19 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+\f[B]bc\f[R] [\f[B]-ghilPqRsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
-[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
-[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
+[\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
@@ -53,210 +53,233 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.SH OPTIONS
.PP
The following are the options that bc(1) accepts.
-.TP
+.PP
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
-Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
-\f[B]seed\f[R] into stacks.
-.RS
.PP
-This has the effect that a copy of the current value of all four are
-pushed onto a stack for every function call, as well as popped when
-every function returns.
-This means that functions can assign to any and all of those globals
-without worrying that the change will affect other functions.
-Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply
-printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this:
+: Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R],
+and \f[B]seed\f[R] into stacks.
.IP
.nf
\f[C]
-define void output(x, b) {
- obase=b
- x
-}
+This has the effect that a copy of the current value of all four are pushed
+onto a stack for every function call, as well as popped when every function
+returns. This means that functions can assign to any and all of those
+globals without worrying that the change will affect other functions.
+Thus, a hypothetical function named **output(x,b)** that simply printed
+**x** in base **b** could be written like this:
+
+ define void output(x, b) {
+ obase=b
+ x
+ }
+
+instead of like this:
+
+ define void output(x, b) {
+ auto c
+ c=obase
+ obase=b
+ x
+ obase=c
+ }
+
+This makes writing functions much easier.
+
+(**Note**: the function **output(x,b)** exists in the extended math library.
+ See the **LIBRARY** section.)
+
+However, since using this flag means that functions cannot set **ibase**,
+**obase**, **scale**, or **seed** globally, functions that are made to do so
+cannot work anymore. There are two possible use cases for that, and each has
+a solution.
+
+First, if a function is called on startup to turn bc(1) into a number
+converter, it is possible to replace that capability with various shell
+aliases. Examples:
+
+ alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
+ alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
+
+Second, if the purpose of a function is to set **ibase**, **obase**,
+**scale**, or **seed** globally for any other purpose, it could be split
+into one to four functions (based on how many globals it sets) and each of
+those functions could return the desired value for a global.
+
+For functions that set **seed**, the value assigned to **seed** is not
+propagated to parent functions. This means that the sequence of
+pseudo-random numbers that they see will not be the same sequence of
+pseudo-random numbers that any parent sees. This is only the case once
+**seed** has been set.
+
+If a function desires to not affect the sequence of pseudo-random numbers
+of its parents, but wants to use the same **seed**, it can use the following
+line:
+
+ seed = seed
+
+If the behavior of this option is desired for every run of bc(1), then users
+could make sure to define **BC_ENV_ARGS** and include this option (see the
+**ENVIRONMENT VARIABLES** section for more details).
+
+If **-s**, **-w**, or any equivalents are used, this option is ignored.
+
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-instead of like this:
+\f[B]-h\f[R], \f[B]--help\f[R]
+.PP
+: Prints a usage message and quits.
+.PP
+\f[B]-i\f[R], \f[B]--interactive\f[R]
+.PP
+: Forces interactive mode.
+(See the \f[B]INTERACTIVE MODE\f[R] section.)
.IP
.nf
\f[C]
-define void output(x, b) {
- auto c
- c=obase
- obase=b
- x
- obase=c
-}
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-This makes writing functions much easier.
-.PP
-(\f[B]Note\f[R]: the function \f[B]output(x,b)\f[R] exists in the
-extended math library.
-See the \f[B]LIBRARY\f[R] section.)
-.PP
-However, since using this flag means that functions cannot set
-\f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R]
-globally, functions that are made to do so cannot work anymore.
-There are two possible use cases for that, and each has a solution.
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
.PP
-First, if a function is called on startup to turn bc(1) into a number
-converter, it is possible to replace that capability with various shell
-aliases.
-Examples:
+: Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to
+\f[B]20\f[R] and loads the included math library and the extended math
+library before running any code, including any expressions or files
+specified on the command line.
.IP
.nf
\f[C]
-alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
-alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
+To learn what is in the libraries, see the **LIBRARY** section.
\f[R]
.fi
.PP
-Second, if the purpose of a function is to set \f[B]ibase\f[R],
-\f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R] globally for any
-other purpose, it could be split into one to four functions (based on
-how many globals it sets) and each of those functions could return the
-desired value for a global.
-.PP
-For functions that set \f[B]seed\f[R], the value assigned to
-\f[B]seed\f[R] is not propagated to parent functions.
-This means that the sequence of pseudo-random numbers that they see will
-not be the same sequence of pseudo-random numbers that any parent sees.
-This is only the case once \f[B]seed\f[R] has been set.
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
.PP
-If a function desires to not affect the sequence of pseudo-random
-numbers of its parents, but wants to use the same \f[B]seed\f[R], it can
-use the following line:
+: Disables the prompt in TTY mode.
+(The prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a prompt or are not used to having them in bc(1).
+Most of those users would want to put this option in
+\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.IP
.nf
\f[C]
-seed = seed
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-If the behavior of this option is desired for every run of bc(1), then
-users could make sure to define \f[B]BC_ENV_ARGS\f[R] and include this
-option (see the \f[B]ENVIRONMENT VARIABLES\f[R] section for more
-details).
-.PP
-If \f[B]-s\f[R], \f[B]-w\f[R], or any equivalents are used, this option
-is ignored.
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
-\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
-(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]-l\f[R], \f[B]--mathlib\f[R]
-Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
-and loads the included math library and the extended math library before
-running any code, including any expressions or files specified on the
-command line.
-.RS
-.PP
-To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
-.RE
-.TP
-\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-Disables the prompt in TTY mode.
-(The prompt is only enabled in TTY mode.
-See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
-do not want a prompt or are not used to having them in bc(1).
+: Disables the read prompt in TTY mode.
+(The read prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a read prompt or are not used to having them in bc(1).
Most of those users would want to put this option in
\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
-.RS
+This option is also useful in hash bang lines of bc(1) scripts that
+prompt for user input.
+.IP
+.nf
+\f[C]
+This option does not disable the regular prompt because the read prompt is
+only used when the **read()** built-in function is called.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
+.PP
+: This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-s\f[R], \f[B]--standard\f[R]
-Process exactly the language defined by the
+.PP
+: Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Print the version information (copyright header) and exit.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-w\f[R], \f[B]--warn\f[R]
-Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
+.PP
+: Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]BC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -313,7 +336,7 @@ Identifiers with more than one character (letter) are a
.PP
\f[B]ibase\f[R] is a global variable determining how to interpret
constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
@@ -325,7 +348,7 @@ The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
programs with the \f[B]maxibase()\f[R] built-in function.
.PP
\f[B]obase\f[R] is a global variable determining how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
@@ -497,7 +520,7 @@ This is a \f[B]non-portable extension\f[R].
.IP "15." 4
\f[B]irand(E)\f[R]: A pseudo-random integer between \f[B]0\f[R]
(inclusive) and the value of \f[B]E\f[R] (exclusive).
-If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[cq]s
+If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[aq]s
\f[I]scale\f[R] is not \f[B]0\f[R]), an error is raised, and bc(1)
resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R] remains
unchanged.
@@ -575,301 +598,377 @@ extension\f[R].
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-Type: Prefix and Postfix
-.RS
.PP
+: Type: Prefix and Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **increment**, **decrement**
+\f[R]
+.fi
.PP
-Description: \f[B]increment\f[R], \f[B]decrement\f[R]
-.RE
-.TP
\f[B]-\f[R] \f[B]!\f[R]
-Type: Prefix
-.RS
.PP
+: Type: Prefix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **negation**, **boolean not**
+\f[R]
+.fi
.PP
-Description: \f[B]negation\f[R], \f[B]boolean not\f[R]
-.RE
-.TP
\f[B]$\f[R]
-Type: Postfix
-.RS
.PP
+: Type: Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **truncation**
+\f[R]
+.fi
.PP
-Description: \f[B]truncation\f[R]
-.RE
-.TP
\f[B]\[at]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **set precision**
+\f[R]
+.fi
.PP
-Description: \f[B]set precision\f[R]
-.RE
-.TP
\f[B]\[ha]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **power**
+\f[R]
+.fi
.PP
-Description: \f[B]power\f[R]
-.RE
-.TP
\f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **multiply**, **divide**, **modulus**
+\f[R]
+.fi
.PP
-Description: \f[B]multiply\f[R], \f[B]divide\f[R], \f[B]modulus\f[R]
-.RE
-.TP
\f[B]+\f[R] \f[B]-\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **add**, **subtract**
+\f[R]
+.fi
.PP
-Description: \f[B]add\f[R], \f[B]subtract\f[R]
-.RE
-.TP
\f[B]<<\f[R] \f[B]>>\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **shift left**, **shift right**
+\f[R]
+.fi
.PP
-Description: \f[B]shift left\f[R], \f[B]shift right\f[R]
-.RE
-.TP
-\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
-Type: Binary
-.RS
+\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R]
+\f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **assignment**
+\f[R]
+.fi
.PP
-Description: \f[B]assignment\f[R]
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-Type: Binary
-.RS
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **relational**
+\f[R]
+.fi
.PP
-Description: \f[B]relational\f[R]
-.RE
-.TP
\f[B]&&\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **boolean and**
+\f[R]
+.fi
.PP
-Description: \f[B]boolean and\f[R]
-.RE
-.TP
\f[B]||\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
-.PP
-Description: \f[B]boolean or\f[R]
-.RE
+
+Description: **boolean or**
+\f[R]
+.fi
.PP
The operators will be described in more detail below.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
+.PP
+: The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
subsection) as an operand.
-.RS
+.IP
+.nf
+\f[C]
+The prefix versions of these operators are more efficient; use them where
+possible.
+\f[R]
+.fi
.PP
-The prefix versions of these operators are more efficient; use them
-where possible.
-.RE
-.TP
\f[B]-\f[R]
-The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
+.PP
+: The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
to negate any expression with the value \f[B]0\f[R].
Otherwise, a copy of the expression with its sign flipped is returned.
-.TP
+.PP
\f[B]!\f[R]
-The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the expression
-is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the
+expression is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]$\f[R]
-The \f[B]truncation\f[R] operator returns a copy of the given expression
-with all of its \f[I]scale\f[R] removed.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]truncation\f[R] operator returns a copy of the given
+expression with all of its \f[I]scale\f[R] removed.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]\[at]\f[R]
-The \f[B]set precision\f[R] operator takes two expressions and returns a
-copy of the first with its \f[I]scale\f[R] equal to the value of the
+.PP
+: The \f[B]set precision\f[R] operator takes two expressions and returns
+a copy of the first with its \f[I]scale\f[R] equal to the value of the
second expression.
That could either mean that the number is returned without change (if
the \f[I]scale\f[R] of the first expression matches the value of the
second expression), extended (if it is less), or truncated (if it is
more).
-.RS
-.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
+.PP
+: The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
as it would be in C) takes two expressions and raises the first to the
power of the value of the second.
The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*), and if it is
+negative, the first value must be non-zero.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]), and if it
-is negative, the first value must be non-zero.
-.RE
-.TP
\f[B]*\f[R]
-The \f[B]multiply\f[R] operator takes two expressions, multiplies them,
-and returns the product.
+.PP
+: The \f[B]multiply\f[R] operator takes two expressions, multiplies
+them, and returns the product.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The \f[B]divide\f[R] operator takes two expressions, divides them, and
+.PP
+: The \f[B]divide\f[R] operator takes two expressions, divides them, and
returns the quotient.
The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]%\f[R]
-The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
\f[B]scale\f[R] and 2) Using the result of step 1 to calculate
\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
\f[B]max(scale+scale(b),scale(a))\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]+\f[R]
-The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]-\f[R]
-The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]<<\f[R]
-The \f[B]left shift\f[R] operator takes two expressions, \f[B]a\f[R] and
-\f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
-decimal point moved \f[B]b\f[R] places to the right.
-.RS
.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+: The \f[B]left shift\f[R] operator takes two expressions, \f[B]a\f[R]
+and \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
+decimal point moved \f[B]b\f[R] places to the right.
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]>>\f[R]
-The \f[B]right shift\f[R] operator takes two expressions, \f[B]a\f[R]
+.PP
+: The \f[B]right shift\f[R] operator takes two expressions, \f[B]a\f[R]
and \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
decimal point moved \f[B]b\f[R] places to the left.
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R]
+\f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
-The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R] and
-\f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the \f[I]Named
-Expressions\f[R] subsection).
-.RS
-.PP
-For \f[B]=\f[R], \f[B]b\f[R] is copied and the result is assigned to
-\f[B]a\f[R].
-For all others, \f[B]a\f[R] and \f[B]b\f[R] are applied as operands to
-the corresponding arithmetic operator and the result is assigned to
-\f[B]a\f[R].
-.PP
-The \f[B]assignment\f[R] operators that correspond to operators that are
-extensions are themselves \f[B]non-portable extensions\f[R].
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-The \f[B]relational\f[R] operators compare two expressions, \f[B]a\f[R]
-and \f[B]b\f[R], and if the relation holds, according to C language
-semantics, the result is \f[B]1\f[R].
-Otherwise, it is \f[B]0\f[R].
-.RS
+: The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R]
+and \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the
+\f[I]Named Expressions\f[R] subsection).
+.IP
+.nf
+\f[C]
+For **=**, **b** is copied and the result is assigned to **a**. For all
+others, **a** and **b** are applied as operands to the corresponding
+arithmetic operator and the result is assigned to **a**.
+
+The **assignment** operators that correspond to operators that are
+extensions are themselves **non-portable extensions**.
+\f[R]
+.fi
+.PP
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: The \f[B]relational\f[R] operators compare two expressions,
+\f[B]a\f[R] and \f[B]b\f[R], and if the relation holds, according to C
+language semantics, the result is \f[B]1\f[R].
+Otherwise, it is \f[B]0\f[R].
+.IP
+.nf
+\f[C]
Note that unlike in C, these operators have a lower precedence than the
-\f[B]assignment\f[R] operators, which means that \f[B]a=b>c\f[R] is
-interpreted as \f[B](a=b)>c\f[R].
+**assignment** operators, which means that **a=b\[rs]>c** is interpreted as
+**(a=b)\[rs]>c**.
+
+Also, unlike the [standard][1] requires, these operators can appear anywhere
+any other expressions can be used. This allowance is a
+**non-portable extension**.
+\f[R]
+.fi
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-requires, these operators can appear anywhere any other expressions can
-be used.
-This allowance is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]&&\f[R]
-The \f[B]boolean and\f[R] operator takes two expressions and returns
-\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
-.RS
.PP
-This is \f[I]not\f[R] a short-circuit operator.
+: The \f[B]boolean and\f[R] operator takes two expressions and returns
+\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]||\f[R]
-The \f[B]boolean or\f[R] operator takes two expressions and returns
+.PP
+: The \f[B]boolean or\f[R] operator takes two expressions and returns
\f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
otherwise.
-.RS
-.PP
-This is \f[I]not\f[R] a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Statements
.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
.IP " 2." 4
-\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] \&... \f[B];\f[R] \f[B]S\f[R]
-\f[B]}\f[R]
+\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] ...
+\f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
.IP " 3." 4
\f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
.IP " 4." 4
@@ -895,7 +994,8 @@ An empty statement
.IP "13." 4
A string of characters, enclosed in double quotes
.IP "14." 4
-\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] \&... \f[B],\f[R] \f[B]E\f[R]
+\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] ...
+\f[B],\f[R] \f[B]E\f[R]
.IP "15." 4
\f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
\f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
@@ -953,62 +1053,22 @@ Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
.SS Print Statement
.PP
-The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
+The \[dq]expressions\[dq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
specially.
What those sequences are, and what they cause to be printed, are shown
below:
.PP
-.TS
-tab(@);
-l l.
-T{
-\f[B]\[rs]a\f[R]
-T}@T{
-\f[B]\[rs]a\f[R]
-T}
-T{
-\f[B]\[rs]b\f[R]
-T}@T{
-\f[B]\[rs]b\f[R]
-T}
-T{
-\f[B]\[rs]\[rs]\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]e\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]f\f[R]
-T}@T{
-\f[B]\[rs]f\f[R]
-T}
-T{
-\f[B]\[rs]n\f[R]
-T}@T{
-\f[B]\[rs]n\f[R]
-T}
-T{
-\f[B]\[rs]q\f[R]
-T}@T{
-\f[B]\[dq]\f[R]
-T}
-T{
-\f[B]\[rs]r\f[R]
-T}@T{
-\f[B]\[rs]r\f[R]
-T}
-T{
-\f[B]\[rs]t\f[R]
-T}@T{
-\f[B]\[rs]t\f[R]
-T}
-.TE
+ * * * * *
+.PP
+\f[B]\[rs]a\f[R] \f[B]\[rs]a\f[R] \f[B]\[rs]b\f[R] \f[B]\[rs]b\f[R]
+\f[B]\[rs]\[rs]\f[R] \f[B]\[rs]\f[R] \f[B]\[rs]e\f[R] \f[B]\[rs]\f[R]
+\f[B]\[rs]f\f[R] \f[B]\[rs]f\f[R] \f[B]\[rs]n\f[R] \f[B]\[rs]n\f[R]
+\f[B]\[rs]q\f[R] \f[B]\[dq]\f[R] \f[B]\[rs]r\f[R] \f[B]\[rs]r\f[R]
+\f[B]\[rs]t\f[R] \f[B]\[rs]t\f[R]
+.PP
+ * * * * *
.PP
Any other character following a backslash causes the backslash and
character to be printed as-is.
@@ -1104,9 +1164,9 @@ Void functions can only use the first two \f[B]return\f[R] statements
listed above.
They can also omit the return statement entirely.
.PP
-The word \[lq]void\[rq] is not treated as a keyword; it is still
+The word \[dq]void\[dq] is not treated as a keyword; it is still
possible to have variables, arrays, and functions named \f[B]void\f[R].
-The word \[lq]void\[rq] is only treated specially right after the
+The word \[dq]void\[dq] is only treated specially right after the
\f[B]define\f[R] keyword.
.PP
This is a \f[B]non-portable extension\f[R].
@@ -1141,55 +1201,74 @@ are given.
The
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
-.TP
+.PP
\f[B]s(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]c(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l(x)\f[R]
-Returns the natural logarithm of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the natural logarithm of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]e(x)\f[R]
-Returns the mathematical constant \f[B]e\f[R] raised to the power of
+.PP
+: Returns the mathematical constant \f[B]e\f[R] raised to the power of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]j(x, n)\f[R]
-Returns the bessel integer order \f[B]n\f[R] (truncated) of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
+: Returns the bessel integer order \f[B]n\f[R] (truncated) of
+\f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
@@ -1198,99 +1277,126 @@ options are given since they are not part of the library defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
The extended library is a \f[B]non-portable extension\f[R].
-.TP
+.PP
\f[B]p(x, y)\f[R]
-Calculates \f[B]x\f[R] to the power of \f[B]y\f[R], even if \f[B]y\f[R]
-is not an integer, and returns the result to the current
-\f[B]scale\f[R].
-.RS
.PP
-It is an error if \f[B]y\f[R] is negative and \f[B]x\f[R] is
-\f[B]0\f[R].
+: Calculates \f[B]x\f[R] to the power of \f[B]y\f[R], even if
+\f[B]y\f[R] is not an integer, and returns the result to the current
+\f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+It is an error if **y** is negative and **x** is **0**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]r(x, p)\f[R]
-Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
+.PP
+: Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
the rounding mode round half away from
\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
-.TP
+.PP
\f[B]ceil(x, p)\f[R]
-Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
+.PP
+: Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
the rounding mode round away from
\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero).
-.TP
+.PP
\f[B]f(x)\f[R]
-Returns the factorial of the truncated absolute value of \f[B]x\f[R].
-.TP
+.PP
+: Returns the factorial of the truncated absolute value of \f[B]x\f[R].
+.PP
\f[B]perm(n, k)\f[R]
-Returns the permutation of the truncated absolute value of \f[B]n\f[R]
+.PP
+: Returns the permutation of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
If not, it returns \f[B]0\f[R].
-.TP
+.PP
\f[B]comb(n, k)\f[R]
-Returns the combination of the truncated absolute value of \f[B]n\f[R]
+.PP
+: Returns the combination of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
If not, it returns \f[B]0\f[R].
-.TP
+.PP
\f[B]l2(x)\f[R]
-Returns the logarithm base \f[B]2\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]2\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l10(x)\f[R]
-Returns the logarithm base \f[B]10\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]10\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]log(x, b)\f[R]
-Returns the logarithm base \f[B]b\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]b\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]cbrt(x)\f[R]
-Returns the cube root of \f[B]x\f[R].
-.TP
+.PP
+: Returns the cube root of \f[B]x\f[R].
+.PP
\f[B]root(x, n)\f[R]
-Calculates the truncated value of \f[B]n\f[R], \f[B]r\f[R], and returns
-the \f[B]r\f[R]th root of \f[B]x\f[R] to the current \f[B]scale\f[R].
-.RS
-.PP
-If \f[B]r\f[R] is \f[B]0\f[R] or negative, this raises an error and
-causes bc(1) to reset (see the \f[B]RESET\f[R] section).
-It also raises an error and causes bc(1) to reset if \f[B]r\f[R] is even
-and \f[B]x\f[R] is negative.
-.RE
-.TP
+.PP
+: Calculates the truncated value of \f[B]n\f[R], \f[B]r\f[R], and
+returns the \f[B]r\f[R]th root of \f[B]x\f[R] to the current
+\f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+If **r** is **0** or negative, this raises an error and causes bc(1) to
+reset (see the **RESET** section). It also raises an error and causes bc(1)
+to reset if **r** is even and **x** is negative.
+\f[R]
+.fi
+.PP
\f[B]pi(p)\f[R]
-Returns \f[B]pi\f[R] to \f[B]p\f[R] decimal places.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns \f[B]pi\f[R] to \f[B]p\f[R] decimal places.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]t(x)\f[R]
-Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a2(y, x)\f[R]
-Returns the arctangent of \f[B]y/x\f[R], in radians.
+.PP
+: Returns the arctangent of \f[B]y/x\f[R], in radians.
If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
@@ -1303,60 +1409,75 @@ If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
\f[B]0\f[R], it returns \f[B]pi/2\f[R].
If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
\f[B]0\f[R], it returns \f[B]-pi/2\f[R].
-.RS
-.PP
-This function is the same as the \f[B]atan2()\f[R] function in many
-programming languages.
+.IP
+.nf
+\f[C]
+This function is the same as the **atan2()** function in many programming
+languages.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]sin(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is an alias of \f[B]s(x)\f[R].
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **s(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]cos(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is an alias of \f[B]c(x)\f[R].
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **c(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]tan(x)\f[R]
-Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-If \f[B]x\f[R] is equal to \f[B]1\f[R] or \f[B]-1\f[R], this raises an
-error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
-.PP
-This is an alias of \f[B]t(x)\f[R].
+: Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+If **x** is equal to **1** or **-1**, this raises an error and causes bc(1)
+to reset (see the **RESET** section).
+
+This is an alias of **t(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]atan(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is an alias of \f[B]a(x)\f[R].
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **a(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]atan2(y, x)\f[R]
-Returns the arctangent of \f[B]y/x\f[R], in radians.
+.PP
+: Returns the arctangent of \f[B]y/x\f[R], in radians.
If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
@@ -1369,302 +1490,367 @@ If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
\f[B]0\f[R], it returns \f[B]pi/2\f[R].
If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
\f[B]0\f[R], it returns \f[B]-pi/2\f[R].
-.RS
-.PP
-This function is the same as the \f[B]atan2()\f[R] function in many
-programming languages.
-.PP
-This is an alias of \f[B]a2(y, x)\f[R].
+.IP
+.nf
+\f[C]
+This function is the same as the **atan2()** function in many programming
+languages.
+
+This is an alias of **a2(y, x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]r2d(x)\f[R]
-Converts \f[B]x\f[R] from radians to degrees and returns the result.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Converts \f[B]x\f[R] from radians to degrees and returns the result.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]d2r(x)\f[R]
-Converts \f[B]x\f[R] from degrees to radians and returns the result.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Converts \f[B]x\f[R] from degrees to radians and returns the result.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]frand(p)\f[R]
-Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
+.PP
+: Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
\f[B]1\f[R] (exclusive) with the number of decimal digits after the
decimal point equal to the truncated absolute value of \f[B]p\f[R].
If \f[B]p\f[R] is not \f[B]0\f[R], then calling this function will
change the value of \f[B]seed\f[R].
If \f[B]p\f[R] is \f[B]0\f[R], then \f[B]0\f[R] is returned, and
\f[B]seed\f[R] is \f[I]not\f[R] changed.
-.TP
+.PP
\f[B]ifrand(i, p)\f[R]
-Generates a pseudo-random number that is between \f[B]0\f[R] (inclusive)
-and the truncated absolute value of \f[B]i\f[R] (exclusive) with the
-number of decimal digits after the decimal point equal to the truncated
-absolute value of \f[B]p\f[R].
+.PP
+: Generates a pseudo-random number that is between \f[B]0\f[R]
+(inclusive) and the truncated absolute value of \f[B]i\f[R] (exclusive)
+with the number of decimal digits after the decimal point equal to the
+truncated absolute value of \f[B]p\f[R].
If the absolute value of \f[B]i\f[R] is greater than or equal to
\f[B]2\f[R], and \f[B]p\f[R] is not \f[B]0\f[R], then calling this
function will change the value of \f[B]seed\f[R]; otherwise, \f[B]0\f[R]
is returned and \f[B]seed\f[R] is not changed.
-.TP
+.PP
\f[B]srand(x)\f[R]
-Returns \f[B]x\f[R] with its sign flipped with probability
+.PP
+: Returns \f[B]x\f[R] with its sign flipped with probability
\f[B]0.5\f[R].
In other words, it randomizes the sign of \f[B]x\f[R].
-.TP
+.PP
\f[B]brand()\f[R]
-Returns a random boolean value (either \f[B]0\f[R] or \f[B]1\f[R]).
-.TP
+.PP
+: Returns a random boolean value (either \f[B]0\f[R] or \f[B]1\f[R]).
+.PP
\f[B]ubytes(x)\f[R]
-Returns the numbers of unsigned integer bytes required to hold the
+.PP
+: Returns the numbers of unsigned integer bytes required to hold the
truncated absolute value of \f[B]x\f[R].
-.TP
+.PP
\f[B]sbytes(x)\f[R]
-Returns the numbers of signed, two\[cq]s-complement integer bytes
+.PP
+: Returns the numbers of signed, two\[aq]s-complement integer bytes
required to hold the truncated value of \f[B]x\f[R].
-.TP
+.PP
\f[B]hex(x)\f[R]
-Outputs the hexadecimal (base \f[B]16\f[R]) representation of
+.PP
+: Outputs the hexadecimal (base \f[B]16\f[R]) representation of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]binary(x)\f[R]
-Outputs the binary (base \f[B]2\f[R]) representation of \f[B]x\f[R].
-.RS
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
+: Outputs the binary (base \f[B]2\f[R]) representation of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
+.PP
\f[B]output(x, b)\f[R]
-Outputs the base \f[B]b\f[R] representation of \f[B]x\f[R].
-.RS
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
+: Outputs the base \f[B]b\f[R] representation of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
+.PP
\f[B]uint(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in as few power of two bytes as possible.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or is negative, an error message is
-printed instead, but bc(1) is not reset (see the \f[B]RESET\f[R]
-section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in as few power of two bytes as possible.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or is negative, an error message is printed
+instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in as few power of two bytes as
-possible.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, an error message is printed instead,
-but bc(1) is not reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in as few power of two bytes
+as possible.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, an error message is printed instead, but bc(1)
+is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uintn(x, n)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]n\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]n\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]n\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **n** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]intn(x, n)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]n\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]n\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]n\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **n** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint8(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]1\f[R] byte.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]1\f[R] byte, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]1\f[R] byte.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **1** byte, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int8(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]1\f[R] byte.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]1\f[R] byte, an
-error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]1\f[R] byte.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **1** byte, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint16(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]2\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]2\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]2\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **2** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int16(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]2\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]2\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]2\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **2** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint32(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]4\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]4\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]4\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **4** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int32(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]4\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]4\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]4\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **4** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint64(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]8\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]8\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]8\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **8** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int64(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]8\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]8\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]8\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **8** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]hex_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in hexadecimal using \f[B]n\f[R]
bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]binary_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in binary using \f[B]n\f[R] bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]output_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in the current \f[B]obase\f[R] (see
the \f[B]SYNTAX\f[R] section) using \f[B]n\f[R] bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]output_byte(x, i)\f[R]
-Outputs byte \f[B]i\f[R] of the truncated absolute value of \f[B]x\f[R],
-where \f[B]0\f[R] is the least significant byte and \f[B]number_of_bytes
-- 1\f[R] is the most significant byte.
-.RS
-.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
+.PP
+: Outputs byte \f[B]i\f[R] of the truncated absolute value of
+\f[B]x\f[R], where \f[B]0\f[R] is the least significant byte and
+\f[B]number_of_bytes - 1\f[R] is the most significant byte.
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.SS Transcendental Functions
.PP
All transcendental functions can return slightly inaccurate results (up
@@ -1768,64 +1954,77 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on bc(1):
-.TP
+.PP
\f[B]BC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
bc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]BC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]BC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]BC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]BC_BASE_POW\f[R].
-.TP
+.PP
\f[B]BC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_RAND_MAX\f[R]
-The maximum integer (inclusive) returned by the \f[B]rand()\f[R]
+.PP
+: The maximum integer (inclusive) returned by the \f[B]rand()\f[R]
operand.
Set at \f[B]2\[ha]BC_LONG_BIT-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]BC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
The actual values can be queried with the \f[B]limits\f[R] statement.
@@ -1837,42 +2036,44 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
bc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]POSIXLY_CORRECT\f[R]
-If this variable exists (no matter the contents), bc(1) behaves as if
+.PP
+: If this variable exists (no matter the contents), bc(1) behaves as if
the \f[B]-s\f[R] option was given.
-.TP
+.PP
\f[B]BC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to bc(1).
+.PP
+: This is another way to give command-line arguments to bc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time bc(1) runs.
-.RS
-.PP
-The code that parses \f[B]BC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some bc file.bc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]bc\[dq] file.bc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]BC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **BC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some bc file.bc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]bc\[rs]\[dq] file.bc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]bc\[aq] file.bc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **BC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]BC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
including the backslash (\f[B]\[rs]\f[R]).
@@ -1880,68 +2081,76 @@ The default line length is \f[B]70\f[R].
.SH EXIT STATUS
.PP
bc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, using a negative number as a bound for the
-pseudo-random number generator, attempting to convert a negative number
-to a hardware integer, overflow when converting a number to a hardware
-integer, and attempting to use a non-integer where an integer is
-required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
-(\f[B]<<\f[R]), and right shift (\f[B]>>\f[R]) operators and their
-corresponding assignment operators.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, using a negative number as a bound for the pseudo-random number
+generator, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**), places (**\[rs]\[at]**), left shift (**\[rs]<\[rs]<**), and right shift (**\[rs]>\[rs]>**)
+operators and their corresponding assignment operators.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, using a token
-where it is invalid, giving an invalid expression, giving an invalid
-print statement, giving an invalid function definition, attempting to
-assign to an expression that is not a named expression (see the
-\f[I]Named Expressions\f[R] subsection of the \f[B]SYNTAX\f[R] section),
-giving an invalid \f[B]auto\f[R] list, having a duplicate
-\f[B]auto\f[R]/function parameter, failing to find the end of a code
-block, attempting to return a value from a \f[B]void\f[R] function,
-attempting to use a variable as a reference, and using any extensions
-when the option \f[B]-s\f[R] or any equivalents were given.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, using a token where it is invalid,
+giving an invalid expression, giving an invalid print statement, giving an
+invalid function definition, attempting to assign to an expression that is
+not a named expression (see the *Named Expressions* subsection of the
+**SYNTAX** section), giving an invalid **auto** list, having a duplicate
+**auto**/function parameter, failing to find the end of a code block,
+attempting to return a value from a **void** function, attempting to use a
+variable as a reference, and using any extensions when the option **-s** or
+any equivalents were given.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, passing the wrong number of
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, passing the wrong number of
arguments to functions, attempting to call an undefined function, and
-attempting to use a \f[B]void\f[R] function call as a value in an
-expression.
-.RE
-.TP
+attempting to use a **void** function call as a value in an expression.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (bc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (bc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
@@ -1971,7 +2180,7 @@ In interactive mode, bc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, bc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, bc(1) turns on \[dq]TTY mode.\[dq]
.PP
The prompt is enabled in TTY mode.
.PP
@@ -1988,7 +2197,7 @@ If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If bc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If bc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/bc/H.1.md b/contrib/bc/manuals/bc/H.1.md
index 5ba65ba1f5d6..57a753a417e6 100644
--- a/contrib/bc/manuals/bc/H.1.md
+++ b/contrib/bc/manuals/bc/H.1.md
@@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -139,13 +139,27 @@ The following are the options that bc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in bc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of bc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **read()** built-in function is called.
+
+ This is a **non-portable extension**.
+
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
diff --git a/contrib/bc/manuals/bc/HN.1 b/contrib/bc/manuals/bc/HN.1
index fe6043eb69d1..97965d7a8868 100644
--- a/contrib/bc/manuals/bc/HN.1
+++ b/contrib/bc/manuals/bc/HN.1
@@ -25,19 +25,19 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+\f[B]bc\f[R] [\f[B]-ghilPqRsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
-[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
-[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
+[\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
@@ -53,210 +53,233 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.SH OPTIONS
.PP
The following are the options that bc(1) accepts.
-.TP
+.PP
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
-Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
-\f[B]seed\f[R] into stacks.
-.RS
.PP
-This has the effect that a copy of the current value of all four are
-pushed onto a stack for every function call, as well as popped when
-every function returns.
-This means that functions can assign to any and all of those globals
-without worrying that the change will affect other functions.
-Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply
-printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this:
+: Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R],
+and \f[B]seed\f[R] into stacks.
.IP
.nf
\f[C]
-define void output(x, b) {
- obase=b
- x
-}
+This has the effect that a copy of the current value of all four are pushed
+onto a stack for every function call, as well as popped when every function
+returns. This means that functions can assign to any and all of those
+globals without worrying that the change will affect other functions.
+Thus, a hypothetical function named **output(x,b)** that simply printed
+**x** in base **b** could be written like this:
+
+ define void output(x, b) {
+ obase=b
+ x
+ }
+
+instead of like this:
+
+ define void output(x, b) {
+ auto c
+ c=obase
+ obase=b
+ x
+ obase=c
+ }
+
+This makes writing functions much easier.
+
+(**Note**: the function **output(x,b)** exists in the extended math library.
+ See the **LIBRARY** section.)
+
+However, since using this flag means that functions cannot set **ibase**,
+**obase**, **scale**, or **seed** globally, functions that are made to do so
+cannot work anymore. There are two possible use cases for that, and each has
+a solution.
+
+First, if a function is called on startup to turn bc(1) into a number
+converter, it is possible to replace that capability with various shell
+aliases. Examples:
+
+ alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
+ alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
+
+Second, if the purpose of a function is to set **ibase**, **obase**,
+**scale**, or **seed** globally for any other purpose, it could be split
+into one to four functions (based on how many globals it sets) and each of
+those functions could return the desired value for a global.
+
+For functions that set **seed**, the value assigned to **seed** is not
+propagated to parent functions. This means that the sequence of
+pseudo-random numbers that they see will not be the same sequence of
+pseudo-random numbers that any parent sees. This is only the case once
+**seed** has been set.
+
+If a function desires to not affect the sequence of pseudo-random numbers
+of its parents, but wants to use the same **seed**, it can use the following
+line:
+
+ seed = seed
+
+If the behavior of this option is desired for every run of bc(1), then users
+could make sure to define **BC_ENV_ARGS** and include this option (see the
+**ENVIRONMENT VARIABLES** section for more details).
+
+If **-s**, **-w**, or any equivalents are used, this option is ignored.
+
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-instead of like this:
+\f[B]-h\f[R], \f[B]--help\f[R]
+.PP
+: Prints a usage message and quits.
+.PP
+\f[B]-i\f[R], \f[B]--interactive\f[R]
+.PP
+: Forces interactive mode.
+(See the \f[B]INTERACTIVE MODE\f[R] section.)
.IP
.nf
\f[C]
-define void output(x, b) {
- auto c
- c=obase
- obase=b
- x
- obase=c
-}
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-This makes writing functions much easier.
-.PP
-(\f[B]Note\f[R]: the function \f[B]output(x,b)\f[R] exists in the
-extended math library.
-See the \f[B]LIBRARY\f[R] section.)
-.PP
-However, since using this flag means that functions cannot set
-\f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R]
-globally, functions that are made to do so cannot work anymore.
-There are two possible use cases for that, and each has a solution.
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
.PP
-First, if a function is called on startup to turn bc(1) into a number
-converter, it is possible to replace that capability with various shell
-aliases.
-Examples:
+: Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to
+\f[B]20\f[R] and loads the included math library and the extended math
+library before running any code, including any expressions or files
+specified on the command line.
.IP
.nf
\f[C]
-alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
-alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
+To learn what is in the libraries, see the **LIBRARY** section.
\f[R]
.fi
.PP
-Second, if the purpose of a function is to set \f[B]ibase\f[R],
-\f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R] globally for any
-other purpose, it could be split into one to four functions (based on
-how many globals it sets) and each of those functions could return the
-desired value for a global.
-.PP
-For functions that set \f[B]seed\f[R], the value assigned to
-\f[B]seed\f[R] is not propagated to parent functions.
-This means that the sequence of pseudo-random numbers that they see will
-not be the same sequence of pseudo-random numbers that any parent sees.
-This is only the case once \f[B]seed\f[R] has been set.
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
.PP
-If a function desires to not affect the sequence of pseudo-random
-numbers of its parents, but wants to use the same \f[B]seed\f[R], it can
-use the following line:
+: Disables the prompt in TTY mode.
+(The prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a prompt or are not used to having them in bc(1).
+Most of those users would want to put this option in
+\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.IP
.nf
\f[C]
-seed = seed
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-If the behavior of this option is desired for every run of bc(1), then
-users could make sure to define \f[B]BC_ENV_ARGS\f[R] and include this
-option (see the \f[B]ENVIRONMENT VARIABLES\f[R] section for more
-details).
-.PP
-If \f[B]-s\f[R], \f[B]-w\f[R], or any equivalents are used, this option
-is ignored.
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
-\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
-(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]-l\f[R], \f[B]--mathlib\f[R]
-Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
-and loads the included math library and the extended math library before
-running any code, including any expressions or files specified on the
-command line.
-.RS
-.PP
-To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
-.RE
-.TP
-\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-Disables the prompt in TTY mode.
-(The prompt is only enabled in TTY mode.
-See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
-do not want a prompt or are not used to having them in bc(1).
+: Disables the read prompt in TTY mode.
+(The read prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a read prompt or are not used to having them in bc(1).
Most of those users would want to put this option in
\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
-.RS
+This option is also useful in hash bang lines of bc(1) scripts that
+prompt for user input.
+.IP
+.nf
+\f[C]
+This option does not disable the regular prompt because the read prompt is
+only used when the **read()** built-in function is called.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
+.PP
+: This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-s\f[R], \f[B]--standard\f[R]
-Process exactly the language defined by the
+.PP
+: Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Print the version information (copyright header) and exit.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-w\f[R], \f[B]--warn\f[R]
-Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
+.PP
+: Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]BC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -313,7 +336,7 @@ Identifiers with more than one character (letter) are a
.PP
\f[B]ibase\f[R] is a global variable determining how to interpret
constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
@@ -325,7 +348,7 @@ The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
programs with the \f[B]maxibase()\f[R] built-in function.
.PP
\f[B]obase\f[R] is a global variable determining how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
@@ -497,7 +520,7 @@ This is a \f[B]non-portable extension\f[R].
.IP "15." 4
\f[B]irand(E)\f[R]: A pseudo-random integer between \f[B]0\f[R]
(inclusive) and the value of \f[B]E\f[R] (exclusive).
-If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[cq]s
+If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[aq]s
\f[I]scale\f[R] is not \f[B]0\f[R]), an error is raised, and bc(1)
resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R] remains
unchanged.
@@ -575,301 +598,377 @@ extension\f[R].
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-Type: Prefix and Postfix
-.RS
.PP
+: Type: Prefix and Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **increment**, **decrement**
+\f[R]
+.fi
.PP
-Description: \f[B]increment\f[R], \f[B]decrement\f[R]
-.RE
-.TP
\f[B]-\f[R] \f[B]!\f[R]
-Type: Prefix
-.RS
.PP
+: Type: Prefix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **negation**, **boolean not**
+\f[R]
+.fi
.PP
-Description: \f[B]negation\f[R], \f[B]boolean not\f[R]
-.RE
-.TP
\f[B]$\f[R]
-Type: Postfix
-.RS
.PP
+: Type: Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **truncation**
+\f[R]
+.fi
.PP
-Description: \f[B]truncation\f[R]
-.RE
-.TP
\f[B]\[at]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **set precision**
+\f[R]
+.fi
.PP
-Description: \f[B]set precision\f[R]
-.RE
-.TP
\f[B]\[ha]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **power**
+\f[R]
+.fi
.PP
-Description: \f[B]power\f[R]
-.RE
-.TP
\f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **multiply**, **divide**, **modulus**
+\f[R]
+.fi
.PP
-Description: \f[B]multiply\f[R], \f[B]divide\f[R], \f[B]modulus\f[R]
-.RE
-.TP
\f[B]+\f[R] \f[B]-\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **add**, **subtract**
+\f[R]
+.fi
.PP
-Description: \f[B]add\f[R], \f[B]subtract\f[R]
-.RE
-.TP
\f[B]<<\f[R] \f[B]>>\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **shift left**, **shift right**
+\f[R]
+.fi
.PP
-Description: \f[B]shift left\f[R], \f[B]shift right\f[R]
-.RE
-.TP
-\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
-Type: Binary
-.RS
+\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R]
+\f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **assignment**
+\f[R]
+.fi
.PP
-Description: \f[B]assignment\f[R]
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-Type: Binary
-.RS
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **relational**
+\f[R]
+.fi
.PP
-Description: \f[B]relational\f[R]
-.RE
-.TP
\f[B]&&\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **boolean and**
+\f[R]
+.fi
.PP
-Description: \f[B]boolean and\f[R]
-.RE
-.TP
\f[B]||\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
-.PP
-Description: \f[B]boolean or\f[R]
-.RE
+
+Description: **boolean or**
+\f[R]
+.fi
.PP
The operators will be described in more detail below.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
+.PP
+: The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
subsection) as an operand.
-.RS
+.IP
+.nf
+\f[C]
+The prefix versions of these operators are more efficient; use them where
+possible.
+\f[R]
+.fi
.PP
-The prefix versions of these operators are more efficient; use them
-where possible.
-.RE
-.TP
\f[B]-\f[R]
-The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
+.PP
+: The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
to negate any expression with the value \f[B]0\f[R].
Otherwise, a copy of the expression with its sign flipped is returned.
-.TP
+.PP
\f[B]!\f[R]
-The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the expression
-is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the
+expression is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]$\f[R]
-The \f[B]truncation\f[R] operator returns a copy of the given expression
-with all of its \f[I]scale\f[R] removed.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]truncation\f[R] operator returns a copy of the given
+expression with all of its \f[I]scale\f[R] removed.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]\[at]\f[R]
-The \f[B]set precision\f[R] operator takes two expressions and returns a
-copy of the first with its \f[I]scale\f[R] equal to the value of the
+.PP
+: The \f[B]set precision\f[R] operator takes two expressions and returns
+a copy of the first with its \f[I]scale\f[R] equal to the value of the
second expression.
That could either mean that the number is returned without change (if
the \f[I]scale\f[R] of the first expression matches the value of the
second expression), extended (if it is less), or truncated (if it is
more).
-.RS
-.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
+.PP
+: The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
as it would be in C) takes two expressions and raises the first to the
power of the value of the second.
The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*), and if it is
+negative, the first value must be non-zero.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]), and if it
-is negative, the first value must be non-zero.
-.RE
-.TP
\f[B]*\f[R]
-The \f[B]multiply\f[R] operator takes two expressions, multiplies them,
-and returns the product.
+.PP
+: The \f[B]multiply\f[R] operator takes two expressions, multiplies
+them, and returns the product.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The \f[B]divide\f[R] operator takes two expressions, divides them, and
+.PP
+: The \f[B]divide\f[R] operator takes two expressions, divides them, and
returns the quotient.
The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]%\f[R]
-The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
\f[B]scale\f[R] and 2) Using the result of step 1 to calculate
\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
\f[B]max(scale+scale(b),scale(a))\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]+\f[R]
-The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]-\f[R]
-The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]<<\f[R]
-The \f[B]left shift\f[R] operator takes two expressions, \f[B]a\f[R] and
-\f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
-decimal point moved \f[B]b\f[R] places to the right.
-.RS
.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+: The \f[B]left shift\f[R] operator takes two expressions, \f[B]a\f[R]
+and \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
+decimal point moved \f[B]b\f[R] places to the right.
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]>>\f[R]
-The \f[B]right shift\f[R] operator takes two expressions, \f[B]a\f[R]
+.PP
+: The \f[B]right shift\f[R] operator takes two expressions, \f[B]a\f[R]
and \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
decimal point moved \f[B]b\f[R] places to the left.
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R]
+\f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
-The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R] and
-\f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the \f[I]Named
-Expressions\f[R] subsection).
-.RS
-.PP
-For \f[B]=\f[R], \f[B]b\f[R] is copied and the result is assigned to
-\f[B]a\f[R].
-For all others, \f[B]a\f[R] and \f[B]b\f[R] are applied as operands to
-the corresponding arithmetic operator and the result is assigned to
-\f[B]a\f[R].
-.PP
-The \f[B]assignment\f[R] operators that correspond to operators that are
-extensions are themselves \f[B]non-portable extensions\f[R].
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-The \f[B]relational\f[R] operators compare two expressions, \f[B]a\f[R]
-and \f[B]b\f[R], and if the relation holds, according to C language
-semantics, the result is \f[B]1\f[R].
-Otherwise, it is \f[B]0\f[R].
-.RS
+: The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R]
+and \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the
+\f[I]Named Expressions\f[R] subsection).
+.IP
+.nf
+\f[C]
+For **=**, **b** is copied and the result is assigned to **a**. For all
+others, **a** and **b** are applied as operands to the corresponding
+arithmetic operator and the result is assigned to **a**.
+
+The **assignment** operators that correspond to operators that are
+extensions are themselves **non-portable extensions**.
+\f[R]
+.fi
+.PP
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: The \f[B]relational\f[R] operators compare two expressions,
+\f[B]a\f[R] and \f[B]b\f[R], and if the relation holds, according to C
+language semantics, the result is \f[B]1\f[R].
+Otherwise, it is \f[B]0\f[R].
+.IP
+.nf
+\f[C]
Note that unlike in C, these operators have a lower precedence than the
-\f[B]assignment\f[R] operators, which means that \f[B]a=b>c\f[R] is
-interpreted as \f[B](a=b)>c\f[R].
+**assignment** operators, which means that **a=b\[rs]>c** is interpreted as
+**(a=b)\[rs]>c**.
+
+Also, unlike the [standard][1] requires, these operators can appear anywhere
+any other expressions can be used. This allowance is a
+**non-portable extension**.
+\f[R]
+.fi
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-requires, these operators can appear anywhere any other expressions can
-be used.
-This allowance is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]&&\f[R]
-The \f[B]boolean and\f[R] operator takes two expressions and returns
-\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
-.RS
.PP
-This is \f[I]not\f[R] a short-circuit operator.
+: The \f[B]boolean and\f[R] operator takes two expressions and returns
+\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]||\f[R]
-The \f[B]boolean or\f[R] operator takes two expressions and returns
+.PP
+: The \f[B]boolean or\f[R] operator takes two expressions and returns
\f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
otherwise.
-.RS
-.PP
-This is \f[I]not\f[R] a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Statements
.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
.IP " 2." 4
-\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] \&... \f[B];\f[R] \f[B]S\f[R]
-\f[B]}\f[R]
+\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] ...
+\f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
.IP " 3." 4
\f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
.IP " 4." 4
@@ -895,7 +994,8 @@ An empty statement
.IP "13." 4
A string of characters, enclosed in double quotes
.IP "14." 4
-\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] \&... \f[B],\f[R] \f[B]E\f[R]
+\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] ...
+\f[B],\f[R] \f[B]E\f[R]
.IP "15." 4
\f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
\f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
@@ -953,62 +1053,22 @@ Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
.SS Print Statement
.PP
-The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
+The \[dq]expressions\[dq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
specially.
What those sequences are, and what they cause to be printed, are shown
below:
.PP
-.TS
-tab(@);
-l l.
-T{
-\f[B]\[rs]a\f[R]
-T}@T{
-\f[B]\[rs]a\f[R]
-T}
-T{
-\f[B]\[rs]b\f[R]
-T}@T{
-\f[B]\[rs]b\f[R]
-T}
-T{
-\f[B]\[rs]\[rs]\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]e\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]f\f[R]
-T}@T{
-\f[B]\[rs]f\f[R]
-T}
-T{
-\f[B]\[rs]n\f[R]
-T}@T{
-\f[B]\[rs]n\f[R]
-T}
-T{
-\f[B]\[rs]q\f[R]
-T}@T{
-\f[B]\[dq]\f[R]
-T}
-T{
-\f[B]\[rs]r\f[R]
-T}@T{
-\f[B]\[rs]r\f[R]
-T}
-T{
-\f[B]\[rs]t\f[R]
-T}@T{
-\f[B]\[rs]t\f[R]
-T}
-.TE
+ * * * * *
+.PP
+\f[B]\[rs]a\f[R] \f[B]\[rs]a\f[R] \f[B]\[rs]b\f[R] \f[B]\[rs]b\f[R]
+\f[B]\[rs]\[rs]\f[R] \f[B]\[rs]\f[R] \f[B]\[rs]e\f[R] \f[B]\[rs]\f[R]
+\f[B]\[rs]f\f[R] \f[B]\[rs]f\f[R] \f[B]\[rs]n\f[R] \f[B]\[rs]n\f[R]
+\f[B]\[rs]q\f[R] \f[B]\[dq]\f[R] \f[B]\[rs]r\f[R] \f[B]\[rs]r\f[R]
+\f[B]\[rs]t\f[R] \f[B]\[rs]t\f[R]
+.PP
+ * * * * *
.PP
Any other character following a backslash causes the backslash and
character to be printed as-is.
@@ -1104,9 +1164,9 @@ Void functions can only use the first two \f[B]return\f[R] statements
listed above.
They can also omit the return statement entirely.
.PP
-The word \[lq]void\[rq] is not treated as a keyword; it is still
+The word \[dq]void\[dq] is not treated as a keyword; it is still
possible to have variables, arrays, and functions named \f[B]void\f[R].
-The word \[lq]void\[rq] is only treated specially right after the
+The word \[dq]void\[dq] is only treated specially right after the
\f[B]define\f[R] keyword.
.PP
This is a \f[B]non-portable extension\f[R].
@@ -1141,55 +1201,74 @@ are given.
The
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
-.TP
+.PP
\f[B]s(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]c(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l(x)\f[R]
-Returns the natural logarithm of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the natural logarithm of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]e(x)\f[R]
-Returns the mathematical constant \f[B]e\f[R] raised to the power of
+.PP
+: Returns the mathematical constant \f[B]e\f[R] raised to the power of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]j(x, n)\f[R]
-Returns the bessel integer order \f[B]n\f[R] (truncated) of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
+: Returns the bessel integer order \f[B]n\f[R] (truncated) of
+\f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
@@ -1198,99 +1277,126 @@ options are given since they are not part of the library defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
The extended library is a \f[B]non-portable extension\f[R].
-.TP
+.PP
\f[B]p(x, y)\f[R]
-Calculates \f[B]x\f[R] to the power of \f[B]y\f[R], even if \f[B]y\f[R]
-is not an integer, and returns the result to the current
-\f[B]scale\f[R].
-.RS
.PP
-It is an error if \f[B]y\f[R] is negative and \f[B]x\f[R] is
-\f[B]0\f[R].
+: Calculates \f[B]x\f[R] to the power of \f[B]y\f[R], even if
+\f[B]y\f[R] is not an integer, and returns the result to the current
+\f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+It is an error if **y** is negative and **x** is **0**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]r(x, p)\f[R]
-Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
+.PP
+: Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
the rounding mode round half away from
\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
-.TP
+.PP
\f[B]ceil(x, p)\f[R]
-Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
+.PP
+: Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
the rounding mode round away from
\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero).
-.TP
+.PP
\f[B]f(x)\f[R]
-Returns the factorial of the truncated absolute value of \f[B]x\f[R].
-.TP
+.PP
+: Returns the factorial of the truncated absolute value of \f[B]x\f[R].
+.PP
\f[B]perm(n, k)\f[R]
-Returns the permutation of the truncated absolute value of \f[B]n\f[R]
+.PP
+: Returns the permutation of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
If not, it returns \f[B]0\f[R].
-.TP
+.PP
\f[B]comb(n, k)\f[R]
-Returns the combination of the truncated absolute value of \f[B]n\f[R]
+.PP
+: Returns the combination of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
If not, it returns \f[B]0\f[R].
-.TP
+.PP
\f[B]l2(x)\f[R]
-Returns the logarithm base \f[B]2\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]2\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l10(x)\f[R]
-Returns the logarithm base \f[B]10\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]10\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]log(x, b)\f[R]
-Returns the logarithm base \f[B]b\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]b\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]cbrt(x)\f[R]
-Returns the cube root of \f[B]x\f[R].
-.TP
+.PP
+: Returns the cube root of \f[B]x\f[R].
+.PP
\f[B]root(x, n)\f[R]
-Calculates the truncated value of \f[B]n\f[R], \f[B]r\f[R], and returns
-the \f[B]r\f[R]th root of \f[B]x\f[R] to the current \f[B]scale\f[R].
-.RS
-.PP
-If \f[B]r\f[R] is \f[B]0\f[R] or negative, this raises an error and
-causes bc(1) to reset (see the \f[B]RESET\f[R] section).
-It also raises an error and causes bc(1) to reset if \f[B]r\f[R] is even
-and \f[B]x\f[R] is negative.
-.RE
-.TP
+.PP
+: Calculates the truncated value of \f[B]n\f[R], \f[B]r\f[R], and
+returns the \f[B]r\f[R]th root of \f[B]x\f[R] to the current
+\f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+If **r** is **0** or negative, this raises an error and causes bc(1) to
+reset (see the **RESET** section). It also raises an error and causes bc(1)
+to reset if **r** is even and **x** is negative.
+\f[R]
+.fi
+.PP
\f[B]pi(p)\f[R]
-Returns \f[B]pi\f[R] to \f[B]p\f[R] decimal places.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns \f[B]pi\f[R] to \f[B]p\f[R] decimal places.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]t(x)\f[R]
-Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a2(y, x)\f[R]
-Returns the arctangent of \f[B]y/x\f[R], in radians.
+.PP
+: Returns the arctangent of \f[B]y/x\f[R], in radians.
If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
@@ -1303,60 +1409,75 @@ If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
\f[B]0\f[R], it returns \f[B]pi/2\f[R].
If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
\f[B]0\f[R], it returns \f[B]-pi/2\f[R].
-.RS
-.PP
-This function is the same as the \f[B]atan2()\f[R] function in many
-programming languages.
+.IP
+.nf
+\f[C]
+This function is the same as the **atan2()** function in many programming
+languages.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]sin(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is an alias of \f[B]s(x)\f[R].
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **s(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]cos(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is an alias of \f[B]c(x)\f[R].
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **c(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]tan(x)\f[R]
-Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-If \f[B]x\f[R] is equal to \f[B]1\f[R] or \f[B]-1\f[R], this raises an
-error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
-.PP
-This is an alias of \f[B]t(x)\f[R].
+: Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+If **x** is equal to **1** or **-1**, this raises an error and causes bc(1)
+to reset (see the **RESET** section).
+
+This is an alias of **t(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]atan(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is an alias of \f[B]a(x)\f[R].
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **a(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]atan2(y, x)\f[R]
-Returns the arctangent of \f[B]y/x\f[R], in radians.
+.PP
+: Returns the arctangent of \f[B]y/x\f[R], in radians.
If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
@@ -1369,302 +1490,367 @@ If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
\f[B]0\f[R], it returns \f[B]pi/2\f[R].
If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
\f[B]0\f[R], it returns \f[B]-pi/2\f[R].
-.RS
-.PP
-This function is the same as the \f[B]atan2()\f[R] function in many
-programming languages.
-.PP
-This is an alias of \f[B]a2(y, x)\f[R].
+.IP
+.nf
+\f[C]
+This function is the same as the **atan2()** function in many programming
+languages.
+
+This is an alias of **a2(y, x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]r2d(x)\f[R]
-Converts \f[B]x\f[R] from radians to degrees and returns the result.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Converts \f[B]x\f[R] from radians to degrees and returns the result.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]d2r(x)\f[R]
-Converts \f[B]x\f[R] from degrees to radians and returns the result.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Converts \f[B]x\f[R] from degrees to radians and returns the result.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]frand(p)\f[R]
-Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
+.PP
+: Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
\f[B]1\f[R] (exclusive) with the number of decimal digits after the
decimal point equal to the truncated absolute value of \f[B]p\f[R].
If \f[B]p\f[R] is not \f[B]0\f[R], then calling this function will
change the value of \f[B]seed\f[R].
If \f[B]p\f[R] is \f[B]0\f[R], then \f[B]0\f[R] is returned, and
\f[B]seed\f[R] is \f[I]not\f[R] changed.
-.TP
+.PP
\f[B]ifrand(i, p)\f[R]
-Generates a pseudo-random number that is between \f[B]0\f[R] (inclusive)
-and the truncated absolute value of \f[B]i\f[R] (exclusive) with the
-number of decimal digits after the decimal point equal to the truncated
-absolute value of \f[B]p\f[R].
+.PP
+: Generates a pseudo-random number that is between \f[B]0\f[R]
+(inclusive) and the truncated absolute value of \f[B]i\f[R] (exclusive)
+with the number of decimal digits after the decimal point equal to the
+truncated absolute value of \f[B]p\f[R].
If the absolute value of \f[B]i\f[R] is greater than or equal to
\f[B]2\f[R], and \f[B]p\f[R] is not \f[B]0\f[R], then calling this
function will change the value of \f[B]seed\f[R]; otherwise, \f[B]0\f[R]
is returned and \f[B]seed\f[R] is not changed.
-.TP
+.PP
\f[B]srand(x)\f[R]
-Returns \f[B]x\f[R] with its sign flipped with probability
+.PP
+: Returns \f[B]x\f[R] with its sign flipped with probability
\f[B]0.5\f[R].
In other words, it randomizes the sign of \f[B]x\f[R].
-.TP
+.PP
\f[B]brand()\f[R]
-Returns a random boolean value (either \f[B]0\f[R] or \f[B]1\f[R]).
-.TP
+.PP
+: Returns a random boolean value (either \f[B]0\f[R] or \f[B]1\f[R]).
+.PP
\f[B]ubytes(x)\f[R]
-Returns the numbers of unsigned integer bytes required to hold the
+.PP
+: Returns the numbers of unsigned integer bytes required to hold the
truncated absolute value of \f[B]x\f[R].
-.TP
+.PP
\f[B]sbytes(x)\f[R]
-Returns the numbers of signed, two\[cq]s-complement integer bytes
+.PP
+: Returns the numbers of signed, two\[aq]s-complement integer bytes
required to hold the truncated value of \f[B]x\f[R].
-.TP
+.PP
\f[B]hex(x)\f[R]
-Outputs the hexadecimal (base \f[B]16\f[R]) representation of
+.PP
+: Outputs the hexadecimal (base \f[B]16\f[R]) representation of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]binary(x)\f[R]
-Outputs the binary (base \f[B]2\f[R]) representation of \f[B]x\f[R].
-.RS
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
+: Outputs the binary (base \f[B]2\f[R]) representation of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
+.PP
\f[B]output(x, b)\f[R]
-Outputs the base \f[B]b\f[R] representation of \f[B]x\f[R].
-.RS
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
+: Outputs the base \f[B]b\f[R] representation of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
+.PP
\f[B]uint(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in as few power of two bytes as possible.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or is negative, an error message is
-printed instead, but bc(1) is not reset (see the \f[B]RESET\f[R]
-section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in as few power of two bytes as possible.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or is negative, an error message is printed
+instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in as few power of two bytes as
-possible.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, an error message is printed instead,
-but bc(1) is not reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in as few power of two bytes
+as possible.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, an error message is printed instead, but bc(1)
+is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uintn(x, n)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]n\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]n\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]n\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **n** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]intn(x, n)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]n\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]n\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]n\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **n** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint8(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]1\f[R] byte.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]1\f[R] byte, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]1\f[R] byte.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **1** byte, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int8(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]1\f[R] byte.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]1\f[R] byte, an
-error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]1\f[R] byte.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **1** byte, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint16(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]2\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]2\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]2\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **2** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int16(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]2\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]2\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]2\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **2** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint32(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]4\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]4\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]4\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **4** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int32(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]4\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]4\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]4\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **4** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint64(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]8\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]8\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]8\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **8** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int64(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]8\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]8\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]8\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **8** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]hex_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in hexadecimal using \f[B]n\f[R]
bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]binary_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in binary using \f[B]n\f[R] bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]output_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in the current \f[B]obase\f[R] (see
the \f[B]SYNTAX\f[R] section) using \f[B]n\f[R] bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]output_byte(x, i)\f[R]
-Outputs byte \f[B]i\f[R] of the truncated absolute value of \f[B]x\f[R],
-where \f[B]0\f[R] is the least significant byte and \f[B]number_of_bytes
-- 1\f[R] is the most significant byte.
-.RS
-.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
+.PP
+: Outputs byte \f[B]i\f[R] of the truncated absolute value of
+\f[B]x\f[R], where \f[B]0\f[R] is the least significant byte and
+\f[B]number_of_bytes - 1\f[R] is the most significant byte.
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.SS Transcendental Functions
.PP
All transcendental functions can return slightly inaccurate results (up
@@ -1768,64 +1954,77 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on bc(1):
-.TP
+.PP
\f[B]BC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
bc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]BC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]BC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]BC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]BC_BASE_POW\f[R].
-.TP
+.PP
\f[B]BC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_RAND_MAX\f[R]
-The maximum integer (inclusive) returned by the \f[B]rand()\f[R]
+.PP
+: The maximum integer (inclusive) returned by the \f[B]rand()\f[R]
operand.
Set at \f[B]2\[ha]BC_LONG_BIT-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]BC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
The actual values can be queried with the \f[B]limits\f[R] statement.
@@ -1837,42 +2036,44 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
bc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]POSIXLY_CORRECT\f[R]
-If this variable exists (no matter the contents), bc(1) behaves as if
+.PP
+: If this variable exists (no matter the contents), bc(1) behaves as if
the \f[B]-s\f[R] option was given.
-.TP
+.PP
\f[B]BC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to bc(1).
+.PP
+: This is another way to give command-line arguments to bc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time bc(1) runs.
-.RS
-.PP
-The code that parses \f[B]BC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some bc file.bc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]bc\[dq] file.bc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]BC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **BC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some bc file.bc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]bc\[rs]\[dq] file.bc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]bc\[aq] file.bc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **BC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]BC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
including the backslash (\f[B]\[rs]\f[R]).
@@ -1880,68 +2081,76 @@ The default line length is \f[B]70\f[R].
.SH EXIT STATUS
.PP
bc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, using a negative number as a bound for the
-pseudo-random number generator, attempting to convert a negative number
-to a hardware integer, overflow when converting a number to a hardware
-integer, and attempting to use a non-integer where an integer is
-required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
-(\f[B]<<\f[R]), and right shift (\f[B]>>\f[R]) operators and their
-corresponding assignment operators.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, using a negative number as a bound for the pseudo-random number
+generator, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**), places (**\[rs]\[at]**), left shift (**\[rs]<\[rs]<**), and right shift (**\[rs]>\[rs]>**)
+operators and their corresponding assignment operators.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, using a token
-where it is invalid, giving an invalid expression, giving an invalid
-print statement, giving an invalid function definition, attempting to
-assign to an expression that is not a named expression (see the
-\f[I]Named Expressions\f[R] subsection of the \f[B]SYNTAX\f[R] section),
-giving an invalid \f[B]auto\f[R] list, having a duplicate
-\f[B]auto\f[R]/function parameter, failing to find the end of a code
-block, attempting to return a value from a \f[B]void\f[R] function,
-attempting to use a variable as a reference, and using any extensions
-when the option \f[B]-s\f[R] or any equivalents were given.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, using a token where it is invalid,
+giving an invalid expression, giving an invalid print statement, giving an
+invalid function definition, attempting to assign to an expression that is
+not a named expression (see the *Named Expressions* subsection of the
+**SYNTAX** section), giving an invalid **auto** list, having a duplicate
+**auto**/function parameter, failing to find the end of a code block,
+attempting to return a value from a **void** function, attempting to use a
+variable as a reference, and using any extensions when the option **-s** or
+any equivalents were given.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, passing the wrong number of
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, passing the wrong number of
arguments to functions, attempting to call an undefined function, and
-attempting to use a \f[B]void\f[R] function call as a value in an
-expression.
-.RE
-.TP
+attempting to use a **void** function call as a value in an expression.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (bc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (bc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
@@ -1971,7 +2180,7 @@ In interactive mode, bc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, bc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, bc(1) turns on \[dq]TTY mode.\[dq]
.PP
The prompt is enabled in TTY mode.
.PP
@@ -1988,7 +2197,7 @@ If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If bc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If bc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/bc/HN.1.md b/contrib/bc/manuals/bc/HN.1.md
index adf1ffcc29fb..c81f7adcd7e3 100644
--- a/contrib/bc/manuals/bc/HN.1.md
+++ b/contrib/bc/manuals/bc/HN.1.md
@@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -139,13 +139,27 @@ The following are the options that bc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in bc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of bc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **read()** built-in function is called.
+
+ This is a **non-portable extension**.
+
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
diff --git a/contrib/bc/manuals/bc/HNP.1 b/contrib/bc/manuals/bc/HNP.1
index f407050515b2..e51c6373e732 100644
--- a/contrib/bc/manuals/bc/HNP.1
+++ b/contrib/bc/manuals/bc/HNP.1
@@ -25,19 +25,19 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+\f[B]bc\f[R] [\f[B]-ghilPqRsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
-[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
-[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
+[\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
@@ -53,205 +53,219 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.SH OPTIONS
.PP
The following are the options that bc(1) accepts.
-.TP
+.PP
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
-Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
-\f[B]seed\f[R] into stacks.
-.RS
.PP
-This has the effect that a copy of the current value of all four are
-pushed onto a stack for every function call, as well as popped when
-every function returns.
-This means that functions can assign to any and all of those globals
-without worrying that the change will affect other functions.
-Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply
-printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this:
+: Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R],
+and \f[B]seed\f[R] into stacks.
.IP
.nf
\f[C]
-define void output(x, b) {
- obase=b
- x
-}
+This has the effect that a copy of the current value of all four are pushed
+onto a stack for every function call, as well as popped when every function
+returns. This means that functions can assign to any and all of those
+globals without worrying that the change will affect other functions.
+Thus, a hypothetical function named **output(x,b)** that simply printed
+**x** in base **b** could be written like this:
+
+ define void output(x, b) {
+ obase=b
+ x
+ }
+
+instead of like this:
+
+ define void output(x, b) {
+ auto c
+ c=obase
+ obase=b
+ x
+ obase=c
+ }
+
+This makes writing functions much easier.
+
+(**Note**: the function **output(x,b)** exists in the extended math library.
+ See the **LIBRARY** section.)
+
+However, since using this flag means that functions cannot set **ibase**,
+**obase**, **scale**, or **seed** globally, functions that are made to do so
+cannot work anymore. There are two possible use cases for that, and each has
+a solution.
+
+First, if a function is called on startup to turn bc(1) into a number
+converter, it is possible to replace that capability with various shell
+aliases. Examples:
+
+ alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
+ alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
+
+Second, if the purpose of a function is to set **ibase**, **obase**,
+**scale**, or **seed** globally for any other purpose, it could be split
+into one to four functions (based on how many globals it sets) and each of
+those functions could return the desired value for a global.
+
+For functions that set **seed**, the value assigned to **seed** is not
+propagated to parent functions. This means that the sequence of
+pseudo-random numbers that they see will not be the same sequence of
+pseudo-random numbers that any parent sees. This is only the case once
+**seed** has been set.
+
+If a function desires to not affect the sequence of pseudo-random numbers
+of its parents, but wants to use the same **seed**, it can use the following
+line:
+
+ seed = seed
+
+If the behavior of this option is desired for every run of bc(1), then users
+could make sure to define **BC_ENV_ARGS** and include this option (see the
+**ENVIRONMENT VARIABLES** section for more details).
+
+If **-s**, **-w**, or any equivalents are used, this option is ignored.
+
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-instead of like this:
+\f[B]-h\f[R], \f[B]--help\f[R]
+.PP
+: Prints a usage message and quits.
+.PP
+\f[B]-i\f[R], \f[B]--interactive\f[R]
+.PP
+: Forces interactive mode.
+(See the \f[B]INTERACTIVE MODE\f[R] section.)
.IP
.nf
\f[C]
-define void output(x, b) {
- auto c
- c=obase
- obase=b
- x
- obase=c
-}
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-This makes writing functions much easier.
-.PP
-(\f[B]Note\f[R]: the function \f[B]output(x,b)\f[R] exists in the
-extended math library.
-See the \f[B]LIBRARY\f[R] section.)
-.PP
-However, since using this flag means that functions cannot set
-\f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R]
-globally, functions that are made to do so cannot work anymore.
-There are two possible use cases for that, and each has a solution.
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
.PP
-First, if a function is called on startup to turn bc(1) into a number
-converter, it is possible to replace that capability with various shell
-aliases.
-Examples:
+: Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to
+\f[B]20\f[R] and loads the included math library and the extended math
+library before running any code, including any expressions or files
+specified on the command line.
.IP
.nf
\f[C]
-alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
-alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
+To learn what is in the libraries, see the **LIBRARY** section.
\f[R]
.fi
.PP
-Second, if the purpose of a function is to set \f[B]ibase\f[R],
-\f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R] globally for any
-other purpose, it could be split into one to four functions (based on
-how many globals it sets) and each of those functions could return the
-desired value for a global.
-.PP
-For functions that set \f[B]seed\f[R], the value assigned to
-\f[B]seed\f[R] is not propagated to parent functions.
-This means that the sequence of pseudo-random numbers that they see will
-not be the same sequence of pseudo-random numbers that any parent sees.
-This is only the case once \f[B]seed\f[R] has been set.
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
.PP
-If a function desires to not affect the sequence of pseudo-random
-numbers of its parents, but wants to use the same \f[B]seed\f[R], it can
-use the following line:
+: This option is a no-op.
.IP
.nf
\f[C]
-seed = seed
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-If the behavior of this option is desired for every run of bc(1), then
-users could make sure to define \f[B]BC_ENV_ARGS\f[R] and include this
-option (see the \f[B]ENVIRONMENT VARIABLES\f[R] section for more
-details).
-.PP
-If \f[B]-s\f[R], \f[B]-w\f[R], or any equivalents are used, this option
-is ignored.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
-\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
-(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]-l\f[R], \f[B]--mathlib\f[R]
-Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
-and loads the included math library and the extended math library before
-running any code, including any expressions or files specified on the
-command line.
-.RS
-.PP
-To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
-.RE
-.TP
-\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-This option is a no-op.
-.RS
+: Because bc(1) was built without support for prompts, this option is a
+no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
+.PP
+: This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-s\f[R], \f[B]--standard\f[R]
-Process exactly the language defined by the
+.PP
+: Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Print the version information (copyright header) and exit.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-w\f[R], \f[B]--warn\f[R]
-Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
+.PP
+: Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]BC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -308,7 +322,7 @@ Identifiers with more than one character (letter) are a
.PP
\f[B]ibase\f[R] is a global variable determining how to interpret
constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
@@ -320,7 +334,7 @@ The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
programs with the \f[B]maxibase()\f[R] built-in function.
.PP
\f[B]obase\f[R] is a global variable determining how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
@@ -492,7 +506,7 @@ This is a \f[B]non-portable extension\f[R].
.IP "15." 4
\f[B]irand(E)\f[R]: A pseudo-random integer between \f[B]0\f[R]
(inclusive) and the value of \f[B]E\f[R] (exclusive).
-If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[cq]s
+If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[aq]s
\f[I]scale\f[R] is not \f[B]0\f[R]), an error is raised, and bc(1)
resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R] remains
unchanged.
@@ -570,301 +584,377 @@ extension\f[R].
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-Type: Prefix and Postfix
-.RS
.PP
+: Type: Prefix and Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **increment**, **decrement**
+\f[R]
+.fi
.PP
-Description: \f[B]increment\f[R], \f[B]decrement\f[R]
-.RE
-.TP
\f[B]-\f[R] \f[B]!\f[R]
-Type: Prefix
-.RS
.PP
+: Type: Prefix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **negation**, **boolean not**
+\f[R]
+.fi
.PP
-Description: \f[B]negation\f[R], \f[B]boolean not\f[R]
-.RE
-.TP
\f[B]$\f[R]
-Type: Postfix
-.RS
.PP
+: Type: Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **truncation**
+\f[R]
+.fi
.PP
-Description: \f[B]truncation\f[R]
-.RE
-.TP
\f[B]\[at]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **set precision**
+\f[R]
+.fi
.PP
-Description: \f[B]set precision\f[R]
-.RE
-.TP
\f[B]\[ha]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **power**
+\f[R]
+.fi
.PP
-Description: \f[B]power\f[R]
-.RE
-.TP
\f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **multiply**, **divide**, **modulus**
+\f[R]
+.fi
.PP
-Description: \f[B]multiply\f[R], \f[B]divide\f[R], \f[B]modulus\f[R]
-.RE
-.TP
\f[B]+\f[R] \f[B]-\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **add**, **subtract**
+\f[R]
+.fi
.PP
-Description: \f[B]add\f[R], \f[B]subtract\f[R]
-.RE
-.TP
\f[B]<<\f[R] \f[B]>>\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **shift left**, **shift right**
+\f[R]
+.fi
.PP
-Description: \f[B]shift left\f[R], \f[B]shift right\f[R]
-.RE
-.TP
-\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
-Type: Binary
-.RS
+\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R]
+\f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **assignment**
+\f[R]
+.fi
.PP
-Description: \f[B]assignment\f[R]
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-Type: Binary
-.RS
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **relational**
+\f[R]
+.fi
.PP
-Description: \f[B]relational\f[R]
-.RE
-.TP
\f[B]&&\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **boolean and**
+\f[R]
+.fi
.PP
-Description: \f[B]boolean and\f[R]
-.RE
-.TP
\f[B]||\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
-.PP
-Description: \f[B]boolean or\f[R]
-.RE
+
+Description: **boolean or**
+\f[R]
+.fi
.PP
The operators will be described in more detail below.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
+.PP
+: The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
subsection) as an operand.
-.RS
+.IP
+.nf
+\f[C]
+The prefix versions of these operators are more efficient; use them where
+possible.
+\f[R]
+.fi
.PP
-The prefix versions of these operators are more efficient; use them
-where possible.
-.RE
-.TP
\f[B]-\f[R]
-The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
+.PP
+: The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
to negate any expression with the value \f[B]0\f[R].
Otherwise, a copy of the expression with its sign flipped is returned.
-.TP
+.PP
\f[B]!\f[R]
-The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the expression
-is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the
+expression is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]$\f[R]
-The \f[B]truncation\f[R] operator returns a copy of the given expression
-with all of its \f[I]scale\f[R] removed.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]truncation\f[R] operator returns a copy of the given
+expression with all of its \f[I]scale\f[R] removed.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]\[at]\f[R]
-The \f[B]set precision\f[R] operator takes two expressions and returns a
-copy of the first with its \f[I]scale\f[R] equal to the value of the
+.PP
+: The \f[B]set precision\f[R] operator takes two expressions and returns
+a copy of the first with its \f[I]scale\f[R] equal to the value of the
second expression.
That could either mean that the number is returned without change (if
the \f[I]scale\f[R] of the first expression matches the value of the
second expression), extended (if it is less), or truncated (if it is
more).
-.RS
-.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
+.PP
+: The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
as it would be in C) takes two expressions and raises the first to the
power of the value of the second.
The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*), and if it is
+negative, the first value must be non-zero.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]), and if it
-is negative, the first value must be non-zero.
-.RE
-.TP
\f[B]*\f[R]
-The \f[B]multiply\f[R] operator takes two expressions, multiplies them,
-and returns the product.
+.PP
+: The \f[B]multiply\f[R] operator takes two expressions, multiplies
+them, and returns the product.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The \f[B]divide\f[R] operator takes two expressions, divides them, and
+.PP
+: The \f[B]divide\f[R] operator takes two expressions, divides them, and
returns the quotient.
The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]%\f[R]
-The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
\f[B]scale\f[R] and 2) Using the result of step 1 to calculate
\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
\f[B]max(scale+scale(b),scale(a))\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]+\f[R]
-The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]-\f[R]
-The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]<<\f[R]
-The \f[B]left shift\f[R] operator takes two expressions, \f[B]a\f[R] and
-\f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
-decimal point moved \f[B]b\f[R] places to the right.
-.RS
.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+: The \f[B]left shift\f[R] operator takes two expressions, \f[B]a\f[R]
+and \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
+decimal point moved \f[B]b\f[R] places to the right.
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]>>\f[R]
-The \f[B]right shift\f[R] operator takes two expressions, \f[B]a\f[R]
+.PP
+: The \f[B]right shift\f[R] operator takes two expressions, \f[B]a\f[R]
and \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
decimal point moved \f[B]b\f[R] places to the left.
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R]
+\f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
-The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R] and
-\f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the \f[I]Named
-Expressions\f[R] subsection).
-.RS
-.PP
-For \f[B]=\f[R], \f[B]b\f[R] is copied and the result is assigned to
-\f[B]a\f[R].
-For all others, \f[B]a\f[R] and \f[B]b\f[R] are applied as operands to
-the corresponding arithmetic operator and the result is assigned to
-\f[B]a\f[R].
-.PP
-The \f[B]assignment\f[R] operators that correspond to operators that are
-extensions are themselves \f[B]non-portable extensions\f[R].
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-The \f[B]relational\f[R] operators compare two expressions, \f[B]a\f[R]
-and \f[B]b\f[R], and if the relation holds, according to C language
-semantics, the result is \f[B]1\f[R].
-Otherwise, it is \f[B]0\f[R].
-.RS
+: The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R]
+and \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the
+\f[I]Named Expressions\f[R] subsection).
+.IP
+.nf
+\f[C]
+For **=**, **b** is copied and the result is assigned to **a**. For all
+others, **a** and **b** are applied as operands to the corresponding
+arithmetic operator and the result is assigned to **a**.
+
+The **assignment** operators that correspond to operators that are
+extensions are themselves **non-portable extensions**.
+\f[R]
+.fi
+.PP
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: The \f[B]relational\f[R] operators compare two expressions,
+\f[B]a\f[R] and \f[B]b\f[R], and if the relation holds, according to C
+language semantics, the result is \f[B]1\f[R].
+Otherwise, it is \f[B]0\f[R].
+.IP
+.nf
+\f[C]
Note that unlike in C, these operators have a lower precedence than the
-\f[B]assignment\f[R] operators, which means that \f[B]a=b>c\f[R] is
-interpreted as \f[B](a=b)>c\f[R].
+**assignment** operators, which means that **a=b\[rs]>c** is interpreted as
+**(a=b)\[rs]>c**.
+
+Also, unlike the [standard][1] requires, these operators can appear anywhere
+any other expressions can be used. This allowance is a
+**non-portable extension**.
+\f[R]
+.fi
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-requires, these operators can appear anywhere any other expressions can
-be used.
-This allowance is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]&&\f[R]
-The \f[B]boolean and\f[R] operator takes two expressions and returns
-\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
-.RS
.PP
-This is \f[I]not\f[R] a short-circuit operator.
+: The \f[B]boolean and\f[R] operator takes two expressions and returns
+\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]||\f[R]
-The \f[B]boolean or\f[R] operator takes two expressions and returns
+.PP
+: The \f[B]boolean or\f[R] operator takes two expressions and returns
\f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
otherwise.
-.RS
-.PP
-This is \f[I]not\f[R] a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Statements
.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
.IP " 2." 4
-\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] \&... \f[B];\f[R] \f[B]S\f[R]
-\f[B]}\f[R]
+\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] ...
+\f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
.IP " 3." 4
\f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
.IP " 4." 4
@@ -890,7 +980,8 @@ An empty statement
.IP "13." 4
A string of characters, enclosed in double quotes
.IP "14." 4
-\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] \&... \f[B],\f[R] \f[B]E\f[R]
+\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] ...
+\f[B],\f[R] \f[B]E\f[R]
.IP "15." 4
\f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
\f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
@@ -948,62 +1039,22 @@ Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
.SS Print Statement
.PP
-The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
+The \[dq]expressions\[dq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
specially.
What those sequences are, and what they cause to be printed, are shown
below:
.PP
-.TS
-tab(@);
-l l.
-T{
-\f[B]\[rs]a\f[R]
-T}@T{
-\f[B]\[rs]a\f[R]
-T}
-T{
-\f[B]\[rs]b\f[R]
-T}@T{
-\f[B]\[rs]b\f[R]
-T}
-T{
-\f[B]\[rs]\[rs]\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]e\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]f\f[R]
-T}@T{
-\f[B]\[rs]f\f[R]
-T}
-T{
-\f[B]\[rs]n\f[R]
-T}@T{
-\f[B]\[rs]n\f[R]
-T}
-T{
-\f[B]\[rs]q\f[R]
-T}@T{
-\f[B]\[dq]\f[R]
-T}
-T{
-\f[B]\[rs]r\f[R]
-T}@T{
-\f[B]\[rs]r\f[R]
-T}
-T{
-\f[B]\[rs]t\f[R]
-T}@T{
-\f[B]\[rs]t\f[R]
-T}
-.TE
+ * * * * *
+.PP
+\f[B]\[rs]a\f[R] \f[B]\[rs]a\f[R] \f[B]\[rs]b\f[R] \f[B]\[rs]b\f[R]
+\f[B]\[rs]\[rs]\f[R] \f[B]\[rs]\f[R] \f[B]\[rs]e\f[R] \f[B]\[rs]\f[R]
+\f[B]\[rs]f\f[R] \f[B]\[rs]f\f[R] \f[B]\[rs]n\f[R] \f[B]\[rs]n\f[R]
+\f[B]\[rs]q\f[R] \f[B]\[dq]\f[R] \f[B]\[rs]r\f[R] \f[B]\[rs]r\f[R]
+\f[B]\[rs]t\f[R] \f[B]\[rs]t\f[R]
+.PP
+ * * * * *
.PP
Any other character following a backslash causes the backslash and
character to be printed as-is.
@@ -1099,9 +1150,9 @@ Void functions can only use the first two \f[B]return\f[R] statements
listed above.
They can also omit the return statement entirely.
.PP
-The word \[lq]void\[rq] is not treated as a keyword; it is still
+The word \[dq]void\[dq] is not treated as a keyword; it is still
possible to have variables, arrays, and functions named \f[B]void\f[R].
-The word \[lq]void\[rq] is only treated specially right after the
+The word \[dq]void\[dq] is only treated specially right after the
\f[B]define\f[R] keyword.
.PP
This is a \f[B]non-portable extension\f[R].
@@ -1136,55 +1187,74 @@ are given.
The
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
-.TP
+.PP
\f[B]s(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]c(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l(x)\f[R]
-Returns the natural logarithm of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the natural logarithm of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]e(x)\f[R]
-Returns the mathematical constant \f[B]e\f[R] raised to the power of
+.PP
+: Returns the mathematical constant \f[B]e\f[R] raised to the power of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]j(x, n)\f[R]
-Returns the bessel integer order \f[B]n\f[R] (truncated) of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
+: Returns the bessel integer order \f[B]n\f[R] (truncated) of
+\f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
@@ -1193,99 +1263,126 @@ options are given since they are not part of the library defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
The extended library is a \f[B]non-portable extension\f[R].
-.TP
+.PP
\f[B]p(x, y)\f[R]
-Calculates \f[B]x\f[R] to the power of \f[B]y\f[R], even if \f[B]y\f[R]
-is not an integer, and returns the result to the current
-\f[B]scale\f[R].
-.RS
.PP
-It is an error if \f[B]y\f[R] is negative and \f[B]x\f[R] is
-\f[B]0\f[R].
+: Calculates \f[B]x\f[R] to the power of \f[B]y\f[R], even if
+\f[B]y\f[R] is not an integer, and returns the result to the current
+\f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+It is an error if **y** is negative and **x** is **0**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]r(x, p)\f[R]
-Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
+.PP
+: Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
the rounding mode round half away from
\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
-.TP
+.PP
\f[B]ceil(x, p)\f[R]
-Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
+.PP
+: Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
the rounding mode round away from
\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero).
-.TP
+.PP
\f[B]f(x)\f[R]
-Returns the factorial of the truncated absolute value of \f[B]x\f[R].
-.TP
+.PP
+: Returns the factorial of the truncated absolute value of \f[B]x\f[R].
+.PP
\f[B]perm(n, k)\f[R]
-Returns the permutation of the truncated absolute value of \f[B]n\f[R]
+.PP
+: Returns the permutation of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
If not, it returns \f[B]0\f[R].
-.TP
+.PP
\f[B]comb(n, k)\f[R]
-Returns the combination of the truncated absolute value of \f[B]n\f[R]
+.PP
+: Returns the combination of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
If not, it returns \f[B]0\f[R].
-.TP
+.PP
\f[B]l2(x)\f[R]
-Returns the logarithm base \f[B]2\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]2\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l10(x)\f[R]
-Returns the logarithm base \f[B]10\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]10\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]log(x, b)\f[R]
-Returns the logarithm base \f[B]b\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]b\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]cbrt(x)\f[R]
-Returns the cube root of \f[B]x\f[R].
-.TP
+.PP
+: Returns the cube root of \f[B]x\f[R].
+.PP
\f[B]root(x, n)\f[R]
-Calculates the truncated value of \f[B]n\f[R], \f[B]r\f[R], and returns
-the \f[B]r\f[R]th root of \f[B]x\f[R] to the current \f[B]scale\f[R].
-.RS
-.PP
-If \f[B]r\f[R] is \f[B]0\f[R] or negative, this raises an error and
-causes bc(1) to reset (see the \f[B]RESET\f[R] section).
-It also raises an error and causes bc(1) to reset if \f[B]r\f[R] is even
-and \f[B]x\f[R] is negative.
-.RE
-.TP
+.PP
+: Calculates the truncated value of \f[B]n\f[R], \f[B]r\f[R], and
+returns the \f[B]r\f[R]th root of \f[B]x\f[R] to the current
+\f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+If **r** is **0** or negative, this raises an error and causes bc(1) to
+reset (see the **RESET** section). It also raises an error and causes bc(1)
+to reset if **r** is even and **x** is negative.
+\f[R]
+.fi
+.PP
\f[B]pi(p)\f[R]
-Returns \f[B]pi\f[R] to \f[B]p\f[R] decimal places.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns \f[B]pi\f[R] to \f[B]p\f[R] decimal places.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]t(x)\f[R]
-Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a2(y, x)\f[R]
-Returns the arctangent of \f[B]y/x\f[R], in radians.
+.PP
+: Returns the arctangent of \f[B]y/x\f[R], in radians.
If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
@@ -1298,60 +1395,75 @@ If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
\f[B]0\f[R], it returns \f[B]pi/2\f[R].
If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
\f[B]0\f[R], it returns \f[B]-pi/2\f[R].
-.RS
-.PP
-This function is the same as the \f[B]atan2()\f[R] function in many
-programming languages.
+.IP
+.nf
+\f[C]
+This function is the same as the **atan2()** function in many programming
+languages.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]sin(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is an alias of \f[B]s(x)\f[R].
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **s(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]cos(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is an alias of \f[B]c(x)\f[R].
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **c(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]tan(x)\f[R]
-Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-If \f[B]x\f[R] is equal to \f[B]1\f[R] or \f[B]-1\f[R], this raises an
-error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
-.PP
-This is an alias of \f[B]t(x)\f[R].
+: Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+If **x** is equal to **1** or **-1**, this raises an error and causes bc(1)
+to reset (see the **RESET** section).
+
+This is an alias of **t(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]atan(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is an alias of \f[B]a(x)\f[R].
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **a(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]atan2(y, x)\f[R]
-Returns the arctangent of \f[B]y/x\f[R], in radians.
+.PP
+: Returns the arctangent of \f[B]y/x\f[R], in radians.
If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
@@ -1364,302 +1476,367 @@ If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
\f[B]0\f[R], it returns \f[B]pi/2\f[R].
If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
\f[B]0\f[R], it returns \f[B]-pi/2\f[R].
-.RS
-.PP
-This function is the same as the \f[B]atan2()\f[R] function in many
-programming languages.
-.PP
-This is an alias of \f[B]a2(y, x)\f[R].
+.IP
+.nf
+\f[C]
+This function is the same as the **atan2()** function in many programming
+languages.
+
+This is an alias of **a2(y, x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]r2d(x)\f[R]
-Converts \f[B]x\f[R] from radians to degrees and returns the result.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Converts \f[B]x\f[R] from radians to degrees and returns the result.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]d2r(x)\f[R]
-Converts \f[B]x\f[R] from degrees to radians and returns the result.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Converts \f[B]x\f[R] from degrees to radians and returns the result.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]frand(p)\f[R]
-Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
+.PP
+: Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
\f[B]1\f[R] (exclusive) with the number of decimal digits after the
decimal point equal to the truncated absolute value of \f[B]p\f[R].
If \f[B]p\f[R] is not \f[B]0\f[R], then calling this function will
change the value of \f[B]seed\f[R].
If \f[B]p\f[R] is \f[B]0\f[R], then \f[B]0\f[R] is returned, and
\f[B]seed\f[R] is \f[I]not\f[R] changed.
-.TP
+.PP
\f[B]ifrand(i, p)\f[R]
-Generates a pseudo-random number that is between \f[B]0\f[R] (inclusive)
-and the truncated absolute value of \f[B]i\f[R] (exclusive) with the
-number of decimal digits after the decimal point equal to the truncated
-absolute value of \f[B]p\f[R].
+.PP
+: Generates a pseudo-random number that is between \f[B]0\f[R]
+(inclusive) and the truncated absolute value of \f[B]i\f[R] (exclusive)
+with the number of decimal digits after the decimal point equal to the
+truncated absolute value of \f[B]p\f[R].
If the absolute value of \f[B]i\f[R] is greater than or equal to
\f[B]2\f[R], and \f[B]p\f[R] is not \f[B]0\f[R], then calling this
function will change the value of \f[B]seed\f[R]; otherwise, \f[B]0\f[R]
is returned and \f[B]seed\f[R] is not changed.
-.TP
+.PP
\f[B]srand(x)\f[R]
-Returns \f[B]x\f[R] with its sign flipped with probability
+.PP
+: Returns \f[B]x\f[R] with its sign flipped with probability
\f[B]0.5\f[R].
In other words, it randomizes the sign of \f[B]x\f[R].
-.TP
+.PP
\f[B]brand()\f[R]
-Returns a random boolean value (either \f[B]0\f[R] or \f[B]1\f[R]).
-.TP
+.PP
+: Returns a random boolean value (either \f[B]0\f[R] or \f[B]1\f[R]).
+.PP
\f[B]ubytes(x)\f[R]
-Returns the numbers of unsigned integer bytes required to hold the
+.PP
+: Returns the numbers of unsigned integer bytes required to hold the
truncated absolute value of \f[B]x\f[R].
-.TP
+.PP
\f[B]sbytes(x)\f[R]
-Returns the numbers of signed, two\[cq]s-complement integer bytes
+.PP
+: Returns the numbers of signed, two\[aq]s-complement integer bytes
required to hold the truncated value of \f[B]x\f[R].
-.TP
+.PP
\f[B]hex(x)\f[R]
-Outputs the hexadecimal (base \f[B]16\f[R]) representation of
+.PP
+: Outputs the hexadecimal (base \f[B]16\f[R]) representation of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]binary(x)\f[R]
-Outputs the binary (base \f[B]2\f[R]) representation of \f[B]x\f[R].
-.RS
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
+: Outputs the binary (base \f[B]2\f[R]) representation of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
+.PP
\f[B]output(x, b)\f[R]
-Outputs the base \f[B]b\f[R] representation of \f[B]x\f[R].
-.RS
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
+: Outputs the base \f[B]b\f[R] representation of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
+.PP
\f[B]uint(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in as few power of two bytes as possible.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or is negative, an error message is
-printed instead, but bc(1) is not reset (see the \f[B]RESET\f[R]
-section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in as few power of two bytes as possible.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or is negative, an error message is printed
+instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in as few power of two bytes as
-possible.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, an error message is printed instead,
-but bc(1) is not reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in as few power of two bytes
+as possible.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, an error message is printed instead, but bc(1)
+is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uintn(x, n)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]n\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]n\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]n\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **n** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]intn(x, n)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]n\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]n\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]n\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **n** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint8(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]1\f[R] byte.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]1\f[R] byte, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]1\f[R] byte.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **1** byte, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int8(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]1\f[R] byte.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]1\f[R] byte, an
-error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]1\f[R] byte.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **1** byte, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint16(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]2\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]2\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]2\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **2** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int16(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]2\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]2\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]2\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **2** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint32(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]4\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]4\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]4\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **4** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int32(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]4\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]4\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]4\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **4** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint64(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]8\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]8\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]8\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **8** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int64(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]8\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]8\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]8\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **8** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]hex_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in hexadecimal using \f[B]n\f[R]
bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]binary_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in binary using \f[B]n\f[R] bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]output_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in the current \f[B]obase\f[R] (see
the \f[B]SYNTAX\f[R] section) using \f[B]n\f[R] bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]output_byte(x, i)\f[R]
-Outputs byte \f[B]i\f[R] of the truncated absolute value of \f[B]x\f[R],
-where \f[B]0\f[R] is the least significant byte and \f[B]number_of_bytes
-- 1\f[R] is the most significant byte.
-.RS
-.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
+.PP
+: Outputs byte \f[B]i\f[R] of the truncated absolute value of
+\f[B]x\f[R], where \f[B]0\f[R] is the least significant byte and
+\f[B]number_of_bytes - 1\f[R] is the most significant byte.
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.SS Transcendental Functions
.PP
All transcendental functions can return slightly inaccurate results (up
@@ -1763,64 +1940,77 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on bc(1):
-.TP
+.PP
\f[B]BC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
bc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]BC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]BC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]BC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]BC_BASE_POW\f[R].
-.TP
+.PP
\f[B]BC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_RAND_MAX\f[R]
-The maximum integer (inclusive) returned by the \f[B]rand()\f[R]
+.PP
+: The maximum integer (inclusive) returned by the \f[B]rand()\f[R]
operand.
Set at \f[B]2\[ha]BC_LONG_BIT-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]BC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
The actual values can be queried with the \f[B]limits\f[R] statement.
@@ -1832,42 +2022,44 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
bc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]POSIXLY_CORRECT\f[R]
-If this variable exists (no matter the contents), bc(1) behaves as if
+.PP
+: If this variable exists (no matter the contents), bc(1) behaves as if
the \f[B]-s\f[R] option was given.
-.TP
+.PP
\f[B]BC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to bc(1).
+.PP
+: This is another way to give command-line arguments to bc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time bc(1) runs.
-.RS
-.PP
-The code that parses \f[B]BC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some bc file.bc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]bc\[dq] file.bc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]BC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **BC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some bc file.bc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]bc\[rs]\[dq] file.bc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]bc\[aq] file.bc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **BC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]BC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
including the backslash (\f[B]\[rs]\f[R]).
@@ -1875,68 +2067,76 @@ The default line length is \f[B]70\f[R].
.SH EXIT STATUS
.PP
bc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, using a negative number as a bound for the
-pseudo-random number generator, attempting to convert a negative number
-to a hardware integer, overflow when converting a number to a hardware
-integer, and attempting to use a non-integer where an integer is
-required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
-(\f[B]<<\f[R]), and right shift (\f[B]>>\f[R]) operators and their
-corresponding assignment operators.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, using a negative number as a bound for the pseudo-random number
+generator, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**), places (**\[rs]\[at]**), left shift (**\[rs]<\[rs]<**), and right shift (**\[rs]>\[rs]>**)
+operators and their corresponding assignment operators.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, using a token
-where it is invalid, giving an invalid expression, giving an invalid
-print statement, giving an invalid function definition, attempting to
-assign to an expression that is not a named expression (see the
-\f[I]Named Expressions\f[R] subsection of the \f[B]SYNTAX\f[R] section),
-giving an invalid \f[B]auto\f[R] list, having a duplicate
-\f[B]auto\f[R]/function parameter, failing to find the end of a code
-block, attempting to return a value from a \f[B]void\f[R] function,
-attempting to use a variable as a reference, and using any extensions
-when the option \f[B]-s\f[R] or any equivalents were given.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, using a token where it is invalid,
+giving an invalid expression, giving an invalid print statement, giving an
+invalid function definition, attempting to assign to an expression that is
+not a named expression (see the *Named Expressions* subsection of the
+**SYNTAX** section), giving an invalid **auto** list, having a duplicate
+**auto**/function parameter, failing to find the end of a code block,
+attempting to return a value from a **void** function, attempting to use a
+variable as a reference, and using any extensions when the option **-s** or
+any equivalents were given.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, passing the wrong number of
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, passing the wrong number of
arguments to functions, attempting to call an undefined function, and
-attempting to use a \f[B]void\f[R] function call as a value in an
-expression.
-.RE
-.TP
+attempting to use a **void** function call as a value in an expression.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (bc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (bc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
@@ -1966,7 +2166,7 @@ In interactive mode, bc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, bc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, bc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is different from interactive mode because interactive mode is
required in the bc(1)
@@ -1981,7 +2181,7 @@ If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If bc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If bc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/bc/HNP.1.md b/contrib/bc/manuals/bc/HNP.1.md
index cd6d2c4836e9..365ee36926a1 100644
--- a/contrib/bc/manuals/bc/HNP.1.md
+++ b/contrib/bc/manuals/bc/HNP.1.md
@@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -142,6 +142,12 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Because bc(1) was built without support for prompts, this option is a no-op.
+
+ This is a **non-portable extension**.
+
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
diff --git a/contrib/bc/manuals/bc/HP.1 b/contrib/bc/manuals/bc/HP.1
index 33293307f8f3..71c79623abad 100644
--- a/contrib/bc/manuals/bc/HP.1
+++ b/contrib/bc/manuals/bc/HP.1
@@ -25,19 +25,19 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+\f[B]bc\f[R] [\f[B]-ghilPqRsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
-[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
-[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
+[\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
@@ -53,205 +53,219 @@ the command line and executes them before reading from \f[B]stdin\f[R].
.SH OPTIONS
.PP
The following are the options that bc(1) accepts.
-.TP
+.PP
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
-Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
-\f[B]seed\f[R] into stacks.
-.RS
.PP
-This has the effect that a copy of the current value of all four are
-pushed onto a stack for every function call, as well as popped when
-every function returns.
-This means that functions can assign to any and all of those globals
-without worrying that the change will affect other functions.
-Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply
-printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this:
+: Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R],
+and \f[B]seed\f[R] into stacks.
.IP
.nf
\f[C]
-define void output(x, b) {
- obase=b
- x
-}
+This has the effect that a copy of the current value of all four are pushed
+onto a stack for every function call, as well as popped when every function
+returns. This means that functions can assign to any and all of those
+globals without worrying that the change will affect other functions.
+Thus, a hypothetical function named **output(x,b)** that simply printed
+**x** in base **b** could be written like this:
+
+ define void output(x, b) {
+ obase=b
+ x
+ }
+
+instead of like this:
+
+ define void output(x, b) {
+ auto c
+ c=obase
+ obase=b
+ x
+ obase=c
+ }
+
+This makes writing functions much easier.
+
+(**Note**: the function **output(x,b)** exists in the extended math library.
+ See the **LIBRARY** section.)
+
+However, since using this flag means that functions cannot set **ibase**,
+**obase**, **scale**, or **seed** globally, functions that are made to do so
+cannot work anymore. There are two possible use cases for that, and each has
+a solution.
+
+First, if a function is called on startup to turn bc(1) into a number
+converter, it is possible to replace that capability with various shell
+aliases. Examples:
+
+ alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
+ alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
+
+Second, if the purpose of a function is to set **ibase**, **obase**,
+**scale**, or **seed** globally for any other purpose, it could be split
+into one to four functions (based on how many globals it sets) and each of
+those functions could return the desired value for a global.
+
+For functions that set **seed**, the value assigned to **seed** is not
+propagated to parent functions. This means that the sequence of
+pseudo-random numbers that they see will not be the same sequence of
+pseudo-random numbers that any parent sees. This is only the case once
+**seed** has been set.
+
+If a function desires to not affect the sequence of pseudo-random numbers
+of its parents, but wants to use the same **seed**, it can use the following
+line:
+
+ seed = seed
+
+If the behavior of this option is desired for every run of bc(1), then users
+could make sure to define **BC_ENV_ARGS** and include this option (see the
+**ENVIRONMENT VARIABLES** section for more details).
+
+If **-s**, **-w**, or any equivalents are used, this option is ignored.
+
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-instead of like this:
+\f[B]-h\f[R], \f[B]--help\f[R]
+.PP
+: Prints a usage message and quits.
+.PP
+\f[B]-i\f[R], \f[B]--interactive\f[R]
+.PP
+: Forces interactive mode.
+(See the \f[B]INTERACTIVE MODE\f[R] section.)
.IP
.nf
\f[C]
-define void output(x, b) {
- auto c
- c=obase
- obase=b
- x
- obase=c
-}
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-This makes writing functions much easier.
-.PP
-(\f[B]Note\f[R]: the function \f[B]output(x,b)\f[R] exists in the
-extended math library.
-See the \f[B]LIBRARY\f[R] section.)
-.PP
-However, since using this flag means that functions cannot set
-\f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R]
-globally, functions that are made to do so cannot work anymore.
-There are two possible use cases for that, and each has a solution.
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
.PP
-First, if a function is called on startup to turn bc(1) into a number
-converter, it is possible to replace that capability with various shell
-aliases.
-Examples:
+: Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to
+\f[B]20\f[R] and loads the included math library and the extended math
+library before running any code, including any expressions or files
+specified on the command line.
.IP
.nf
\f[C]
-alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
-alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
+To learn what is in the libraries, see the **LIBRARY** section.
\f[R]
.fi
.PP
-Second, if the purpose of a function is to set \f[B]ibase\f[R],
-\f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R] globally for any
-other purpose, it could be split into one to four functions (based on
-how many globals it sets) and each of those functions could return the
-desired value for a global.
-.PP
-For functions that set \f[B]seed\f[R], the value assigned to
-\f[B]seed\f[R] is not propagated to parent functions.
-This means that the sequence of pseudo-random numbers that they see will
-not be the same sequence of pseudo-random numbers that any parent sees.
-This is only the case once \f[B]seed\f[R] has been set.
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
.PP
-If a function desires to not affect the sequence of pseudo-random
-numbers of its parents, but wants to use the same \f[B]seed\f[R], it can
-use the following line:
+: This option is a no-op.
.IP
.nf
\f[C]
-seed = seed
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-If the behavior of this option is desired for every run of bc(1), then
-users could make sure to define \f[B]BC_ENV_ARGS\f[R] and include this
-option (see the \f[B]ENVIRONMENT VARIABLES\f[R] section for more
-details).
-.PP
-If \f[B]-s\f[R], \f[B]-w\f[R], or any equivalents are used, this option
-is ignored.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
-\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
-(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]-l\f[R], \f[B]--mathlib\f[R]
-Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
-and loads the included math library and the extended math library before
-running any code, including any expressions or files specified on the
-command line.
-.RS
-.PP
-To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
-.RE
-.TP
-\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-This option is a no-op.
-.RS
+: Because bc(1) was built without support for prompts, this option is a
+no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
+.PP
+: This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-s\f[R], \f[B]--standard\f[R]
-Process exactly the language defined by the
+.PP
+: Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Print the version information (copyright header) and exit.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-w\f[R], \f[B]--warn\f[R]
-Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
+.PP
+: Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]BC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -308,7 +322,7 @@ Identifiers with more than one character (letter) are a
.PP
\f[B]ibase\f[R] is a global variable determining how to interpret
constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
@@ -320,7 +334,7 @@ The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
programs with the \f[B]maxibase()\f[R] built-in function.
.PP
\f[B]obase\f[R] is a global variable determining how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
@@ -492,7 +506,7 @@ This is a \f[B]non-portable extension\f[R].
.IP "15." 4
\f[B]irand(E)\f[R]: A pseudo-random integer between \f[B]0\f[R]
(inclusive) and the value of \f[B]E\f[R] (exclusive).
-If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[cq]s
+If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[aq]s
\f[I]scale\f[R] is not \f[B]0\f[R]), an error is raised, and bc(1)
resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R] remains
unchanged.
@@ -570,301 +584,377 @@ extension\f[R].
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-Type: Prefix and Postfix
-.RS
.PP
+: Type: Prefix and Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **increment**, **decrement**
+\f[R]
+.fi
.PP
-Description: \f[B]increment\f[R], \f[B]decrement\f[R]
-.RE
-.TP
\f[B]-\f[R] \f[B]!\f[R]
-Type: Prefix
-.RS
.PP
+: Type: Prefix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **negation**, **boolean not**
+\f[R]
+.fi
.PP
-Description: \f[B]negation\f[R], \f[B]boolean not\f[R]
-.RE
-.TP
\f[B]$\f[R]
-Type: Postfix
-.RS
.PP
+: Type: Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **truncation**
+\f[R]
+.fi
.PP
-Description: \f[B]truncation\f[R]
-.RE
-.TP
\f[B]\[at]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **set precision**
+\f[R]
+.fi
.PP
-Description: \f[B]set precision\f[R]
-.RE
-.TP
\f[B]\[ha]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **power**
+\f[R]
+.fi
.PP
-Description: \f[B]power\f[R]
-.RE
-.TP
\f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **multiply**, **divide**, **modulus**
+\f[R]
+.fi
.PP
-Description: \f[B]multiply\f[R], \f[B]divide\f[R], \f[B]modulus\f[R]
-.RE
-.TP
\f[B]+\f[R] \f[B]-\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **add**, **subtract**
+\f[R]
+.fi
.PP
-Description: \f[B]add\f[R], \f[B]subtract\f[R]
-.RE
-.TP
\f[B]<<\f[R] \f[B]>>\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **shift left**, **shift right**
+\f[R]
+.fi
.PP
-Description: \f[B]shift left\f[R], \f[B]shift right\f[R]
-.RE
-.TP
-\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
-Type: Binary
-.RS
+\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R]
+\f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **assignment**
+\f[R]
+.fi
.PP
-Description: \f[B]assignment\f[R]
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-Type: Binary
-.RS
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **relational**
+\f[R]
+.fi
.PP
-Description: \f[B]relational\f[R]
-.RE
-.TP
\f[B]&&\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **boolean and**
+\f[R]
+.fi
.PP
-Description: \f[B]boolean and\f[R]
-.RE
-.TP
\f[B]||\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
-.PP
-Description: \f[B]boolean or\f[R]
-.RE
+
+Description: **boolean or**
+\f[R]
+.fi
.PP
The operators will be described in more detail below.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
+.PP
+: The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
subsection) as an operand.
-.RS
+.IP
+.nf
+\f[C]
+The prefix versions of these operators are more efficient; use them where
+possible.
+\f[R]
+.fi
.PP
-The prefix versions of these operators are more efficient; use them
-where possible.
-.RE
-.TP
\f[B]-\f[R]
-The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
+.PP
+: The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
to negate any expression with the value \f[B]0\f[R].
Otherwise, a copy of the expression with its sign flipped is returned.
-.TP
+.PP
\f[B]!\f[R]
-The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the expression
-is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the
+expression is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]$\f[R]
-The \f[B]truncation\f[R] operator returns a copy of the given expression
-with all of its \f[I]scale\f[R] removed.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]truncation\f[R] operator returns a copy of the given
+expression with all of its \f[I]scale\f[R] removed.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]\[at]\f[R]
-The \f[B]set precision\f[R] operator takes two expressions and returns a
-copy of the first with its \f[I]scale\f[R] equal to the value of the
+.PP
+: The \f[B]set precision\f[R] operator takes two expressions and returns
+a copy of the first with its \f[I]scale\f[R] equal to the value of the
second expression.
That could either mean that the number is returned without change (if
the \f[I]scale\f[R] of the first expression matches the value of the
second expression), extended (if it is less), or truncated (if it is
more).
-.RS
-.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
+.PP
+: The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
as it would be in C) takes two expressions and raises the first to the
power of the value of the second.
The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*), and if it is
+negative, the first value must be non-zero.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]), and if it
-is negative, the first value must be non-zero.
-.RE
-.TP
\f[B]*\f[R]
-The \f[B]multiply\f[R] operator takes two expressions, multiplies them,
-and returns the product.
+.PP
+: The \f[B]multiply\f[R] operator takes two expressions, multiplies
+them, and returns the product.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The \f[B]divide\f[R] operator takes two expressions, divides them, and
+.PP
+: The \f[B]divide\f[R] operator takes two expressions, divides them, and
returns the quotient.
The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]%\f[R]
-The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
\f[B]scale\f[R] and 2) Using the result of step 1 to calculate
\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
\f[B]max(scale+scale(b),scale(a))\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]+\f[R]
-The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]-\f[R]
-The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]<<\f[R]
-The \f[B]left shift\f[R] operator takes two expressions, \f[B]a\f[R] and
-\f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
-decimal point moved \f[B]b\f[R] places to the right.
-.RS
.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+: The \f[B]left shift\f[R] operator takes two expressions, \f[B]a\f[R]
+and \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
+decimal point moved \f[B]b\f[R] places to the right.
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]>>\f[R]
-The \f[B]right shift\f[R] operator takes two expressions, \f[B]a\f[R]
+.PP
+: The \f[B]right shift\f[R] operator takes two expressions, \f[B]a\f[R]
and \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
decimal point moved \f[B]b\f[R] places to the left.
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R]
+\f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
-The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R] and
-\f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the \f[I]Named
-Expressions\f[R] subsection).
-.RS
-.PP
-For \f[B]=\f[R], \f[B]b\f[R] is copied and the result is assigned to
-\f[B]a\f[R].
-For all others, \f[B]a\f[R] and \f[B]b\f[R] are applied as operands to
-the corresponding arithmetic operator and the result is assigned to
-\f[B]a\f[R].
-.PP
-The \f[B]assignment\f[R] operators that correspond to operators that are
-extensions are themselves \f[B]non-portable extensions\f[R].
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-The \f[B]relational\f[R] operators compare two expressions, \f[B]a\f[R]
-and \f[B]b\f[R], and if the relation holds, according to C language
-semantics, the result is \f[B]1\f[R].
-Otherwise, it is \f[B]0\f[R].
-.RS
+: The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R]
+and \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the
+\f[I]Named Expressions\f[R] subsection).
+.IP
+.nf
+\f[C]
+For **=**, **b** is copied and the result is assigned to **a**. For all
+others, **a** and **b** are applied as operands to the corresponding
+arithmetic operator and the result is assigned to **a**.
+
+The **assignment** operators that correspond to operators that are
+extensions are themselves **non-portable extensions**.
+\f[R]
+.fi
+.PP
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: The \f[B]relational\f[R] operators compare two expressions,
+\f[B]a\f[R] and \f[B]b\f[R], and if the relation holds, according to C
+language semantics, the result is \f[B]1\f[R].
+Otherwise, it is \f[B]0\f[R].
+.IP
+.nf
+\f[C]
Note that unlike in C, these operators have a lower precedence than the
-\f[B]assignment\f[R] operators, which means that \f[B]a=b>c\f[R] is
-interpreted as \f[B](a=b)>c\f[R].
+**assignment** operators, which means that **a=b\[rs]>c** is interpreted as
+**(a=b)\[rs]>c**.
+
+Also, unlike the [standard][1] requires, these operators can appear anywhere
+any other expressions can be used. This allowance is a
+**non-portable extension**.
+\f[R]
+.fi
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-requires, these operators can appear anywhere any other expressions can
-be used.
-This allowance is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]&&\f[R]
-The \f[B]boolean and\f[R] operator takes two expressions and returns
-\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
-.RS
.PP
-This is \f[I]not\f[R] a short-circuit operator.
+: The \f[B]boolean and\f[R] operator takes two expressions and returns
+\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]||\f[R]
-The \f[B]boolean or\f[R] operator takes two expressions and returns
+.PP
+: The \f[B]boolean or\f[R] operator takes two expressions and returns
\f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
otherwise.
-.RS
-.PP
-This is \f[I]not\f[R] a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Statements
.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
.IP " 2." 4
-\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] \&... \f[B];\f[R] \f[B]S\f[R]
-\f[B]}\f[R]
+\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] ...
+\f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
.IP " 3." 4
\f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
.IP " 4." 4
@@ -890,7 +980,8 @@ An empty statement
.IP "13." 4
A string of characters, enclosed in double quotes
.IP "14." 4
-\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] \&... \f[B],\f[R] \f[B]E\f[R]
+\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] ...
+\f[B],\f[R] \f[B]E\f[R]
.IP "15." 4
\f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
\f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
@@ -948,62 +1039,22 @@ Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
.SS Print Statement
.PP
-The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
+The \[dq]expressions\[dq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
specially.
What those sequences are, and what they cause to be printed, are shown
below:
.PP
-.TS
-tab(@);
-l l.
-T{
-\f[B]\[rs]a\f[R]
-T}@T{
-\f[B]\[rs]a\f[R]
-T}
-T{
-\f[B]\[rs]b\f[R]
-T}@T{
-\f[B]\[rs]b\f[R]
-T}
-T{
-\f[B]\[rs]\[rs]\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]e\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]f\f[R]
-T}@T{
-\f[B]\[rs]f\f[R]
-T}
-T{
-\f[B]\[rs]n\f[R]
-T}@T{
-\f[B]\[rs]n\f[R]
-T}
-T{
-\f[B]\[rs]q\f[R]
-T}@T{
-\f[B]\[dq]\f[R]
-T}
-T{
-\f[B]\[rs]r\f[R]
-T}@T{
-\f[B]\[rs]r\f[R]
-T}
-T{
-\f[B]\[rs]t\f[R]
-T}@T{
-\f[B]\[rs]t\f[R]
-T}
-.TE
+ * * * * *
+.PP
+\f[B]\[rs]a\f[R] \f[B]\[rs]a\f[R] \f[B]\[rs]b\f[R] \f[B]\[rs]b\f[R]
+\f[B]\[rs]\[rs]\f[R] \f[B]\[rs]\f[R] \f[B]\[rs]e\f[R] \f[B]\[rs]\f[R]
+\f[B]\[rs]f\f[R] \f[B]\[rs]f\f[R] \f[B]\[rs]n\f[R] \f[B]\[rs]n\f[R]
+\f[B]\[rs]q\f[R] \f[B]\[dq]\f[R] \f[B]\[rs]r\f[R] \f[B]\[rs]r\f[R]
+\f[B]\[rs]t\f[R] \f[B]\[rs]t\f[R]
+.PP
+ * * * * *
.PP
Any other character following a backslash causes the backslash and
character to be printed as-is.
@@ -1099,9 +1150,9 @@ Void functions can only use the first two \f[B]return\f[R] statements
listed above.
They can also omit the return statement entirely.
.PP
-The word \[lq]void\[rq] is not treated as a keyword; it is still
+The word \[dq]void\[dq] is not treated as a keyword; it is still
possible to have variables, arrays, and functions named \f[B]void\f[R].
-The word \[lq]void\[rq] is only treated specially right after the
+The word \[dq]void\[dq] is only treated specially right after the
\f[B]define\f[R] keyword.
.PP
This is a \f[B]non-portable extension\f[R].
@@ -1136,55 +1187,74 @@ are given.
The
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
-.TP
+.PP
\f[B]s(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]c(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l(x)\f[R]
-Returns the natural logarithm of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the natural logarithm of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]e(x)\f[R]
-Returns the mathematical constant \f[B]e\f[R] raised to the power of
+.PP
+: Returns the mathematical constant \f[B]e\f[R] raised to the power of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]j(x, n)\f[R]
-Returns the bessel integer order \f[B]n\f[R] (truncated) of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
+: Returns the bessel integer order \f[B]n\f[R] (truncated) of
+\f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
@@ -1193,99 +1263,126 @@ options are given since they are not part of the library defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
The extended library is a \f[B]non-portable extension\f[R].
-.TP
+.PP
\f[B]p(x, y)\f[R]
-Calculates \f[B]x\f[R] to the power of \f[B]y\f[R], even if \f[B]y\f[R]
-is not an integer, and returns the result to the current
-\f[B]scale\f[R].
-.RS
.PP
-It is an error if \f[B]y\f[R] is negative and \f[B]x\f[R] is
-\f[B]0\f[R].
+: Calculates \f[B]x\f[R] to the power of \f[B]y\f[R], even if
+\f[B]y\f[R] is not an integer, and returns the result to the current
+\f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+It is an error if **y** is negative and **x** is **0**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]r(x, p)\f[R]
-Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
+.PP
+: Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
the rounding mode round half away from
\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
-.TP
+.PP
\f[B]ceil(x, p)\f[R]
-Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
+.PP
+: Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
the rounding mode round away from
\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero).
-.TP
+.PP
\f[B]f(x)\f[R]
-Returns the factorial of the truncated absolute value of \f[B]x\f[R].
-.TP
+.PP
+: Returns the factorial of the truncated absolute value of \f[B]x\f[R].
+.PP
\f[B]perm(n, k)\f[R]
-Returns the permutation of the truncated absolute value of \f[B]n\f[R]
+.PP
+: Returns the permutation of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
If not, it returns \f[B]0\f[R].
-.TP
+.PP
\f[B]comb(n, k)\f[R]
-Returns the combination of the truncated absolute value of \f[B]n\f[R]
+.PP
+: Returns the combination of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
If not, it returns \f[B]0\f[R].
-.TP
+.PP
\f[B]l2(x)\f[R]
-Returns the logarithm base \f[B]2\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]2\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l10(x)\f[R]
-Returns the logarithm base \f[B]10\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]10\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]log(x, b)\f[R]
-Returns the logarithm base \f[B]b\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]b\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]cbrt(x)\f[R]
-Returns the cube root of \f[B]x\f[R].
-.TP
+.PP
+: Returns the cube root of \f[B]x\f[R].
+.PP
\f[B]root(x, n)\f[R]
-Calculates the truncated value of \f[B]n\f[R], \f[B]r\f[R], and returns
-the \f[B]r\f[R]th root of \f[B]x\f[R] to the current \f[B]scale\f[R].
-.RS
-.PP
-If \f[B]r\f[R] is \f[B]0\f[R] or negative, this raises an error and
-causes bc(1) to reset (see the \f[B]RESET\f[R] section).
-It also raises an error and causes bc(1) to reset if \f[B]r\f[R] is even
-and \f[B]x\f[R] is negative.
-.RE
-.TP
+.PP
+: Calculates the truncated value of \f[B]n\f[R], \f[B]r\f[R], and
+returns the \f[B]r\f[R]th root of \f[B]x\f[R] to the current
+\f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+If **r** is **0** or negative, this raises an error and causes bc(1) to
+reset (see the **RESET** section). It also raises an error and causes bc(1)
+to reset if **r** is even and **x** is negative.
+\f[R]
+.fi
+.PP
\f[B]pi(p)\f[R]
-Returns \f[B]pi\f[R] to \f[B]p\f[R] decimal places.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns \f[B]pi\f[R] to \f[B]p\f[R] decimal places.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]t(x)\f[R]
-Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a2(y, x)\f[R]
-Returns the arctangent of \f[B]y/x\f[R], in radians.
+.PP
+: Returns the arctangent of \f[B]y/x\f[R], in radians.
If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
@@ -1298,60 +1395,75 @@ If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
\f[B]0\f[R], it returns \f[B]pi/2\f[R].
If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
\f[B]0\f[R], it returns \f[B]-pi/2\f[R].
-.RS
-.PP
-This function is the same as the \f[B]atan2()\f[R] function in many
-programming languages.
+.IP
+.nf
+\f[C]
+This function is the same as the **atan2()** function in many programming
+languages.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]sin(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is an alias of \f[B]s(x)\f[R].
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **s(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]cos(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is an alias of \f[B]c(x)\f[R].
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **c(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]tan(x)\f[R]
-Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-If \f[B]x\f[R] is equal to \f[B]1\f[R] or \f[B]-1\f[R], this raises an
-error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
-.PP
-This is an alias of \f[B]t(x)\f[R].
+: Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+If **x** is equal to **1** or **-1**, this raises an error and causes bc(1)
+to reset (see the **RESET** section).
+
+This is an alias of **t(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]atan(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is an alias of \f[B]a(x)\f[R].
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **a(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]atan2(y, x)\f[R]
-Returns the arctangent of \f[B]y/x\f[R], in radians.
+.PP
+: Returns the arctangent of \f[B]y/x\f[R], in radians.
If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
@@ -1364,302 +1476,367 @@ If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
\f[B]0\f[R], it returns \f[B]pi/2\f[R].
If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
\f[B]0\f[R], it returns \f[B]-pi/2\f[R].
-.RS
-.PP
-This function is the same as the \f[B]atan2()\f[R] function in many
-programming languages.
-.PP
-This is an alias of \f[B]a2(y, x)\f[R].
+.IP
+.nf
+\f[C]
+This function is the same as the **atan2()** function in many programming
+languages.
+
+This is an alias of **a2(y, x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]r2d(x)\f[R]
-Converts \f[B]x\f[R] from radians to degrees and returns the result.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Converts \f[B]x\f[R] from radians to degrees and returns the result.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]d2r(x)\f[R]
-Converts \f[B]x\f[R] from degrees to radians and returns the result.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Converts \f[B]x\f[R] from degrees to radians and returns the result.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]frand(p)\f[R]
-Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
+.PP
+: Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
\f[B]1\f[R] (exclusive) with the number of decimal digits after the
decimal point equal to the truncated absolute value of \f[B]p\f[R].
If \f[B]p\f[R] is not \f[B]0\f[R], then calling this function will
change the value of \f[B]seed\f[R].
If \f[B]p\f[R] is \f[B]0\f[R], then \f[B]0\f[R] is returned, and
\f[B]seed\f[R] is \f[I]not\f[R] changed.
-.TP
+.PP
\f[B]ifrand(i, p)\f[R]
-Generates a pseudo-random number that is between \f[B]0\f[R] (inclusive)
-and the truncated absolute value of \f[B]i\f[R] (exclusive) with the
-number of decimal digits after the decimal point equal to the truncated
-absolute value of \f[B]p\f[R].
+.PP
+: Generates a pseudo-random number that is between \f[B]0\f[R]
+(inclusive) and the truncated absolute value of \f[B]i\f[R] (exclusive)
+with the number of decimal digits after the decimal point equal to the
+truncated absolute value of \f[B]p\f[R].
If the absolute value of \f[B]i\f[R] is greater than or equal to
\f[B]2\f[R], and \f[B]p\f[R] is not \f[B]0\f[R], then calling this
function will change the value of \f[B]seed\f[R]; otherwise, \f[B]0\f[R]
is returned and \f[B]seed\f[R] is not changed.
-.TP
+.PP
\f[B]srand(x)\f[R]
-Returns \f[B]x\f[R] with its sign flipped with probability
+.PP
+: Returns \f[B]x\f[R] with its sign flipped with probability
\f[B]0.5\f[R].
In other words, it randomizes the sign of \f[B]x\f[R].
-.TP
+.PP
\f[B]brand()\f[R]
-Returns a random boolean value (either \f[B]0\f[R] or \f[B]1\f[R]).
-.TP
+.PP
+: Returns a random boolean value (either \f[B]0\f[R] or \f[B]1\f[R]).
+.PP
\f[B]ubytes(x)\f[R]
-Returns the numbers of unsigned integer bytes required to hold the
+.PP
+: Returns the numbers of unsigned integer bytes required to hold the
truncated absolute value of \f[B]x\f[R].
-.TP
+.PP
\f[B]sbytes(x)\f[R]
-Returns the numbers of signed, two\[cq]s-complement integer bytes
+.PP
+: Returns the numbers of signed, two\[aq]s-complement integer bytes
required to hold the truncated value of \f[B]x\f[R].
-.TP
+.PP
\f[B]hex(x)\f[R]
-Outputs the hexadecimal (base \f[B]16\f[R]) representation of
+.PP
+: Outputs the hexadecimal (base \f[B]16\f[R]) representation of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]binary(x)\f[R]
-Outputs the binary (base \f[B]2\f[R]) representation of \f[B]x\f[R].
-.RS
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
+: Outputs the binary (base \f[B]2\f[R]) representation of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
+.PP
\f[B]output(x, b)\f[R]
-Outputs the base \f[B]b\f[R] representation of \f[B]x\f[R].
-.RS
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
+: Outputs the base \f[B]b\f[R] representation of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
+.PP
\f[B]uint(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in as few power of two bytes as possible.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or is negative, an error message is
-printed instead, but bc(1) is not reset (see the \f[B]RESET\f[R]
-section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in as few power of two bytes as possible.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or is negative, an error message is printed
+instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in as few power of two bytes as
-possible.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, an error message is printed instead,
-but bc(1) is not reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in as few power of two bytes
+as possible.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, an error message is printed instead, but bc(1)
+is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uintn(x, n)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]n\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]n\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]n\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **n** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]intn(x, n)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]n\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]n\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]n\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **n** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint8(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]1\f[R] byte.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]1\f[R] byte, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]1\f[R] byte.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **1** byte, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int8(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]1\f[R] byte.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]1\f[R] byte, an
-error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]1\f[R] byte.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **1** byte, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint16(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]2\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]2\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]2\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **2** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int16(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]2\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]2\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]2\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **2** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint32(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]4\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]4\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]4\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **4** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int32(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]4\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]4\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]4\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **4** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint64(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]8\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]8\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]8\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **8** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int64(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]8\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]8\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]8\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **8** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]hex_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in hexadecimal using \f[B]n\f[R]
bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]binary_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in binary using \f[B]n\f[R] bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]output_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in the current \f[B]obase\f[R] (see
the \f[B]SYNTAX\f[R] section) using \f[B]n\f[R] bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]output_byte(x, i)\f[R]
-Outputs byte \f[B]i\f[R] of the truncated absolute value of \f[B]x\f[R],
-where \f[B]0\f[R] is the least significant byte and \f[B]number_of_bytes
-- 1\f[R] is the most significant byte.
-.RS
-.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
+.PP
+: Outputs byte \f[B]i\f[R] of the truncated absolute value of
+\f[B]x\f[R], where \f[B]0\f[R] is the least significant byte and
+\f[B]number_of_bytes - 1\f[R] is the most significant byte.
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.SS Transcendental Functions
.PP
All transcendental functions can return slightly inaccurate results (up
@@ -1763,64 +1940,77 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on bc(1):
-.TP
+.PP
\f[B]BC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
bc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]BC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]BC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]BC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]BC_BASE_POW\f[R].
-.TP
+.PP
\f[B]BC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_RAND_MAX\f[R]
-The maximum integer (inclusive) returned by the \f[B]rand()\f[R]
+.PP
+: The maximum integer (inclusive) returned by the \f[B]rand()\f[R]
operand.
Set at \f[B]2\[ha]BC_LONG_BIT-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]BC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
The actual values can be queried with the \f[B]limits\f[R] statement.
@@ -1832,42 +2022,44 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
bc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]POSIXLY_CORRECT\f[R]
-If this variable exists (no matter the contents), bc(1) behaves as if
+.PP
+: If this variable exists (no matter the contents), bc(1) behaves as if
the \f[B]-s\f[R] option was given.
-.TP
+.PP
\f[B]BC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to bc(1).
+.PP
+: This is another way to give command-line arguments to bc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time bc(1) runs.
-.RS
-.PP
-The code that parses \f[B]BC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some bc file.bc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]bc\[dq] file.bc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]BC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **BC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some bc file.bc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]bc\[rs]\[dq] file.bc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]bc\[aq] file.bc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **BC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]BC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
including the backslash (\f[B]\[rs]\f[R]).
@@ -1875,68 +2067,76 @@ The default line length is \f[B]70\f[R].
.SH EXIT STATUS
.PP
bc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, using a negative number as a bound for the
-pseudo-random number generator, attempting to convert a negative number
-to a hardware integer, overflow when converting a number to a hardware
-integer, and attempting to use a non-integer where an integer is
-required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
-(\f[B]<<\f[R]), and right shift (\f[B]>>\f[R]) operators and their
-corresponding assignment operators.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, using a negative number as a bound for the pseudo-random number
+generator, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**), places (**\[rs]\[at]**), left shift (**\[rs]<\[rs]<**), and right shift (**\[rs]>\[rs]>**)
+operators and their corresponding assignment operators.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, using a token
-where it is invalid, giving an invalid expression, giving an invalid
-print statement, giving an invalid function definition, attempting to
-assign to an expression that is not a named expression (see the
-\f[I]Named Expressions\f[R] subsection of the \f[B]SYNTAX\f[R] section),
-giving an invalid \f[B]auto\f[R] list, having a duplicate
-\f[B]auto\f[R]/function parameter, failing to find the end of a code
-block, attempting to return a value from a \f[B]void\f[R] function,
-attempting to use a variable as a reference, and using any extensions
-when the option \f[B]-s\f[R] or any equivalents were given.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, using a token where it is invalid,
+giving an invalid expression, giving an invalid print statement, giving an
+invalid function definition, attempting to assign to an expression that is
+not a named expression (see the *Named Expressions* subsection of the
+**SYNTAX** section), giving an invalid **auto** list, having a duplicate
+**auto**/function parameter, failing to find the end of a code block,
+attempting to return a value from a **void** function, attempting to use a
+variable as a reference, and using any extensions when the option **-s** or
+any equivalents were given.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, passing the wrong number of
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, passing the wrong number of
arguments to functions, attempting to call an undefined function, and
-attempting to use a \f[B]void\f[R] function call as a value in an
-expression.
-.RE
-.TP
+attempting to use a **void** function call as a value in an expression.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (bc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (bc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
@@ -1966,7 +2166,7 @@ In interactive mode, bc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, bc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, bc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is different from interactive mode because interactive mode is
required in the bc(1)
@@ -1981,7 +2181,7 @@ If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If bc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If bc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/bc/HP.1.md b/contrib/bc/manuals/bc/HP.1.md
index 7273a346b758..06ad718d3679 100644
--- a/contrib/bc/manuals/bc/HP.1.md
+++ b/contrib/bc/manuals/bc/HP.1.md
@@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -142,6 +142,12 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Because bc(1) was built without support for prompts, this option is a no-op.
+
+ This is a **non-portable extension**.
+
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
diff --git a/contrib/bc/manuals/bc/N.1 b/contrib/bc/manuals/bc/N.1
index faf35eb8b255..d5df71cb5a18 100644
--- a/contrib/bc/manuals/bc/N.1
+++ b/contrib/bc/manuals/bc/N.1
@@ -25,19 +25,19 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+\f[B]bc\f[R] [\f[B]-ghilPqRsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
-[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
-[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
+[\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
@@ -58,210 +58,233 @@ implementations.
.SH OPTIONS
.PP
The following are the options that bc(1) accepts.
-.TP
+.PP
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
-Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
-\f[B]seed\f[R] into stacks.
-.RS
.PP
-This has the effect that a copy of the current value of all four are
-pushed onto a stack for every function call, as well as popped when
-every function returns.
-This means that functions can assign to any and all of those globals
-without worrying that the change will affect other functions.
-Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply
-printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this:
+: Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R],
+and \f[B]seed\f[R] into stacks.
.IP
.nf
\f[C]
-define void output(x, b) {
- obase=b
- x
-}
+This has the effect that a copy of the current value of all four are pushed
+onto a stack for every function call, as well as popped when every function
+returns. This means that functions can assign to any and all of those
+globals without worrying that the change will affect other functions.
+Thus, a hypothetical function named **output(x,b)** that simply printed
+**x** in base **b** could be written like this:
+
+ define void output(x, b) {
+ obase=b
+ x
+ }
+
+instead of like this:
+
+ define void output(x, b) {
+ auto c
+ c=obase
+ obase=b
+ x
+ obase=c
+ }
+
+This makes writing functions much easier.
+
+(**Note**: the function **output(x,b)** exists in the extended math library.
+ See the **LIBRARY** section.)
+
+However, since using this flag means that functions cannot set **ibase**,
+**obase**, **scale**, or **seed** globally, functions that are made to do so
+cannot work anymore. There are two possible use cases for that, and each has
+a solution.
+
+First, if a function is called on startup to turn bc(1) into a number
+converter, it is possible to replace that capability with various shell
+aliases. Examples:
+
+ alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
+ alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
+
+Second, if the purpose of a function is to set **ibase**, **obase**,
+**scale**, or **seed** globally for any other purpose, it could be split
+into one to four functions (based on how many globals it sets) and each of
+those functions could return the desired value for a global.
+
+For functions that set **seed**, the value assigned to **seed** is not
+propagated to parent functions. This means that the sequence of
+pseudo-random numbers that they see will not be the same sequence of
+pseudo-random numbers that any parent sees. This is only the case once
+**seed** has been set.
+
+If a function desires to not affect the sequence of pseudo-random numbers
+of its parents, but wants to use the same **seed**, it can use the following
+line:
+
+ seed = seed
+
+If the behavior of this option is desired for every run of bc(1), then users
+could make sure to define **BC_ENV_ARGS** and include this option (see the
+**ENVIRONMENT VARIABLES** section for more details).
+
+If **-s**, **-w**, or any equivalents are used, this option is ignored.
+
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-instead of like this:
+\f[B]-h\f[R], \f[B]--help\f[R]
+.PP
+: Prints a usage message and quits.
+.PP
+\f[B]-i\f[R], \f[B]--interactive\f[R]
+.PP
+: Forces interactive mode.
+(See the \f[B]INTERACTIVE MODE\f[R] section.)
.IP
.nf
\f[C]
-define void output(x, b) {
- auto c
- c=obase
- obase=b
- x
- obase=c
-}
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-This makes writing functions much easier.
-.PP
-(\f[B]Note\f[R]: the function \f[B]output(x,b)\f[R] exists in the
-extended math library.
-See the \f[B]LIBRARY\f[R] section.)
-.PP
-However, since using this flag means that functions cannot set
-\f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R]
-globally, functions that are made to do so cannot work anymore.
-There are two possible use cases for that, and each has a solution.
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
.PP
-First, if a function is called on startup to turn bc(1) into a number
-converter, it is possible to replace that capability with various shell
-aliases.
-Examples:
+: Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to
+\f[B]20\f[R] and loads the included math library and the extended math
+library before running any code, including any expressions or files
+specified on the command line.
.IP
.nf
\f[C]
-alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
-alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
+To learn what is in the libraries, see the **LIBRARY** section.
\f[R]
.fi
.PP
-Second, if the purpose of a function is to set \f[B]ibase\f[R],
-\f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R] globally for any
-other purpose, it could be split into one to four functions (based on
-how many globals it sets) and each of those functions could return the
-desired value for a global.
-.PP
-For functions that set \f[B]seed\f[R], the value assigned to
-\f[B]seed\f[R] is not propagated to parent functions.
-This means that the sequence of pseudo-random numbers that they see will
-not be the same sequence of pseudo-random numbers that any parent sees.
-This is only the case once \f[B]seed\f[R] has been set.
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
.PP
-If a function desires to not affect the sequence of pseudo-random
-numbers of its parents, but wants to use the same \f[B]seed\f[R], it can
-use the following line:
+: Disables the prompt in TTY mode.
+(The prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a prompt or are not used to having them in bc(1).
+Most of those users would want to put this option in
+\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
.IP
.nf
\f[C]
-seed = seed
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-If the behavior of this option is desired for every run of bc(1), then
-users could make sure to define \f[B]BC_ENV_ARGS\f[R] and include this
-option (see the \f[B]ENVIRONMENT VARIABLES\f[R] section for more
-details).
-.PP
-If \f[B]-s\f[R], \f[B]-w\f[R], or any equivalents are used, this option
-is ignored.
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
-\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
-(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]-l\f[R], \f[B]--mathlib\f[R]
-Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
-and loads the included math library and the extended math library before
-running any code, including any expressions or files specified on the
-command line.
-.RS
-.PP
-To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
-.RE
-.TP
-\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-Disables the prompt in TTY mode.
-(The prompt is only enabled in TTY mode.
-See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
-do not want a prompt or are not used to having them in bc(1).
+: Disables the read prompt in TTY mode.
+(The read prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a read prompt or are not used to having them in bc(1).
Most of those users would want to put this option in
\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
-.RS
+This option is also useful in hash bang lines of bc(1) scripts that
+prompt for user input.
+.IP
+.nf
+\f[C]
+This option does not disable the regular prompt because the read prompt is
+only used when the **read()** built-in function is called.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
+.PP
+: This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-s\f[R], \f[B]--standard\f[R]
-Process exactly the language defined by the
+.PP
+: Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Print the version information (copyright header) and exit.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-w\f[R], \f[B]--warn\f[R]
-Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
+.PP
+: Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]BC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -318,7 +341,7 @@ Identifiers with more than one character (letter) are a
.PP
\f[B]ibase\f[R] is a global variable determining how to interpret
constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
@@ -330,7 +353,7 @@ The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
programs with the \f[B]maxibase()\f[R] built-in function.
.PP
\f[B]obase\f[R] is a global variable determining how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
@@ -502,7 +525,7 @@ This is a \f[B]non-portable extension\f[R].
.IP "15." 4
\f[B]irand(E)\f[R]: A pseudo-random integer between \f[B]0\f[R]
(inclusive) and the value of \f[B]E\f[R] (exclusive).
-If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[cq]s
+If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[aq]s
\f[I]scale\f[R] is not \f[B]0\f[R]), an error is raised, and bc(1)
resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R] remains
unchanged.
@@ -580,301 +603,377 @@ extension\f[R].
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-Type: Prefix and Postfix
-.RS
.PP
+: Type: Prefix and Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **increment**, **decrement**
+\f[R]
+.fi
.PP
-Description: \f[B]increment\f[R], \f[B]decrement\f[R]
-.RE
-.TP
\f[B]-\f[R] \f[B]!\f[R]
-Type: Prefix
-.RS
.PP
+: Type: Prefix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **negation**, **boolean not**
+\f[R]
+.fi
.PP
-Description: \f[B]negation\f[R], \f[B]boolean not\f[R]
-.RE
-.TP
\f[B]$\f[R]
-Type: Postfix
-.RS
.PP
+: Type: Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **truncation**
+\f[R]
+.fi
.PP
-Description: \f[B]truncation\f[R]
-.RE
-.TP
\f[B]\[at]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **set precision**
+\f[R]
+.fi
.PP
-Description: \f[B]set precision\f[R]
-.RE
-.TP
\f[B]\[ha]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **power**
+\f[R]
+.fi
.PP
-Description: \f[B]power\f[R]
-.RE
-.TP
\f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **multiply**, **divide**, **modulus**
+\f[R]
+.fi
.PP
-Description: \f[B]multiply\f[R], \f[B]divide\f[R], \f[B]modulus\f[R]
-.RE
-.TP
\f[B]+\f[R] \f[B]-\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **add**, **subtract**
+\f[R]
+.fi
.PP
-Description: \f[B]add\f[R], \f[B]subtract\f[R]
-.RE
-.TP
\f[B]<<\f[R] \f[B]>>\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **shift left**, **shift right**
+\f[R]
+.fi
.PP
-Description: \f[B]shift left\f[R], \f[B]shift right\f[R]
-.RE
-.TP
-\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
-Type: Binary
-.RS
+\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R]
+\f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **assignment**
+\f[R]
+.fi
.PP
-Description: \f[B]assignment\f[R]
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-Type: Binary
-.RS
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **relational**
+\f[R]
+.fi
.PP
-Description: \f[B]relational\f[R]
-.RE
-.TP
\f[B]&&\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **boolean and**
+\f[R]
+.fi
.PP
-Description: \f[B]boolean and\f[R]
-.RE
-.TP
\f[B]||\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
-.PP
-Description: \f[B]boolean or\f[R]
-.RE
+
+Description: **boolean or**
+\f[R]
+.fi
.PP
The operators will be described in more detail below.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
+.PP
+: The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
subsection) as an operand.
-.RS
+.IP
+.nf
+\f[C]
+The prefix versions of these operators are more efficient; use them where
+possible.
+\f[R]
+.fi
.PP
-The prefix versions of these operators are more efficient; use them
-where possible.
-.RE
-.TP
\f[B]-\f[R]
-The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
+.PP
+: The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
to negate any expression with the value \f[B]0\f[R].
Otherwise, a copy of the expression with its sign flipped is returned.
-.TP
+.PP
\f[B]!\f[R]
-The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the expression
-is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the
+expression is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]$\f[R]
-The \f[B]truncation\f[R] operator returns a copy of the given expression
-with all of its \f[I]scale\f[R] removed.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]truncation\f[R] operator returns a copy of the given
+expression with all of its \f[I]scale\f[R] removed.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]\[at]\f[R]
-The \f[B]set precision\f[R] operator takes two expressions and returns a
-copy of the first with its \f[I]scale\f[R] equal to the value of the
+.PP
+: The \f[B]set precision\f[R] operator takes two expressions and returns
+a copy of the first with its \f[I]scale\f[R] equal to the value of the
second expression.
That could either mean that the number is returned without change (if
the \f[I]scale\f[R] of the first expression matches the value of the
second expression), extended (if it is less), or truncated (if it is
more).
-.RS
-.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
+.PP
+: The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
as it would be in C) takes two expressions and raises the first to the
power of the value of the second.
The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*), and if it is
+negative, the first value must be non-zero.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]), and if it
-is negative, the first value must be non-zero.
-.RE
-.TP
\f[B]*\f[R]
-The \f[B]multiply\f[R] operator takes two expressions, multiplies them,
-and returns the product.
+.PP
+: The \f[B]multiply\f[R] operator takes two expressions, multiplies
+them, and returns the product.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The \f[B]divide\f[R] operator takes two expressions, divides them, and
+.PP
+: The \f[B]divide\f[R] operator takes two expressions, divides them, and
returns the quotient.
The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]%\f[R]
-The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
\f[B]scale\f[R] and 2) Using the result of step 1 to calculate
\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
\f[B]max(scale+scale(b),scale(a))\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]+\f[R]
-The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]-\f[R]
-The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]<<\f[R]
-The \f[B]left shift\f[R] operator takes two expressions, \f[B]a\f[R] and
-\f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
-decimal point moved \f[B]b\f[R] places to the right.
-.RS
.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+: The \f[B]left shift\f[R] operator takes two expressions, \f[B]a\f[R]
+and \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
+decimal point moved \f[B]b\f[R] places to the right.
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]>>\f[R]
-The \f[B]right shift\f[R] operator takes two expressions, \f[B]a\f[R]
+.PP
+: The \f[B]right shift\f[R] operator takes two expressions, \f[B]a\f[R]
and \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
decimal point moved \f[B]b\f[R] places to the left.
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R]
+\f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
-The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R] and
-\f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the \f[I]Named
-Expressions\f[R] subsection).
-.RS
-.PP
-For \f[B]=\f[R], \f[B]b\f[R] is copied and the result is assigned to
-\f[B]a\f[R].
-For all others, \f[B]a\f[R] and \f[B]b\f[R] are applied as operands to
-the corresponding arithmetic operator and the result is assigned to
-\f[B]a\f[R].
-.PP
-The \f[B]assignment\f[R] operators that correspond to operators that are
-extensions are themselves \f[B]non-portable extensions\f[R].
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-The \f[B]relational\f[R] operators compare two expressions, \f[B]a\f[R]
-and \f[B]b\f[R], and if the relation holds, according to C language
-semantics, the result is \f[B]1\f[R].
-Otherwise, it is \f[B]0\f[R].
-.RS
+: The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R]
+and \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the
+\f[I]Named Expressions\f[R] subsection).
+.IP
+.nf
+\f[C]
+For **=**, **b** is copied and the result is assigned to **a**. For all
+others, **a** and **b** are applied as operands to the corresponding
+arithmetic operator and the result is assigned to **a**.
+
+The **assignment** operators that correspond to operators that are
+extensions are themselves **non-portable extensions**.
+\f[R]
+.fi
+.PP
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: The \f[B]relational\f[R] operators compare two expressions,
+\f[B]a\f[R] and \f[B]b\f[R], and if the relation holds, according to C
+language semantics, the result is \f[B]1\f[R].
+Otherwise, it is \f[B]0\f[R].
+.IP
+.nf
+\f[C]
Note that unlike in C, these operators have a lower precedence than the
-\f[B]assignment\f[R] operators, which means that \f[B]a=b>c\f[R] is
-interpreted as \f[B](a=b)>c\f[R].
+**assignment** operators, which means that **a=b\[rs]>c** is interpreted as
+**(a=b)\[rs]>c**.
+
+Also, unlike the [standard][1] requires, these operators can appear anywhere
+any other expressions can be used. This allowance is a
+**non-portable extension**.
+\f[R]
+.fi
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-requires, these operators can appear anywhere any other expressions can
-be used.
-This allowance is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]&&\f[R]
-The \f[B]boolean and\f[R] operator takes two expressions and returns
-\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
-.RS
.PP
-This is \f[I]not\f[R] a short-circuit operator.
+: The \f[B]boolean and\f[R] operator takes two expressions and returns
+\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]||\f[R]
-The \f[B]boolean or\f[R] operator takes two expressions and returns
+.PP
+: The \f[B]boolean or\f[R] operator takes two expressions and returns
\f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
otherwise.
-.RS
-.PP
-This is \f[I]not\f[R] a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Statements
.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
.IP " 2." 4
-\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] \&... \f[B];\f[R] \f[B]S\f[R]
-\f[B]}\f[R]
+\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] ...
+\f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
.IP " 3." 4
\f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
.IP " 4." 4
@@ -900,7 +999,8 @@ An empty statement
.IP "13." 4
A string of characters, enclosed in double quotes
.IP "14." 4
-\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] \&... \f[B],\f[R] \f[B]E\f[R]
+\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] ...
+\f[B],\f[R] \f[B]E\f[R]
.IP "15." 4
\f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
\f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
@@ -958,62 +1058,22 @@ Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
.SS Print Statement
.PP
-The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
+The \[dq]expressions\[dq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
specially.
What those sequences are, and what they cause to be printed, are shown
below:
.PP
-.TS
-tab(@);
-l l.
-T{
-\f[B]\[rs]a\f[R]
-T}@T{
-\f[B]\[rs]a\f[R]
-T}
-T{
-\f[B]\[rs]b\f[R]
-T}@T{
-\f[B]\[rs]b\f[R]
-T}
-T{
-\f[B]\[rs]\[rs]\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]e\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]f\f[R]
-T}@T{
-\f[B]\[rs]f\f[R]
-T}
-T{
-\f[B]\[rs]n\f[R]
-T}@T{
-\f[B]\[rs]n\f[R]
-T}
-T{
-\f[B]\[rs]q\f[R]
-T}@T{
-\f[B]\[dq]\f[R]
-T}
-T{
-\f[B]\[rs]r\f[R]
-T}@T{
-\f[B]\[rs]r\f[R]
-T}
-T{
-\f[B]\[rs]t\f[R]
-T}@T{
-\f[B]\[rs]t\f[R]
-T}
-.TE
+ * * * * *
+.PP
+\f[B]\[rs]a\f[R] \f[B]\[rs]a\f[R] \f[B]\[rs]b\f[R] \f[B]\[rs]b\f[R]
+\f[B]\[rs]\[rs]\f[R] \f[B]\[rs]\f[R] \f[B]\[rs]e\f[R] \f[B]\[rs]\f[R]
+\f[B]\[rs]f\f[R] \f[B]\[rs]f\f[R] \f[B]\[rs]n\f[R] \f[B]\[rs]n\f[R]
+\f[B]\[rs]q\f[R] \f[B]\[dq]\f[R] \f[B]\[rs]r\f[R] \f[B]\[rs]r\f[R]
+\f[B]\[rs]t\f[R] \f[B]\[rs]t\f[R]
+.PP
+ * * * * *
.PP
Any other character following a backslash causes the backslash and
character to be printed as-is.
@@ -1109,9 +1169,9 @@ Void functions can only use the first two \f[B]return\f[R] statements
listed above.
They can also omit the return statement entirely.
.PP
-The word \[lq]void\[rq] is not treated as a keyword; it is still
+The word \[dq]void\[dq] is not treated as a keyword; it is still
possible to have variables, arrays, and functions named \f[B]void\f[R].
-The word \[lq]void\[rq] is only treated specially right after the
+The word \[dq]void\[dq] is only treated specially right after the
\f[B]define\f[R] keyword.
.PP
This is a \f[B]non-portable extension\f[R].
@@ -1146,55 +1206,74 @@ are given.
The
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
-.TP
+.PP
\f[B]s(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]c(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l(x)\f[R]
-Returns the natural logarithm of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the natural logarithm of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]e(x)\f[R]
-Returns the mathematical constant \f[B]e\f[R] raised to the power of
+.PP
+: Returns the mathematical constant \f[B]e\f[R] raised to the power of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]j(x, n)\f[R]
-Returns the bessel integer order \f[B]n\f[R] (truncated) of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
+: Returns the bessel integer order \f[B]n\f[R] (truncated) of
+\f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
@@ -1203,99 +1282,126 @@ options are given since they are not part of the library defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
The extended library is a \f[B]non-portable extension\f[R].
-.TP
+.PP
\f[B]p(x, y)\f[R]
-Calculates \f[B]x\f[R] to the power of \f[B]y\f[R], even if \f[B]y\f[R]
-is not an integer, and returns the result to the current
-\f[B]scale\f[R].
-.RS
.PP
-It is an error if \f[B]y\f[R] is negative and \f[B]x\f[R] is
-\f[B]0\f[R].
+: Calculates \f[B]x\f[R] to the power of \f[B]y\f[R], even if
+\f[B]y\f[R] is not an integer, and returns the result to the current
+\f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+It is an error if **y** is negative and **x** is **0**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]r(x, p)\f[R]
-Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
+.PP
+: Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
the rounding mode round half away from
\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
-.TP
+.PP
\f[B]ceil(x, p)\f[R]
-Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
+.PP
+: Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
the rounding mode round away from
\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero).
-.TP
+.PP
\f[B]f(x)\f[R]
-Returns the factorial of the truncated absolute value of \f[B]x\f[R].
-.TP
+.PP
+: Returns the factorial of the truncated absolute value of \f[B]x\f[R].
+.PP
\f[B]perm(n, k)\f[R]
-Returns the permutation of the truncated absolute value of \f[B]n\f[R]
+.PP
+: Returns the permutation of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
If not, it returns \f[B]0\f[R].
-.TP
+.PP
\f[B]comb(n, k)\f[R]
-Returns the combination of the truncated absolute value of \f[B]n\f[R]
+.PP
+: Returns the combination of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
If not, it returns \f[B]0\f[R].
-.TP
+.PP
\f[B]l2(x)\f[R]
-Returns the logarithm base \f[B]2\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]2\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l10(x)\f[R]
-Returns the logarithm base \f[B]10\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]10\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]log(x, b)\f[R]
-Returns the logarithm base \f[B]b\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]b\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]cbrt(x)\f[R]
-Returns the cube root of \f[B]x\f[R].
-.TP
+.PP
+: Returns the cube root of \f[B]x\f[R].
+.PP
\f[B]root(x, n)\f[R]
-Calculates the truncated value of \f[B]n\f[R], \f[B]r\f[R], and returns
-the \f[B]r\f[R]th root of \f[B]x\f[R] to the current \f[B]scale\f[R].
-.RS
-.PP
-If \f[B]r\f[R] is \f[B]0\f[R] or negative, this raises an error and
-causes bc(1) to reset (see the \f[B]RESET\f[R] section).
-It also raises an error and causes bc(1) to reset if \f[B]r\f[R] is even
-and \f[B]x\f[R] is negative.
-.RE
-.TP
+.PP
+: Calculates the truncated value of \f[B]n\f[R], \f[B]r\f[R], and
+returns the \f[B]r\f[R]th root of \f[B]x\f[R] to the current
+\f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+If **r** is **0** or negative, this raises an error and causes bc(1) to
+reset (see the **RESET** section). It also raises an error and causes bc(1)
+to reset if **r** is even and **x** is negative.
+\f[R]
+.fi
+.PP
\f[B]pi(p)\f[R]
-Returns \f[B]pi\f[R] to \f[B]p\f[R] decimal places.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns \f[B]pi\f[R] to \f[B]p\f[R] decimal places.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]t(x)\f[R]
-Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a2(y, x)\f[R]
-Returns the arctangent of \f[B]y/x\f[R], in radians.
+.PP
+: Returns the arctangent of \f[B]y/x\f[R], in radians.
If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
@@ -1308,60 +1414,75 @@ If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
\f[B]0\f[R], it returns \f[B]pi/2\f[R].
If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
\f[B]0\f[R], it returns \f[B]-pi/2\f[R].
-.RS
-.PP
-This function is the same as the \f[B]atan2()\f[R] function in many
-programming languages.
+.IP
+.nf
+\f[C]
+This function is the same as the **atan2()** function in many programming
+languages.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]sin(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is an alias of \f[B]s(x)\f[R].
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **s(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]cos(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is an alias of \f[B]c(x)\f[R].
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **c(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]tan(x)\f[R]
-Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-If \f[B]x\f[R] is equal to \f[B]1\f[R] or \f[B]-1\f[R], this raises an
-error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
-.PP
-This is an alias of \f[B]t(x)\f[R].
+: Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+If **x** is equal to **1** or **-1**, this raises an error and causes bc(1)
+to reset (see the **RESET** section).
+
+This is an alias of **t(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]atan(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is an alias of \f[B]a(x)\f[R].
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **a(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]atan2(y, x)\f[R]
-Returns the arctangent of \f[B]y/x\f[R], in radians.
+.PP
+: Returns the arctangent of \f[B]y/x\f[R], in radians.
If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
@@ -1374,302 +1495,367 @@ If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
\f[B]0\f[R], it returns \f[B]pi/2\f[R].
If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
\f[B]0\f[R], it returns \f[B]-pi/2\f[R].
-.RS
-.PP
-This function is the same as the \f[B]atan2()\f[R] function in many
-programming languages.
-.PP
-This is an alias of \f[B]a2(y, x)\f[R].
+.IP
+.nf
+\f[C]
+This function is the same as the **atan2()** function in many programming
+languages.
+
+This is an alias of **a2(y, x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]r2d(x)\f[R]
-Converts \f[B]x\f[R] from radians to degrees and returns the result.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Converts \f[B]x\f[R] from radians to degrees and returns the result.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]d2r(x)\f[R]
-Converts \f[B]x\f[R] from degrees to radians and returns the result.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Converts \f[B]x\f[R] from degrees to radians and returns the result.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]frand(p)\f[R]
-Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
+.PP
+: Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
\f[B]1\f[R] (exclusive) with the number of decimal digits after the
decimal point equal to the truncated absolute value of \f[B]p\f[R].
If \f[B]p\f[R] is not \f[B]0\f[R], then calling this function will
change the value of \f[B]seed\f[R].
If \f[B]p\f[R] is \f[B]0\f[R], then \f[B]0\f[R] is returned, and
\f[B]seed\f[R] is \f[I]not\f[R] changed.
-.TP
+.PP
\f[B]ifrand(i, p)\f[R]
-Generates a pseudo-random number that is between \f[B]0\f[R] (inclusive)
-and the truncated absolute value of \f[B]i\f[R] (exclusive) with the
-number of decimal digits after the decimal point equal to the truncated
-absolute value of \f[B]p\f[R].
+.PP
+: Generates a pseudo-random number that is between \f[B]0\f[R]
+(inclusive) and the truncated absolute value of \f[B]i\f[R] (exclusive)
+with the number of decimal digits after the decimal point equal to the
+truncated absolute value of \f[B]p\f[R].
If the absolute value of \f[B]i\f[R] is greater than or equal to
\f[B]2\f[R], and \f[B]p\f[R] is not \f[B]0\f[R], then calling this
function will change the value of \f[B]seed\f[R]; otherwise, \f[B]0\f[R]
is returned and \f[B]seed\f[R] is not changed.
-.TP
+.PP
\f[B]srand(x)\f[R]
-Returns \f[B]x\f[R] with its sign flipped with probability
+.PP
+: Returns \f[B]x\f[R] with its sign flipped with probability
\f[B]0.5\f[R].
In other words, it randomizes the sign of \f[B]x\f[R].
-.TP
+.PP
\f[B]brand()\f[R]
-Returns a random boolean value (either \f[B]0\f[R] or \f[B]1\f[R]).
-.TP
+.PP
+: Returns a random boolean value (either \f[B]0\f[R] or \f[B]1\f[R]).
+.PP
\f[B]ubytes(x)\f[R]
-Returns the numbers of unsigned integer bytes required to hold the
+.PP
+: Returns the numbers of unsigned integer bytes required to hold the
truncated absolute value of \f[B]x\f[R].
-.TP
+.PP
\f[B]sbytes(x)\f[R]
-Returns the numbers of signed, two\[cq]s-complement integer bytes
+.PP
+: Returns the numbers of signed, two\[aq]s-complement integer bytes
required to hold the truncated value of \f[B]x\f[R].
-.TP
+.PP
\f[B]hex(x)\f[R]
-Outputs the hexadecimal (base \f[B]16\f[R]) representation of
+.PP
+: Outputs the hexadecimal (base \f[B]16\f[R]) representation of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]binary(x)\f[R]
-Outputs the binary (base \f[B]2\f[R]) representation of \f[B]x\f[R].
-.RS
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
+: Outputs the binary (base \f[B]2\f[R]) representation of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
+.PP
\f[B]output(x, b)\f[R]
-Outputs the base \f[B]b\f[R] representation of \f[B]x\f[R].
-.RS
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
+: Outputs the base \f[B]b\f[R] representation of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
+.PP
\f[B]uint(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in as few power of two bytes as possible.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or is negative, an error message is
-printed instead, but bc(1) is not reset (see the \f[B]RESET\f[R]
-section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in as few power of two bytes as possible.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or is negative, an error message is printed
+instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in as few power of two bytes as
-possible.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, an error message is printed instead,
-but bc(1) is not reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in as few power of two bytes
+as possible.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, an error message is printed instead, but bc(1)
+is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uintn(x, n)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]n\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]n\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]n\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **n** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]intn(x, n)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]n\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]n\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]n\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **n** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint8(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]1\f[R] byte.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]1\f[R] byte, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]1\f[R] byte.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **1** byte, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int8(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]1\f[R] byte.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]1\f[R] byte, an
-error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]1\f[R] byte.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **1** byte, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint16(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]2\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]2\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]2\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **2** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int16(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]2\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]2\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]2\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **2** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint32(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]4\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]4\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]4\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **4** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int32(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]4\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]4\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]4\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **4** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint64(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]8\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]8\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]8\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **8** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int64(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]8\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]8\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]8\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **8** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]hex_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in hexadecimal using \f[B]n\f[R]
bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]binary_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in binary using \f[B]n\f[R] bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]output_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in the current \f[B]obase\f[R] (see
the \f[B]SYNTAX\f[R] section) using \f[B]n\f[R] bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]output_byte(x, i)\f[R]
-Outputs byte \f[B]i\f[R] of the truncated absolute value of \f[B]x\f[R],
-where \f[B]0\f[R] is the least significant byte and \f[B]number_of_bytes
-- 1\f[R] is the most significant byte.
-.RS
-.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
+.PP
+: Outputs byte \f[B]i\f[R] of the truncated absolute value of
+\f[B]x\f[R], where \f[B]0\f[R] is the least significant byte and
+\f[B]number_of_bytes - 1\f[R] is the most significant byte.
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.SS Transcendental Functions
.PP
All transcendental functions can return slightly inaccurate results (up
@@ -1773,64 +1959,77 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on bc(1):
-.TP
+.PP
\f[B]BC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
bc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]BC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]BC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]BC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]BC_BASE_POW\f[R].
-.TP
+.PP
\f[B]BC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_RAND_MAX\f[R]
-The maximum integer (inclusive) returned by the \f[B]rand()\f[R]
+.PP
+: The maximum integer (inclusive) returned by the \f[B]rand()\f[R]
operand.
Set at \f[B]2\[ha]BC_LONG_BIT-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]BC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
The actual values can be queried with the \f[B]limits\f[R] statement.
@@ -1842,42 +2041,44 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
bc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]POSIXLY_CORRECT\f[R]
-If this variable exists (no matter the contents), bc(1) behaves as if
+.PP
+: If this variable exists (no matter the contents), bc(1) behaves as if
the \f[B]-s\f[R] option was given.
-.TP
+.PP
\f[B]BC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to bc(1).
+.PP
+: This is another way to give command-line arguments to bc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time bc(1) runs.
-.RS
-.PP
-The code that parses \f[B]BC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some bc file.bc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]bc\[dq] file.bc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]BC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **BC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some bc file.bc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]bc\[rs]\[dq] file.bc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]bc\[aq] file.bc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **BC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]BC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
including the backslash (\f[B]\[rs]\f[R]).
@@ -1885,68 +2086,76 @@ The default line length is \f[B]70\f[R].
.SH EXIT STATUS
.PP
bc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, using a negative number as a bound for the
-pseudo-random number generator, attempting to convert a negative number
-to a hardware integer, overflow when converting a number to a hardware
-integer, and attempting to use a non-integer where an integer is
-required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
-(\f[B]<<\f[R]), and right shift (\f[B]>>\f[R]) operators and their
-corresponding assignment operators.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, using a negative number as a bound for the pseudo-random number
+generator, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**), places (**\[rs]\[at]**), left shift (**\[rs]<\[rs]<**), and right shift (**\[rs]>\[rs]>**)
+operators and their corresponding assignment operators.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, using a token
-where it is invalid, giving an invalid expression, giving an invalid
-print statement, giving an invalid function definition, attempting to
-assign to an expression that is not a named expression (see the
-\f[I]Named Expressions\f[R] subsection of the \f[B]SYNTAX\f[R] section),
-giving an invalid \f[B]auto\f[R] list, having a duplicate
-\f[B]auto\f[R]/function parameter, failing to find the end of a code
-block, attempting to return a value from a \f[B]void\f[R] function,
-attempting to use a variable as a reference, and using any extensions
-when the option \f[B]-s\f[R] or any equivalents were given.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, using a token where it is invalid,
+giving an invalid expression, giving an invalid print statement, giving an
+invalid function definition, attempting to assign to an expression that is
+not a named expression (see the *Named Expressions* subsection of the
+**SYNTAX** section), giving an invalid **auto** list, having a duplicate
+**auto**/function parameter, failing to find the end of a code block,
+attempting to return a value from a **void** function, attempting to use a
+variable as a reference, and using any extensions when the option **-s** or
+any equivalents were given.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, passing the wrong number of
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, passing the wrong number of
arguments to functions, attempting to call an undefined function, and
-attempting to use a \f[B]void\f[R] function call as a value in an
-expression.
-.RE
-.TP
+attempting to use a **void** function call as a value in an expression.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (bc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (bc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
@@ -1976,7 +2185,7 @@ In interactive mode, bc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, bc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, bc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is required for history to be enabled (see the \f[B]COMMAND
LINE HISTORY\f[R] section).
@@ -1998,7 +2207,7 @@ If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If bc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If bc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/bc/N.1.md b/contrib/bc/manuals/bc/N.1.md
index 5c877ef79823..1bb215640871 100644
--- a/contrib/bc/manuals/bc/N.1.md
+++ b/contrib/bc/manuals/bc/N.1.md
@@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -143,13 +143,27 @@ The following are the options that bc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in bc(1). Most of those users
would want to put this option in **BC_ENV_ARGS** (see the
**ENVIRONMENT VARIABLES** section).
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in bc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of bc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **read()** built-in function is called.
+
+ This is a **non-portable extension**.
+
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
diff --git a/contrib/bc/manuals/bc/NP.1 b/contrib/bc/manuals/bc/NP.1
index 149037fd9705..339ab9e214d9 100644
--- a/contrib/bc/manuals/bc/NP.1
+++ b/contrib/bc/manuals/bc/NP.1
@@ -25,19 +25,19 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+\f[B]bc\f[R] [\f[B]-ghilPqRsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
-[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
-[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
+[\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
@@ -58,205 +58,219 @@ implementations.
.SH OPTIONS
.PP
The following are the options that bc(1) accepts.
-.TP
+.PP
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
-Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
-\f[B]seed\f[R] into stacks.
-.RS
.PP
-This has the effect that a copy of the current value of all four are
-pushed onto a stack for every function call, as well as popped when
-every function returns.
-This means that functions can assign to any and all of those globals
-without worrying that the change will affect other functions.
-Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply
-printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this:
+: Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R],
+and \f[B]seed\f[R] into stacks.
.IP
.nf
\f[C]
-define void output(x, b) {
- obase=b
- x
-}
+This has the effect that a copy of the current value of all four are pushed
+onto a stack for every function call, as well as popped when every function
+returns. This means that functions can assign to any and all of those
+globals without worrying that the change will affect other functions.
+Thus, a hypothetical function named **output(x,b)** that simply printed
+**x** in base **b** could be written like this:
+
+ define void output(x, b) {
+ obase=b
+ x
+ }
+
+instead of like this:
+
+ define void output(x, b) {
+ auto c
+ c=obase
+ obase=b
+ x
+ obase=c
+ }
+
+This makes writing functions much easier.
+
+(**Note**: the function **output(x,b)** exists in the extended math library.
+ See the **LIBRARY** section.)
+
+However, since using this flag means that functions cannot set **ibase**,
+**obase**, **scale**, or **seed** globally, functions that are made to do so
+cannot work anymore. There are two possible use cases for that, and each has
+a solution.
+
+First, if a function is called on startup to turn bc(1) into a number
+converter, it is possible to replace that capability with various shell
+aliases. Examples:
+
+ alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
+ alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
+
+Second, if the purpose of a function is to set **ibase**, **obase**,
+**scale**, or **seed** globally for any other purpose, it could be split
+into one to four functions (based on how many globals it sets) and each of
+those functions could return the desired value for a global.
+
+For functions that set **seed**, the value assigned to **seed** is not
+propagated to parent functions. This means that the sequence of
+pseudo-random numbers that they see will not be the same sequence of
+pseudo-random numbers that any parent sees. This is only the case once
+**seed** has been set.
+
+If a function desires to not affect the sequence of pseudo-random numbers
+of its parents, but wants to use the same **seed**, it can use the following
+line:
+
+ seed = seed
+
+If the behavior of this option is desired for every run of bc(1), then users
+could make sure to define **BC_ENV_ARGS** and include this option (see the
+**ENVIRONMENT VARIABLES** section for more details).
+
+If **-s**, **-w**, or any equivalents are used, this option is ignored.
+
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-instead of like this:
+\f[B]-h\f[R], \f[B]--help\f[R]
+.PP
+: Prints a usage message and quits.
+.PP
+\f[B]-i\f[R], \f[B]--interactive\f[R]
+.PP
+: Forces interactive mode.
+(See the \f[B]INTERACTIVE MODE\f[R] section.)
.IP
.nf
\f[C]
-define void output(x, b) {
- auto c
- c=obase
- obase=b
- x
- obase=c
-}
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-This makes writing functions much easier.
-.PP
-(\f[B]Note\f[R]: the function \f[B]output(x,b)\f[R] exists in the
-extended math library.
-See the \f[B]LIBRARY\f[R] section.)
-.PP
-However, since using this flag means that functions cannot set
-\f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R]
-globally, functions that are made to do so cannot work anymore.
-There are two possible use cases for that, and each has a solution.
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
.PP
-First, if a function is called on startup to turn bc(1) into a number
-converter, it is possible to replace that capability with various shell
-aliases.
-Examples:
+: Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to
+\f[B]20\f[R] and loads the included math library and the extended math
+library before running any code, including any expressions or files
+specified on the command line.
.IP
.nf
\f[C]
-alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
-alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
+To learn what is in the libraries, see the **LIBRARY** section.
\f[R]
.fi
.PP
-Second, if the purpose of a function is to set \f[B]ibase\f[R],
-\f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R] globally for any
-other purpose, it could be split into one to four functions (based on
-how many globals it sets) and each of those functions could return the
-desired value for a global.
-.PP
-For functions that set \f[B]seed\f[R], the value assigned to
-\f[B]seed\f[R] is not propagated to parent functions.
-This means that the sequence of pseudo-random numbers that they see will
-not be the same sequence of pseudo-random numbers that any parent sees.
-This is only the case once \f[B]seed\f[R] has been set.
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
.PP
-If a function desires to not affect the sequence of pseudo-random
-numbers of its parents, but wants to use the same \f[B]seed\f[R], it can
-use the following line:
+: This option is a no-op.
.IP
.nf
\f[C]
-seed = seed
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-If the behavior of this option is desired for every run of bc(1), then
-users could make sure to define \f[B]BC_ENV_ARGS\f[R] and include this
-option (see the \f[B]ENVIRONMENT VARIABLES\f[R] section for more
-details).
-.PP
-If \f[B]-s\f[R], \f[B]-w\f[R], or any equivalents are used, this option
-is ignored.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
-\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
-(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]-l\f[R], \f[B]--mathlib\f[R]
-Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
-and loads the included math library and the extended math library before
-running any code, including any expressions or files specified on the
-command line.
-.RS
-.PP
-To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
-.RE
-.TP
-\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-This option is a no-op.
-.RS
+: Because bc(1) was built without support for prompts, this option is a
+no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
+.PP
+: This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-s\f[R], \f[B]--standard\f[R]
-Process exactly the language defined by the
+.PP
+: Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Print the version information (copyright header) and exit.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-w\f[R], \f[B]--warn\f[R]
-Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
+.PP
+: Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]BC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -313,7 +327,7 @@ Identifiers with more than one character (letter) are a
.PP
\f[B]ibase\f[R] is a global variable determining how to interpret
constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
@@ -325,7 +339,7 @@ The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
programs with the \f[B]maxibase()\f[R] built-in function.
.PP
\f[B]obase\f[R] is a global variable determining how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
@@ -497,7 +511,7 @@ This is a \f[B]non-portable extension\f[R].
.IP "15." 4
\f[B]irand(E)\f[R]: A pseudo-random integer between \f[B]0\f[R]
(inclusive) and the value of \f[B]E\f[R] (exclusive).
-If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[cq]s
+If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[aq]s
\f[I]scale\f[R] is not \f[B]0\f[R]), an error is raised, and bc(1)
resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R] remains
unchanged.
@@ -575,301 +589,377 @@ extension\f[R].
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-Type: Prefix and Postfix
-.RS
.PP
+: Type: Prefix and Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **increment**, **decrement**
+\f[R]
+.fi
.PP
-Description: \f[B]increment\f[R], \f[B]decrement\f[R]
-.RE
-.TP
\f[B]-\f[R] \f[B]!\f[R]
-Type: Prefix
-.RS
.PP
+: Type: Prefix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **negation**, **boolean not**
+\f[R]
+.fi
.PP
-Description: \f[B]negation\f[R], \f[B]boolean not\f[R]
-.RE
-.TP
\f[B]$\f[R]
-Type: Postfix
-.RS
.PP
+: Type: Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **truncation**
+\f[R]
+.fi
.PP
-Description: \f[B]truncation\f[R]
-.RE
-.TP
\f[B]\[at]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **set precision**
+\f[R]
+.fi
.PP
-Description: \f[B]set precision\f[R]
-.RE
-.TP
\f[B]\[ha]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **power**
+\f[R]
+.fi
.PP
-Description: \f[B]power\f[R]
-.RE
-.TP
\f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **multiply**, **divide**, **modulus**
+\f[R]
+.fi
.PP
-Description: \f[B]multiply\f[R], \f[B]divide\f[R], \f[B]modulus\f[R]
-.RE
-.TP
\f[B]+\f[R] \f[B]-\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **add**, **subtract**
+\f[R]
+.fi
.PP
-Description: \f[B]add\f[R], \f[B]subtract\f[R]
-.RE
-.TP
\f[B]<<\f[R] \f[B]>>\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **shift left**, **shift right**
+\f[R]
+.fi
.PP
-Description: \f[B]shift left\f[R], \f[B]shift right\f[R]
-.RE
-.TP
-\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
-Type: Binary
-.RS
+\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R]
+\f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **assignment**
+\f[R]
+.fi
.PP
-Description: \f[B]assignment\f[R]
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-Type: Binary
-.RS
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **relational**
+\f[R]
+.fi
.PP
-Description: \f[B]relational\f[R]
-.RE
-.TP
\f[B]&&\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **boolean and**
+\f[R]
+.fi
.PP
-Description: \f[B]boolean and\f[R]
-.RE
-.TP
\f[B]||\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
-.PP
-Description: \f[B]boolean or\f[R]
-.RE
+
+Description: **boolean or**
+\f[R]
+.fi
.PP
The operators will be described in more detail below.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
+.PP
+: The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
subsection) as an operand.
-.RS
+.IP
+.nf
+\f[C]
+The prefix versions of these operators are more efficient; use them where
+possible.
+\f[R]
+.fi
.PP
-The prefix versions of these operators are more efficient; use them
-where possible.
-.RE
-.TP
\f[B]-\f[R]
-The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
+.PP
+: The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
to negate any expression with the value \f[B]0\f[R].
Otherwise, a copy of the expression with its sign flipped is returned.
-.TP
+.PP
\f[B]!\f[R]
-The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the expression
-is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the
+expression is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]$\f[R]
-The \f[B]truncation\f[R] operator returns a copy of the given expression
-with all of its \f[I]scale\f[R] removed.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]truncation\f[R] operator returns a copy of the given
+expression with all of its \f[I]scale\f[R] removed.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]\[at]\f[R]
-The \f[B]set precision\f[R] operator takes two expressions and returns a
-copy of the first with its \f[I]scale\f[R] equal to the value of the
+.PP
+: The \f[B]set precision\f[R] operator takes two expressions and returns
+a copy of the first with its \f[I]scale\f[R] equal to the value of the
second expression.
That could either mean that the number is returned without change (if
the \f[I]scale\f[R] of the first expression matches the value of the
second expression), extended (if it is less), or truncated (if it is
more).
-.RS
-.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
+.PP
+: The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
as it would be in C) takes two expressions and raises the first to the
power of the value of the second.
The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*), and if it is
+negative, the first value must be non-zero.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]), and if it
-is negative, the first value must be non-zero.
-.RE
-.TP
\f[B]*\f[R]
-The \f[B]multiply\f[R] operator takes two expressions, multiplies them,
-and returns the product.
+.PP
+: The \f[B]multiply\f[R] operator takes two expressions, multiplies
+them, and returns the product.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The \f[B]divide\f[R] operator takes two expressions, divides them, and
+.PP
+: The \f[B]divide\f[R] operator takes two expressions, divides them, and
returns the quotient.
The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]%\f[R]
-The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
\f[B]scale\f[R] and 2) Using the result of step 1 to calculate
\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
\f[B]max(scale+scale(b),scale(a))\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]+\f[R]
-The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]-\f[R]
-The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]<<\f[R]
-The \f[B]left shift\f[R] operator takes two expressions, \f[B]a\f[R] and
-\f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
-decimal point moved \f[B]b\f[R] places to the right.
-.RS
.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+: The \f[B]left shift\f[R] operator takes two expressions, \f[B]a\f[R]
+and \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
+decimal point moved \f[B]b\f[R] places to the right.
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]>>\f[R]
-The \f[B]right shift\f[R] operator takes two expressions, \f[B]a\f[R]
+.PP
+: The \f[B]right shift\f[R] operator takes two expressions, \f[B]a\f[R]
and \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
decimal point moved \f[B]b\f[R] places to the left.
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R]
+\f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
-The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R] and
-\f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the \f[I]Named
-Expressions\f[R] subsection).
-.RS
-.PP
-For \f[B]=\f[R], \f[B]b\f[R] is copied and the result is assigned to
-\f[B]a\f[R].
-For all others, \f[B]a\f[R] and \f[B]b\f[R] are applied as operands to
-the corresponding arithmetic operator and the result is assigned to
-\f[B]a\f[R].
-.PP
-The \f[B]assignment\f[R] operators that correspond to operators that are
-extensions are themselves \f[B]non-portable extensions\f[R].
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-The \f[B]relational\f[R] operators compare two expressions, \f[B]a\f[R]
-and \f[B]b\f[R], and if the relation holds, according to C language
-semantics, the result is \f[B]1\f[R].
-Otherwise, it is \f[B]0\f[R].
-.RS
+: The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R]
+and \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the
+\f[I]Named Expressions\f[R] subsection).
+.IP
+.nf
+\f[C]
+For **=**, **b** is copied and the result is assigned to **a**. For all
+others, **a** and **b** are applied as operands to the corresponding
+arithmetic operator and the result is assigned to **a**.
+
+The **assignment** operators that correspond to operators that are
+extensions are themselves **non-portable extensions**.
+\f[R]
+.fi
+.PP
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: The \f[B]relational\f[R] operators compare two expressions,
+\f[B]a\f[R] and \f[B]b\f[R], and if the relation holds, according to C
+language semantics, the result is \f[B]1\f[R].
+Otherwise, it is \f[B]0\f[R].
+.IP
+.nf
+\f[C]
Note that unlike in C, these operators have a lower precedence than the
-\f[B]assignment\f[R] operators, which means that \f[B]a=b>c\f[R] is
-interpreted as \f[B](a=b)>c\f[R].
+**assignment** operators, which means that **a=b\[rs]>c** is interpreted as
+**(a=b)\[rs]>c**.
+
+Also, unlike the [standard][1] requires, these operators can appear anywhere
+any other expressions can be used. This allowance is a
+**non-portable extension**.
+\f[R]
+.fi
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-requires, these operators can appear anywhere any other expressions can
-be used.
-This allowance is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]&&\f[R]
-The \f[B]boolean and\f[R] operator takes two expressions and returns
-\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
-.RS
.PP
-This is \f[I]not\f[R] a short-circuit operator.
+: The \f[B]boolean and\f[R] operator takes two expressions and returns
+\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]||\f[R]
-The \f[B]boolean or\f[R] operator takes two expressions and returns
+.PP
+: The \f[B]boolean or\f[R] operator takes two expressions and returns
\f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
otherwise.
-.RS
-.PP
-This is \f[I]not\f[R] a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Statements
.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
.IP " 2." 4
-\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] \&... \f[B];\f[R] \f[B]S\f[R]
-\f[B]}\f[R]
+\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] ...
+\f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
.IP " 3." 4
\f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
.IP " 4." 4
@@ -895,7 +985,8 @@ An empty statement
.IP "13." 4
A string of characters, enclosed in double quotes
.IP "14." 4
-\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] \&... \f[B],\f[R] \f[B]E\f[R]
+\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] ...
+\f[B],\f[R] \f[B]E\f[R]
.IP "15." 4
\f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
\f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
@@ -953,62 +1044,22 @@ Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
.SS Print Statement
.PP
-The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
+The \[dq]expressions\[dq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
specially.
What those sequences are, and what they cause to be printed, are shown
below:
.PP
-.TS
-tab(@);
-l l.
-T{
-\f[B]\[rs]a\f[R]
-T}@T{
-\f[B]\[rs]a\f[R]
-T}
-T{
-\f[B]\[rs]b\f[R]
-T}@T{
-\f[B]\[rs]b\f[R]
-T}
-T{
-\f[B]\[rs]\[rs]\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]e\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]f\f[R]
-T}@T{
-\f[B]\[rs]f\f[R]
-T}
-T{
-\f[B]\[rs]n\f[R]
-T}@T{
-\f[B]\[rs]n\f[R]
-T}
-T{
-\f[B]\[rs]q\f[R]
-T}@T{
-\f[B]\[dq]\f[R]
-T}
-T{
-\f[B]\[rs]r\f[R]
-T}@T{
-\f[B]\[rs]r\f[R]
-T}
-T{
-\f[B]\[rs]t\f[R]
-T}@T{
-\f[B]\[rs]t\f[R]
-T}
-.TE
+ * * * * *
+.PP
+\f[B]\[rs]a\f[R] \f[B]\[rs]a\f[R] \f[B]\[rs]b\f[R] \f[B]\[rs]b\f[R]
+\f[B]\[rs]\[rs]\f[R] \f[B]\[rs]\f[R] \f[B]\[rs]e\f[R] \f[B]\[rs]\f[R]
+\f[B]\[rs]f\f[R] \f[B]\[rs]f\f[R] \f[B]\[rs]n\f[R] \f[B]\[rs]n\f[R]
+\f[B]\[rs]q\f[R] \f[B]\[dq]\f[R] \f[B]\[rs]r\f[R] \f[B]\[rs]r\f[R]
+\f[B]\[rs]t\f[R] \f[B]\[rs]t\f[R]
+.PP
+ * * * * *
.PP
Any other character following a backslash causes the backslash and
character to be printed as-is.
@@ -1104,9 +1155,9 @@ Void functions can only use the first two \f[B]return\f[R] statements
listed above.
They can also omit the return statement entirely.
.PP
-The word \[lq]void\[rq] is not treated as a keyword; it is still
+The word \[dq]void\[dq] is not treated as a keyword; it is still
possible to have variables, arrays, and functions named \f[B]void\f[R].
-The word \[lq]void\[rq] is only treated specially right after the
+The word \[dq]void\[dq] is only treated specially right after the
\f[B]define\f[R] keyword.
.PP
This is a \f[B]non-portable extension\f[R].
@@ -1141,55 +1192,74 @@ are given.
The
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
-.TP
+.PP
\f[B]s(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]c(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l(x)\f[R]
-Returns the natural logarithm of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the natural logarithm of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]e(x)\f[R]
-Returns the mathematical constant \f[B]e\f[R] raised to the power of
+.PP
+: Returns the mathematical constant \f[B]e\f[R] raised to the power of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]j(x, n)\f[R]
-Returns the bessel integer order \f[B]n\f[R] (truncated) of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
+: Returns the bessel integer order \f[B]n\f[R] (truncated) of
+\f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
@@ -1198,99 +1268,126 @@ options are given since they are not part of the library defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
The extended library is a \f[B]non-portable extension\f[R].
-.TP
+.PP
\f[B]p(x, y)\f[R]
-Calculates \f[B]x\f[R] to the power of \f[B]y\f[R], even if \f[B]y\f[R]
-is not an integer, and returns the result to the current
-\f[B]scale\f[R].
-.RS
.PP
-It is an error if \f[B]y\f[R] is negative and \f[B]x\f[R] is
-\f[B]0\f[R].
+: Calculates \f[B]x\f[R] to the power of \f[B]y\f[R], even if
+\f[B]y\f[R] is not an integer, and returns the result to the current
+\f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+It is an error if **y** is negative and **x** is **0**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]r(x, p)\f[R]
-Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
+.PP
+: Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
the rounding mode round half away from
\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
-.TP
+.PP
\f[B]ceil(x, p)\f[R]
-Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
+.PP
+: Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
the rounding mode round away from
\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero).
-.TP
+.PP
\f[B]f(x)\f[R]
-Returns the factorial of the truncated absolute value of \f[B]x\f[R].
-.TP
+.PP
+: Returns the factorial of the truncated absolute value of \f[B]x\f[R].
+.PP
\f[B]perm(n, k)\f[R]
-Returns the permutation of the truncated absolute value of \f[B]n\f[R]
+.PP
+: Returns the permutation of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
If not, it returns \f[B]0\f[R].
-.TP
+.PP
\f[B]comb(n, k)\f[R]
-Returns the combination of the truncated absolute value of \f[B]n\f[R]
+.PP
+: Returns the combination of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
If not, it returns \f[B]0\f[R].
-.TP
+.PP
\f[B]l2(x)\f[R]
-Returns the logarithm base \f[B]2\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]2\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l10(x)\f[R]
-Returns the logarithm base \f[B]10\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]10\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]log(x, b)\f[R]
-Returns the logarithm base \f[B]b\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]b\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]cbrt(x)\f[R]
-Returns the cube root of \f[B]x\f[R].
-.TP
+.PP
+: Returns the cube root of \f[B]x\f[R].
+.PP
\f[B]root(x, n)\f[R]
-Calculates the truncated value of \f[B]n\f[R], \f[B]r\f[R], and returns
-the \f[B]r\f[R]th root of \f[B]x\f[R] to the current \f[B]scale\f[R].
-.RS
-.PP
-If \f[B]r\f[R] is \f[B]0\f[R] or negative, this raises an error and
-causes bc(1) to reset (see the \f[B]RESET\f[R] section).
-It also raises an error and causes bc(1) to reset if \f[B]r\f[R] is even
-and \f[B]x\f[R] is negative.
-.RE
-.TP
+.PP
+: Calculates the truncated value of \f[B]n\f[R], \f[B]r\f[R], and
+returns the \f[B]r\f[R]th root of \f[B]x\f[R] to the current
+\f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+If **r** is **0** or negative, this raises an error and causes bc(1) to
+reset (see the **RESET** section). It also raises an error and causes bc(1)
+to reset if **r** is even and **x** is negative.
+\f[R]
+.fi
+.PP
\f[B]pi(p)\f[R]
-Returns \f[B]pi\f[R] to \f[B]p\f[R] decimal places.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns \f[B]pi\f[R] to \f[B]p\f[R] decimal places.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]t(x)\f[R]
-Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a2(y, x)\f[R]
-Returns the arctangent of \f[B]y/x\f[R], in radians.
+.PP
+: Returns the arctangent of \f[B]y/x\f[R], in radians.
If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
@@ -1303,60 +1400,75 @@ If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
\f[B]0\f[R], it returns \f[B]pi/2\f[R].
If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
\f[B]0\f[R], it returns \f[B]-pi/2\f[R].
-.RS
-.PP
-This function is the same as the \f[B]atan2()\f[R] function in many
-programming languages.
+.IP
+.nf
+\f[C]
+This function is the same as the **atan2()** function in many programming
+languages.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]sin(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is an alias of \f[B]s(x)\f[R].
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **s(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]cos(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is an alias of \f[B]c(x)\f[R].
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **c(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]tan(x)\f[R]
-Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-If \f[B]x\f[R] is equal to \f[B]1\f[R] or \f[B]-1\f[R], this raises an
-error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
-.PP
-This is an alias of \f[B]t(x)\f[R].
+: Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+If **x** is equal to **1** or **-1**, this raises an error and causes bc(1)
+to reset (see the **RESET** section).
+
+This is an alias of **t(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]atan(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is an alias of \f[B]a(x)\f[R].
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **a(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]atan2(y, x)\f[R]
-Returns the arctangent of \f[B]y/x\f[R], in radians.
+.PP
+: Returns the arctangent of \f[B]y/x\f[R], in radians.
If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
@@ -1369,302 +1481,367 @@ If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
\f[B]0\f[R], it returns \f[B]pi/2\f[R].
If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
\f[B]0\f[R], it returns \f[B]-pi/2\f[R].
-.RS
-.PP
-This function is the same as the \f[B]atan2()\f[R] function in many
-programming languages.
-.PP
-This is an alias of \f[B]a2(y, x)\f[R].
+.IP
+.nf
+\f[C]
+This function is the same as the **atan2()** function in many programming
+languages.
+
+This is an alias of **a2(y, x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]r2d(x)\f[R]
-Converts \f[B]x\f[R] from radians to degrees and returns the result.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Converts \f[B]x\f[R] from radians to degrees and returns the result.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]d2r(x)\f[R]
-Converts \f[B]x\f[R] from degrees to radians and returns the result.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Converts \f[B]x\f[R] from degrees to radians and returns the result.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]frand(p)\f[R]
-Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
+.PP
+: Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
\f[B]1\f[R] (exclusive) with the number of decimal digits after the
decimal point equal to the truncated absolute value of \f[B]p\f[R].
If \f[B]p\f[R] is not \f[B]0\f[R], then calling this function will
change the value of \f[B]seed\f[R].
If \f[B]p\f[R] is \f[B]0\f[R], then \f[B]0\f[R] is returned, and
\f[B]seed\f[R] is \f[I]not\f[R] changed.
-.TP
+.PP
\f[B]ifrand(i, p)\f[R]
-Generates a pseudo-random number that is between \f[B]0\f[R] (inclusive)
-and the truncated absolute value of \f[B]i\f[R] (exclusive) with the
-number of decimal digits after the decimal point equal to the truncated
-absolute value of \f[B]p\f[R].
+.PP
+: Generates a pseudo-random number that is between \f[B]0\f[R]
+(inclusive) and the truncated absolute value of \f[B]i\f[R] (exclusive)
+with the number of decimal digits after the decimal point equal to the
+truncated absolute value of \f[B]p\f[R].
If the absolute value of \f[B]i\f[R] is greater than or equal to
\f[B]2\f[R], and \f[B]p\f[R] is not \f[B]0\f[R], then calling this
function will change the value of \f[B]seed\f[R]; otherwise, \f[B]0\f[R]
is returned and \f[B]seed\f[R] is not changed.
-.TP
+.PP
\f[B]srand(x)\f[R]
-Returns \f[B]x\f[R] with its sign flipped with probability
+.PP
+: Returns \f[B]x\f[R] with its sign flipped with probability
\f[B]0.5\f[R].
In other words, it randomizes the sign of \f[B]x\f[R].
-.TP
+.PP
\f[B]brand()\f[R]
-Returns a random boolean value (either \f[B]0\f[R] or \f[B]1\f[R]).
-.TP
+.PP
+: Returns a random boolean value (either \f[B]0\f[R] or \f[B]1\f[R]).
+.PP
\f[B]ubytes(x)\f[R]
-Returns the numbers of unsigned integer bytes required to hold the
+.PP
+: Returns the numbers of unsigned integer bytes required to hold the
truncated absolute value of \f[B]x\f[R].
-.TP
+.PP
\f[B]sbytes(x)\f[R]
-Returns the numbers of signed, two\[cq]s-complement integer bytes
+.PP
+: Returns the numbers of signed, two\[aq]s-complement integer bytes
required to hold the truncated value of \f[B]x\f[R].
-.TP
+.PP
\f[B]hex(x)\f[R]
-Outputs the hexadecimal (base \f[B]16\f[R]) representation of
+.PP
+: Outputs the hexadecimal (base \f[B]16\f[R]) representation of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]binary(x)\f[R]
-Outputs the binary (base \f[B]2\f[R]) representation of \f[B]x\f[R].
-.RS
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
+: Outputs the binary (base \f[B]2\f[R]) representation of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
+.PP
\f[B]output(x, b)\f[R]
-Outputs the base \f[B]b\f[R] representation of \f[B]x\f[R].
-.RS
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
+: Outputs the base \f[B]b\f[R] representation of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
+.PP
\f[B]uint(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in as few power of two bytes as possible.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or is negative, an error message is
-printed instead, but bc(1) is not reset (see the \f[B]RESET\f[R]
-section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in as few power of two bytes as possible.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or is negative, an error message is printed
+instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in as few power of two bytes as
-possible.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, an error message is printed instead,
-but bc(1) is not reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in as few power of two bytes
+as possible.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, an error message is printed instead, but bc(1)
+is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uintn(x, n)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]n\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]n\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]n\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **n** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]intn(x, n)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]n\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]n\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]n\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **n** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint8(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]1\f[R] byte.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]1\f[R] byte, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]1\f[R] byte.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **1** byte, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int8(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]1\f[R] byte.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]1\f[R] byte, an
-error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]1\f[R] byte.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **1** byte, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint16(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]2\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]2\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]2\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **2** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int16(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]2\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]2\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]2\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **2** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint32(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]4\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]4\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]4\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **4** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int32(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]4\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]4\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]4\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **4** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint64(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]8\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]8\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]8\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **8** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int64(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]8\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]8\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]8\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **8** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]hex_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in hexadecimal using \f[B]n\f[R]
bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]binary_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in binary using \f[B]n\f[R] bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]output_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in the current \f[B]obase\f[R] (see
the \f[B]SYNTAX\f[R] section) using \f[B]n\f[R] bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]output_byte(x, i)\f[R]
-Outputs byte \f[B]i\f[R] of the truncated absolute value of \f[B]x\f[R],
-where \f[B]0\f[R] is the least significant byte and \f[B]number_of_bytes
-- 1\f[R] is the most significant byte.
-.RS
-.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
+.PP
+: Outputs byte \f[B]i\f[R] of the truncated absolute value of
+\f[B]x\f[R], where \f[B]0\f[R] is the least significant byte and
+\f[B]number_of_bytes - 1\f[R] is the most significant byte.
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.SS Transcendental Functions
.PP
All transcendental functions can return slightly inaccurate results (up
@@ -1768,64 +1945,77 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on bc(1):
-.TP
+.PP
\f[B]BC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
bc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]BC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]BC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]BC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]BC_BASE_POW\f[R].
-.TP
+.PP
\f[B]BC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_RAND_MAX\f[R]
-The maximum integer (inclusive) returned by the \f[B]rand()\f[R]
+.PP
+: The maximum integer (inclusive) returned by the \f[B]rand()\f[R]
operand.
Set at \f[B]2\[ha]BC_LONG_BIT-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]BC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
The actual values can be queried with the \f[B]limits\f[R] statement.
@@ -1837,42 +2027,44 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
bc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]POSIXLY_CORRECT\f[R]
-If this variable exists (no matter the contents), bc(1) behaves as if
+.PP
+: If this variable exists (no matter the contents), bc(1) behaves as if
the \f[B]-s\f[R] option was given.
-.TP
+.PP
\f[B]BC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to bc(1).
+.PP
+: This is another way to give command-line arguments to bc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time bc(1) runs.
-.RS
-.PP
-The code that parses \f[B]BC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some bc file.bc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]bc\[dq] file.bc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]BC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **BC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some bc file.bc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]bc\[rs]\[dq] file.bc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]bc\[aq] file.bc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **BC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]BC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
including the backslash (\f[B]\[rs]\f[R]).
@@ -1880,68 +2072,76 @@ The default line length is \f[B]70\f[R].
.SH EXIT STATUS
.PP
bc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, using a negative number as a bound for the
-pseudo-random number generator, attempting to convert a negative number
-to a hardware integer, overflow when converting a number to a hardware
-integer, and attempting to use a non-integer where an integer is
-required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
-(\f[B]<<\f[R]), and right shift (\f[B]>>\f[R]) operators and their
-corresponding assignment operators.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, using a negative number as a bound for the pseudo-random number
+generator, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**), places (**\[rs]\[at]**), left shift (**\[rs]<\[rs]<**), and right shift (**\[rs]>\[rs]>**)
+operators and their corresponding assignment operators.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, using a token
-where it is invalid, giving an invalid expression, giving an invalid
-print statement, giving an invalid function definition, attempting to
-assign to an expression that is not a named expression (see the
-\f[I]Named Expressions\f[R] subsection of the \f[B]SYNTAX\f[R] section),
-giving an invalid \f[B]auto\f[R] list, having a duplicate
-\f[B]auto\f[R]/function parameter, failing to find the end of a code
-block, attempting to return a value from a \f[B]void\f[R] function,
-attempting to use a variable as a reference, and using any extensions
-when the option \f[B]-s\f[R] or any equivalents were given.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, using a token where it is invalid,
+giving an invalid expression, giving an invalid print statement, giving an
+invalid function definition, attempting to assign to an expression that is
+not a named expression (see the *Named Expressions* subsection of the
+**SYNTAX** section), giving an invalid **auto** list, having a duplicate
+**auto**/function parameter, failing to find the end of a code block,
+attempting to return a value from a **void** function, attempting to use a
+variable as a reference, and using any extensions when the option **-s** or
+any equivalents were given.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, passing the wrong number of
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, passing the wrong number of
arguments to functions, attempting to call an undefined function, and
-attempting to use a \f[B]void\f[R] function call as a value in an
-expression.
-.RE
-.TP
+attempting to use a **void** function call as a value in an expression.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (bc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (bc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
@@ -1971,7 +2171,7 @@ In interactive mode, bc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, bc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, bc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is required for history to be enabled (see the \f[B]COMMAND
LINE HISTORY\f[R] section).
@@ -1991,7 +2191,7 @@ If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If bc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If bc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/bc/NP.1.md b/contrib/bc/manuals/bc/NP.1.md
index 518d237020df..c8ae18b194bf 100644
--- a/contrib/bc/manuals/bc/NP.1.md
+++ b/contrib/bc/manuals/bc/NP.1.md
@@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -146,6 +146,12 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Because bc(1) was built without support for prompts, this option is a no-op.
+
+ This is a **non-portable extension**.
+
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
diff --git a/contrib/bc/manuals/bc/P.1 b/contrib/bc/manuals/bc/P.1
index cfe4afe1fdf3..ed539824b385 100644
--- a/contrib/bc/manuals/bc/P.1
+++ b/contrib/bc/manuals/bc/P.1
@@ -25,19 +25,19 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
.SH SYNOPSIS
.PP
-\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
+\f[B]bc\f[R] [\f[B]-ghilPqRsvVw\f[R]] [\f[B]--global-stacks\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
-[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
-[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
+[\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
@@ -58,205 +58,219 @@ implementations.
.SH OPTIONS
.PP
The following are the options that bc(1) accepts.
-.TP
+.PP
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
-Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
-\f[B]seed\f[R] into stacks.
-.RS
.PP
-This has the effect that a copy of the current value of all four are
-pushed onto a stack for every function call, as well as popped when
-every function returns.
-This means that functions can assign to any and all of those globals
-without worrying that the change will affect other functions.
-Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply
-printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this:
+: Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R],
+and \f[B]seed\f[R] into stacks.
.IP
.nf
\f[C]
-define void output(x, b) {
- obase=b
- x
-}
+This has the effect that a copy of the current value of all four are pushed
+onto a stack for every function call, as well as popped when every function
+returns. This means that functions can assign to any and all of those
+globals without worrying that the change will affect other functions.
+Thus, a hypothetical function named **output(x,b)** that simply printed
+**x** in base **b** could be written like this:
+
+ define void output(x, b) {
+ obase=b
+ x
+ }
+
+instead of like this:
+
+ define void output(x, b) {
+ auto c
+ c=obase
+ obase=b
+ x
+ obase=c
+ }
+
+This makes writing functions much easier.
+
+(**Note**: the function **output(x,b)** exists in the extended math library.
+ See the **LIBRARY** section.)
+
+However, since using this flag means that functions cannot set **ibase**,
+**obase**, **scale**, or **seed** globally, functions that are made to do so
+cannot work anymore. There are two possible use cases for that, and each has
+a solution.
+
+First, if a function is called on startup to turn bc(1) into a number
+converter, it is possible to replace that capability with various shell
+aliases. Examples:
+
+ alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
+ alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
+
+Second, if the purpose of a function is to set **ibase**, **obase**,
+**scale**, or **seed** globally for any other purpose, it could be split
+into one to four functions (based on how many globals it sets) and each of
+those functions could return the desired value for a global.
+
+For functions that set **seed**, the value assigned to **seed** is not
+propagated to parent functions. This means that the sequence of
+pseudo-random numbers that they see will not be the same sequence of
+pseudo-random numbers that any parent sees. This is only the case once
+**seed** has been set.
+
+If a function desires to not affect the sequence of pseudo-random numbers
+of its parents, but wants to use the same **seed**, it can use the following
+line:
+
+ seed = seed
+
+If the behavior of this option is desired for every run of bc(1), then users
+could make sure to define **BC_ENV_ARGS** and include this option (see the
+**ENVIRONMENT VARIABLES** section for more details).
+
+If **-s**, **-w**, or any equivalents are used, this option is ignored.
+
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-instead of like this:
+\f[B]-h\f[R], \f[B]--help\f[R]
+.PP
+: Prints a usage message and quits.
+.PP
+\f[B]-i\f[R], \f[B]--interactive\f[R]
+.PP
+: Forces interactive mode.
+(See the \f[B]INTERACTIVE MODE\f[R] section.)
.IP
.nf
\f[C]
-define void output(x, b) {
- auto c
- c=obase
- obase=b
- x
- obase=c
-}
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-This makes writing functions much easier.
-.PP
-(\f[B]Note\f[R]: the function \f[B]output(x,b)\f[R] exists in the
-extended math library.
-See the \f[B]LIBRARY\f[R] section.)
-.PP
-However, since using this flag means that functions cannot set
-\f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R]
-globally, functions that are made to do so cannot work anymore.
-There are two possible use cases for that, and each has a solution.
+\f[B]-l\f[R], \f[B]--mathlib\f[R]
.PP
-First, if a function is called on startup to turn bc(1) into a number
-converter, it is possible to replace that capability with various shell
-aliases.
-Examples:
+: Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to
+\f[B]20\f[R] and loads the included math library and the extended math
+library before running any code, including any expressions or files
+specified on the command line.
.IP
.nf
\f[C]
-alias d2o=\[dq]bc -e ibase=A -e obase=8\[dq]
-alias h2b=\[dq]bc -e ibase=G -e obase=2\[dq]
+To learn what is in the libraries, see the **LIBRARY** section.
\f[R]
.fi
.PP
-Second, if the purpose of a function is to set \f[B]ibase\f[R],
-\f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R] globally for any
-other purpose, it could be split into one to four functions (based on
-how many globals it sets) and each of those functions could return the
-desired value for a global.
-.PP
-For functions that set \f[B]seed\f[R], the value assigned to
-\f[B]seed\f[R] is not propagated to parent functions.
-This means that the sequence of pseudo-random numbers that they see will
-not be the same sequence of pseudo-random numbers that any parent sees.
-This is only the case once \f[B]seed\f[R] has been set.
+\f[B]-P\f[R], \f[B]--no-prompt\f[R]
.PP
-If a function desires to not affect the sequence of pseudo-random
-numbers of its parents, but wants to use the same \f[B]seed\f[R], it can
-use the following line:
+: This option is a no-op.
.IP
.nf
\f[C]
-seed = seed
+This is a **non-portable extension**.
\f[R]
.fi
.PP
-If the behavior of this option is desired for every run of bc(1), then
-users could make sure to define \f[B]BC_ENV_ARGS\f[R] and include this
-option (see the \f[B]ENVIRONMENT VARIABLES\f[R] section for more
-details).
-.PP
-If \f[B]-s\f[R], \f[B]-w\f[R], or any equivalents are used, this option
-is ignored.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
-\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
-(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]-l\f[R], \f[B]--mathlib\f[R]
-Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
-and loads the included math library and the extended math library before
-running any code, including any expressions or files specified on the
-command line.
-.RS
-.PP
-To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
-.RE
-.TP
-\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-This option is a no-op.
-.RS
+: Because bc(1) was built without support for prompts, this option is a
+no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
+.PP
+: This option is for compatibility with the GNU
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
Without this option, GNU bc(1) prints a copyright header.
This bc(1) only prints the copyright header if one or more of the
\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-s\f[R], \f[B]--standard\f[R]
-Process exactly the language defined by the
+.PP
+: Process exactly the language defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
and error if any extensions are used.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Print the version information (copyright header) and exit.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-w\f[R], \f[B]--warn\f[R]
-Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
+.PP
+: Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
not errors) are printed for non-standard extensions and execution
continues normally.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]BC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, bc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -313,7 +327,7 @@ Identifiers with more than one character (letter) are a
.PP
\f[B]ibase\f[R] is a global variable determining how to interpret
constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
@@ -325,7 +339,7 @@ The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
programs with the \f[B]maxibase()\f[R] built-in function.
.PP
\f[B]obase\f[R] is a global variable determining how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
@@ -497,7 +511,7 @@ This is a \f[B]non-portable extension\f[R].
.IP "15." 4
\f[B]irand(E)\f[R]: A pseudo-random integer between \f[B]0\f[R]
(inclusive) and the value of \f[B]E\f[R] (exclusive).
-If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[cq]s
+If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[aq]s
\f[I]scale\f[R] is not \f[B]0\f[R]), an error is raised, and bc(1)
resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R] remains
unchanged.
@@ -575,301 +589,377 @@ extension\f[R].
The following arithmetic and logical operators can be used.
They are listed in order of decreasing precedence.
Operators in the same group have the same precedence.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-Type: Prefix and Postfix
-.RS
.PP
+: Type: Prefix and Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **increment**, **decrement**
+\f[R]
+.fi
.PP
-Description: \f[B]increment\f[R], \f[B]decrement\f[R]
-.RE
-.TP
\f[B]-\f[R] \f[B]!\f[R]
-Type: Prefix
-.RS
.PP
+: Type: Prefix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **negation**, **boolean not**
+\f[R]
+.fi
.PP
-Description: \f[B]negation\f[R], \f[B]boolean not\f[R]
-.RE
-.TP
\f[B]$\f[R]
-Type: Postfix
-.RS
.PP
+: Type: Postfix
+.IP
+.nf
+\f[C]
Associativity: None
+
+Description: **truncation**
+\f[R]
+.fi
.PP
-Description: \f[B]truncation\f[R]
-.RE
-.TP
\f[B]\[at]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **set precision**
+\f[R]
+.fi
.PP
-Description: \f[B]set precision\f[R]
-.RE
-.TP
\f[B]\[ha]\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **power**
+\f[R]
+.fi
.PP
-Description: \f[B]power\f[R]
-.RE
-.TP
\f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **multiply**, **divide**, **modulus**
+\f[R]
+.fi
.PP
-Description: \f[B]multiply\f[R], \f[B]divide\f[R], \f[B]modulus\f[R]
-.RE
-.TP
\f[B]+\f[R] \f[B]-\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **add**, **subtract**
+\f[R]
+.fi
.PP
-Description: \f[B]add\f[R], \f[B]subtract\f[R]
-.RE
-.TP
\f[B]<<\f[R] \f[B]>>\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **shift left**, **shift right**
+\f[R]
+.fi
.PP
-Description: \f[B]shift left\f[R], \f[B]shift right\f[R]
-.RE
-.TP
-\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
-Type: Binary
-.RS
+\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R]
+\f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Right
+
+Description: **assignment**
+\f[R]
+.fi
.PP
-Description: \f[B]assignment\f[R]
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-Type: Binary
-.RS
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **relational**
+\f[R]
+.fi
.PP
-Description: \f[B]relational\f[R]
-.RE
-.TP
\f[B]&&\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
+
+Description: **boolean and**
+\f[R]
+.fi
.PP
-Description: \f[B]boolean and\f[R]
-.RE
-.TP
\f[B]||\f[R]
-Type: Binary
-.RS
.PP
+: Type: Binary
+.IP
+.nf
+\f[C]
Associativity: Left
-.PP
-Description: \f[B]boolean or\f[R]
-.RE
+
+Description: **boolean or**
+\f[R]
+.fi
.PP
The operators will be described in more detail below.
-.TP
+.PP
\f[B]++\f[R] \f[B]--\f[R]
-The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
+.PP
+: The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
operators behave exactly like they would in C.
They require a named expression (see the \f[I]Named Expressions\f[R]
subsection) as an operand.
-.RS
+.IP
+.nf
+\f[C]
+The prefix versions of these operators are more efficient; use them where
+possible.
+\f[R]
+.fi
.PP
-The prefix versions of these operators are more efficient; use them
-where possible.
-.RE
-.TP
\f[B]-\f[R]
-The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
+.PP
+: The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
to negate any expression with the value \f[B]0\f[R].
Otherwise, a copy of the expression with its sign flipped is returned.
-.TP
+.PP
\f[B]!\f[R]
-The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the expression
-is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the
+expression is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]$\f[R]
-The \f[B]truncation\f[R] operator returns a copy of the given expression
-with all of its \f[I]scale\f[R] removed.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The \f[B]truncation\f[R] operator returns a copy of the given
+expression with all of its \f[I]scale\f[R] removed.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]\[at]\f[R]
-The \f[B]set precision\f[R] operator takes two expressions and returns a
-copy of the first with its \f[I]scale\f[R] equal to the value of the
+.PP
+: The \f[B]set precision\f[R] operator takes two expressions and returns
+a copy of the first with its \f[I]scale\f[R] equal to the value of the
second expression.
That could either mean that the number is returned without change (if
the \f[I]scale\f[R] of the first expression matches the value of the
second expression), extended (if it is less), or truncated (if it is
more).
-.RS
-.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
+.PP
+: The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
as it would be in C) takes two expressions and raises the first to the
power of the value of the second.
The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*), and if it is
+negative, the first value must be non-zero.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]), and if it
-is negative, the first value must be non-zero.
-.RE
-.TP
\f[B]*\f[R]
-The \f[B]multiply\f[R] operator takes two expressions, multiplies them,
-and returns the product.
+.PP
+: The \f[B]multiply\f[R] operator takes two expressions, multiplies
+them, and returns the product.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The \f[B]divide\f[R] operator takes two expressions, divides them, and
+.PP
+: The \f[B]divide\f[R] operator takes two expressions, divides them, and
returns the quotient.
The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]%\f[R]
-The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
\f[B]scale\f[R] and 2) Using the result of step 1 to calculate
\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
\f[B]max(scale+scale(b),scale(a))\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
The second expression must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]+\f[R]
-The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]-\f[R]
-The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
+.PP
+: The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
\f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
-.TP
+.PP
\f[B]<<\f[R]
-The \f[B]left shift\f[R] operator takes two expressions, \f[B]a\f[R] and
-\f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
-decimal point moved \f[B]b\f[R] places to the right.
-.RS
.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+: The \f[B]left shift\f[R] operator takes two expressions, \f[B]a\f[R]
+and \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
+decimal point moved \f[B]b\f[R] places to the right.
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]>>\f[R]
-The \f[B]right shift\f[R] operator takes two expressions, \f[B]a\f[R]
+.PP
+: The \f[B]right shift\f[R] operator takes two expressions, \f[B]a\f[R]
and \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
decimal point moved \f[B]b\f[R] places to the left.
-.RS
+.IP
+.nf
+\f[C]
+The second expression must be an integer (no *scale*) and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The second expression must be an integer (no \f[I]scale\f[R]) and
-non-negative.
+\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R]
+\f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
-The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R] and
-\f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the \f[I]Named
-Expressions\f[R] subsection).
-.RS
-.PP
-For \f[B]=\f[R], \f[B]b\f[R] is copied and the result is assigned to
-\f[B]a\f[R].
-For all others, \f[B]a\f[R] and \f[B]b\f[R] are applied as operands to
-the corresponding arithmetic operator and the result is assigned to
-\f[B]a\f[R].
-.PP
-The \f[B]assignment\f[R] operators that correspond to operators that are
-extensions are themselves \f[B]non-portable extensions\f[R].
-.RE
-.TP
-\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
-The \f[B]relational\f[R] operators compare two expressions, \f[B]a\f[R]
-and \f[B]b\f[R], and if the relation holds, according to C language
-semantics, the result is \f[B]1\f[R].
-Otherwise, it is \f[B]0\f[R].
-.RS
+: The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R]
+and \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the
+\f[I]Named Expressions\f[R] subsection).
+.IP
+.nf
+\f[C]
+For **=**, **b** is copied and the result is assigned to **a**. For all
+others, **a** and **b** are applied as operands to the corresponding
+arithmetic operator and the result is assigned to **a**.
+
+The **assignment** operators that correspond to operators that are
+extensions are themselves **non-portable extensions**.
+\f[R]
+.fi
+.PP
+\f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R]
+\f[B]>\f[R]
.PP
+: The \f[B]relational\f[R] operators compare two expressions,
+\f[B]a\f[R] and \f[B]b\f[R], and if the relation holds, according to C
+language semantics, the result is \f[B]1\f[R].
+Otherwise, it is \f[B]0\f[R].
+.IP
+.nf
+\f[C]
Note that unlike in C, these operators have a lower precedence than the
-\f[B]assignment\f[R] operators, which means that \f[B]a=b>c\f[R] is
-interpreted as \f[B](a=b)>c\f[R].
+**assignment** operators, which means that **a=b\[rs]>c** is interpreted as
+**(a=b)\[rs]>c**.
+
+Also, unlike the [standard][1] requires, these operators can appear anywhere
+any other expressions can be used. This allowance is a
+**non-portable extension**.
+\f[R]
+.fi
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-requires, these operators can appear anywhere any other expressions can
-be used.
-This allowance is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]&&\f[R]
-The \f[B]boolean and\f[R] operator takes two expressions and returns
-\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
-.RS
.PP
-This is \f[I]not\f[R] a short-circuit operator.
+: The \f[B]boolean and\f[R] operator takes two expressions and returns
+\f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]||\f[R]
-The \f[B]boolean or\f[R] operator takes two expressions and returns
+.PP
+: The \f[B]boolean or\f[R] operator takes two expressions and returns
\f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
otherwise.
-.RS
-.PP
-This is \f[I]not\f[R] a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is *not* a short-circuit operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Statements
.PP
The following items are statements:
.IP " 1." 4
\f[B]E\f[R]
.IP " 2." 4
-\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] \&... \f[B];\f[R] \f[B]S\f[R]
-\f[B]}\f[R]
+\f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] ...
+\f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
.IP " 3." 4
\f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
.IP " 4." 4
@@ -895,7 +985,8 @@ An empty statement
.IP "13." 4
A string of characters, enclosed in double quotes
.IP "14." 4
-\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] \&... \f[B],\f[R] \f[B]E\f[R]
+\f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] ...
+\f[B],\f[R] \f[B]E\f[R]
.IP "15." 4
\f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
\f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
@@ -953,62 +1044,22 @@ Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
.SS Print Statement
.PP
-The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
+The \[dq]expressions\[dq] in a \f[B]print\f[R] statement may also be
strings.
If they are, there are backslash escape sequences that are interpreted
specially.
What those sequences are, and what they cause to be printed, are shown
below:
.PP
-.TS
-tab(@);
-l l.
-T{
-\f[B]\[rs]a\f[R]
-T}@T{
-\f[B]\[rs]a\f[R]
-T}
-T{
-\f[B]\[rs]b\f[R]
-T}@T{
-\f[B]\[rs]b\f[R]
-T}
-T{
-\f[B]\[rs]\[rs]\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]e\f[R]
-T}@T{
-\f[B]\[rs]\f[R]
-T}
-T{
-\f[B]\[rs]f\f[R]
-T}@T{
-\f[B]\[rs]f\f[R]
-T}
-T{
-\f[B]\[rs]n\f[R]
-T}@T{
-\f[B]\[rs]n\f[R]
-T}
-T{
-\f[B]\[rs]q\f[R]
-T}@T{
-\f[B]\[dq]\f[R]
-T}
-T{
-\f[B]\[rs]r\f[R]
-T}@T{
-\f[B]\[rs]r\f[R]
-T}
-T{
-\f[B]\[rs]t\f[R]
-T}@T{
-\f[B]\[rs]t\f[R]
-T}
-.TE
+ * * * * *
+.PP
+\f[B]\[rs]a\f[R] \f[B]\[rs]a\f[R] \f[B]\[rs]b\f[R] \f[B]\[rs]b\f[R]
+\f[B]\[rs]\[rs]\f[R] \f[B]\[rs]\f[R] \f[B]\[rs]e\f[R] \f[B]\[rs]\f[R]
+\f[B]\[rs]f\f[R] \f[B]\[rs]f\f[R] \f[B]\[rs]n\f[R] \f[B]\[rs]n\f[R]
+\f[B]\[rs]q\f[R] \f[B]\[dq]\f[R] \f[B]\[rs]r\f[R] \f[B]\[rs]r\f[R]
+\f[B]\[rs]t\f[R] \f[B]\[rs]t\f[R]
+.PP
+ * * * * *
.PP
Any other character following a backslash causes the backslash and
character to be printed as-is.
@@ -1104,9 +1155,9 @@ Void functions can only use the first two \f[B]return\f[R] statements
listed above.
They can also omit the return statement entirely.
.PP
-The word \[lq]void\[rq] is not treated as a keyword; it is still
+The word \[dq]void\[dq] is not treated as a keyword; it is still
possible to have variables, arrays, and functions named \f[B]void\f[R].
-The word \[lq]void\[rq] is only treated specially right after the
+The word \[dq]void\[dq] is only treated specially right after the
\f[B]define\f[R] keyword.
.PP
This is a \f[B]non-portable extension\f[R].
@@ -1141,55 +1192,74 @@ are given.
The
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
-.TP
+.PP
\f[B]s(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]c(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l(x)\f[R]
-Returns the natural logarithm of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the natural logarithm of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]e(x)\f[R]
-Returns the mathematical constant \f[B]e\f[R] raised to the power of
+.PP
+: Returns the mathematical constant \f[B]e\f[R] raised to the power of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]j(x, n)\f[R]
-Returns the bessel integer order \f[B]n\f[R] (truncated) of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
+: Returns the bessel integer order \f[B]n\f[R] (truncated) of
+\f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.SS Extended Library
.PP
The extended library is \f[I]not\f[R] loaded when the
@@ -1198,99 +1268,126 @@ options are given since they are not part of the library defined by the
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
The extended library is a \f[B]non-portable extension\f[R].
-.TP
+.PP
\f[B]p(x, y)\f[R]
-Calculates \f[B]x\f[R] to the power of \f[B]y\f[R], even if \f[B]y\f[R]
-is not an integer, and returns the result to the current
-\f[B]scale\f[R].
-.RS
.PP
-It is an error if \f[B]y\f[R] is negative and \f[B]x\f[R] is
-\f[B]0\f[R].
+: Calculates \f[B]x\f[R] to the power of \f[B]y\f[R], even if
+\f[B]y\f[R] is not an integer, and returns the result to the current
+\f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+It is an error if **y** is negative and **x** is **0**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]r(x, p)\f[R]
-Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
+.PP
+: Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
the rounding mode round half away from
\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
-.TP
+.PP
\f[B]ceil(x, p)\f[R]
-Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
+.PP
+: Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
the rounding mode round away from
\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero).
-.TP
+.PP
\f[B]f(x)\f[R]
-Returns the factorial of the truncated absolute value of \f[B]x\f[R].
-.TP
+.PP
+: Returns the factorial of the truncated absolute value of \f[B]x\f[R].
+.PP
\f[B]perm(n, k)\f[R]
-Returns the permutation of the truncated absolute value of \f[B]n\f[R]
+.PP
+: Returns the permutation of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
If not, it returns \f[B]0\f[R].
-.TP
+.PP
\f[B]comb(n, k)\f[R]
-Returns the combination of the truncated absolute value of \f[B]n\f[R]
+.PP
+: Returns the combination of the truncated absolute value of \f[B]n\f[R]
of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
If not, it returns \f[B]0\f[R].
-.TP
+.PP
\f[B]l2(x)\f[R]
-Returns the logarithm base \f[B]2\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]2\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]l10(x)\f[R]
-Returns the logarithm base \f[B]10\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]10\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]log(x, b)\f[R]
-Returns the logarithm base \f[B]b\f[R] of \f[B]x\f[R].
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the logarithm base \f[B]b\f[R] of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]cbrt(x)\f[R]
-Returns the cube root of \f[B]x\f[R].
-.TP
+.PP
+: Returns the cube root of \f[B]x\f[R].
+.PP
\f[B]root(x, n)\f[R]
-Calculates the truncated value of \f[B]n\f[R], \f[B]r\f[R], and returns
-the \f[B]r\f[R]th root of \f[B]x\f[R] to the current \f[B]scale\f[R].
-.RS
-.PP
-If \f[B]r\f[R] is \f[B]0\f[R] or negative, this raises an error and
-causes bc(1) to reset (see the \f[B]RESET\f[R] section).
-It also raises an error and causes bc(1) to reset if \f[B]r\f[R] is even
-and \f[B]x\f[R] is negative.
-.RE
-.TP
+.PP
+: Calculates the truncated value of \f[B]n\f[R], \f[B]r\f[R], and
+returns the \f[B]r\f[R]th root of \f[B]x\f[R] to the current
+\f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+If **r** is **0** or negative, this raises an error and causes bc(1) to
+reset (see the **RESET** section). It also raises an error and causes bc(1)
+to reset if **r** is even and **x** is negative.
+\f[R]
+.fi
+.PP
\f[B]pi(p)\f[R]
-Returns \f[B]pi\f[R] to \f[B]p\f[R] decimal places.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns \f[B]pi\f[R] to \f[B]p\f[R] decimal places.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]t(x)\f[R]
-Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]a2(y, x)\f[R]
-Returns the arctangent of \f[B]y/x\f[R], in radians.
+.PP
+: Returns the arctangent of \f[B]y/x\f[R], in radians.
If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
@@ -1303,60 +1400,75 @@ If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
\f[B]0\f[R], it returns \f[B]pi/2\f[R].
If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
\f[B]0\f[R], it returns \f[B]-pi/2\f[R].
-.RS
-.PP
-This function is the same as the \f[B]atan2()\f[R] function in many
-programming languages.
+.IP
+.nf
+\f[C]
+This function is the same as the **atan2()** function in many programming
+languages.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]sin(x)\f[R]
-Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is an alias of \f[B]s(x)\f[R].
+: Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **s(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]cos(x)\f[R]
-Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-This is an alias of \f[B]c(x)\f[R].
+: Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **c(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]tan(x)\f[R]
-Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
-.RS
.PP
-If \f[B]x\f[R] is equal to \f[B]1\f[R] or \f[B]-1\f[R], this raises an
-error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
-.PP
-This is an alias of \f[B]t(x)\f[R].
+: Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
+.IP
+.nf
+\f[C]
+If **x** is equal to **1** or **-1**, this raises an error and causes bc(1)
+to reset (see the **RESET** section).
+
+This is an alias of **t(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]atan(x)\f[R]
-Returns the arctangent of \f[B]x\f[R], in radians.
-.RS
.PP
-This is an alias of \f[B]a(x)\f[R].
+: Returns the arctangent of \f[B]x\f[R], in radians.
+.IP
+.nf
+\f[C]
+This is an alias of **a(x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]atan2(y, x)\f[R]
-Returns the arctangent of \f[B]y/x\f[R], in radians.
+.PP
+: Returns the arctangent of \f[B]y/x\f[R], in radians.
If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
@@ -1369,302 +1481,367 @@ If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
\f[B]0\f[R], it returns \f[B]pi/2\f[R].
If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
\f[B]0\f[R], it returns \f[B]-pi/2\f[R].
-.RS
-.PP
-This function is the same as the \f[B]atan2()\f[R] function in many
-programming languages.
-.PP
-This is an alias of \f[B]a2(y, x)\f[R].
+.IP
+.nf
+\f[C]
+This function is the same as the **atan2()** function in many programming
+languages.
+
+This is an alias of **a2(y, x)**.
+
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
\f[B]r2d(x)\f[R]
-Converts \f[B]x\f[R] from radians to degrees and returns the result.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Converts \f[B]x\f[R] from radians to degrees and returns the result.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]d2r(x)\f[R]
-Converts \f[B]x\f[R] from degrees to radians and returns the result.
-.RS
.PP
-This is a transcendental function (see the \f[I]Transcendental
-Functions\f[R] subsection below).
-.RE
-.TP
+: Converts \f[B]x\f[R] from degrees to radians and returns the result.
+.IP
+.nf
+\f[C]
+This is a transcendental function (see the *Transcendental Functions*
+subsection below).
+\f[R]
+.fi
+.PP
\f[B]frand(p)\f[R]
-Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
+.PP
+: Generates a pseudo-random number between \f[B]0\f[R] (inclusive) and
\f[B]1\f[R] (exclusive) with the number of decimal digits after the
decimal point equal to the truncated absolute value of \f[B]p\f[R].
If \f[B]p\f[R] is not \f[B]0\f[R], then calling this function will
change the value of \f[B]seed\f[R].
If \f[B]p\f[R] is \f[B]0\f[R], then \f[B]0\f[R] is returned, and
\f[B]seed\f[R] is \f[I]not\f[R] changed.
-.TP
+.PP
\f[B]ifrand(i, p)\f[R]
-Generates a pseudo-random number that is between \f[B]0\f[R] (inclusive)
-and the truncated absolute value of \f[B]i\f[R] (exclusive) with the
-number of decimal digits after the decimal point equal to the truncated
-absolute value of \f[B]p\f[R].
+.PP
+: Generates a pseudo-random number that is between \f[B]0\f[R]
+(inclusive) and the truncated absolute value of \f[B]i\f[R] (exclusive)
+with the number of decimal digits after the decimal point equal to the
+truncated absolute value of \f[B]p\f[R].
If the absolute value of \f[B]i\f[R] is greater than or equal to
\f[B]2\f[R], and \f[B]p\f[R] is not \f[B]0\f[R], then calling this
function will change the value of \f[B]seed\f[R]; otherwise, \f[B]0\f[R]
is returned and \f[B]seed\f[R] is not changed.
-.TP
+.PP
\f[B]srand(x)\f[R]
-Returns \f[B]x\f[R] with its sign flipped with probability
+.PP
+: Returns \f[B]x\f[R] with its sign flipped with probability
\f[B]0.5\f[R].
In other words, it randomizes the sign of \f[B]x\f[R].
-.TP
+.PP
\f[B]brand()\f[R]
-Returns a random boolean value (either \f[B]0\f[R] or \f[B]1\f[R]).
-.TP
+.PP
+: Returns a random boolean value (either \f[B]0\f[R] or \f[B]1\f[R]).
+.PP
\f[B]ubytes(x)\f[R]
-Returns the numbers of unsigned integer bytes required to hold the
+.PP
+: Returns the numbers of unsigned integer bytes required to hold the
truncated absolute value of \f[B]x\f[R].
-.TP
+.PP
\f[B]sbytes(x)\f[R]
-Returns the numbers of signed, two\[cq]s-complement integer bytes
+.PP
+: Returns the numbers of signed, two\[aq]s-complement integer bytes
required to hold the truncated value of \f[B]x\f[R].
-.TP
+.PP
\f[B]hex(x)\f[R]
-Outputs the hexadecimal (base \f[B]16\f[R]) representation of
+.PP
+: Outputs the hexadecimal (base \f[B]16\f[R]) representation of
\f[B]x\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]binary(x)\f[R]
-Outputs the binary (base \f[B]2\f[R]) representation of \f[B]x\f[R].
-.RS
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
+: Outputs the binary (base \f[B]2\f[R]) representation of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
+.PP
\f[B]output(x, b)\f[R]
-Outputs the base \f[B]b\f[R] representation of \f[B]x\f[R].
-.RS
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
+: Outputs the base \f[B]b\f[R] representation of \f[B]x\f[R].
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
+.PP
\f[B]uint(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in as few power of two bytes as possible.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or is negative, an error message is
-printed instead, but bc(1) is not reset (see the \f[B]RESET\f[R]
-section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in as few power of two bytes as possible.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or is negative, an error message is printed
+instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in as few power of two bytes as
-possible.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, an error message is printed instead,
-but bc(1) is not reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in as few power of two bytes
+as possible.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, an error message is printed instead, but bc(1)
+is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uintn(x, n)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]n\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]n\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]n\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **n** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]intn(x, n)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]n\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]n\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]n\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **n** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint8(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]1\f[R] byte.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]1\f[R] byte, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]1\f[R] byte.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **1** byte, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int8(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]1\f[R] byte.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]1\f[R] byte, an
-error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]1\f[R] byte.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **1** byte, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint16(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]2\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]2\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]2\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **2** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int16(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]2\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]2\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]2\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **2** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint32(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]4\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]4\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]4\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **4** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int32(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]4\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]4\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]4\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **4** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]uint64(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-an unsigned integer in \f[B]8\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
-\f[B]8\f[R] bytes, an error message is printed instead, but bc(1) is not
-reset (see the \f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as an unsigned integer in \f[B]8\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer, is negative, or cannot fit into **8** bytes, an
+error message is printed instead, but bc(1) is not reset (see the **RESET**
+section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]int64(x)\f[R]
-Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
-a signed, two\[cq]s-complement integer in \f[B]8\f[R] bytes.
-Both outputs are split into bytes separated by spaces.
-.RS
.PP
-If \f[B]x\f[R] is not an integer or cannot fit into \f[B]8\f[R] bytes,
-an error message is printed instead, but bc(1) is not reset (see the
-\f[B]RESET\f[R] section).
+: Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R]
+as a signed, two\[aq]s-complement integer in \f[B]8\f[R] bytes.
+Both outputs are split into bytes separated by spaces.
+.IP
+.nf
+\f[C]
+If **x** is not an integer or cannot fit into **8** bytes, an error message
+is printed instead, but bc(1) is not reset (see the **RESET** section).
+
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]hex_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in hexadecimal using \f[B]n\f[R]
bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]binary_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in binary using \f[B]n\f[R] bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]output_uint(x, n)\f[R]
-Outputs the representation of the truncated absolute value of
+.PP
+: Outputs the representation of the truncated absolute value of
\f[B]x\f[R] as an unsigned integer in the current \f[B]obase\f[R] (see
the \f[B]SYNTAX\f[R] section) using \f[B]n\f[R] bytes.
Not all of the value will be output if \f[B]n\f[R] is too small.
-.RS
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
-.TP
\f[B]output_byte(x, i)\f[R]
-Outputs byte \f[B]i\f[R] of the truncated absolute value of \f[B]x\f[R],
-where \f[B]0\f[R] is the least significant byte and \f[B]number_of_bytes
-- 1\f[R] is the most significant byte.
-.RS
-.PP
-This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
-subsection of the \f[B]FUNCTIONS\f[R] section).
-.RE
+.PP
+: Outputs byte \f[B]i\f[R] of the truncated absolute value of
+\f[B]x\f[R], where \f[B]0\f[R] is the least significant byte and
+\f[B]number_of_bytes - 1\f[R] is the most significant byte.
+.IP
+.nf
+\f[C]
+This is a **void** function (see the *Void Functions* subsection of the
+**FUNCTIONS** section).
+\f[R]
+.fi
.SS Transcendental Functions
.PP
All transcendental functions can return slightly inaccurate results (up
@@ -1768,64 +1945,77 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on bc(1):
-.TP
+.PP
\f[B]BC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
bc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]BC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]BC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]BC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]BC_BASE_POW\f[R].
-.TP
+.PP
\f[B]BC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_RAND_MAX\f[R]
-The maximum integer (inclusive) returned by the \f[B]rand()\f[R]
+.PP
+: The maximum integer (inclusive) returned by the \f[B]rand()\f[R]
operand.
Set at \f[B]2\[ha]BC_LONG_BIT-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]BC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
The actual values can be queried with the \f[B]limits\f[R] statement.
@@ -1837,42 +2027,44 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
bc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]POSIXLY_CORRECT\f[R]
-If this variable exists (no matter the contents), bc(1) behaves as if
+.PP
+: If this variable exists (no matter the contents), bc(1) behaves as if
the \f[B]-s\f[R] option was given.
-.TP
+.PP
\f[B]BC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to bc(1).
+.PP
+: This is another way to give command-line arguments to bc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time bc(1) runs.
-.RS
-.PP
-The code that parses \f[B]BC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some bc file.bc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]bc\[dq] file.bc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `bc' file.bc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]BC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **BC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some bc file.bc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]bc\[rs]\[dq] file.bc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]bc\[aq] file.bc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **BC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]BC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
including the backslash (\f[B]\[rs]\f[R]).
@@ -1880,68 +2072,76 @@ The default line length is \f[B]70\f[R].
.SH EXIT STATUS
.PP
bc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, using a negative number as a bound for the
-pseudo-random number generator, attempting to convert a negative number
-to a hardware integer, overflow when converting a number to a hardware
-integer, and attempting to use a non-integer where an integer is
-required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
-(\f[B]<<\f[R]), and right shift (\f[B]>>\f[R]) operators and their
-corresponding assignment operators.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, using a negative number as a bound for the pseudo-random number
+generator, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**), places (**\[rs]\[at]**), left shift (**\[rs]<\[rs]<**), and right shift (**\[rs]>\[rs]>**)
+operators and their corresponding assignment operators.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, using a token
-where it is invalid, giving an invalid expression, giving an invalid
-print statement, giving an invalid function definition, attempting to
-assign to an expression that is not a named expression (see the
-\f[I]Named Expressions\f[R] subsection of the \f[B]SYNTAX\f[R] section),
-giving an invalid \f[B]auto\f[R] list, having a duplicate
-\f[B]auto\f[R]/function parameter, failing to find the end of a code
-block, attempting to return a value from a \f[B]void\f[R] function,
-attempting to use a variable as a reference, and using any extensions
-when the option \f[B]-s\f[R] or any equivalents were given.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, using a token where it is invalid,
+giving an invalid expression, giving an invalid print statement, giving an
+invalid function definition, attempting to assign to an expression that is
+not a named expression (see the *Named Expressions* subsection of the
+**SYNTAX** section), giving an invalid **auto** list, having a duplicate
+**auto**/function parameter, failing to find the end of a code block,
+attempting to return a value from a **void** function, attempting to use a
+variable as a reference, and using any extensions when the option **-s** or
+any equivalents were given.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, passing the wrong number of
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, passing the wrong number of
arguments to functions, attempting to call an undefined function, and
-attempting to use a \f[B]void\f[R] function call as a value in an
-expression.
-.RE
-.TP
+attempting to use a **void** function call as a value in an expression.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (bc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (bc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
@@ -1971,7 +2171,7 @@ In interactive mode, bc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, bc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, bc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is required for history to be enabled (see the \f[B]COMMAND
LINE HISTORY\f[R] section).
@@ -1991,7 +2191,7 @@ If bc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If bc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If bc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/bc/P.1.md b/contrib/bc/manuals/bc/P.1.md
index 489af865475c..4434f7c803a2 100644
--- a/contrib/bc/manuals/bc/P.1.md
+++ b/contrib/bc/manuals/bc/P.1.md
@@ -34,7 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**bc** [**-ghilPqRsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -146,6 +146,12 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Because bc(1) was built without support for prompts, this option is a no-op.
+
+ This is a **non-portable extension**.
+
**-q**, **-\-quiet**
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
diff --git a/contrib/bc/manuals/bcl.3 b/contrib/bc/manuals/bcl.3
index d83a2d3ad2e5..550ea118431e 100644
--- a/contrib/bc/manuals/bcl.3
+++ b/contrib/bc/manuals/bcl.3
@@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BCL" "3" "March 2021" "Gavin D. Howard" "Libraries Manual"
+.TH "BCL" "3" "April 2021" "Gavin D. Howard" "Libraries Manual"
.SH NAME
.PP
bcl - library of arbitrary precision decimal arithmetic
@@ -40,22 +40,22 @@ Link with \f[I]-lbcl\f[R].
This procedure will allow clients to use signals to interrupt
computations running in bcl(3).
.PP
-\f[B]void bcl_handleSignal(\f[R]\f[I]void\f[R]\f[B]);\f[R]
+\f[B]void bcl_handleSignal(\f[BI]\f[I]void\f[BI]\f[B]);\f[R]
.PP
-\f[B]bool bcl_running(\f[R]\f[I]void\f[R]\f[B]);\f[R]
+\f[B]bool bcl_running(\f[BI]\f[I]void\f[BI]\f[B]);\f[R]
.SS Setup
.PP
These items allow clients to set up bcl(3).
.PP
-\f[B]BclError bcl_init(\f[R]\f[I]void\f[R]\f[B]);\f[R]
+\f[B]BclError bcl_init(\f[BI]\f[I]void\f[BI]\f[B]);\f[R]
.PP
-\f[B]void bcl_free(\f[R]\f[I]void\f[R]\f[B]);\f[R]
+\f[B]void bcl_free(\f[BI]\f[I]void\f[BI]\f[B]);\f[R]
.PP
-\f[B]bool bcl_abortOnFatalError(\f[R]\f[I]void\f[R]\f[B]);\f[R]
+\f[B]bool bcl_abortOnFatalError(\f[BI]\f[I]void\f[BI]\f[B]);\f[R]
.PP
-\f[B]void bcl_setAbortOnFatalError(bool\f[R] \f[I]abrt\f[R]\f[B]);\f[R]
+\f[B]void bcl_setAbortOnFatalError(bool\f[R] \f[I]abrt\f[R]**);**
.PP
-\f[B]void bcl_gc(\f[R]\f[I]void\f[R]\f[B]);\f[R]
+\f[B]void bcl_gc(\f[BI]\f[I]void\f[BI]\f[B]);\f[R]
.SS Contexts
.PP
These items will allow clients to handle contexts, which are isolated
@@ -66,39 +66,39 @@ This allows more than one client to use bcl(3) in the same program.
.PP
\f[B]typedef struct BclCtxt* BclContext;\f[R]
.PP
-\f[B]BclContext bcl_ctxt_create(\f[R]\f[I]void\f[R]\f[B]);\f[R]
+\f[B]BclContext bcl_ctxt_create(\f[BI]\f[I]void\f[BI]\f[B]);\f[R]
.PP
-\f[B]void bcl_ctxt_free(BclContext\f[R] \f[I]ctxt\f[R]\f[B]);\f[R]
+\f[B]void bcl_ctxt_free(BclContext\f[R] \f[I]ctxt\f[R]**);**
.PP
-\f[B]BclError bcl_pushContext(BclContext\f[R] \f[I]ctxt\f[R]\f[B]);\f[R]
+\f[B]BclError bcl_pushContext(BclContext\f[R] \f[I]ctxt\f[R]**);**
.PP
-\f[B]void bcl_popContext(\f[R]\f[I]void\f[R]\f[B]);\f[R]
+\f[B]void bcl_popContext(\f[BI]\f[I]void\f[BI]\f[B]);\f[R]
.PP
-\f[B]BclContext bcl_context(\f[R]\f[I]void\f[R]\f[B]);\f[R]
+\f[B]BclContext bcl_context(\f[BI]\f[I]void\f[BI]\f[B]);\f[R]
.PP
-\f[B]void bcl_ctxt_freeNums(BclContext\f[R] \f[I]ctxt\f[R]\f[B]);\f[R]
+\f[B]void bcl_ctxt_freeNums(BclContext\f[R] \f[I]ctxt\f[R]**);**
.PP
-\f[B]size_t bcl_ctxt_scale(BclContext\f[R] \f[I]ctxt\f[R]\f[B]);\f[R]
+\f[B]size_t bcl_ctxt_scale(BclContext\f[R] \f[I]ctxt\f[R]**);**
.PP
-\f[B]void bcl_ctxt_setScale(BclContext\f[R] \f[I]ctxt\f[R]\f[B],
-size_t\f[R] \f[I]scale\f[R]\f[B]);\f[R]
+\f[B]void bcl_ctxt_setScale(BclContext\f[R] \f[I]ctxt\f[R]**, size_t**
+\f[I]scale\f[R]**);**
.PP
-\f[B]size_t bcl_ctxt_ibase(BclContext\f[R] \f[I]ctxt\f[R]\f[B]);\f[R]
+\f[B]size_t bcl_ctxt_ibase(BclContext\f[R] \f[I]ctxt\f[R]**);**
.PP
-\f[B]void bcl_ctxt_setIbase(BclContext\f[R] \f[I]ctxt\f[R]\f[B],
-size_t\f[R] \f[I]ibase\f[R]\f[B]);\f[R]
+\f[B]void bcl_ctxt_setIbase(BclContext\f[R] \f[I]ctxt\f[R]**, size_t**
+\f[I]ibase\f[R]**);**
.PP
-\f[B]size_t bcl_ctxt_obase(BclContext\f[R] \f[I]ctxt\f[R]\f[B]);\f[R]
+\f[B]size_t bcl_ctxt_obase(BclContext\f[R] \f[I]ctxt\f[R]**);**
.PP
-\f[B]void bcl_ctxt_setObase(BclContext\f[R] \f[I]ctxt\f[R]\f[B],
-size_t\f[R] \f[I]obase\f[R]\f[B]);\f[R]
+\f[B]void bcl_ctxt_setObase(BclContext\f[R] \f[I]ctxt\f[R]**, size_t**
+\f[I]obase\f[R]**);**
.SS Errors
.PP
These items allow clients to handle errors.
.PP
\f[B]typedef enum BclError BclError;\f[R]
.PP
-\f[B]BclError bcl_err(BclNumber\f[R] \f[I]n\f[R]\f[B]);\f[R]
+\f[B]BclError bcl_err(BclNumber\f[R] \f[I]n\f[R]**);**
.SS Numbers
.PP
These items allow clients to manipulate and query the
@@ -106,86 +106,85 @@ arbitrary-precision numbers managed by bcl(3).
.PP
\f[B]typedef struct { size_t i; } BclNumber;\f[R]
.PP
-\f[B]BclNumber bcl_num_create(\f[R]\f[I]void\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_num_create(\f[BI]\f[I]void\f[BI]\f[B]);\f[R]
.PP
-\f[B]void bcl_num_free(BclNumber\f[R] \f[I]n\f[R]\f[B]);\f[R]
+\f[B]void bcl_num_free(BclNumber\f[R] \f[I]n\f[R]**);**
.PP
-\f[B]bool bcl_num_neg(BclNumber\f[R] \f[I]n\f[R]\f[B]);\f[R]
+\f[B]bool bcl_num_neg(BclNumber\f[R] \f[I]n\f[R]**);**
.PP
-\f[B]void bcl_num_setNeg(BclNumber\f[R] \f[I]n\f[R]\f[B], bool\f[R]
-\f[I]neg\f[R]\f[B]);\f[R]
+\f[B]void bcl_num_setNeg(BclNumber\f[R] \f[I]n\f[R]**, bool**
+\f[I]neg\f[R]**);**
.PP
-\f[B]size_t bcl_num_scale(BclNumber\f[R] \f[I]n\f[R]\f[B]);\f[R]
+\f[B]size_t bcl_num_scale(BclNumber\f[R] \f[I]n\f[R]**);**
.PP
-\f[B]BclError bcl_num_setScale(BclNumber\f[R] \f[I]n\f[R]\f[B],
-size_t\f[R] \f[I]scale\f[R]\f[B]);\f[R]
+\f[B]BclError bcl_num_setScale(BclNumber\f[R] \f[I]n\f[R]**, size_t**
+\f[I]scale\f[R]**);**
.PP
-\f[B]size_t bcl_num_len(BclNumber\f[R] \f[I]n\f[R]\f[B]);\f[R]
+\f[B]size_t bcl_num_len(BclNumber\f[R] \f[I]n\f[R]**);**
.SS Conversion
.PP
These items allow clients to convert numbers into and from strings and
integers.
.PP
-\f[B]BclNumber bcl_parse(const char *restrict\f[R]
-\f[I]val\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_parse(const char *restrict\f[R] \f[I]val\f[R]**);**
.PP
-\f[B]char* bcl_string(BclNumber\f[R] \f[I]n\f[R]\f[B]);\f[R]
+\f[B]char* bcl_string(BclNumber\f[R] \f[I]n\f[R]**);**
.PP
-\f[B]BclError bcl_bigdig(BclNumber\f[R] \f[I]n\f[R]\f[B], BclBigDig
-*\f[R]\f[I]result\f[R]\f[B]);\f[R]
+\f[B]BclError bcl_bigdig(BclNumber\f[R] \f[I]n\f[R]**, BclBigDig
+*\f[I]\f[BI]result\f[I]\f[R]);**
.PP
-\f[B]BclNumber bcl_bigdig2num(BclBigDig\f[R] \f[I]val\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_bigdig2num(BclBigDig\f[R] \f[I]val\f[R]**);**
.SS Math
.PP
These items allow clients to run math on numbers.
.PP
-\f[B]BclNumber bcl_add(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R]
-\f[I]b\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_add(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**);**
.PP
-\f[B]BclNumber bcl_sub(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R]
-\f[I]b\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_sub(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**);**
.PP
-\f[B]BclNumber bcl_mul(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R]
-\f[I]b\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_mul(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**);**
.PP
-\f[B]BclNumber bcl_div(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R]
-\f[I]b\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_div(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**);**
.PP
-\f[B]BclNumber bcl_mod(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R]
-\f[I]b\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_mod(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**);**
.PP
-\f[B]BclNumber bcl_pow(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R]
-\f[I]b\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_pow(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**);**
.PP
-\f[B]BclNumber bcl_lshift(BclNumber\f[R] \f[I]a\f[R]\f[B],
-BclNumber\f[R] \f[I]b\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_lshift(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**);**
.PP
-\f[B]BclNumber bcl_rshift(BclNumber\f[R] \f[I]a\f[R]\f[B],
-BclNumber\f[R] \f[I]b\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_rshift(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**);**
.PP
-\f[B]BclNumber bcl_sqrt(BclNumber\f[R] \f[I]a\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_sqrt(BclNumber\f[R] \f[I]a\f[R]**);**
.PP
-\f[B]BclError bcl_divmod(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R]
-\f[I]b\f[R]\f[B], BclNumber *\f[R]\f[I]c\f[R]\f[B], BclNumber
-*\f[R]\f[I]d\f[R]\f[B]);\f[R]
+\f[B]BclError bcl_divmod(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**, BclNumber *\f[I]\f[BI]c\f[I]\f[R], BclNumber
+*\f[I]\f[BI]d\f[I]\f[R]);**
.PP
-\f[B]BclNumber bcl_modexp(BclNumber\f[R] \f[I]a\f[R]\f[B],
-BclNumber\f[R] \f[I]b\f[R]\f[B], BclNumber\f[R] \f[I]c\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_modexp(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**, BclNumber** \f[I]c\f[R]**);**
.SS Miscellaneous
.PP
These items are miscellaneous.
.PP
-\f[B]void bcl_zero(BclNumber\f[R] \f[I]n\f[R]\f[B]);\f[R]
+\f[B]void bcl_zero(BclNumber\f[R] \f[I]n\f[R]**);**
.PP
-\f[B]void bcl_one(BclNumber\f[R] \f[I]n\f[R]\f[B]);\f[R]
+\f[B]void bcl_one(BclNumber\f[R] \f[I]n\f[R]**);**
.PP
-\f[B]ssize_t bcl_cmp(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R]
-\f[I]b\f[R]\f[B]);\f[R]
+\f[B]ssize_t bcl_cmp(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**);**
.PP
-\f[B]BclError bcl_copy(BclNumber\f[R] \f[I]d\f[R]\f[B], BclNumber\f[R]
-\f[I]s\f[R]\f[B]);\f[R]
+\f[B]BclError bcl_copy(BclNumber\f[R] \f[I]d\f[R]**, BclNumber**
+\f[I]s\f[R]**);**
.PP
-\f[B]BclNumber bcl_dup(BclNumber\f[R] \f[I]s\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_dup(BclNumber\f[R] \f[I]s\f[R]**);**
.SS Pseudo-Random Number Generator
.PP
These items allow clients to manipulate the seeded pseudo-random number
@@ -199,27 +198,25 @@ generator in bcl(3).
.PP
\f[B]typedef unsigned long BclRandInt;\f[R]
.PP
-\f[B]BclNumber bcl_irand(BclNumber\f[R] \f[I]a\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_irand(BclNumber\f[R] \f[I]a\f[R]**);**
.PP
-\f[B]BclNumber bcl_frand(size_t\f[R] \f[I]places\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_frand(size_t\f[R] \f[I]places\f[R]**);**
.PP
-\f[B]BclNumber bcl_ifrand(BclNumber\f[R] \f[I]a\f[R]\f[B], size_t\f[R]
-\f[I]places\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_ifrand(BclNumber\f[R] \f[I]a\f[R]**, size_t**
+\f[I]places\f[R]**);**
.PP
-\f[B]BclError bcl_rand_seedWithNum(BclNumber\f[R]
-\f[I]n\f[R]\f[B]);\f[R]
+\f[B]BclError bcl_rand_seedWithNum(BclNumber\f[R] \f[I]n\f[R]**);**
.PP
\f[B]BclError bcl_rand_seed(unsigned char\f[R]
-\f[I]seed\f[R]\f[B][\f[R]\f[I]BC_SEED_SIZE\f[R]\f[B]]);\f[R]
+\f[I]seed\f[R]**[\f[I]\f[BI]BC_SEED_SIZE\f[I]\f[R]]);**
.PP
-\f[B]void bcl_rand_reseed(\f[R]\f[I]void\f[R]\f[B]);\f[R]
+\f[B]void bcl_rand_reseed(\f[BI]\f[I]void\f[BI]\f[B]);\f[R]
.PP
-\f[B]BclNumber bcl_rand_seed2num(\f[R]\f[I]void\f[R]\f[B]);\f[R]
+\f[B]BclNumber bcl_rand_seed2num(\f[BI]\f[I]void\f[BI]\f[B]);\f[R]
.PP
-\f[B]BclRandInt bcl_rand_int(\f[R]\f[I]void\f[R]\f[B]);\f[R]
+\f[B]BclRandInt bcl_rand_int(\f[BI]\f[I]void\f[BI]\f[B]);\f[R]
.PP
-\f[B]BclRandInt bcl_rand_bounded(BclRandInt\f[R]
-\f[I]bound\f[R]\f[B]);\f[R]
+\f[B]BclRandInt bcl_rand_bounded(BclRandInt\f[R] \f[I]bound\f[R]**);**
.SH DESCRIPTION
.PP
bcl(3) is a library that implements arbitrary-precision decimal math, as
@@ -228,278 +225,329 @@ POSIX (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
in bc(1).
.PP
bcl(3) is async-signal-safe if
-\f[B]bcl_handleSignal(\f[R]\f[I]void\f[R]\f[B])\f[R] is used properly.
+\f[B]bcl_handleSignal(\f[BI]\f[I]void\f[BI]\f[B])\f[R] is used properly.
(See the \f[B]SIGNAL HANDLING\f[R] section.)
.PP
All of the items in its interface are described below.
See the documentation for each function for what each function can
return.
.SS Signals
-.TP
-\f[B]void bcl_handleSignal(\f[R]\f[I]void\f[R]\f[B])\f[R]
-An async-signal-safe function that can be called from a signal handler.
+.PP
+\f[B]void bcl_handleSignal(\f[BI]\f[I]void\f[BI]\f[B])\f[R]
+.PP
+: An async-signal-safe function that can be called from a signal
+handler.
If called from a signal handler on the same thread as any executing
bcl(3) functions, it will interrupt the functions and force them to
return early.
It is undefined behavior if this function is called from a thread that
is \f[I]not\f[R] executing any bcl(3) functions while any bcl(3)
functions are executing.
-.RS
-.PP
-If execution \f[I]is\f[R] interrupted,
-\f[B]bcl_handleSignal(\f[R]\f[I]void\f[R]\f[B])\f[R] does \f[I]not\f[R]
+.IP
+.nf
+\f[C]
+If execution *is* interrupted, **bcl_handleSignal(***void***)** does *not*
return to its caller.
+
+See the **SIGNAL HANDLING** section.
+\f[R]
+.fi
.PP
-See the \f[B]SIGNAL HANDLING\f[R] section.
-.RE
-.TP
-\f[B]bool bcl_running(\f[R]\f[I]void\f[R]\f[B])\f[R]
-An async-signal-safe function that can be called from a signal handler.
+\f[B]bool bcl_running(\f[BI]\f[I]void\f[BI]\f[B])\f[R]
+.PP
+: An async-signal-safe function that can be called from a signal
+handler.
It will return \f[B]true\f[R] if any bcl(3) procedures are running,
which means it is safe to call
-\f[B]bcl_handleSignal(\f[R]\f[I]void\f[R]\f[B])\f[R].
+\f[B]bcl_handleSignal(\f[BI]\f[I]void\f[BI]\f[B])\f[R].
Otherwise, it returns \f[B]false\f[R].
-.RS
-.PP
-See the \f[B]SIGNAL HANDLING\f[R] section.
-.RE
+.IP
+.nf
+\f[C]
+See the **SIGNAL HANDLING** section.
+\f[R]
+.fi
.SS Setup
-.TP
-\f[B]BclError bcl_init(\f[R]\f[I]void\f[R]\f[B])\f[R]
-Initializes this library.
+.PP
+\f[B]BclError bcl_init(\f[BI]\f[I]void\f[BI]\f[B])\f[R]
+.PP
+: Initializes this library.
This function can be called multiple times, but each call must be
-matched by a call to \f[B]bcl_free(\f[R]\f[I]void\f[R]\f[B])\f[R].
+matched by a call to \f[B]bcl_free(\f[BI]\f[I]void\f[BI]\f[B])\f[R].
This is to make it possible for multiple libraries and applications to
initialize bcl(3) without problem.
-.RS
+.IP
+.nf
+\f[C]
+If there was no error, **BCL_ERROR_NONE** is returned. Otherwise, this
+function can return:
+
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+
+This function must be the first one clients call. Calling any other
+function without calling this one first is undefined behavior.
+\f[R]
+.fi
.PP
-If there was no error, \f[B]BCL_ERROR_NONE\f[R] is returned.
-Otherwise, this function can return:
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
+\f[B]void bcl_free(\f[BI]\f[I]void\f[BI]\f[B])\f[R]
.PP
-This function must be the first one clients call.
-Calling any other function without calling this one first is undefined
-behavior.
-.RE
-.TP
-\f[B]void bcl_free(\f[R]\f[I]void\f[R]\f[B])\f[R]
-Decrements bcl(3)\[cq]s reference count and frees the data associated
+: Decrements bcl(3)\[aq]s reference count and frees the data associated
with it if the reference count is \f[B]0\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This function must be the last one clients call. Calling this function
+before calling any other function is undefined behavior.
+\f[R]
+.fi
.PP
-This function must be the last one clients call.
-Calling this function before calling any other function is undefined
-behavior.
-.RE
-.TP
-\f[B]bool bcl_abortOnFatalError(\f[R]\f[I]void\f[R]\f[B])\f[R]
-Queries and returns the current state of calling \f[B]abort()\f[R] on
+\f[B]bool bcl_abortOnFatalError(\f[BI]\f[I]void\f[BI]\f[B])\f[R]
+.PP
+: Queries and returns the current state of calling \f[B]abort()\f[R] on
fatal errors.
If \f[B]true\f[R] is returned, bcl(3) will cause a \f[B]SIGABRT\f[R] if
a fatal error occurs.
-.RS
-.PP
+.IP
+.nf
+\f[C]
If activated, clients do not need to check for fatal errors.
-.RE
-.TP
-\f[B]void bcl_setAbortOnFatalError(bool\f[R] \f[I]abrt\f[R]\f[B])\f[R]
-Sets the state of calling \f[B]abort()\f[R] on fatal errors.
+\f[R]
+.fi
+.PP
+\f[B]void bcl_setAbortOnFatalError(bool\f[R] \f[I]abrt\f[R]**)**
+.PP
+: Sets the state of calling \f[B]abort()\f[R] on fatal errors.
If \f[I]abrt\f[R] is \f[B]false\f[R], bcl(3) will not cause a
\f[B]SIGABRT\f[R] on fatal errors after the call.
If \f[I]abrt\f[R] is \f[B]true\f[R], bcl(3) will cause a
\f[B]SIGABRT\f[R] on fatal errors after the call.
-.RS
-.PP
+.IP
+.nf
+\f[C]
If activated, clients do not need to check for fatal errors.
-.RE
-.TP
-\f[B]void bcl_gc(\f[R]\f[I]void\f[R]\f[B])\f[R]
-Garbage collects cached instances of arbitrary-precision numbers.
+\f[R]
+.fi
+.PP
+\f[B]void bcl_gc(\f[BI]\f[I]void\f[BI]\f[B])\f[R]
+.PP
+: Garbage collects cached instances of arbitrary-precision numbers.
This only frees the memory of numbers that are \f[I]not\f[R] in use, so
it is safe to call at any time.
.SS Contexts
.PP
All procedures that take a \f[B]BclContext\f[R] parameter a require a
valid context as an argument.
-.TP
+.PP
\f[B]struct BclCtxt\f[R]
-A forward declaration for a hidden \f[B]struct\f[R] type.
+.PP
+: A forward declaration for a hidden \f[B]struct\f[R] type.
Clients cannot access the internals of the \f[B]struct\f[R] type
directly.
All interactions with the type are done through pointers.
See \f[B]BclContext\f[R] below.
-.TP
+.PP
\f[B]BclContext\f[R]
-A typedef to a pointer of \f[B]struct BclCtxt\f[R].
+.PP
+: A typedef to a pointer of \f[B]struct BclCtxt\f[R].
This is the only handle clients can get to \f[B]struct BclCtxt\f[R].
-.RS
+.IP
+.nf
+\f[C]
+A **BclContext** contains the values **scale**, **ibase**, and **obase**, as
+well as a list of numbers.
+
+**scale** is a value used to control how many decimal places calculations
+should use. A value of **0** means that calculations are done on integers
+only, where applicable, and a value of 20, for example, means that all
+applicable calculations return results with 20 decimal places. The default
+is **0**.
+
+**ibase** is a value used to control the input base. The minimum **ibase**
+is **2**, and the maximum is **36**. If **ibase** is **2**, numbers are
+parsed as though they are in binary, and any digits larger than **1** are
+clamped. Likewise, a value of **10** means that numbers are parsed as though
+they are decimal, and any larger digits are clamped. The default is **10**.
+
+**obase** is a value used to control the output base. The minimum **obase**
+is **0** and the maximum is **BC_BASE_MAX** (see the **LIMITS** section).
+
+Numbers created in one context are not valid in another context. It is
+undefined behavior to use a number created in a different context. Contexts
+are meant to isolate the numbers used by different clients in the same
+application.
+\f[R]
+.fi
.PP
-A \f[B]BclContext\f[R] contains the values \f[B]scale\f[R],
-\f[B]ibase\f[R], and \f[B]obase\f[R], as well as a list of numbers.
+\f[B]BclContext bcl_ctxt_create(\f[BI]\f[I]void\f[BI]\f[B])\f[R]
.PP
-\f[B]scale\f[R] is a value used to control how many decimal places
-calculations should use.
-A value of \f[B]0\f[R] means that calculations are done on integers
-only, where applicable, and a value of 20, for example, means that all
-applicable calculations return results with 20 decimal places.
-The default is \f[B]0\f[R].
-.PP
-\f[B]ibase\f[R] is a value used to control the input base.
-The minimum \f[B]ibase\f[R] is \f[B]2\f[R], and the maximum is
-\f[B]36\f[R].
-If \f[B]ibase\f[R] is \f[B]2\f[R], numbers are parsed as though they are
-in binary, and any digits larger than \f[B]1\f[R] are clamped.
-Likewise, a value of \f[B]10\f[R] means that numbers are parsed as
-though they are decimal, and any larger digits are clamped.
-The default is \f[B]10\f[R].
-.PP
-\f[B]obase\f[R] is a value used to control the output base.
-The minimum \f[B]obase\f[R] is \f[B]0\f[R] and the maximum is
-\f[B]BC_BASE_MAX\f[R] (see the \f[B]LIMITS\f[R] section).
-.PP
-Numbers created in one context are not valid in another context.
-It is undefined behavior to use a number created in a different context.
-Contexts are meant to isolate the numbers used by different clients in
-the same application.
-.RE
-.TP
-\f[B]BclContext bcl_ctxt_create(\f[R]\f[I]void\f[R]\f[B])\f[R]
-Creates a context and returns it.
+: Creates a context and returns it.
Returns \f[B]NULL\f[R] if there was an error.
-.TP
-\f[B]void bcl_ctxt_free(BclContext\f[R] \f[I]ctxt\f[R]\f[B])\f[R]
-Frees \f[I]ctxt\f[R], after which it is no longer valid.
+.PP
+\f[B]void bcl_ctxt_free(BclContext\f[R] \f[I]ctxt\f[R]**)**
+.PP
+: Frees \f[I]ctxt\f[R], after which it is no longer valid.
It is undefined behavior to attempt to use an invalid context.
-.TP
-\f[B]BclError bcl_pushContext(BclContext\f[R] \f[I]ctxt\f[R]\f[B])\f[R]
-Pushes \f[I]ctxt\f[R] onto bcl(3)\[cq]s stack of contexts.
+.PP
+\f[B]BclError bcl_pushContext(BclContext\f[R] \f[I]ctxt\f[R]**)**
+.PP
+: Pushes \f[I]ctxt\f[R] onto bcl(3)\[aq]s stack of contexts.
\f[I]ctxt\f[R] must have been created with
-\f[B]bcl_ctxt_create(\f[R]\f[I]void\f[R]\f[B])\f[R].
-.RS
+\f[B]bcl_ctxt_create(\f[BI]\f[I]void\f[BI]\f[B])\f[R].
+.IP
+.nf
+\f[C]
+If there was no error, **BCL_ERROR_NONE** is returned. Otherwise, this
+function can return:
+
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+
+There *must* be a valid context to do any arithmetic.
+\f[R]
+.fi
.PP
-If there was no error, \f[B]BCL_ERROR_NONE\f[R] is returned.
-Otherwise, this function can return:
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
+\f[B]void bcl_popContext(\f[BI]\f[I]void\f[BI]\f[B])\f[R]
+.PP
+: Pops the current context off of the stack, if one exists.
+.PP
+\f[B]BclContext bcl_context(\f[BI]\f[I]void\f[BI]\f[B])\f[R]
+.PP
+: Returns the current context, or \f[B]NULL\f[R] if no context exists.
+.PP
+\f[B]void bcl_ctxt_freeNums(BclContext\f[R] \f[I]ctxt\f[R]**)**
.PP
-There \f[I]must\f[R] be a valid context to do any arithmetic.
-.RE
-.TP
-\f[B]void bcl_popContext(\f[R]\f[I]void\f[R]\f[B])\f[R]
-Pops the current context off of the stack, if one exists.
-.TP
-\f[B]BclContext bcl_context(\f[R]\f[I]void\f[R]\f[B])\f[R]
-Returns the current context, or \f[B]NULL\f[R] if no context exists.
-.TP
-\f[B]void bcl_ctxt_freeNums(BclContext\f[R] \f[I]ctxt\f[R]\f[B])\f[R]
-Frees all numbers in use that are associated with \f[I]ctxt\f[R].
+: Frees all numbers in use that are associated with \f[I]ctxt\f[R].
It is undefined behavior to attempt to use a number associated with
\f[I]ctxt\f[R] after calling this procedure unless such numbers have
-been created with \f[B]bcl_num_create(\f[R]\f[I]void\f[R]\f[B])\f[R]
+been created with \f[B]bcl_num_create(\f[BI]\f[I]void\f[BI]\f[B])\f[R]
after calling this procedure.
-.TP
-\f[B]size_t bcl_ctxt_scale(BclContext\f[R] \f[I]ctxt\f[R]\f[B])\f[R]
-Returns the \f[B]scale\f[R] for given context.
-.TP
-\f[B]void bcl_ctxt_setScale(BclContext\f[R] \f[I]ctxt\f[R]\f[B], size_t\f[R] \f[I]scale\f[R]\f[B])\f[R]
-Sets the \f[B]scale\f[R] for the given context to the argument
+.PP
+\f[B]size_t bcl_ctxt_scale(BclContext\f[R] \f[I]ctxt\f[R]**)**
+.PP
+: Returns the \f[B]scale\f[R] for given context.
+.PP
+\f[B]void bcl_ctxt_setScale(BclContext\f[R] \f[I]ctxt\f[R]**, size_t**
+\f[I]scale\f[R]**)**
+.PP
+: Sets the \f[B]scale\f[R] for the given context to the argument
\f[I]scale\f[R].
-.TP
-\f[B]size_t bcl_ctxt_ibase(BclContext\f[R] \f[I]ctxt\f[R]\f[B])\f[R]
-Returns the \f[B]ibase\f[R] for the given context.
-.TP
-\f[B]void bcl_ctxt_setIbase(BclContext\f[R] \f[I]ctxt\f[R]\f[B], size_t\f[R] \f[I]ibase\f[R]\f[B])\f[R]
-Sets the \f[B]ibase\f[R] for the given context to the argument
+.PP
+\f[B]size_t bcl_ctxt_ibase(BclContext\f[R] \f[I]ctxt\f[R]**)**
+.PP
+: Returns the \f[B]ibase\f[R] for the given context.
+.PP
+\f[B]void bcl_ctxt_setIbase(BclContext\f[R] \f[I]ctxt\f[R]**, size_t**
+\f[I]ibase\f[R]**)**
+.PP
+: Sets the \f[B]ibase\f[R] for the given context to the argument
\f[I]ibase\f[R].
If the argument \f[I]ibase\f[R] is invalid, it clamped, so an
\f[I]ibase\f[R] of \f[B]0\f[R] or \f[B]1\f[R] is clamped to \f[B]2\f[R],
and any values above \f[B]36\f[R] are clamped to \f[B]36\f[R].
-.TP
-\f[B]size_t bcl_ctxt_obase(BclContext\f[R] \f[I]ctxt\f[R]\f[B])\f[R]
-Returns the \f[B]obase\f[R] for the given context.
-.TP
-\f[B]void bcl_ctxt_setObase(BclContext\f[R] \f[I]ctxt\f[R]\f[B], size_t\f[R] \f[I]obase\f[R]\f[B])\f[R]
-Sets the \f[B]obase\f[R] for the given context to the argument
+.PP
+\f[B]size_t bcl_ctxt_obase(BclContext\f[R] \f[I]ctxt\f[R]**)**
+.PP
+: Returns the \f[B]obase\f[R] for the given context.
+.PP
+\f[B]void bcl_ctxt_setObase(BclContext\f[R] \f[I]ctxt\f[R]**, size_t**
+\f[I]obase\f[R]**)**
+.PP
+: Sets the \f[B]obase\f[R] for the given context to the argument
\f[I]obase\f[R].
.SS Errors
-.TP
+.PP
\f[B]BclError\f[R]
-An \f[B]enum\f[R] of possible error codes.
+.PP
+: An \f[B]enum\f[R] of possible error codes.
See the \f[B]ERRORS\f[R] section for a complete listing the codes.
-.TP
-\f[B]BclError bcl_err(BclNumber\f[R] \f[I]n\f[R]\f[B])\f[R]
-Checks for errors in a \f[B]BclNumber\f[R].
+.PP
+\f[B]BclError bcl_err(BclNumber\f[R] \f[I]n\f[R]**)**
+.PP
+: Checks for errors in a \f[B]BclNumber\f[R].
All functions that can return a \f[B]BclNumber\f[R] can encode an error
in the number, and this function will return the error, if any.
If there was no error, it will return \f[B]BCL_ERROR_NONE\f[R].
-.RS
-.PP
+.IP
+.nf
+\f[C]
There must be a valid current context.
-.RE
+\f[R]
+.fi
.SS Numbers
.PP
All procedures in this section require a valid current context.
-.TP
+.PP
\f[B]BclNumber\f[R]
-A handle to an arbitrary-precision number.
+.PP
+: A handle to an arbitrary-precision number.
The actual number type is not exposed; the \f[B]BclNumber\f[R] handle is
the only way clients can refer to instances of arbitrary-precision
numbers.
-.TP
-\f[B]BclNumber bcl_num_create(\f[R]\f[I]void\f[R]\f[B])\f[R]
-Creates and returns a \f[B]BclNumber\f[R].
-.RS
-.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]void bcl_num_free(BclNumber\f[R] \f[I]n\f[R]\f[B])\f[R]
-Frees \f[I]n\f[R].
+.PP
+\f[B]BclNumber bcl_num_create(\f[BI]\f[I]void\f[BI]\f[B])\f[R]
+.PP
+: Creates and returns a \f[B]BclNumber\f[R].
+.IP
+.nf
+\f[C]
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
+.PP
+\f[B]void bcl_num_free(BclNumber\f[R] \f[I]n\f[R]**)**
+.PP
+: Frees \f[I]n\f[R].
It is undefined behavior to use \f[I]n\f[R] after calling this function.
-.TP
-\f[B]bool bcl_num_neg(BclNumber\f[R] \f[I]n\f[R]\f[B])\f[R]
-Returns \f[B]true\f[R] if \f[I]n\f[R] is negative, \f[B]false\f[R]
+.PP
+\f[B]bool bcl_num_neg(BclNumber\f[R] \f[I]n\f[R]**)**
+.PP
+: Returns \f[B]true\f[R] if \f[I]n\f[R] is negative, \f[B]false\f[R]
otherwise.
-.TP
-\f[B]void bcl_num_setNeg(BclNumber\f[R] \f[I]n\f[R]\f[B], bool\f[R] \f[I]neg\f[R]\f[B])\f[R]
-Sets \f[I]n\f[R]\[cq]s sign to \f[I]neg\f[R], where \f[B]true\f[R] is
+.PP
+\f[B]void bcl_num_setNeg(BclNumber\f[R] \f[I]n\f[R]**, bool**
+\f[I]neg\f[R]**)**
+.PP
+: Sets \f[I]n\f[R]\[aq]s sign to \f[I]neg\f[R], where \f[B]true\f[R] is
negative, and \f[B]false\f[R] is positive.
-.TP
-\f[B]size_t bcl_num_scale(BclNumber\f[R] \f[I]n\f[R]\f[B])\f[R]
-Returns the \f[I]scale\f[R] of \f[I]n\f[R].
-.RS
-.PP
-The \f[I]scale\f[R] of a number is the number of decimal places it has
-after the radix (decimal point).
-.RE
-.TP
-\f[B]BclError bcl_num_setScale(BclNumber\f[R] \f[I]n\f[R]\f[B], size_t\f[R] \f[I]scale\f[R]\f[B])\f[R]
-Sets the \f[I]scale\f[R] of \f[I]n\f[R] to the argument \f[I]scale\f[R].
+.PP
+\f[B]size_t bcl_num_scale(BclNumber\f[R] \f[I]n\f[R]**)**
+.PP
+: Returns the \f[I]scale\f[R] of \f[I]n\f[R].
+.IP
+.nf
+\f[C]
+The *scale* of a number is the number of decimal places it has after the
+radix (decimal point).
+\f[R]
+.fi
+.PP
+\f[B]BclError bcl_num_setScale(BclNumber\f[R] \f[I]n\f[R]**, size_t**
+\f[I]scale\f[R]**)**
+.PP
+: Sets the \f[I]scale\f[R] of \f[I]n\f[R] to the argument
+\f[I]scale\f[R].
If the argument \f[I]scale\f[R] is greater than the \f[I]scale\f[R] of
\f[I]n\f[R], \f[I]n\f[R] is extended.
If the argument \f[I]scale\f[R] is less than the \f[I]scale\f[R] of
\f[I]n\f[R], \f[I]n\f[R] is truncated.
-.RS
+.IP
+.nf
+\f[C]
+If there was no error, **BCL_ERROR_NONE** is returned. Otherwise, this
+function can return:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.PP
-If there was no error, \f[B]BCL_ERROR_NONE\f[R] is returned.
-Otherwise, this function can return:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]size_t bcl_num_len(BclNumber\f[R] \f[I]n\f[R]\f[B])\f[R]
-Returns the number of \f[I]significant decimal digits\f[R] in
+\f[B]size_t bcl_num_len(BclNumber\f[R] \f[I]n\f[R]**)**
+.PP
+: Returns the number of \f[I]significant decimal digits\f[R] in
\f[I]n\f[R].
.SS Conversion
.PP
@@ -508,72 +556,76 @@ All procedures in this section require a valid current context.
All procedures in this section consume the given \f[B]BclNumber\f[R]
arguments that are not given to pointer arguments.
See the \f[B]Consumption and Propagation\f[R] subsection below.
-.TP
-\f[B]BclNumber bcl_parse(const char *restrict\f[R] \f[I]val\f[R]\f[B])\f[R]
-Parses a number string according to the current context\[cq]s
+.PP
+\f[B]BclNumber bcl_parse(const char *restrict\f[R] \f[I]val\f[R]**)**
+.PP
+: Parses a number string according to the current context\[aq]s
\f[B]ibase\f[R] and returns the resulting number.
-.RS
+.IP
+.nf
+\f[C]
+*val* must be non-**NULL** and a valid string. See
+**BCL_ERROR_PARSE_INVALID_STR** in the **ERRORS** section for more
+information.
+
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_PARSE_INVALID_STR**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.PP
-\f[I]val\f[R] must be non-\f[B]NULL\f[R] and a valid string.
-See \f[B]BCL_ERROR_PARSE_INVALID_STR\f[R] in the \f[B]ERRORS\f[R]
-section for more information.
+\f[B]char* bcl_string(BclNumber\f[R] \f[I]n\f[R]**)**
.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_PARSE_INVALID_STR\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]char* bcl_string(BclNumber\f[R] \f[I]n\f[R]\f[B])\f[R]
-Returns a string representation of \f[I]n\f[R] according the the current
-context\[cq]s \f[B]ibase\f[R].
+: Returns a string representation of \f[I]n\f[R] according the the
+current context\[aq]s \f[B]ibase\f[R].
The string is dynamically allocated and must be freed by the caller.
-.RS
+.IP
+.nf
+\f[C]
+*n* is consumed; it cannot be used after the call. See the
+**Consumption and Propagation** subsection below.
+\f[R]
+.fi
.PP
-\f[I]n\f[R] is consumed; it cannot be used after the call.
-See the \f[B]Consumption and Propagation\f[R] subsection below.
-.RE
-.TP
-\f[B]BclError bcl_bigdig(BclNumber\f[R] \f[I]n\f[R]\f[B], BclBigDig *\f[R]\f[I]result\f[R]\f[B])\f[R]
-Converts \f[I]n\f[R] into a \f[B]BclBigDig\f[R] and returns the result
+\f[B]BclError bcl_bigdig(BclNumber\f[R] \f[I]n\f[R]**, BclBigDig
+*\f[I]\f[BI]result\f[I]\f[R])**
+.PP
+: Converts \f[I]n\f[R] into a \f[B]BclBigDig\f[R] and returns the result
in the space pointed to by \f[I]result\f[R].
-.RS
+.IP
+.nf
+\f[C]
+*a* must be smaller than **BC_OVERFLOW_MAX**. See the **LIMITS** section.
+
+If there was no error, **BCL_ERROR_NONE** is returned. Otherwise, this
+function can return:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_MATH_OVERFLOW**
+
+*n* is consumed; it cannot be used after the call. See the
+**Consumption and Propagation** subsection below.
+\f[R]
+.fi
.PP
-\f[I]a\f[R] must be smaller than \f[B]BC_OVERFLOW_MAX\f[R].
-See the \f[B]LIMITS\f[R] section.
+\f[B]BclNumber bcl_bigdig2num(BclBigDig\f[R] \f[I]val\f[R]**)**
.PP
-If there was no error, \f[B]BCL_ERROR_NONE\f[R] is returned.
-Otherwise, this function can return:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_MATH_OVERFLOW\f[R]
-.PP
-\f[I]n\f[R] is consumed; it cannot be used after the call.
-See the \f[B]Consumption and Propagation\f[R] subsection below.
-.RE
-.TP
-\f[B]BclNumber bcl_bigdig2num(BclBigDig\f[R] \f[I]val\f[R]\f[B])\f[R]
-Creates a \f[B]BclNumber\f[R] from \f[I]val\f[R].
-.RS
-.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
+: Creates a \f[B]BclNumber\f[R] from \f[I]val\f[R].
+.IP
+.nf
+\f[C]
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.SS Math
.PP
All procedures in this section require a valid current context.
@@ -585,352 +637,345 @@ All procedures in this section can return the following errors:
\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
.IP \[bu] 2
\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.TP
-\f[B]BclNumber bcl_add(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R] \f[I]b\f[R]\f[B])\f[R]
-Adds \f[I]a\f[R] and \f[I]b\f[R] and returns the result.
+.PP
+\f[B]BclNumber bcl_add(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**)**
+.PP
+: Adds \f[I]a\f[R] and \f[I]b\f[R] and returns the result.
The \f[I]scale\f[R] of the result is the max of the \f[I]scale\f[R]s of
\f[I]a\f[R] and \f[I]b\f[R].
-.RS
-.PP
-\f[I]a\f[R] and \f[I]b\f[R] are consumed; they cannot be used after the
-call.
-See the \f[B]Consumption and Propagation\f[R] subsection below.
+.IP
+.nf
+\f[C]
+*a* and *b* are consumed; they cannot be used after the call. See the
+**Consumption and Propagation** subsection below.
+
+*a* and *b* can be the same number.
+
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.PP
-\f[I]a\f[R] and \f[I]b\f[R] can be the same number.
+\f[B]BclNumber bcl_sub(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**)**
.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]BclNumber bcl_sub(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R] \f[I]b\f[R]\f[B])\f[R]
-Subtracts \f[I]b\f[R] from \f[I]a\f[R] and returns the result.
+: Subtracts \f[I]b\f[R] from \f[I]a\f[R] and returns the result.
The \f[I]scale\f[R] of the result is the max of the \f[I]scale\f[R]s of
\f[I]a\f[R] and \f[I]b\f[R].
-.RS
-.PP
-\f[I]a\f[R] and \f[I]b\f[R] are consumed; they cannot be used after the
-call.
-See the \f[B]Consumption and Propagation\f[R] subsection below.
+.IP
+.nf
+\f[C]
+*a* and *b* are consumed; they cannot be used after the call. See the
+**Consumption and Propagation** subsection below.
+
+*a* and *b* can be the same number.
+
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.PP
-\f[I]a\f[R] and \f[I]b\f[R] can be the same number.
+\f[B]BclNumber bcl_mul(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**)**
.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]BclNumber bcl_mul(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R] \f[I]b\f[R]\f[B])\f[R]
-Multiplies \f[I]a\f[R] and \f[I]b\f[R] and returns the result.
+: Multiplies \f[I]a\f[R] and \f[I]b\f[R] and returns the result.
If \f[I]ascale\f[R] is the \f[I]scale\f[R] of \f[I]a\f[R] and
\f[I]bscale\f[R] is the \f[I]scale\f[R] of \f[I]b\f[R], the
\f[I]scale\f[R] of the result is equal to
\f[B]min(ascale+bscale,max(scale,ascale,bscale))\f[R], where
\f[B]min()\f[R] and \f[B]max()\f[R] return the obvious values.
-.RS
-.PP
-\f[I]a\f[R] and \f[I]b\f[R] are consumed; they cannot be used after the
-call.
-See the \f[B]Consumption and Propagation\f[R] subsection below.
+.IP
+.nf
+\f[C]
+*a* and *b* are consumed; they cannot be used after the call. See the
+**Consumption and Propagation** subsection below.
+
+*a* and *b* can be the same number.
+
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.PP
-\f[I]a\f[R] and \f[I]b\f[R] can be the same number.
+\f[B]BclNumber bcl_div(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**)**
.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]BclNumber bcl_div(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R] \f[I]b\f[R]\f[B])\f[R]
-Divides \f[I]a\f[R] by \f[I]b\f[R] and returns the result.
+: Divides \f[I]a\f[R] by \f[I]b\f[R] and returns the result.
The \f[I]scale\f[R] of the result is the \f[I]scale\f[R] of the current
context.
-.RS
-.PP
-\f[I]b\f[R] cannot be \f[B]0\f[R].
-.PP
-\f[I]a\f[R] and \f[I]b\f[R] are consumed; they cannot be used after the
-call.
-See the \f[B]Consumption and Propagation\f[R] subsection below.
+.IP
+.nf
+\f[C]
+*b* cannot be **0**.
+
+*a* and *b* are consumed; they cannot be used after the call. See the
+**Consumption and Propagation** subsection below.
+
+*a* and *b* can be the same number.
+
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.PP
-\f[I]a\f[R] and \f[I]b\f[R] can be the same number.
+\f[B]BclNumber bcl_mod(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**)**
.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_MATH_DIVIDE_BY_ZERO\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]BclNumber bcl_mod(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R] \f[I]b\f[R]\f[B])\f[R]
-Divides \f[I]a\f[R] by \f[I]b\f[R] to the \f[I]scale\f[R] of the current
-context, computes the modulus \f[B]a-(a/b)*b\f[R], and returns the
-modulus.
-.RS
-.PP
-\f[I]b\f[R] cannot be \f[B]0\f[R].
-.PP
-\f[I]a\f[R] and \f[I]b\f[R] are consumed; they cannot be used after the
-call.
-See the \f[B]Consumption and Propagation\f[R] subsection below.
+: Divides \f[I]a\f[R] by \f[I]b\f[R] to the \f[I]scale\f[R] of the
+current context, computes the modulus \f[B]a-(a/b)*b\f[R], and returns
+the modulus.
+.IP
+.nf
+\f[C]
+*b* cannot be **0**.
+
+*a* and *b* are consumed; they cannot be used after the call. See the
+**Consumption and Propagation** subsection below.
+
+*a* and *b* can be the same number.
+
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.PP
-\f[I]a\f[R] and \f[I]b\f[R] can be the same number.
+\f[B]BclNumber bcl_pow(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**)**
.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_MATH_DIVIDE_BY_ZERO\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]BclNumber bcl_pow(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R] \f[I]b\f[R]\f[B])\f[R]
-Calculates \f[I]a\f[R] to the power of \f[I]b\f[R] to the
+: Calculates \f[I]a\f[R] to the power of \f[I]b\f[R] to the
\f[I]scale\f[R] of the current context.
\f[I]b\f[R] must be an integer, but can be negative.
If it is negative, \f[I]a\f[R] must be non-zero.
-.RS
-.PP
-\f[I]b\f[R] must be an integer.
-If \f[I]b\f[R] is negative, \f[I]a\f[R] must not be \f[B]0\f[R].
-.PP
-\f[I]a\f[R] must be smaller than \f[B]BC_OVERFLOW_MAX\f[R].
-See the \f[B]LIMITS\f[R] section.
-.PP
-\f[I]a\f[R] and \f[I]b\f[R] are consumed; they cannot be used after the
-call.
-See the \f[B]Consumption and Propagation\f[R] subsection below.
+.IP
+.nf
+\f[C]
+*b* must be an integer. If *b* is negative, *a* must not be **0**.
+
+*a* must be smaller than **BC_OVERFLOW_MAX**. See the **LIMITS** section.
+
+*a* and *b* are consumed; they cannot be used after the call. See the
+**Consumption and Propagation** subsection below.
+
+*a* and *b* can be the same number.
+
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_MATH_NON_INTEGER**
+* **BCL_ERROR_MATH_OVERFLOW**
+* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.PP
-\f[I]a\f[R] and \f[I]b\f[R] can be the same number.
+\f[B]BclNumber bcl_lshift(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**)**
.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_MATH_NON_INTEGER\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_MATH_OVERFLOW\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_MATH_DIVIDE_BY_ZERO\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]BclNumber bcl_lshift(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R] \f[I]b\f[R]\f[B])\f[R]
-Shifts \f[I]a\f[R] left (moves the radix right) by \f[I]b\f[R] places
+: Shifts \f[I]a\f[R] left (moves the radix right) by \f[I]b\f[R] places
and returns the result.
This is done in decimal.
\f[I]b\f[R] must be an integer.
-.RS
-.PP
-\f[I]b\f[R] must be an integer.
-.PP
-\f[I]a\f[R] and \f[I]b\f[R] are consumed; they cannot be used after the
-call.
-See the \f[B]Consumption and Propagation\f[R] subsection below.
+.IP
+.nf
+\f[C]
+*b* must be an integer.
+
+*a* and *b* are consumed; they cannot be used after the call. See the
+**Consumption and Propagation** subsection below.
+
+*a* and *b* can be the same number.
+
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_MATH_NON_INTEGER**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.PP
-\f[I]a\f[R] and \f[I]b\f[R] can be the same number.
+\f[B]BclNumber bcl_rshift(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**)**
.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_MATH_NON_INTEGER\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]BclNumber bcl_rshift(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R] \f[I]b\f[R]\f[B])\f[R]
-Shifts \f[I]a\f[R] right (moves the radix left) by \f[I]b\f[R] places
+: Shifts \f[I]a\f[R] right (moves the radix left) by \f[I]b\f[R] places
and returns the result.
This is done in decimal.
\f[I]b\f[R] must be an integer.
-.RS
-.PP
-\f[I]b\f[R] must be an integer.
-.PP
-\f[I]a\f[R] and \f[I]b\f[R] are consumed; they cannot be used after the
-call.
-See the \f[B]Consumption and Propagation\f[R] subsection below.
+.IP
+.nf
+\f[C]
+*b* must be an integer.
+
+*a* and *b* are consumed; they cannot be used after the call. See the
+**Consumption and Propagation** subsection below.
+
+*a* and *b* can be the same number.
+
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_MATH_NON_INTEGER**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.PP
-\f[I]a\f[R] and \f[I]b\f[R] can be the same number.
+\f[B]BclNumber bcl_sqrt(BclNumber\f[R] \f[I]a\f[R]**)**
.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_MATH_NON_INTEGER\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]BclNumber bcl_sqrt(BclNumber\f[R] \f[I]a\f[R]\f[B])\f[R]
-Calculates the square root of \f[I]a\f[R] and returns the result.
+: Calculates the square root of \f[I]a\f[R] and returns the result.
The \f[I]scale\f[R] of the result is equal to the \f[B]scale\f[R] of the
current context.
-.RS
-.PP
-\f[I]a\f[R] cannot be negative.
+.IP
+.nf
+\f[C]
+*a* cannot be negative.
+
+*a* is consumed; it cannot be used after the call. See the
+**Consumption and Propagation** subsection below.
+
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_MATH_NEGATIVE**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.PP
-\f[I]a\f[R] is consumed; it cannot be used after the call.
-See the \f[B]Consumption and Propagation\f[R] subsection below.
+\f[B]BclError bcl_divmod(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**, BclNumber *\f[I]\f[BI]c\f[I]\f[R], BclNumber
+*\f[I]\f[BI]d\f[I]\f[R])**
.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_MATH_NEGATIVE\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]BclError bcl_divmod(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R] \f[I]b\f[R]\f[B], BclNumber *\f[R]\f[I]c\f[R]\f[B], BclNumber *\f[R]\f[I]d\f[R]\f[B])\f[R]
-Divides \f[I]a\f[R] by \f[I]b\f[R] and returns the quotient in a new
+: Divides \f[I]a\f[R] by \f[I]b\f[R] and returns the quotient in a new
number which is put into the space pointed to by \f[I]c\f[R], and puts
the modulus in a new number which is put into the space pointed to by
\f[I]d\f[R].
-.RS
-.PP
-\f[I]b\f[R] cannot be \f[B]0\f[R].
-.PP
-\f[I]a\f[R] and \f[I]b\f[R] are consumed; they cannot be used after the
-call.
-See the \f[B]Consumption and Propagation\f[R] subsection below.
+.IP
+.nf
+\f[C]
+*b* cannot be **0**.
+
+*a* and *b* are consumed; they cannot be used after the call. See the
+**Consumption and Propagation** subsection below.
+
+*c* and *d* cannot point to the same place, nor can they point to the space
+occupied by *a* or *b*.
+
+If there was no error, **BCL_ERROR_NONE** is returned. Otherwise, this
+function can return:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.PP
-\f[I]c\f[R] and \f[I]d\f[R] cannot point to the same place, nor can they
-point to the space occupied by \f[I]a\f[R] or \f[I]b\f[R].
+\f[B]BclNumber bcl_modexp(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**, BclNumber** \f[I]c\f[R]**)**
.PP
-If there was no error, \f[B]BCL_ERROR_NONE\f[R] is returned.
-Otherwise, this function can return:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_MATH_DIVIDE_BY_ZERO\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]BclNumber bcl_modexp(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R] \f[I]b\f[R]\f[B], BclNumber\f[R] \f[I]c\f[R]\f[B])\f[R]
-Computes a modular exponentiation where \f[I]a\f[R] is the base,
+: Computes a modular exponentiation where \f[I]a\f[R] is the base,
\f[I]b\f[R] is the exponent, and \f[I]c\f[R] is the modulus, and returns
the result.
The \f[I]scale\f[R] of the result is equal to the \f[B]scale\f[R] of the
current context.
-.RS
+.IP
+.nf
+\f[C]
+*a*, *b*, and *c* must be integers. *c* must not be **0**. *b* must not be
+negative.
+
+*a*, *b*, and *c* are consumed; they cannot be used after the call. See the
+**Consumption and Propagation** subsection below.
+
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_MATH_NEGATIVE**
+* **BCL_ERROR_MATH_NON_INTEGER**
+* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
+.SS Miscellaneous
.PP
-\f[I]a\f[R], \f[I]b\f[R], and \f[I]c\f[R] must be integers.
-\f[I]c\f[R] must not be \f[B]0\f[R].
-\f[I]b\f[R] must not be negative.
+\f[B]void bcl_zero(BclNumber\f[R] \f[I]n\f[R]**)**
.PP
-\f[I]a\f[R], \f[I]b\f[R], and \f[I]c\f[R] are consumed; they cannot be
-used after the call.
-See the \f[B]Consumption and Propagation\f[R] subsection below.
+: Sets \f[I]n\f[R] to \f[B]0\f[R].
.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_MATH_NEGATIVE\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_MATH_NON_INTEGER\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_MATH_DIVIDE_BY_ZERO\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.SS Miscellaneous
-.TP
-\f[B]void bcl_zero(BclNumber\f[R] \f[I]n\f[R]\f[B])\f[R]
-Sets \f[I]n\f[R] to \f[B]0\f[R].
-.TP
-\f[B]void bcl_one(BclNumber\f[R] \f[I]n\f[R]\f[B])\f[R]
-Sets \f[I]n\f[R] to \f[B]1\f[R].
-.TP
-\f[B]ssize_t bcl_cmp(BclNumber\f[R] \f[I]a\f[R]\f[B], BclNumber\f[R] \f[I]b\f[R]\f[B])\f[R]
-Compares \f[I]a\f[R] and \f[I]b\f[R] and returns \f[B]0\f[R] if
+\f[B]void bcl_one(BclNumber\f[R] \f[I]n\f[R]**)**
+.PP
+: Sets \f[I]n\f[R] to \f[B]1\f[R].
+.PP
+\f[B]ssize_t bcl_cmp(BclNumber\f[R] \f[I]a\f[R]**, BclNumber**
+\f[I]b\f[R]**)**
+.PP
+: Compares \f[I]a\f[R] and \f[I]b\f[R] and returns \f[B]0\f[R] if
\f[I]a\f[R] and \f[I]b\f[R] are equal, \f[B]<0\f[R] if \f[I]a\f[R] is
less than \f[I]b\f[R], and \f[B]>0\f[R] if \f[I]a\f[R] is greater than
\f[I]b\f[R].
-.TP
-\f[B]BclError bcl_copy(BclNumber\f[R] \f[I]d\f[R]\f[B], BclNumber\f[R] \f[I]s\f[R]\f[B])\f[R]
-Copies \f[I]s\f[R] into \f[I]d\f[R].
-.RS
.PP
-If there was no error, \f[B]BCL_ERROR_NONE\f[R] is returned.
-Otherwise, this function can return:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]BclNumber bcl_dup(BclNumber\f[R] \f[I]s\f[R]\f[B])\f[R]
-Creates and returns a new \f[B]BclNumber\f[R] that is a copy of
-\f[I]s\f[R].
-.RS
+\f[B]BclError bcl_copy(BclNumber\f[R] \f[I]d\f[R]**, BclNumber**
+\f[I]s\f[R]**)**
.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
+: Copies \f[I]s\f[R] into \f[I]d\f[R].
+.IP
+.nf
+\f[C]
+If there was no error, **BCL_ERROR_NONE** is returned. Otherwise, this
+function can return:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
+.PP
+\f[B]BclNumber bcl_dup(BclNumber\f[R] \f[I]s\f[R]**)**
+.PP
+: Creates and returns a new \f[B]BclNumber\f[R] that is a copy of
+\f[I]s\f[R].
+.IP
+.nf
+\f[C]
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.SS Pseudo-Random Number Generator
.PP
The pseudo-random number generator in bcl(3) is a \f[I]seeded\f[R] PRNG.
@@ -939,7 +984,7 @@ pseudo-random numbers twice.
.PP
By default, bcl(3) attempts to seed the PRNG with data from
\f[B]/dev/urandom\f[R].
-If that fails, it seeds itself with by calling \f[B]libc\f[R]\[cq]s
+If that fails, it seeds itself with by calling \f[B]libc\f[R]\[aq]s
\f[B]srand(time(NULL))\f[R] and then calling \f[B]rand()\f[R] for each
byte, since \f[B]rand()\f[R] is only guaranteed to return \f[B]15\f[R]
bits.
@@ -954,29 +999,34 @@ functions:
.IP \[bu] 2
\f[B]bcl_rand_seed(unsigned char[BC_SEED_SIZE])\f[R]
.IP \[bu] 2
-\f[B]bcl_rand_reseed(\f[R]\f[I]void\f[R]\f[B])\f[R]
+\f[B]bcl_rand_reseed(\f[BI]\f[I]void\f[BI]\f[B])\f[R]
.PP
The following items allow clients to use the pseudo-random number
generator.
All procedures require a valid current context.
-.TP
+.PP
\f[B]BCL_SEED_ULONGS\f[R]
-The number of \f[B]unsigned long\f[R]\[cq]s in a seed for bcl(3)\[cq]s
+.PP
+: The number of \f[B]unsigned long\f[R]\[aq]s in a seed for bcl(3)\[aq]s
random number generator.
-.TP
+.PP
\f[B]BCL_SEED_SIZE\f[R]
-The size, in \f[B]char\f[R]\[cq]s, of a seed for bcl(3)\[cq]s random
+.PP
+: The size, in \f[B]char\f[R]\[aq]s, of a seed for bcl(3)\[aq]s random
number generator.
-.TP
+.PP
\f[B]BclBigDig\f[R]
-bcl(3)\[cq]s overflow type (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
+: bcl(3)\[aq]s overflow type (see the \f[B]PERFORMANCE\f[R] section).
+.PP
\f[B]BclRandInt\f[R]
-An unsigned integer type returned by bcl(3)\[cq]s random number
+.PP
+: An unsigned integer type returned by bcl(3)\[aq]s random number
generator.
-.TP
-\f[B]BclNumber bcl_irand(BclNumber\f[R] \f[I]a\f[R]\f[B])\f[R]
-Returns a random number that is not larger than \f[I]a\f[R] in a new
+.PP
+\f[B]BclNumber bcl_irand(BclNumber\f[R] \f[I]a\f[R]**)**
+.PP
+: Returns a random number that is not larger than \f[I]a\f[R] in a new
number.
If \f[I]a\f[R] is \f[B]0\f[R] or \f[B]1\f[R], the new number is equal to
\f[B]0\f[R].
@@ -984,147 +1034,159 @@ The bound is unlimited, so it is not bound to the size of
\f[B]BclRandInt\f[R].
This is done by generating as many random numbers as necessary,
multiplying them by certain exponents, and adding them all together.
-.RS
-.PP
-\f[I]a\f[R] must be an integer and non-negative.
-.PP
-\f[I]a\f[R] is consumed; it cannot be used after the call.
-See the \f[B]Consumption and Propagation\f[R] subsection below.
-.PP
+.IP
+.nf
+\f[C]
+*a* must be an integer and non-negative.
+
+*a* is consumed; it cannot be used after the call. See the
+**Consumption and Propagation** subsection below.
+
This procedure requires a valid current context.
+
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_MATH_NEGATIVE**
+* **BCL_ERROR_MATH_NON_INTEGER**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_MATH_NEGATIVE\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_MATH_NON_INTEGER\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]BclNumber bcl_frand(size_t\f[R] \f[I]places\f[R]\f[B])\f[R]
-Returns a random number between \f[B]0\f[R] (inclusive) and \f[B]1\f[R]
-(exclusive) that has \f[I]places\f[R] decimal digits after the radix
-(decimal point).
-There are no limits on \f[I]places\f[R].
-.RS
+\f[B]BclNumber bcl_frand(size_t\f[R] \f[I]places\f[R]**)**
.PP
+: Returns a random number between \f[B]0\f[R] (inclusive) and
+\f[B]1\f[R] (exclusive) that has \f[I]places\f[R] decimal digits after
+the radix (decimal point).
+There are no limits on \f[I]places\f[R].
+.IP
+.nf
+\f[C]
This procedure requires a valid current context.
+
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]BclNumber bcl_ifrand(BclNumber\f[R] \f[I]a\f[R]\f[B], size_t\f[R] \f[I]places\f[R]\f[B])\f[R]
-Returns a random number less than \f[I]a\f[R] with \f[I]places\f[R]
+\f[B]BclNumber bcl_ifrand(BclNumber\f[R] \f[I]a\f[R]**, size_t**
+\f[I]places\f[R]**)**
+.PP
+: Returns a random number less than \f[I]a\f[R] with \f[I]places\f[R]
decimal digits after the radix (decimal point).
There are no limits on \f[I]a\f[R] or \f[I]places\f[R].
-.RS
-.PP
-\f[I]a\f[R] must be an integer and non-negative.
+.IP
+.nf
+\f[C]
+*a* must be an integer and non-negative.
+
+*a* is consumed; it cannot be used after the call. See the
+**Consumption and Propagation** subsection below.
+
+This procedure requires a valid current context.
+
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_MATH_NEGATIVE**
+* **BCL_ERROR_MATH_NON_INTEGER**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.PP
-\f[I]a\f[R] is consumed; it cannot be used after the call.
-See the \f[B]Consumption and Propagation\f[R] subsection below.
+\f[B]BclError bcl_rand_seedWithNum(BclNumber\f[R] \f[I]n\f[R]**)**
.PP
+: Seeds the PRNG with \f[I]n\f[R].
+.IP
+.nf
+\f[C]
+*n* is *not* consumed.
+
This procedure requires a valid current context.
+
+If there was no error, **BCL_ERROR_NONE** is returned. Otherwise, this
+function can return:
+
+* **BCL_ERROR_INVALID_NUM**
+* **BCL_ERROR_INVALID_CONTEXT**
+
+Note that if **bcl_rand_seed2num(***void***)** or
+**bcl_rand_seed2num_err(BclNumber)** are called right after this function,
+they are not guaranteed to return a number equal to *n*.
+\f[R]
+.fi
.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_MATH_NEGATIVE\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_MATH_NON_INTEGER\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]BclError bcl_rand_seedWithNum(BclNumber\f[R] \f[I]n\f[R]\f[B])\f[R]
-Seeds the PRNG with \f[I]n\f[R].
-.RS
-.PP
-\f[I]n\f[R] is \f[I]not\f[R] consumed.
+\f[B]BclError bcl_rand_seed(unsigned char\f[R]
+\f[I]seed\f[R]**[\f[I]\f[BI]BC_SEED_SIZE\f[I]\f[R]])**
.PP
-This procedure requires a valid current context.
+: Seeds the PRNG with the bytes in \f[I]seed\f[R].
+.IP
+.nf
+\f[C]
+If there was no error, **BCL_ERROR_NONE** is returned. Otherwise, this
+function can return:
+
+* **BCL_ERROR_INVALID_CONTEXT**
+\f[R]
+.fi
.PP
-If there was no error, \f[B]BCL_ERROR_NONE\f[R] is returned.
-Otherwise, this function can return:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_NUM\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
+\f[B]void bcl_rand_reseed(\f[BI]\f[I]void\f[BI]\f[B])\f[R]
.PP
-Note that if \f[B]bcl_rand_seed2num(\f[R]\f[I]void\f[R]\f[B])\f[R] or
-\f[B]bcl_rand_seed2num_err(BclNumber)\f[R] are called right after this
-function, they are not guaranteed to return a number equal to
-\f[I]n\f[R].
-.RE
-.TP
-\f[B]BclError bcl_rand_seed(unsigned char\f[R] \f[I]seed\f[R]\f[B][\f[R]\f[I]BC_SEED_SIZE\f[R]\f[B]])\f[R]
-Seeds the PRNG with the bytes in \f[I]seed\f[R].
-.RS
-.PP
-If there was no error, \f[B]BCL_ERROR_NONE\f[R] is returned.
-Otherwise, this function can return:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.RE
-.TP
-\f[B]void bcl_rand_reseed(\f[R]\f[I]void\f[R]\f[B])\f[R]
-Reseeds the PRNG with the default reseeding behavior.
+: Reseeds the PRNG with the default reseeding behavior.
First, it attempts to read data from \f[B]/dev/urandom\f[R] and falls
-back to \f[B]libc\f[R]\[cq]s \f[B]rand()\f[R].
-.RS
-.PP
+back to \f[B]libc\f[R]\[aq]s \f[B]rand()\f[R].
+.IP
+.nf
+\f[C]
This procedure cannot fail.
-.RE
-.TP
-\f[B]BclNumber bcl_rand_seed2num(\f[R]\f[I]void\f[R]\f[B])\f[R]
-Returns the current seed of the PRNG as a \f[B]BclNumber\f[R].
-.RS
+\f[R]
+.fi
+.PP
+\f[B]BclNumber bcl_rand_seed2num(\f[BI]\f[I]void\f[BI]\f[B])\f[R]
.PP
+: Returns the current seed of the PRNG as a \f[B]BclNumber\f[R].
+.IP
+.nf
+\f[C]
This procedure requires a valid current context.
+
+bcl(3) will encode an error in the return value, if there was one. The error
+can be queried with **bcl_err(BclNumber)**. Possible errors include:
+
+* **BCL_ERROR_INVALID_CONTEXT**
+* **BCL_ERROR_FATAL_ALLOC_ERR**
+\f[R]
+.fi
.PP
-bcl(3) will encode an error in the return value, if there was one.
-The error can be queried with \f[B]bcl_err(BclNumber)\f[R].
-Possible errors include:
-.IP \[bu] 2
-\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-.IP \[bu] 2
-\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-.RE
-.TP
-\f[B]BclRandInt bcl_rand_int(\f[R]\f[I]void\f[R]\f[B])\f[R]
-Returns a random integer between \f[B]0\f[R] and \f[B]BC_RAND_MAX\f[R]
-(inclusive).
-.RS
+\f[B]BclRandInt bcl_rand_int(\f[BI]\f[I]void\f[BI]\f[B])\f[R]
.PP
+: Returns a random integer between \f[B]0\f[R] and \f[B]BC_RAND_MAX\f[R]
+(inclusive).
+.IP
+.nf
+\f[C]
This procedure cannot fail.
-.RE
-.TP
-\f[B]BclRandInt bcl_rand_bounded(BclRandInt\f[R] \f[I]bound\f[R]\f[B])\f[R]
-Returns a random integer between \f[B]0\f[R] and \f[I]bound\f[R]
+\f[R]
+.fi
+.PP
+\f[B]BclRandInt bcl_rand_bounded(BclRandInt\f[R] \f[I]bound\f[R]**)**
+.PP
+: Returns a random integer between \f[B]0\f[R] and \f[I]bound\f[R]
(exclusive).
Bias is removed before returning the integer.
-.RS
-.PP
+.IP
+.nf
+\f[C]
This procedure cannot fail.
-.RE
+\f[R]
+.fi
.SS Consumption and Propagation
.PP
Some functions are listed as consuming some or all of their arguments.
@@ -1159,95 +1221,105 @@ if (bc_num_err(n) != BCL_ERROR_NONE) {
Most functions in bcl(3) return, directly or indirectly, any one of the
error codes defined in \f[B]BclError\f[R].
The complete list of codes is the following:
-.TP
+.PP
\f[B]BCL_ERROR_NONE\f[R]
-Success; no error occurred.
-.TP
+.PP
+: Success; no error occurred.
+.PP
\f[B]BCL_ERROR_INVALID_NUM\f[R]
-An invalid \f[B]BclNumber\f[R] was given as a parameter.
-.TP
+.PP
+: An invalid \f[B]BclNumber\f[R] was given as a parameter.
+.PP
\f[B]BCL_ERROR_INVALID_CONTEXT\f[R]
-An invalid \f[B]BclContext\f[R] is being used.
-.TP
+.PP
+: An invalid \f[B]BclContext\f[R] is being used.
+.PP
\f[B]BCL_ERROR_SIGNAL\f[R]
-A signal interrupted execution.
-.TP
+.PP
+: A signal interrupted execution.
+.PP
\f[B]BCL_ERROR_MATH_NEGATIVE\f[R]
-A negative number was given as an argument to a parameter that cannot
+.PP
+: A negative number was given as an argument to a parameter that cannot
accept negative numbers, such as for square roots.
-.TP
+.PP
\f[B]BCL_ERROR_MATH_NON_INTEGER\f[R]
-A non-integer was given as an argument to a parameter that cannot accept
-non-integer numbers, such as for the second parameter of
+.PP
+: A non-integer was given as an argument to a parameter that cannot
+accept non-integer numbers, such as for the second parameter of
\f[B]bcl_num_pow()\f[R].
-.TP
+.PP
\f[B]BCL_ERROR_MATH_OVERFLOW\f[R]
-A number that would overflow its result was given as an argument, such
+.PP
+: A number that would overflow its result was given as an argument, such
as for converting a \f[B]BclNumber\f[R] to a \f[B]BclBigDig\f[R].
-.TP
+.PP
\f[B]BCL_ERROR_MATH_DIVIDE_BY_ZERO\f[R]
-A divide by zero occurred.
-.TP
+.PP
+: A divide by zero occurred.
+.PP
\f[B]BCL_ERROR_PARSE_INVALID_STR\f[R]
-An invalid number string was passed to a parsing function.
-.RS
-.PP
-A valid number string can only be one radix (period).
-In addition, any lowercase ASCII letters, symbols, or non-ASCII
-characters are invalid.
-It is allowed for the first character to be a dash.
-In that case, the number is considered to be negative.
-.PP
-There is one exception to the above: one lowercase \f[B]e\f[R] is
-allowed in the number, after the radix, if it exists.
-If the letter \f[B]e\f[R] exists, the number is considered to be in
-scientific notation, where the part before the \f[B]e\f[R] is the
-number, and the part after, which must be an integer, is the exponent.
-There can be a dash right after the \f[B]e\f[R] to indicate a negative
+.PP
+: An invalid number string was passed to a parsing function.
+.IP
+.nf
+\f[C]
+A valid number string can only be one radix (period). In addition, any
+lowercase ASCII letters, symbols, or non-ASCII characters are invalid. It is
+allowed for the first character to be a dash. In that case, the number is
+considered to be negative.
+
+There is one exception to the above: one lowercase **e** is allowed in the
+number, after the radix, if it exists. If the letter **e** exists, the
+number is considered to be in scientific notation, where the part before the
+**e** is the number, and the part after, which must be an integer, is the
+exponent. There can be a dash right after the **e** to indicate a negative
exponent.
+
+**WARNING**: Both the number and the exponent in scientific notation are
+interpreted according to the current **ibase**, but the number is still
+multiplied by **10\[rs]\[ha]exponent** regardless of the current **ibase**. For
+example, if **ibase** is **16** and bcl(3) is given the number string
+**FFeA**, the resulting decimal number will be **2550000000000**, and if
+bcl(3) is given the number string **10e-4**, the resulting decimal number
+will be **0.0016**.
+\f[R]
+.fi
.PP
-\f[B]WARNING\f[R]: Both the number and the exponent in scientific
-notation are interpreted according to the current \f[B]ibase\f[R], but
-the number is still multiplied by \f[B]10\[ha]exponent\f[R] regardless
-of the current \f[B]ibase\f[R].
-For example, if \f[B]ibase\f[R] is \f[B]16\f[R] and bcl(3) is given the
-number string \f[B]FFeA\f[R], the resulting decimal number will be
-\f[B]2550000000000\f[R], and if bcl(3) is given the number string
-\f[B]10e-4\f[R], the resulting decimal number will be \f[B]0.0016\f[R].
-.RE
-.TP
\f[B]BCL_ERROR_FATAL_ALLOC_ERR\f[R]
-bcl(3) failed to allocate memory.
-.RS
-.PP
-If clients call \f[B]bcl_setAbortOnFatalError()\f[R] with an
-\f[B]true\f[R] argument, this error will cause bcl(3) to throw a
-\f[B]SIGABRT\f[R].
-This behavior can also be turned off later by calling that same function
-with a \f[B]false\f[R] argument.
+.PP
+: bcl(3) failed to allocate memory.
+.IP
+.nf
+\f[C]
+If clients call **bcl_setAbortOnFatalError()** with an **true** argument,
+this error will cause bcl(3) to throw a **SIGABRT**. This behavior can also
+be turned off later by calling that same function with a **false** argument.
By default, this behavior is off.
+
+It is highly recommended that client libraries do *not* activate this
+behavior.
+\f[R]
+.fi
.PP
-It is highly recommended that client libraries do \f[I]not\f[R] activate
-this behavior.
-.RE
-.TP
\f[B]BCL_ERROR_FATAL_UNKNOWN_ERR\f[R]
-An unknown error occurred.
-.RS
-.PP
-If clients call \f[B]bcl_setAbortOnFatalError()\f[R] with an
-\f[B]true\f[R] argument, this error will cause bcl(3) to throw a
-\f[B]SIGABRT\f[R].
-This behavior can also be turned off later by calling that same function
-with a \f[B]false\f[R] argument.
-By default, this behavior is off.
.PP
-It is highly recommended that client libraries do \f[I]not\f[R] activate
-this behavior.
-.RE
+: An unknown error occurred.
+.IP
+.nf
+\f[C]
+If clients call **bcl_setAbortOnFatalError()** with an **true** argument,
+this error will cause bcl(3) to throw a **SIGABRT**. This behavior can also
+be turned off later by calling that same function with a **false** argument.
+By default, this behavior is off.
+
+It is highly recommended that client libraries do *not* activate this
+behavior.
+\f[R]
+.fi
.SH ATTRIBUTES
.PP
-When \f[B]bcl_handleSignal(\f[R]\f[I]void\f[R]\f[B])\f[R] is used
+When \f[B]bcl_handleSignal(\f[BI]\f[I]void\f[BI]\f[B])\f[R] is used
properly, bcl(3) is async-signal-safe.
.PP
bcl(3) is \f[I]MT-Unsafe\f[R]: it is unsafe to call any functions from
@@ -1275,48 +1347,57 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on bcl(3):
-.TP
+.PP
\f[B]BC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
bcl(3) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]BC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]BC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]BC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]BC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]BC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]BC_BASE_POW\f[R].
-.TP
+.PP
\f[B]BC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]BC_RAND_MAX\f[R]
-The maximum integer (inclusive) returned by the \f[B]bcl_rand_int()\f[R]
-function.
+.PP
+: The maximum integer (inclusive) returned by the
+\f[B]bcl_rand_int()\f[R] function.
Set at \f[B]2\[ha]BC_LONG_BIT-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]BC_OVERFLOW_MAX\f[R].
.PP
These limits are meant to be effectively non-existent; the limits are so
@@ -1326,7 +1407,7 @@ In fact, memory should be exhausted before these limits should be hit.
.SH SIGNAL HANDLING
.PP
If a signal handler calls
-\f[B]bcl_handleSignal(\f[R]\f[I]void\f[R]\f[B])\f[R] from the same
+\f[B]bcl_handleSignal(\f[BI]\f[I]void\f[BI]\f[B])\f[R] from the same
thread that there are bcl(3) functions executing in, it will cause all
execution to stop as soon as possible, interrupting long-running
calculations, if necessary and cause the function that was executing to
@@ -1334,11 +1415,11 @@ return.
If possible, the error code \f[B]BC_ERROR_SIGNAL\f[R] is returned.
.PP
If execution \f[I]is\f[R] interrupted,
-\f[B]bcl_handleSignal(\f[R]\f[I]void\f[R]\f[B])\f[R] does \f[I]not\f[R]
-return to its caller.
+\f[B]bcl_handleSignal(\f[BI]\f[I]void\f[BI]\f[B])\f[R] does
+\f[I]not\f[R] return to its caller.
.PP
It is undefined behavior if
-\f[B]bcl_handleSignal(\f[R]\f[I]void\f[R]\f[B])\f[R] is called from a
+\f[B]bcl_handleSignal(\f[BI]\f[I]void\f[BI]\f[B])\f[R] is called from a
thread that is not executing bcl(3) functions, if bcl(3) functions are
executing.
.SH SEE ALSO
diff --git a/contrib/bc/manuals/build.md b/contrib/bc/manuals/build.md
index a58da6d427ed..656aa5250739 100644
--- a/contrib/bc/manuals/build.md
+++ b/contrib/bc/manuals/build.md
@@ -37,9 +37,50 @@ See [Build Environment Variables][4] for a more detailed description of all
accepted environment variables and [Build Options][5] for more detail about all
accepted build options.
+## Windows
+
+On Windows, this `bc` can be built using Visual Studio or MSBuild.
+
+However, only one build configuration (besides Debug or Release) is supported:
+extra math and prompt enabled, history and NLS (locale support) disabled, with
+both calculators built.
+
+The library can also be built on Windows.
+
+### Visual Studio
+
+In Visual Studio, open up the solution file (`bc.sln` for `bc`, or `bcl.sln` for
+the library), select the desired configuration, and build.
+
+### MSBuild
+
+To build with MSBuild, first, *be sure that you are using the MSBuild that comes
+with Visual Studio*.
+
+To build `bc`, run the following from the root directory:
+
+```
+msbuild -property:Configuration=<config> bc.sln
+```
+
+where `<config>` is either one of `Debug` or `Release`.
+
+To build the library, run the following from the root directory:
+
+```
+msbuild -property:Configuration=<config> bcl.sln
+```
+
+where `<config>` is either one of `Debug` or `Release`.
+
+## POSIX-Compatible Systems
+
+Building `bc`, `dc`, and `bcl` (the library) is more complex than on Windows
+because many build options are supported.
+
<a name="cross-compiling"/>
-## Cross Compiling
+### Cross Compiling
To cross-compile this `bc`, an appropriate compiler must be present and assigned
to the environment variable `HOSTCC` or `HOST_CC` (the two are equivalent,
@@ -69,7 +110,7 @@ the environment variable `GEN_EMU`.
<a name="build-environment-variables"/>
-## Build Environment Variables
+### Build Environment Variables
This `bc` supports `CC`, `HOSTCC`, `HOST_CC`, `CFLAGS`, `HOSTCFLAGS`,
`HOST_CFLAGS`, `CPPFLAGS`, `LDFLAGS`, `LDLIBS`, `PREFIX`, `DESTDIR`, `BINDIR`,
@@ -81,7 +122,7 @@ put into the generated Makefile.
More detail on what those environment variables do can be found in the following
sections.
-### `CC`
+#### `CC`
C compiler for the target system. `CC` must be compatible with POSIX `c99`
behavior and options. However, **I encourage users to use any C99 or C11
@@ -104,33 +145,33 @@ automatically moved into HOSTCFLAGS.
Defaults to `$CC`.
-### `CFLAGS`
+#### `CFLAGS`
Command-line flags that will be passed verbatim to `CC`.
Defaults to empty.
-### `HOSTCFLAGS` or `HOST_CFLAGS`
+#### `HOSTCFLAGS` or `HOST_CFLAGS`
Command-line flags that will be passed verbatim to `HOSTCC` or `HOST_CC`.
Defaults to `$CFLAGS`.
-### `CPPFLAGS`
+#### `CPPFLAGS`
Command-line flags for the C preprocessor. These are also passed verbatim to
both compilers (`CC` and `HOSTCC`); they are supported just for legacy reasons.
Defaults to empty.
-### `LDFLAGS`
+#### `LDFLAGS`
Command-line flags for the linker. These are also passed verbatim to both
compilers (`CC` and `HOSTCC`); they are supported just for legacy reasons.
Defaults to empty.
-### `LDLIBS`
+#### `LDLIBS`
Libraries to link to. These are also passed verbatim to both compilers (`CC` and
`HOSTCC`); they are supported just for legacy reasons and for cross compiling
@@ -138,7 +179,7 @@ with different C standard libraries (like [musl][3]).
Defaults to empty.
-### `PREFIX`
+#### `PREFIX`
The prefix to install to.
@@ -146,7 +187,7 @@ Can be overridden by passing the `--prefix` option to `configure.sh`.
Defaults to `/usr/local`.
-### `DESTDIR`
+#### `DESTDIR`
Path to prepend onto `PREFIX`. This is mostly for distro and package
maintainers.
@@ -156,7 +197,7 @@ to both, the one given to `configure.sh` takes precedence.
Defaults to empty.
-### `BINDIR`
+#### `BINDIR`
The directory to install binaries in.
@@ -164,7 +205,7 @@ Can be overridden by passing the `--bindir` option to `configure.sh`.
Defaults to `$PREFIX/bin`.
-### `INCLUDEDIR`
+#### `INCLUDEDIR`
The directory to install header files in.
@@ -172,7 +213,7 @@ Can be overridden by passing the `--includedir` option to `configure.sh`.
Defaults to `$PREFIX/include`.
-### `LIBDIR`
+#### `LIBDIR`
The directory to install libraries in.
@@ -180,7 +221,7 @@ Can be overridden by passing the `--libdir` option to `configure.sh`.
Defaults to `$PREFIX/lib`.
-### `DATAROOTDIR`
+#### `DATAROOTDIR`
The root directory to install data files in.
@@ -188,7 +229,7 @@ Can be overridden by passing the `--datarootdir` option to `configure.sh`.
Defaults to `$PREFIX/share`.
-### `DATADIR`
+#### `DATADIR`
The directory to install data files in.
@@ -196,7 +237,7 @@ Can be overridden by passing the `--datadir` option to `configure.sh`.
Defaults to `$DATAROOTDIR`.
-### `MANDIR`
+#### `MANDIR`
The directory to install manpages in.
@@ -204,7 +245,7 @@ Can be overridden by passing the `--mandir` option to `configure.sh`.
Defaults to `$DATADIR/man`
-### `MAN1DIR`
+#### `MAN1DIR`
The directory to install Section 1 manpages in. Because both `bc` and `dc` are
Section 1 commands, this is the only relevant section directory.
@@ -213,7 +254,7 @@ Can be overridden by passing the `--man1dir` option to `configure.sh`.
Defaults to `$MANDIR/man1`.
-### `LOCALEDIR`
+#### `LOCALEDIR`
The directory to install locales in.
@@ -221,7 +262,7 @@ Can be overridden by passing the `--localedir` option to `configure.sh`.
Defaults to `$DATAROOTDIR/locale`.
-### `EXECSUFFIX`
+#### `EXECSUFFIX`
The suffix to append onto the executable names *when installing*. This is for
packagers and distro maintainers who want this `bc` as an option, but do not
@@ -229,7 +270,7 @@ want to replace the default `bc`.
Defaults to empty.
-### `EXECPREFIX`
+#### `EXECPREFIX`
The prefix to append onto the executable names *when building and installing*.
This is for packagers and distro maintainers who want this `bc` as an option,
@@ -237,7 +278,7 @@ but do not want to replace the default `bc`.
Defaults to empty.
-### `LONG_BIT`
+#### `LONG_BIT`
The number of bits in a C `long` type. This is mostly for the embedded space.
@@ -254,7 +295,7 @@ compliance with the `bc` spec, the minimum allowed value is `32`.
It is an error if the specified value is greater than the default value of
`LONG_BIT` for the target platform.
-### `GEN_HOST`
+#### `GEN_HOST`
Whether to use `gen/strgen.c`, instead of `gen/strgen.sh`, to produce the C
files that contain the help texts as well as the math libraries. By default,
@@ -274,7 +315,7 @@ or a non-existent value, will cause the build system to compile and run
Default is "".
-### `GEN_EMU`
+#### `GEN_EMU`
The emulator to run bootstrap binaries under. This is only if the binaries
produced by `HOSTCC` (or `HOST_CC`) need to be run under an emulator to work.
@@ -283,7 +324,7 @@ Defaults to empty.
<a name="build-options"/>
-## Build Options
+### Build Options
This `bc` comes with several build options, all of which are enabled by default.
@@ -298,7 +339,7 @@ following forms:
--option=arg
```
-### Library
+#### Library
To build the math library, use the following commands for the configure step:
@@ -321,7 +362,7 @@ is installed.
The library is built as `bin/libbcl.a`.
-### `bc` Only
+#### `bc` Only
To build `bc` only (no `dc`), use any one of the following commands for the
configure step:
@@ -338,7 +379,7 @@ Those commands are all equivalent.
***Warning***: It is an error to use those options if `bc` has also been
disabled (see below).
-### `dc` Only
+#### `dc` Only
To build `dc` only (no `bc`), use either one of the following commands for the
configure step:
@@ -357,7 +398,7 @@ disabled (see above).
<a name="build-history"/>
-### History
+#### History
To disable signal handling, pass either the `-H` flag or the `--disable-history`
option to `configure.sh`, as follows:
@@ -376,7 +417,7 @@ platform that does not support the terminal handling that is required.
completely portable. If the `bc` does not work on your platform, your first step
should be to retry with history disabled.
-### NLS (Locale Support)
+#### NLS (Locale Support)
To disable locale support (use only English), pass either the `-N` flag or the
`--disable-nls` option to `configure.sh`, as follows:
@@ -391,7 +432,7 @@ Both commands are equivalent.
NLS (locale support) is automatically disabled when building for Windows or on
another platform that does not support the POSIX locale API or utilities.
-### Prompt
+#### Prompt
By default, `bc` and `dc` print a prompt when in interactive mode. They both
have the command-line option `-P`/`--no-prompt`, which turns that off, but it
@@ -405,7 +446,7 @@ can be disabled permanently in the build by passing the `-P` flag or the
Both commands are equivalent.
-### Locales
+#### Locales
By default, `bc` and `dc` do not install all locales, but only the enabled
locales. If `DESTDIR` exists and is not empty, then they will install all of
@@ -421,7 +462,7 @@ have, regardless. To enable that behavior, you can pass the `-l` flag or the
Both commands are equivalent.
-### Extra Math
+#### Extra Math
This `bc` has 7 extra operators:
@@ -458,7 +499,7 @@ This `bc` also has a larger library that is only enabled if extra operators and
the pseudo-random number generator are. More information about the functions can
be found in the Extended Library section of the full manual.
-### Manpages
+#### Manpages
To disable installing manpages, pass either the `-M` flag or the
`--disable-man-pages` option to `configure.sh` as follows:
@@ -470,7 +511,7 @@ To disable installing manpages, pass either the `-M` flag or the
Both commands are equivalent.
-### Karatsuba Length
+#### Karatsuba Length
The Karatsuba length is the point at which `bc` and `dc` switch from Karatsuba
multiplication to brute force, `O(n^2)` multiplication. It can be set by passing
@@ -489,7 +530,7 @@ Default is `64`.
to `16` (to prevent stack overflow). If it is not, `configure.sh` will give an
error.
-### Install Options
+#### Install Options
The relevant `autotools`-style install options are supported in `configure.sh`:
@@ -520,7 +561,7 @@ environment variable is overridden.
other command-line options must be used. Mixing long and short options is not
supported.
-## Optimization
+### Optimization
The `configure.sh` script will accept an optimization level to pass to the
compiler. Because `bc` is orders of magnitude faster with optimization, I
@@ -560,7 +601,7 @@ I do **NOT*** recommend building with `-march=native`; doing so reduces this
Manual stripping is not necessary; non-debug builds are automatically stripped
in the link stage.
-## Debug Builds
+### Debug Builds
Debug builds (which also disable optimization if no optimization level is given
and if no extra `CFLAGS` are given) can be enabled with either the `-g` flag or
@@ -580,7 +621,7 @@ make
make install
```
-## Stripping Binaries
+### Stripping Binaries
By default, when `bc` and `dc` are not built in debug mode, the binaries are
stripped. Stripping can be disabled with either the `-T` or the
@@ -600,7 +641,7 @@ make
make install
```
-## Binary Size
+### Binary Size
When built with both calculators, all available features, and `-Os` using
`clang` and `musl`, the executable is 140.4 kb (140,386 bytes) on `x86_64`. That
@@ -649,7 +690,7 @@ kb (107,576 bytes) without history and with extra math support, and 95.3 kb
optimizations. These builds were done on an `x86_64` machine running Gentoo
Linux.
-## Testing
+### Testing
The default test suite can be run with the following command:
diff --git a/contrib/bc/manuals/dc.1.md.in b/contrib/bc/manuals/dc.1.md.in
index c5c361fe271a..56417d73f9dd 100644
--- a/contrib/bc/manuals/dc.1.md.in
+++ b/contrib/bc/manuals/dc.1.md.in
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -82,7 +82,7 @@ The following are the options that dc(1) accepts.
{{ A E H N EH EN HN EHN }}
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
{{ end }}
@@ -92,6 +92,25 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+{{ A E H N EH EN HN EHN }}
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in dc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of dc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **?** command is used.
+{{ end }}
+{{ P EP HP NP EHP ENP HNP EHNP }}
+: This option is a no-op.
+{{ end }}
+
+ This is a **non-portable extension**.
+
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@@ -576,25 +595,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
-**s***r*
+**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
-**l***r*
+**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
-**S***r*
+**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
-**L***r*
+**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
- now accessible via the **l***r* command.
+ now accessible via the **l**_r_ command.
## Parameters
@@ -761,7 +780,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-**\>***r*
+**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@@ -773,7 +792,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**>***r***e***s*
+**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -782,7 +801,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\>***r*
+**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@@ -791,7 +810,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\>***r***e***s*
+**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -800,7 +819,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**\<***r*
+**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@@ -809,7 +828,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**\<***r***e***s*
+**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -818,7 +837,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\<***r*
+**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@@ -827,7 +846,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\<***r***e***s*
+**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -836,7 +855,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**=***r*
+**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@@ -845,7 +864,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**=***r***e***s*
+**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -854,7 +873,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!=***r*
+**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@@ -863,7 +882,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!=***r***e***s*
+**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -919,12 +938,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
-**:***r*
+**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
-**;***r*
+**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.
diff --git a/contrib/bc/manuals/dc/A.1 b/contrib/bc/manuals/dc/A.1
index 7b91c02039e4..67bcf9e86d9f 100644
--- a/contrib/bc/manuals/dc/A.1
+++ b/contrib/bc/manuals/dc/A.1
@@ -25,18 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+\f[B]dc\f[R] [\f[B]-hiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
-[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-read-prompt\f[R]] [\f[B]--extended-register\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -70,84 +70,115 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.SH OPTIONS
.PP
The following are the options that dc(1) accepts.
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.TP
+.PP
+: Print the version information (copyright header) and exit.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-Disables the prompt in TTY mode.
+.PP
+: Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
-See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
do not want a prompt or are not used to having them in dc(1).
Most of those users would want to put this option in
\f[B]DC_ENV_ARGS\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: Disables the read prompt in TTY mode.
+(The read prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a read prompt or are not used to having them in dc(1).
+Most of those users would want to put this option in
+\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
+This option is also useful in hash bang lines of dc(1) scripts that
+prompt for user input.
+.IP
+.nf
+\f[C]
+This option does not disable the regular prompt because the read prompt is
+only used when the **?** command is used.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-x\f[R] \f[B]--extended-register\f[R]
-Enables extended register mode.
+.PP
+: Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]DC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -190,7 +221,7 @@ Input is processed immediately when entered.
.PP
\f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to interpret constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
@@ -200,7 +231,7 @@ programs with the \f[B]T\f[R] command.
.PP
\f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
@@ -236,13 +267,13 @@ Likewise, when a value is assigned to \f[B]seed\f[R], it is not
guaranteed that querying \f[B]seed\f[R] immediately after will return
the same value.
In addition, the value of \f[B]seed\f[R] will change after any call to
-the \f[B]\[cq]\f[R] command or the \f[B]\[dq]\f[R] command that does not
+the \f[B]\[aq]\f[R] command or the \f[B]\[dq]\f[R] command that does not
get receive a value of \f[B]0\f[R] or \f[B]1\f[R].
-The maximum integer returned by the \f[B]\[cq]\f[R] command can be
+The maximum integer returned by the \f[B]\[aq]\f[R] command can be
queried with the \f[B]W\f[R] command.
.PP
\f[B]Note\f[R]: The values returned by the pseudo-random number
-generator with the \f[B]\[cq]\f[R] and \f[B]\[dq]\f[R] commands are
+generator with the \f[B]\[aq]\f[R] and \f[B]\[dq]\f[R] commands are
guaranteed to \f[B]NOT\f[R] be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator.
However, they \f[I]are\f[R] guaranteed to be reproducible with identical
@@ -311,272 +342,340 @@ To deactivate them, just assign a different value to \f[B]obase\f[R].
.PP
Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
-.TP
+.PP
\f[B]p\f[R]
-Prints the value on top of the stack, whether number or string, and
-prints a newline after.
-.RS
.PP
+: Prints the value on top of the stack, whether number or string, and
+prints a newline after.
+.IP
+.nf
+\f[C]
This does not alter the stack.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]n\f[R]
-Prints the value on top of the stack, whether number or string, and pops
-it off of the stack.
-.TP
+.PP
+: Prints the value on top of the stack, whether number or string, and
+pops it off of the stack.
+.PP
\f[B]P\f[R]
-Pops a value off the stack.
-.RS
.PP
+: Pops a value off the stack.
+.IP
+.nf
+\f[C]
If the value is a number, it is truncated and the absolute value of the
-result is printed as though \f[B]obase\f[R] is \f[B]UCHAR_MAX+1\f[R] and
-each digit is interpreted as an ASCII character, making it a byte
-stream.
-.PP
+result is printed as though **obase** is **UCHAR_MAX+1** and each digit is
+interpreted as an ASCII character, making it a byte stream.
+
If the value is a string, it is printed without a trailing newline.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]f\f[R]
-Prints the entire contents of the stack, in order from newest to oldest,
-without altering anything.
-.RS
.PP
+: Prints the entire contents of the stack, in order from newest to
+oldest, without altering anything.
+.IP
+.nf
+\f[C]
Users should use this command when they get lost.
-.RE
+\f[R]
+.fi
.SS Arithmetic
.PP
These are the commands used for arithmetic.
-.TP
+.PP
\f[B]+\f[R]
-The top two values are popped off the stack, added, and the result is
+.PP
+: The top two values are popped off the stack, added, and the result is
pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]-\f[R]
-The top two values are popped off the stack, subtracted, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, subtracted, and the
+result is pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]*\f[R]
-The top two values are popped off the stack, multiplied, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, multiplied, and the
+result is pushed onto the stack.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The top two values are popped off the stack, divided, and the result is
-pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
-The first value popped off of the stack must be non-zero.
-.RE
-.TP
-\f[B]%\f[R]
-The top two values are popped off the stack, remaindered, and the result
+: The top two values are popped off the stack, divided, and the result
is pushed onto the stack.
-.RS
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be non-zero.
+\f[R]
+.fi
.PP
-Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
-\f[B]scale\f[R], and 2) Using the result of step 1 to calculate
-\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
-\f[B]max(scale+scale(b),scale(a))\f[R].
+\f[B]%\f[R]
.PP
+: The top two values are popped off the stack, remaindered, and the
+result is pushed onto the stack.
+.IP
+.nf
+\f[C]
+Remaindering is equivalent to 1) Computing **a/b** to current **scale**, and
+2) Using the result of step 1 to calculate **a-(a/b)\[rs]*b** to *scale*
+**max(scale+scale(b),scale(a))**.
+
The first value popped off of the stack must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]\[ti]\f[R]
-The top two values are popped off the stack, divided and remaindered,
+.PP
+: The top two values are popped off the stack, divided and remaindered,
and the results (divided first, remainder second) are pushed onto the
stack.
This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
\f[B]y\f[R] are only evaluated once.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be non-zero.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The top two values are popped off the stack, the second is raised to the
-power of the first, and the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top two values are popped off the stack, the second is raised to
+the power of the first, and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be an integer, and if that
value is negative, the second value popped off of the stack must be
non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]v\f[R]
-The top value is popped off the stack, its square root is computed, and
-the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top value is popped off the stack, its square root is computed,
+and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The value popped off of the stack must be non-negative.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]_\f[R]
-If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
-or other commands), then that number is input as a negative number.
-.RS
-.PP
-Otherwise, the top value on the stack is popped and copied, and the copy
-is negated and pushed onto the stack.
-This behavior without a number is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+.PP
+: If this command \f[I]immediately\f[R] precedes a number (i.e., no
+spaces or other commands), then that number is input as a negative
+number.
+.IP
+.nf
+\f[C]
+Otherwise, the top value on the stack is popped and copied, and the copy is
+negated and pushed onto the stack. This behavior without a number is a
+**non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]b\f[R]
-The top value is popped off the stack, and if it is zero, it is pushed
+.PP
+: The top value is popped off the stack, and if it is zero, it is pushed
back onto the stack.
Otherwise, its absolute value is pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]|\f[R]
-The top three values are popped off the stack, a modular exponentiation
-is computed, and the result is pushed onto the stack.
-.RS
.PP
+: The top three values are popped off the stack, a modular
+exponentiation is computed, and the result is pushed onto the stack.
+.IP
+.nf
+\f[C]
The first value popped is used as the reduction modulus and must be an
-integer and non-zero.
-The second value popped is used as the exponent and must be an integer
-and non-negative.
-The third value popped is the base and must be an integer.
+integer and non-zero. The second value popped is used as the exponent and
+must be an integer and non-negative. The third value popped is the base and
+must be an integer.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]$\f[R]
-The top value is popped off the stack and copied, and the copy is
+.PP
+: The top value is popped off the stack and copied, and the copy is
truncated and pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[at]\f[R]
-The top two values are popped off the stack, and the precision of the
+.PP
+: The top two values are popped off the stack, and the precision of the
second is set to the value of the first, whether by truncation or
extension.
-.RS
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]H\f[R]
-The top two values are popped off the stack, and the second is shifted
-left (radix shifted right) to the value of the first.
-.RS
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+: The top two values are popped off the stack, and the second is shifted
+left (radix shifted right) to the value of the first.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]h\f[R]
-The top two values are popped off the stack, and the second is shifted
-right (radix shifted left) to the value of the first.
-.RS
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+: The top two values are popped off the stack, and the second is shifted
+right (radix shifted left) to the value of the first.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]G\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]N\f[R]
-The top value is popped off of the stack, and if it a \f[B]0\f[R], a
+.PP
+: The top value is popped off of the stack, and if it a \f[B]0\f[R], a
\f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B](\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]{\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than or equal to the second,
-or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than or equal to the
+second, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B])\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]}\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than or equal to the
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than or equal to the
second, or \f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]M\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If they are both non-zero, a \f[B]1\f[R] is pushed onto the stack.
If either of them is zero, or both of them are, then a \f[B]0\f[R] is
pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is like the **&&** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]m\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If at least one of them is non-zero, a \f[B]1\f[R] is pushed onto the
stack.
If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is like the **||** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Pseudo-Random Number Generator
.PP
dc(1) has a built-in pseudo-random number generator.
@@ -586,20 +685,24 @@ controls the pseudo-random number generator.)
.PP
The pseudo-random number generator is guaranteed to \f[B]NOT\f[R] be
cryptographically secure.
-.TP
-\f[B]\[cq]\f[R]
-Generates an integer between 0 and \f[B]DC_RAND_MAX\f[R], inclusive (see
-the \f[B]LIMITS\f[R] section).
-.RS
.PP
+\f[B]\[aq]\f[R]
+.PP
+: Generates an integer between 0 and \f[B]DC_RAND_MAX\f[R], inclusive
+(see the \f[B]LIMITS\f[R] section).
+.IP
+.nf
+\f[C]
The generated integer is made as unbiased as possible, subject to the
limitations of the pseudo-random number generator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[dq]\f[R]
-Pops a value off of the stack, which is used as an \f[B]exclusive\f[R]
+.PP
+: Pops a value off of the stack, which is used as an \f[B]exclusive\f[R]
upper bound on the integer that will be generated.
If the bound is negative or is a non-integer, an error is raised, and
dc(1) resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R]
@@ -614,48 +717,58 @@ Using this command will change the value of \f[B]seed\f[R], unless the
operand is \f[B]0\f[R] or \f[B]1\f[R].
In that case, \f[B]0\f[R] is pushed onto the stack, and \f[B]seed\f[R]
is \f[I]not\f[R] changed.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The generated integer is made as unbiased as possible, subject to the
limitations of the pseudo-random number generator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Stack Control
.PP
These commands control the stack.
-.TP
+.PP
\f[B]c\f[R]
-Removes all items from (\[lq]clears\[rq]) the stack.
-.TP
+.PP
+: Removes all items from (\[dq]clears\[dq]) the stack.
+.PP
\f[B]d\f[R]
-Copies the item on top of the stack (\[lq]duplicates\[rq]) and pushes
+.PP
+: Copies the item on top of the stack (\[dq]duplicates\[dq]) and pushes
the copy onto the stack.
-.TP
+.PP
\f[B]r\f[R]
-Swaps (\[lq]reverses\[rq]) the two top items on the stack.
-.TP
+.PP
+: Swaps (\[dq]reverses\[dq]) the two top items on the stack.
+.PP
\f[B]R\f[R]
-Pops (\[lq]removes\[rq]) the top value from the stack.
+.PP
+: Pops (\[dq]removes\[dq]) the top value from the stack.
.SS Register Control
.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
-.TP
+.PP
\f[B]s\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack and stores it into register
+.PP
+: Pops the value off the top of the stack and stores it into register
\f[I]r\f[R].
-.TP
+.PP
\f[B]l\f[R]\f[I]r\f[R]
-Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
+.PP
+: Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
This does not alter the contents of \f[I]r\f[R].
-.TP
+.PP
\f[B]S\f[R]\f[I]r\f[R]
-Pops the value off the top of the (main) stack and pushes it onto the
+.PP
+: Pops the value off the top of the (main) stack and pushes it onto the
stack of register \f[I]r\f[R].
The previous value of the register becomes inaccessible.
-.TP
+.PP
\f[B]L\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack for register \f[I]r\f[R] and
+.PP
+: Pops the value off the top of the stack for register \f[I]r\f[R] and
push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
@@ -664,113 +777,137 @@ accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
\f[B]scale\f[R], and \f[B]seed\f[R].
Also see the \f[B]SYNTAX\f[R] section.
-.TP
+.PP
\f[B]i\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
inclusive.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]o\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]obase\f[R], which must be between \f[B]0\f[R] and
\f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section and
the \f[B]NUMBERS\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]k\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]scale\f[R], which must be non-negative.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]j\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]seed\f[R].
The meaning of \f[B]seed\f[R] is dependent on the current pseudo-random
number generator but is guaranteed to not change except for new major
versions.
-.RS
+.IP
+.nf
+\f[C]
+The *scale* and sign of the value may be significant.
+
+If a previously used **seed** value is used again, the pseudo-random number
+generator is guaranteed to produce the same sequence of pseudo-random
+numbers as it did when the **seed** value was previously used.
+
+The exact value assigned to **seed** is not guaranteed to be returned if the
+**J** command is used. However, if **seed** *does* return a different value,
+both values, when assigned to **seed**, are guaranteed to produce the same
+sequence of pseudo-random numbers. This means that certain values assigned
+to **seed** will not produce unique sequences of pseudo-random numbers.
+
+There is no limit to the length (number of significant decimal digits) or
+*scale* of the value that can be assigned to **seed**.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The \f[I]scale\f[R] and sign of the value may be significant.
+\f[B]I\f[R]
.PP
-If a previously used \f[B]seed\f[R] value is used again, the
-pseudo-random number generator is guaranteed to produce the same
-sequence of pseudo-random numbers as it did when the \f[B]seed\f[R]
-value was previously used.
+: Pushes the current value of \f[B]ibase\f[R] onto the main stack.
.PP
-The exact value assigned to \f[B]seed\f[R] is not guaranteed to be
-returned if the \f[B]J\f[R] command is used.
-However, if \f[B]seed\f[R] \f[I]does\f[R] return a different value, both
-values, when assigned to \f[B]seed\f[R], are guaranteed to produce the
-same sequence of pseudo-random numbers.
-This means that certain values assigned to \f[B]seed\f[R] will not
-produce unique sequences of pseudo-random numbers.
+\f[B]O\f[R]
.PP
-There is no limit to the length (number of significant decimal digits)
-or \f[I]scale\f[R] of the value that can be assigned to \f[B]seed\f[R].
+: Pushes the current value of \f[B]obase\f[R] onto the main stack.
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]I\f[R]
-Pushes the current value of \f[B]ibase\f[R] onto the main stack.
-.TP
-\f[B]O\f[R]
-Pushes the current value of \f[B]obase\f[R] onto the main stack.
-.TP
\f[B]K\f[R]
-Pushes the current value of \f[B]scale\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]scale\f[R] onto the main stack.
+.PP
\f[B]J\f[R]
-Pushes the current value of \f[B]seed\f[R] onto the main stack.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Pushes the current value of \f[B]seed\f[R] onto the main stack.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]T\f[R]
-Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]U\f[R]
-Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]V\f[R]
-Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]W\f[R]
-Pushes the maximum (inclusive) integer that can be generated with the
-\f[B]\[cq]\f[R] pseudo-random number generator command.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+: Pushes the maximum (inclusive) integer that can be generated with the
+\f[B]\[aq]\f[R] pseudo-random number generator command.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Strings
.PP
The following commands control strings.
@@ -787,233 +924,292 @@ Strings can also be executed as macros.
For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
printed with a newline after and then popped from the stack.
-.TP
-\f[B][\f[R]_characters_\f[B]]\f[R]
-Makes a string containing \f[I]characters\f[R] and pushes it onto the
-stack.
-.RS
.PP
-If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
-they must be balanced.
-Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
-character.
+\f[B][\f[R]\f[I]characters\f[R]\f[B]]\f[R]
.PP
+: Makes a string containing \f[I]characters\f[R] and pushes it onto the
+stack.
+.IP
+.nf
+\f[C]
+If there are brackets (**\[rs][** and **\[rs]]**) in the string, then they must be
+balanced. Unbalanced brackets can be escaped using a backslash (**\[rs]\[rs]**)
+character.
+
If there is a backslash character in the string, the character after it
-(even another backslash) is put into the string verbatim, but the
-(first) backslash is not.
-.RE
-.TP
-\f[B]a\f[R]
-The value on top of the stack is popped.
-.RS
+(even another backslash) is put into the string verbatim, but the (first)
+backslash is not.
+\f[R]
+.fi
.PP
-If it is a number, it is truncated and its absolute value is taken.
-The result mod \f[B]UCHAR_MAX+1\f[R] is calculated.
-If that result is \f[B]0\f[R], push an empty string; otherwise, push a
-one-character string where the character is the result of the mod
-interpreted as an ASCII character.
+\f[B]a\f[R]
.PP
-If it is a string, then a new string is made.
-If the original string is empty, the new string is empty.
-If it is not, then the first character of the original string is used to
-create the new string as a one-character string.
-The new string is then pushed onto the stack.
+: The value on top of the stack is popped.
+.IP
+.nf
+\f[C]
+If it is a number, it is truncated and its absolute value is taken. The
+result mod **UCHAR_MAX+1** is calculated. If that result is **0**, push an
+empty string; otherwise, push a one-character string where the character is
+the result of the mod interpreted as an ASCII character.
+
+If it is a string, then a new string is made. If the original string is
+empty, the new string is empty. If it is not, then the first character of
+the original string is used to create the new string as a one-character
+string. The new string is then pushed onto the stack.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]x\f[R]
-Pops a value off of the top of the stack.
-.RS
.PP
+: Pops a value off of the top of the stack.
+.IP
+.nf
+\f[C]
If it is a number, it is pushed back onto the stack.
-.PP
+
If it is a string, it is executed as a macro.
-.PP
+
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is greater than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
-.PP
-For example, \f[B]0 1>a\f[R] will execute the contents of register
-\f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
+.IP
+.nf
+\f[C]
+For example, **0 1>a** will execute the contents of register **a**, and
+**1 0>a** will not.
+
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not greater than the second (less than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is less than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not less than the second (greater than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is equal to the second, then the contents of register
\f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not equal to the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]?\f[R]
-Reads a line from the \f[B]stdin\f[R] and executes it.
+.PP
+: Reads a line from the \f[B]stdin\f[R] and executes it.
This is to allow macros to request input from users.
-.TP
+.PP
\f[B]q\f[R]
-During execution of a macro, this exits the execution of that macro and
-the execution of the macro that executed it.
+.PP
+: During execution of a macro, this exits the execution of that macro
+and the execution of the macro that executed it.
If there are no macros, or only one macro executing, dc(1) exits.
-.TP
+.PP
\f[B]Q\f[R]
-Pops a value from the stack which must be non-negative and is used the
+.PP
+: Pops a value from the stack which must be non-negative and is used the
number of macro executions to pop off of the execution stack.
If the number of levels to pop is greater than the number of executing
macros, dc(1) exits.
.SS Status
.PP
These commands query status of the stack or its top value.
-.TP
-\f[B]Z\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, calculates the number of significant decimal digits
-it has and pushes the result.
+\f[B]Z\f[R]
.PP
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, calculates the number of significant decimal digits it
+has and pushes the result.
+
If it is a string, pushes the number of characters the string has.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]X\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, pushes the \f[I]scale\f[R] of the value onto the
-stack.
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, pushes the *scale* of the value onto the stack.
+
+If it is a string, pushes **0**.
+\f[R]
+.fi
.PP
-If it is a string, pushes \f[B]0\f[R].
-.RE
-.TP
\f[B]z\f[R]
-Pushes the current stack depth (before execution of this command).
+.PP
+: Pushes the current stack depth (before execution of this command).
.SS Arrays
.PP
These commands manipulate arrays.
-.TP
+.PP
\f[B]:\f[R]\f[I]r\f[R]
-Pops the top two values off of the stack.
+.PP
+: Pops the top two values off of the stack.
The second value will be stored in the array \f[I]r\f[R] (see the
\f[B]REGISTERS\f[R] section), indexed by the first value.
-.TP
+.PP
\f[B];\f[R]\f[I]r\f[R]
-Pops the value on top of the stack and uses it as an index into the
+.PP
+: Pops the value on top of the stack and uses it as an index into the
array \f[I]r\f[R].
The selected value is then pushed onto the stack.
.SH REGISTERS
@@ -1028,8 +1224,8 @@ their stack.
.PP
In non-extended register mode, a register name is just the single
character that follows any command that needs a register name.
-The only exception is a newline (\f[B]`\[rs]n'\f[R]); it is a parse
-error for a newline to be used as a register name.
+The only exception is a newline (\f[B]\[aq]\[rs]n\[aq]\f[R]); it is a
+parse error for a newline to be used as a register name.
.SS Extended Register Mode
.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
@@ -1040,7 +1236,7 @@ If extended register mode is enabled (\f[B]-x\f[R] or
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
-(\f[B]`\[rs]n'\f[R]).
+(\f[B]\[aq]\[rs]n\[aq]\f[R]).
.PP
In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
@@ -1085,64 +1281,77 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on dc(1):
-.TP
+.PP
\f[B]DC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
dc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]DC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]DC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]DC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]DC_BASE_POW\f[R].
-.TP
+.PP
\f[B]DC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_RAND_MAX\f[R]
-The maximum integer (inclusive) returned by the \f[B]\[cq]\f[R] command,
-if dc(1).
+.PP
+: The maximum integer (inclusive) returned by the \f[B]\[aq]\f[R]
+command, if dc(1).
Set at \f[B]2\[ha]DC_LONG_BIT-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]DC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
These limits are meant to be effectively non-existent; the limits are so
@@ -1152,104 +1361,117 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
dc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]DC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to dc(1).
+.PP
+: This is another way to give command-line arguments to dc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time dc(1) runs.
Another use would be to use the \f[B]-e\f[R] option to set
\f[B]scale\f[R] to a value other than \f[B]0\f[R].
-.RS
-.PP
-The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **DC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some dc file.dc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]dc\[rs]\[dq] file.dc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]dc\[aq] file.dc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]DC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
including the backslash newline combo.
The default line length is \f[B]70\f[R].
-.TP
+.PP
\f[B]DC_EXPR_EXIT\f[R]
-If this variable exists (no matter the contents), dc(1) will exit
+.PP
+: If this variable exists (no matter the contents), dc(1) will exit
immediately after executing expressions and files given by the
\f[B]-e\f[R] and/or \f[B]-f\f[R] command-line options (and any
equivalents).
.SH EXIT STATUS
.PP
dc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, using a negative number as a bound for the
-pseudo-random number generator, attempting to convert a negative number
-to a hardware integer, overflow when converting a number to a hardware
-integer, and attempting to use a non-integer where an integer is
-required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
-(\f[B]H\f[R]), and right shift (\f[B]h\f[R]) operators.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, using a negative number as a bound for the pseudo-random number
+generator, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**), places (**\[rs]\[at]**), left shift (**H**), and right shift (**h**)
+operators.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, and using a
-token where it is invalid.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, and using a token where it is
+invalid.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
-.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, and attempting an operation when the
-stack has too few elements.
-.RE
-.TP
+.PP
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, and attempting an operation when
+the stack has too few elements.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (dc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (dc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
@@ -1277,7 +1499,7 @@ In interactive mode, dc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, dc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, dc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is required for history to be enabled (see the \f[B]COMMAND
LINE HISTORY\f[R] section).
@@ -1299,7 +1521,7 @@ If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If dc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If dc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/dc/A.1.md b/contrib/bc/manuals/dc/A.1.md
index e53646c2fba3..8b78f48c8ded 100644
--- a/contrib/bc/manuals/dc/A.1.md
+++ b/contrib/bc/manuals/dc/A.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -81,12 +81,26 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in dc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of dc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **?** command is used.
+
+ This is a **non-portable extension**.
+
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@@ -556,25 +570,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
-**s***r*
+**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
-**l***r*
+**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
-**S***r*
+**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
-**L***r*
+**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
- now accessible via the **l***r* command.
+ now accessible via the **l**_r_ command.
## Parameters
@@ -723,7 +737,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-**\>***r*
+**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@@ -735,7 +749,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**>***r***e***s*
+**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -744,7 +758,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\>***r*
+**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@@ -753,7 +767,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\>***r***e***s*
+**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -762,7 +776,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**\<***r*
+**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@@ -771,7 +785,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**\<***r***e***s*
+**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -780,7 +794,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\<***r*
+**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@@ -789,7 +803,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\<***r***e***s*
+**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -798,7 +812,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**=***r*
+**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@@ -807,7 +821,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**=***r***e***s*
+**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -816,7 +830,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!=***r*
+**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@@ -825,7 +839,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!=***r***e***s*
+**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -881,12 +895,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
-**:***r*
+**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
-**;***r*
+**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.
diff --git a/contrib/bc/manuals/dc/E.1 b/contrib/bc/manuals/dc/E.1
index ebe8db87e996..e65a29fe8db2 100644
--- a/contrib/bc/manuals/dc/E.1
+++ b/contrib/bc/manuals/dc/E.1
@@ -25,18 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+\f[B]dc\f[R] [\f[B]-hiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
-[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-read-prompt\f[R]] [\f[B]--extended-register\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -70,84 +70,115 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.SH OPTIONS
.PP
The following are the options that dc(1) accepts.
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.TP
+.PP
+: Print the version information (copyright header) and exit.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-Disables the prompt in TTY mode.
+.PP
+: Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
-See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
do not want a prompt or are not used to having them in dc(1).
Most of those users would want to put this option in
\f[B]DC_ENV_ARGS\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: Disables the read prompt in TTY mode.
+(The read prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a read prompt or are not used to having them in dc(1).
+Most of those users would want to put this option in
+\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
+This option is also useful in hash bang lines of dc(1) scripts that
+prompt for user input.
+.IP
+.nf
+\f[C]
+This option does not disable the regular prompt because the read prompt is
+only used when the **?** command is used.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-x\f[R] \f[B]--extended-register\f[R]
-Enables extended register mode.
+.PP
+: Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]DC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -190,7 +221,7 @@ Input is processed immediately when entered.
.PP
\f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to interpret constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
@@ -200,7 +231,7 @@ programs with the \f[B]T\f[R] command.
.PP
\f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
@@ -242,265 +273,332 @@ The valid commands are listed below.
.SS Printing
.PP
These commands are used for printing.
-.TP
+.PP
\f[B]p\f[R]
-Prints the value on top of the stack, whether number or string, and
-prints a newline after.
-.RS
.PP
+: Prints the value on top of the stack, whether number or string, and
+prints a newline after.
+.IP
+.nf
+\f[C]
This does not alter the stack.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]n\f[R]
-Prints the value on top of the stack, whether number or string, and pops
-it off of the stack.
-.TP
+.PP
+: Prints the value on top of the stack, whether number or string, and
+pops it off of the stack.
+.PP
\f[B]P\f[R]
-Pops a value off the stack.
-.RS
.PP
+: Pops a value off the stack.
+.IP
+.nf
+\f[C]
If the value is a number, it is truncated and the absolute value of the
-result is printed as though \f[B]obase\f[R] is \f[B]UCHAR_MAX+1\f[R] and
-each digit is interpreted as an ASCII character, making it a byte
-stream.
-.PP
+result is printed as though **obase** is **UCHAR_MAX+1** and each digit is
+interpreted as an ASCII character, making it a byte stream.
+
If the value is a string, it is printed without a trailing newline.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]f\f[R]
-Prints the entire contents of the stack, in order from newest to oldest,
-without altering anything.
-.RS
.PP
+: Prints the entire contents of the stack, in order from newest to
+oldest, without altering anything.
+.IP
+.nf
+\f[C]
Users should use this command when they get lost.
-.RE
+\f[R]
+.fi
.SS Arithmetic
.PP
These are the commands used for arithmetic.
-.TP
+.PP
\f[B]+\f[R]
-The top two values are popped off the stack, added, and the result is
+.PP
+: The top two values are popped off the stack, added, and the result is
pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]-\f[R]
-The top two values are popped off the stack, subtracted, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, subtracted, and the
+result is pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]*\f[R]
-The top two values are popped off the stack, multiplied, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, multiplied, and the
+result is pushed onto the stack.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The top two values are popped off the stack, divided, and the result is
-pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
-The first value popped off of the stack must be non-zero.
-.RE
-.TP
-\f[B]%\f[R]
-The top two values are popped off the stack, remaindered, and the result
+: The top two values are popped off the stack, divided, and the result
is pushed onto the stack.
-.RS
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be non-zero.
+\f[R]
+.fi
.PP
-Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
-\f[B]scale\f[R], and 2) Using the result of step 1 to calculate
-\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
-\f[B]max(scale+scale(b),scale(a))\f[R].
+\f[B]%\f[R]
.PP
+: The top two values are popped off the stack, remaindered, and the
+result is pushed onto the stack.
+.IP
+.nf
+\f[C]
+Remaindering is equivalent to 1) Computing **a/b** to current **scale**, and
+2) Using the result of step 1 to calculate **a-(a/b)\[rs]*b** to *scale*
+**max(scale+scale(b),scale(a))**.
+
The first value popped off of the stack must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]\[ti]\f[R]
-The top two values are popped off the stack, divided and remaindered,
+.PP
+: The top two values are popped off the stack, divided and remaindered,
and the results (divided first, remainder second) are pushed onto the
stack.
This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
\f[B]y\f[R] are only evaluated once.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be non-zero.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The top two values are popped off the stack, the second is raised to the
-power of the first, and the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top two values are popped off the stack, the second is raised to
+the power of the first, and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be an integer, and if that
value is negative, the second value popped off of the stack must be
non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]v\f[R]
-The top value is popped off the stack, its square root is computed, and
-the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top value is popped off the stack, its square root is computed,
+and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The value popped off of the stack must be non-negative.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]_\f[R]
-If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
-or other commands), then that number is input as a negative number.
-.RS
-.PP
-Otherwise, the top value on the stack is popped and copied, and the copy
-is negated and pushed onto the stack.
-This behavior without a number is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+.PP
+: If this command \f[I]immediately\f[R] precedes a number (i.e., no
+spaces or other commands), then that number is input as a negative
+number.
+.IP
+.nf
+\f[C]
+Otherwise, the top value on the stack is popped and copied, and the copy is
+negated and pushed onto the stack. This behavior without a number is a
+**non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]b\f[R]
-The top value is popped off the stack, and if it is zero, it is pushed
+.PP
+: The top value is popped off the stack, and if it is zero, it is pushed
back onto the stack.
Otherwise, its absolute value is pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]|\f[R]
-The top three values are popped off the stack, a modular exponentiation
-is computed, and the result is pushed onto the stack.
-.RS
.PP
+: The top three values are popped off the stack, a modular
+exponentiation is computed, and the result is pushed onto the stack.
+.IP
+.nf
+\f[C]
The first value popped is used as the reduction modulus and must be an
-integer and non-zero.
-The second value popped is used as the exponent and must be an integer
-and non-negative.
-The third value popped is the base and must be an integer.
+integer and non-zero. The second value popped is used as the exponent and
+must be an integer and non-negative. The third value popped is the base and
+must be an integer.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]G\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]N\f[R]
-The top value is popped off of the stack, and if it a \f[B]0\f[R], a
+.PP
+: The top value is popped off of the stack, and if it a \f[B]0\f[R], a
\f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B](\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]{\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than or equal to the second,
-or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than or equal to the
+second, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B])\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]}\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than or equal to the
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than or equal to the
second, or \f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]M\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If they are both non-zero, a \f[B]1\f[R] is pushed onto the stack.
If either of them is zero, or both of them are, then a \f[B]0\f[R] is
pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
+.IP
+.nf
+\f[C]
+This is like the **&&** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]m\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If at least one of them is non-zero, a \f[B]1\f[R] is pushed onto the
stack.
If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is like the **||** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Stack Control
.PP
These commands control the stack.
-.TP
+.PP
\f[B]c\f[R]
-Removes all items from (\[lq]clears\[rq]) the stack.
-.TP
+.PP
+: Removes all items from (\[dq]clears\[dq]) the stack.
+.PP
\f[B]d\f[R]
-Copies the item on top of the stack (\[lq]duplicates\[rq]) and pushes
+.PP
+: Copies the item on top of the stack (\[dq]duplicates\[dq]) and pushes
the copy onto the stack.
-.TP
+.PP
\f[B]r\f[R]
-Swaps (\[lq]reverses\[rq]) the two top items on the stack.
-.TP
+.PP
+: Swaps (\[dq]reverses\[dq]) the two top items on the stack.
+.PP
\f[B]R\f[R]
-Pops (\[lq]removes\[rq]) the top value from the stack.
+.PP
+: Pops (\[dq]removes\[dq]) the top value from the stack.
.SS Register Control
.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
-.TP
+.PP
\f[B]s\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack and stores it into register
+.PP
+: Pops the value off the top of the stack and stores it into register
\f[I]r\f[R].
-.TP
+.PP
\f[B]l\f[R]\f[I]r\f[R]
-Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
+.PP
+: Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
This does not alter the contents of \f[I]r\f[R].
-.TP
+.PP
\f[B]S\f[R]\f[I]r\f[R]
-Pops the value off the top of the (main) stack and pushes it onto the
+.PP
+: Pops the value off the top of the (main) stack and pushes it onto the
stack of register \f[I]r\f[R].
The previous value of the register becomes inaccessible.
-.TP
+.PP
\f[B]L\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack for register \f[I]r\f[R] and
+.PP
+: Pops the value off the top of the stack for register \f[I]r\f[R] and
push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
@@ -509,68 +607,86 @@ accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
and \f[B]scale\f[R].
Also see the \f[B]SYNTAX\f[R] section.
-.TP
+.PP
\f[B]i\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
inclusive.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]o\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]obase\f[R], which must be between \f[B]2\f[R] and
\f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]k\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]scale\f[R], which must be non-negative.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]I\f[R]
-Pushes the current value of \f[B]ibase\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]ibase\f[R] onto the main stack.
+.PP
\f[B]O\f[R]
-Pushes the current value of \f[B]obase\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]obase\f[R] onto the main stack.
+.PP
\f[B]K\f[R]
-Pushes the current value of \f[B]scale\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]scale\f[R] onto the main stack.
+.PP
\f[B]T\f[R]
-Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]U\f[R]
-Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]V\f[R]
-Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
-stack.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+: Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
+stack.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Strings
.PP
The following commands control strings.
@@ -587,233 +703,292 @@ Strings can also be executed as macros.
For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
printed with a newline after and then popped from the stack.
-.TP
-\f[B][\f[R]_characters_\f[B]]\f[R]
-Makes a string containing \f[I]characters\f[R] and pushes it onto the
-stack.
-.RS
.PP
-If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
-they must be balanced.
-Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
-character.
+\f[B][\f[R]\f[I]characters\f[R]\f[B]]\f[R]
.PP
+: Makes a string containing \f[I]characters\f[R] and pushes it onto the
+stack.
+.IP
+.nf
+\f[C]
+If there are brackets (**\[rs][** and **\[rs]]**) in the string, then they must be
+balanced. Unbalanced brackets can be escaped using a backslash (**\[rs]\[rs]**)
+character.
+
If there is a backslash character in the string, the character after it
-(even another backslash) is put into the string verbatim, but the
-(first) backslash is not.
-.RE
-.TP
-\f[B]a\f[R]
-The value on top of the stack is popped.
-.RS
+(even another backslash) is put into the string verbatim, but the (first)
+backslash is not.
+\f[R]
+.fi
.PP
-If it is a number, it is truncated and its absolute value is taken.
-The result mod \f[B]UCHAR_MAX+1\f[R] is calculated.
-If that result is \f[B]0\f[R], push an empty string; otherwise, push a
-one-character string where the character is the result of the mod
-interpreted as an ASCII character.
+\f[B]a\f[R]
.PP
-If it is a string, then a new string is made.
-If the original string is empty, the new string is empty.
-If it is not, then the first character of the original string is used to
-create the new string as a one-character string.
-The new string is then pushed onto the stack.
+: The value on top of the stack is popped.
+.IP
+.nf
+\f[C]
+If it is a number, it is truncated and its absolute value is taken. The
+result mod **UCHAR_MAX+1** is calculated. If that result is **0**, push an
+empty string; otherwise, push a one-character string where the character is
+the result of the mod interpreted as an ASCII character.
+
+If it is a string, then a new string is made. If the original string is
+empty, the new string is empty. If it is not, then the first character of
+the original string is used to create the new string as a one-character
+string. The new string is then pushed onto the stack.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]x\f[R]
-Pops a value off of the top of the stack.
-.RS
.PP
+: Pops a value off of the top of the stack.
+.IP
+.nf
+\f[C]
If it is a number, it is pushed back onto the stack.
-.PP
+
If it is a string, it is executed as a macro.
-.PP
+
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is greater than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
-.PP
-For example, \f[B]0 1>a\f[R] will execute the contents of register
-\f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
+.IP
+.nf
+\f[C]
+For example, **0 1>a** will execute the contents of register **a**, and
+**1 0>a** will not.
+
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not greater than the second (less than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is less than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not less than the second (greater than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is equal to the second, then the contents of register
\f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not equal to the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]?\f[R]
-Reads a line from the \f[B]stdin\f[R] and executes it.
+.PP
+: Reads a line from the \f[B]stdin\f[R] and executes it.
This is to allow macros to request input from users.
-.TP
+.PP
\f[B]q\f[R]
-During execution of a macro, this exits the execution of that macro and
-the execution of the macro that executed it.
+.PP
+: During execution of a macro, this exits the execution of that macro
+and the execution of the macro that executed it.
If there are no macros, or only one macro executing, dc(1) exits.
-.TP
+.PP
\f[B]Q\f[R]
-Pops a value from the stack which must be non-negative and is used the
+.PP
+: Pops a value from the stack which must be non-negative and is used the
number of macro executions to pop off of the execution stack.
If the number of levels to pop is greater than the number of executing
macros, dc(1) exits.
.SS Status
.PP
These commands query status of the stack or its top value.
-.TP
-\f[B]Z\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, calculates the number of significant decimal digits
-it has and pushes the result.
+\f[B]Z\f[R]
.PP
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, calculates the number of significant decimal digits it
+has and pushes the result.
+
If it is a string, pushes the number of characters the string has.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]X\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, pushes the \f[I]scale\f[R] of the value onto the
-stack.
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, pushes the *scale* of the value onto the stack.
+
+If it is a string, pushes **0**.
+\f[R]
+.fi
.PP
-If it is a string, pushes \f[B]0\f[R].
-.RE
-.TP
\f[B]z\f[R]
-Pushes the current stack depth (before execution of this command).
+.PP
+: Pushes the current stack depth (before execution of this command).
.SS Arrays
.PP
These commands manipulate arrays.
-.TP
+.PP
\f[B]:\f[R]\f[I]r\f[R]
-Pops the top two values off of the stack.
+.PP
+: Pops the top two values off of the stack.
The second value will be stored in the array \f[I]r\f[R] (see the
\f[B]REGISTERS\f[R] section), indexed by the first value.
-.TP
+.PP
\f[B];\f[R]\f[I]r\f[R]
-Pops the value on top of the stack and uses it as an index into the
+.PP
+: Pops the value on top of the stack and uses it as an index into the
array \f[I]r\f[R].
The selected value is then pushed onto the stack.
.SH REGISTERS
@@ -828,8 +1003,8 @@ their stack.
.PP
In non-extended register mode, a register name is just the single
character that follows any command that needs a register name.
-The only exception is a newline (\f[B]`\[rs]n'\f[R]); it is a parse
-error for a newline to be used as a register name.
+The only exception is a newline (\f[B]\[aq]\[rs]n\[aq]\f[R]); it is a
+parse error for a newline to be used as a register name.
.SS Extended Register Mode
.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
@@ -840,7 +1015,7 @@ If extended register mode is enabled (\f[B]-x\f[R] or
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
-(\f[B]`\[rs]n'\f[R]).
+(\f[B]\[aq]\[rs]n\[aq]\f[R]).
.PP
In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
@@ -885,59 +1060,71 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on dc(1):
-.TP
+.PP
\f[B]DC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
dc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]DC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]DC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]DC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]DC_BASE_POW\f[R].
-.TP
+.PP
\f[B]DC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]DC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
These limits are meant to be effectively non-existent; the limits are so
@@ -947,101 +1134,115 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
dc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]DC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to dc(1).
+.PP
+: This is another way to give command-line arguments to dc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time dc(1) runs.
Another use would be to use the \f[B]-e\f[R] option to set
\f[B]scale\f[R] to a value other than \f[B]0\f[R].
-.RS
-.PP
-The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **DC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some dc file.dc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]dc\[rs]\[dq] file.dc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]dc\[aq] file.dc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]DC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
including the backslash newline combo.
The default line length is \f[B]70\f[R].
-.TP
+.PP
\f[B]DC_EXPR_EXIT\f[R]
-If this variable exists (no matter the contents), dc(1) will exit
+.PP
+: If this variable exists (no matter the contents), dc(1) will exit
immediately after executing expressions and files given by the
\f[B]-e\f[R] and/or \f[B]-f\f[R] command-line options (and any
equivalents).
.SH EXIT STATUS
.PP
dc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**) operator.
+\f[R]
+.fi
.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, attempting to convert a negative number to a hardware
-integer, overflow when converting a number to a hardware integer, and
-attempting to use a non-integer where an integer is required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]) operator.
-.RE
-.TP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, and using a
-token where it is invalid.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, and using a token where it is
+invalid.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
-.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, and attempting an operation when the
-stack has too few elements.
-.RE
-.TP
+.PP
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, and attempting an operation when
+the stack has too few elements.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (dc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (dc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
@@ -1069,7 +1270,7 @@ In interactive mode, dc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, dc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, dc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is required for history to be enabled (see the \f[B]COMMAND
LINE HISTORY\f[R] section).
@@ -1091,7 +1292,7 @@ If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If dc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If dc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/dc/E.1.md b/contrib/bc/manuals/dc/E.1.md
index 5e0a85af9a90..641a3736878f 100644
--- a/contrib/bc/manuals/dc/E.1.md
+++ b/contrib/bc/manuals/dc/E.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -81,12 +81,26 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in dc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of dc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **?** command is used.
+
+ This is a **non-portable extension**.
+
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@@ -432,25 +446,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
-**s***r*
+**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
-**l***r*
+**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
-**S***r*
+**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
-**L***r*
+**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
- now accessible via the **l***r* command.
+ now accessible via the **l**_r_ command.
## Parameters
@@ -563,7 +577,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-**\>***r*
+**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@@ -575,7 +589,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**>***r***e***s*
+**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -584,7 +598,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\>***r*
+**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@@ -593,7 +607,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\>***r***e***s*
+**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -602,7 +616,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**\<***r*
+**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@@ -611,7 +625,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**\<***r***e***s*
+**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -620,7 +634,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\<***r*
+**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@@ -629,7 +643,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\<***r***e***s*
+**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -638,7 +652,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**=***r*
+**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@@ -647,7 +661,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**=***r***e***s*
+**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -656,7 +670,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!=***r*
+**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@@ -665,7 +679,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!=***r***e***s*
+**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -721,12 +735,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
-**:***r*
+**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
-**;***r*
+**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.
diff --git a/contrib/bc/manuals/dc/EH.1 b/contrib/bc/manuals/dc/EH.1
index e8e4b9069506..9676eeaba1cb 100644
--- a/contrib/bc/manuals/dc/EH.1
+++ b/contrib/bc/manuals/dc/EH.1
@@ -25,18 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+\f[B]dc\f[R] [\f[B]-hiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
-[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-read-prompt\f[R]] [\f[B]--extended-register\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -70,84 +70,115 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.SH OPTIONS
.PP
The following are the options that dc(1) accepts.
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.TP
+.PP
+: Print the version information (copyright header) and exit.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-Disables the prompt in TTY mode.
+.PP
+: Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
-See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
do not want a prompt or are not used to having them in dc(1).
Most of those users would want to put this option in
\f[B]DC_ENV_ARGS\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: Disables the read prompt in TTY mode.
+(The read prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a read prompt or are not used to having them in dc(1).
+Most of those users would want to put this option in
+\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
+This option is also useful in hash bang lines of dc(1) scripts that
+prompt for user input.
+.IP
+.nf
+\f[C]
+This option does not disable the regular prompt because the read prompt is
+only used when the **?** command is used.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-x\f[R] \f[B]--extended-register\f[R]
-Enables extended register mode.
+.PP
+: Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]DC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -190,7 +221,7 @@ Input is processed immediately when entered.
.PP
\f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to interpret constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
@@ -200,7 +231,7 @@ programs with the \f[B]T\f[R] command.
.PP
\f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
@@ -242,265 +273,332 @@ The valid commands are listed below.
.SS Printing
.PP
These commands are used for printing.
-.TP
+.PP
\f[B]p\f[R]
-Prints the value on top of the stack, whether number or string, and
-prints a newline after.
-.RS
.PP
+: Prints the value on top of the stack, whether number or string, and
+prints a newline after.
+.IP
+.nf
+\f[C]
This does not alter the stack.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]n\f[R]
-Prints the value on top of the stack, whether number or string, and pops
-it off of the stack.
-.TP
+.PP
+: Prints the value on top of the stack, whether number or string, and
+pops it off of the stack.
+.PP
\f[B]P\f[R]
-Pops a value off the stack.
-.RS
.PP
+: Pops a value off the stack.
+.IP
+.nf
+\f[C]
If the value is a number, it is truncated and the absolute value of the
-result is printed as though \f[B]obase\f[R] is \f[B]UCHAR_MAX+1\f[R] and
-each digit is interpreted as an ASCII character, making it a byte
-stream.
-.PP
+result is printed as though **obase** is **UCHAR_MAX+1** and each digit is
+interpreted as an ASCII character, making it a byte stream.
+
If the value is a string, it is printed without a trailing newline.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]f\f[R]
-Prints the entire contents of the stack, in order from newest to oldest,
-without altering anything.
-.RS
.PP
+: Prints the entire contents of the stack, in order from newest to
+oldest, without altering anything.
+.IP
+.nf
+\f[C]
Users should use this command when they get lost.
-.RE
+\f[R]
+.fi
.SS Arithmetic
.PP
These are the commands used for arithmetic.
-.TP
+.PP
\f[B]+\f[R]
-The top two values are popped off the stack, added, and the result is
+.PP
+: The top two values are popped off the stack, added, and the result is
pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]-\f[R]
-The top two values are popped off the stack, subtracted, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, subtracted, and the
+result is pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]*\f[R]
-The top two values are popped off the stack, multiplied, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, multiplied, and the
+result is pushed onto the stack.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The top two values are popped off the stack, divided, and the result is
-pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
-The first value popped off of the stack must be non-zero.
-.RE
-.TP
-\f[B]%\f[R]
-The top two values are popped off the stack, remaindered, and the result
+: The top two values are popped off the stack, divided, and the result
is pushed onto the stack.
-.RS
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be non-zero.
+\f[R]
+.fi
.PP
-Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
-\f[B]scale\f[R], and 2) Using the result of step 1 to calculate
-\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
-\f[B]max(scale+scale(b),scale(a))\f[R].
+\f[B]%\f[R]
.PP
+: The top two values are popped off the stack, remaindered, and the
+result is pushed onto the stack.
+.IP
+.nf
+\f[C]
+Remaindering is equivalent to 1) Computing **a/b** to current **scale**, and
+2) Using the result of step 1 to calculate **a-(a/b)\[rs]*b** to *scale*
+**max(scale+scale(b),scale(a))**.
+
The first value popped off of the stack must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]\[ti]\f[R]
-The top two values are popped off the stack, divided and remaindered,
+.PP
+: The top two values are popped off the stack, divided and remaindered,
and the results (divided first, remainder second) are pushed onto the
stack.
This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
\f[B]y\f[R] are only evaluated once.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be non-zero.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The top two values are popped off the stack, the second is raised to the
-power of the first, and the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top two values are popped off the stack, the second is raised to
+the power of the first, and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be an integer, and if that
value is negative, the second value popped off of the stack must be
non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]v\f[R]
-The top value is popped off the stack, its square root is computed, and
-the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top value is popped off the stack, its square root is computed,
+and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The value popped off of the stack must be non-negative.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]_\f[R]
-If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
-or other commands), then that number is input as a negative number.
-.RS
-.PP
-Otherwise, the top value on the stack is popped and copied, and the copy
-is negated and pushed onto the stack.
-This behavior without a number is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+.PP
+: If this command \f[I]immediately\f[R] precedes a number (i.e., no
+spaces or other commands), then that number is input as a negative
+number.
+.IP
+.nf
+\f[C]
+Otherwise, the top value on the stack is popped and copied, and the copy is
+negated and pushed onto the stack. This behavior without a number is a
+**non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]b\f[R]
-The top value is popped off the stack, and if it is zero, it is pushed
+.PP
+: The top value is popped off the stack, and if it is zero, it is pushed
back onto the stack.
Otherwise, its absolute value is pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]|\f[R]
-The top three values are popped off the stack, a modular exponentiation
-is computed, and the result is pushed onto the stack.
-.RS
.PP
+: The top three values are popped off the stack, a modular
+exponentiation is computed, and the result is pushed onto the stack.
+.IP
+.nf
+\f[C]
The first value popped is used as the reduction modulus and must be an
-integer and non-zero.
-The second value popped is used as the exponent and must be an integer
-and non-negative.
-The third value popped is the base and must be an integer.
+integer and non-zero. The second value popped is used as the exponent and
+must be an integer and non-negative. The third value popped is the base and
+must be an integer.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]G\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]N\f[R]
-The top value is popped off of the stack, and if it a \f[B]0\f[R], a
+.PP
+: The top value is popped off of the stack, and if it a \f[B]0\f[R], a
\f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B](\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]{\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than or equal to the second,
-or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than or equal to the
+second, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B])\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]}\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than or equal to the
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than or equal to the
second, or \f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]M\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If they are both non-zero, a \f[B]1\f[R] is pushed onto the stack.
If either of them is zero, or both of them are, then a \f[B]0\f[R] is
pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
+.IP
+.nf
+\f[C]
+This is like the **&&** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]m\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If at least one of them is non-zero, a \f[B]1\f[R] is pushed onto the
stack.
If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is like the **||** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Stack Control
.PP
These commands control the stack.
-.TP
+.PP
\f[B]c\f[R]
-Removes all items from (\[lq]clears\[rq]) the stack.
-.TP
+.PP
+: Removes all items from (\[dq]clears\[dq]) the stack.
+.PP
\f[B]d\f[R]
-Copies the item on top of the stack (\[lq]duplicates\[rq]) and pushes
+.PP
+: Copies the item on top of the stack (\[dq]duplicates\[dq]) and pushes
the copy onto the stack.
-.TP
+.PP
\f[B]r\f[R]
-Swaps (\[lq]reverses\[rq]) the two top items on the stack.
-.TP
+.PP
+: Swaps (\[dq]reverses\[dq]) the two top items on the stack.
+.PP
\f[B]R\f[R]
-Pops (\[lq]removes\[rq]) the top value from the stack.
+.PP
+: Pops (\[dq]removes\[dq]) the top value from the stack.
.SS Register Control
.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
-.TP
+.PP
\f[B]s\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack and stores it into register
+.PP
+: Pops the value off the top of the stack and stores it into register
\f[I]r\f[R].
-.TP
+.PP
\f[B]l\f[R]\f[I]r\f[R]
-Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
+.PP
+: Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
This does not alter the contents of \f[I]r\f[R].
-.TP
+.PP
\f[B]S\f[R]\f[I]r\f[R]
-Pops the value off the top of the (main) stack and pushes it onto the
+.PP
+: Pops the value off the top of the (main) stack and pushes it onto the
stack of register \f[I]r\f[R].
The previous value of the register becomes inaccessible.
-.TP
+.PP
\f[B]L\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack for register \f[I]r\f[R] and
+.PP
+: Pops the value off the top of the stack for register \f[I]r\f[R] and
push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
@@ -509,68 +607,86 @@ accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
and \f[B]scale\f[R].
Also see the \f[B]SYNTAX\f[R] section.
-.TP
+.PP
\f[B]i\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
inclusive.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]o\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]obase\f[R], which must be between \f[B]2\f[R] and
\f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]k\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]scale\f[R], which must be non-negative.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]I\f[R]
-Pushes the current value of \f[B]ibase\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]ibase\f[R] onto the main stack.
+.PP
\f[B]O\f[R]
-Pushes the current value of \f[B]obase\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]obase\f[R] onto the main stack.
+.PP
\f[B]K\f[R]
-Pushes the current value of \f[B]scale\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]scale\f[R] onto the main stack.
+.PP
\f[B]T\f[R]
-Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]U\f[R]
-Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]V\f[R]
-Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
-stack.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+: Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
+stack.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Strings
.PP
The following commands control strings.
@@ -587,233 +703,292 @@ Strings can also be executed as macros.
For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
printed with a newline after and then popped from the stack.
-.TP
-\f[B][\f[R]_characters_\f[B]]\f[R]
-Makes a string containing \f[I]characters\f[R] and pushes it onto the
-stack.
-.RS
.PP
-If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
-they must be balanced.
-Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
-character.
+\f[B][\f[R]\f[I]characters\f[R]\f[B]]\f[R]
.PP
+: Makes a string containing \f[I]characters\f[R] and pushes it onto the
+stack.
+.IP
+.nf
+\f[C]
+If there are brackets (**\[rs][** and **\[rs]]**) in the string, then they must be
+balanced. Unbalanced brackets can be escaped using a backslash (**\[rs]\[rs]**)
+character.
+
If there is a backslash character in the string, the character after it
-(even another backslash) is put into the string verbatim, but the
-(first) backslash is not.
-.RE
-.TP
-\f[B]a\f[R]
-The value on top of the stack is popped.
-.RS
+(even another backslash) is put into the string verbatim, but the (first)
+backslash is not.
+\f[R]
+.fi
.PP
-If it is a number, it is truncated and its absolute value is taken.
-The result mod \f[B]UCHAR_MAX+1\f[R] is calculated.
-If that result is \f[B]0\f[R], push an empty string; otherwise, push a
-one-character string where the character is the result of the mod
-interpreted as an ASCII character.
+\f[B]a\f[R]
.PP
-If it is a string, then a new string is made.
-If the original string is empty, the new string is empty.
-If it is not, then the first character of the original string is used to
-create the new string as a one-character string.
-The new string is then pushed onto the stack.
+: The value on top of the stack is popped.
+.IP
+.nf
+\f[C]
+If it is a number, it is truncated and its absolute value is taken. The
+result mod **UCHAR_MAX+1** is calculated. If that result is **0**, push an
+empty string; otherwise, push a one-character string where the character is
+the result of the mod interpreted as an ASCII character.
+
+If it is a string, then a new string is made. If the original string is
+empty, the new string is empty. If it is not, then the first character of
+the original string is used to create the new string as a one-character
+string. The new string is then pushed onto the stack.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]x\f[R]
-Pops a value off of the top of the stack.
-.RS
.PP
+: Pops a value off of the top of the stack.
+.IP
+.nf
+\f[C]
If it is a number, it is pushed back onto the stack.
-.PP
+
If it is a string, it is executed as a macro.
-.PP
+
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is greater than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
-.PP
-For example, \f[B]0 1>a\f[R] will execute the contents of register
-\f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
+.IP
+.nf
+\f[C]
+For example, **0 1>a** will execute the contents of register **a**, and
+**1 0>a** will not.
+
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not greater than the second (less than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is less than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not less than the second (greater than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is equal to the second, then the contents of register
\f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not equal to the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]?\f[R]
-Reads a line from the \f[B]stdin\f[R] and executes it.
+.PP
+: Reads a line from the \f[B]stdin\f[R] and executes it.
This is to allow macros to request input from users.
-.TP
+.PP
\f[B]q\f[R]
-During execution of a macro, this exits the execution of that macro and
-the execution of the macro that executed it.
+.PP
+: During execution of a macro, this exits the execution of that macro
+and the execution of the macro that executed it.
If there are no macros, or only one macro executing, dc(1) exits.
-.TP
+.PP
\f[B]Q\f[R]
-Pops a value from the stack which must be non-negative and is used the
+.PP
+: Pops a value from the stack which must be non-negative and is used the
number of macro executions to pop off of the execution stack.
If the number of levels to pop is greater than the number of executing
macros, dc(1) exits.
.SS Status
.PP
These commands query status of the stack or its top value.
-.TP
-\f[B]Z\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, calculates the number of significant decimal digits
-it has and pushes the result.
+\f[B]Z\f[R]
.PP
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, calculates the number of significant decimal digits it
+has and pushes the result.
+
If it is a string, pushes the number of characters the string has.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]X\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, pushes the \f[I]scale\f[R] of the value onto the
-stack.
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, pushes the *scale* of the value onto the stack.
+
+If it is a string, pushes **0**.
+\f[R]
+.fi
.PP
-If it is a string, pushes \f[B]0\f[R].
-.RE
-.TP
\f[B]z\f[R]
-Pushes the current stack depth (before execution of this command).
+.PP
+: Pushes the current stack depth (before execution of this command).
.SS Arrays
.PP
These commands manipulate arrays.
-.TP
+.PP
\f[B]:\f[R]\f[I]r\f[R]
-Pops the top two values off of the stack.
+.PP
+: Pops the top two values off of the stack.
The second value will be stored in the array \f[I]r\f[R] (see the
\f[B]REGISTERS\f[R] section), indexed by the first value.
-.TP
+.PP
\f[B];\f[R]\f[I]r\f[R]
-Pops the value on top of the stack and uses it as an index into the
+.PP
+: Pops the value on top of the stack and uses it as an index into the
array \f[I]r\f[R].
The selected value is then pushed onto the stack.
.SH REGISTERS
@@ -828,8 +1003,8 @@ their stack.
.PP
In non-extended register mode, a register name is just the single
character that follows any command that needs a register name.
-The only exception is a newline (\f[B]`\[rs]n'\f[R]); it is a parse
-error for a newline to be used as a register name.
+The only exception is a newline (\f[B]\[aq]\[rs]n\[aq]\f[R]); it is a
+parse error for a newline to be used as a register name.
.SS Extended Register Mode
.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
@@ -840,7 +1015,7 @@ If extended register mode is enabled (\f[B]-x\f[R] or
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
-(\f[B]`\[rs]n'\f[R]).
+(\f[B]\[aq]\[rs]n\[aq]\f[R]).
.PP
In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
@@ -885,59 +1060,71 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on dc(1):
-.TP
+.PP
\f[B]DC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
dc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]DC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]DC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]DC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]DC_BASE_POW\f[R].
-.TP
+.PP
\f[B]DC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]DC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
These limits are meant to be effectively non-existent; the limits are so
@@ -947,101 +1134,115 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
dc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]DC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to dc(1).
+.PP
+: This is another way to give command-line arguments to dc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time dc(1) runs.
Another use would be to use the \f[B]-e\f[R] option to set
\f[B]scale\f[R] to a value other than \f[B]0\f[R].
-.RS
-.PP
-The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **DC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some dc file.dc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]dc\[rs]\[dq] file.dc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]dc\[aq] file.dc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]DC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
including the backslash newline combo.
The default line length is \f[B]70\f[R].
-.TP
+.PP
\f[B]DC_EXPR_EXIT\f[R]
-If this variable exists (no matter the contents), dc(1) will exit
+.PP
+: If this variable exists (no matter the contents), dc(1) will exit
immediately after executing expressions and files given by the
\f[B]-e\f[R] and/or \f[B]-f\f[R] command-line options (and any
equivalents).
.SH EXIT STATUS
.PP
dc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**) operator.
+\f[R]
+.fi
.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, attempting to convert a negative number to a hardware
-integer, overflow when converting a number to a hardware integer, and
-attempting to use a non-integer where an integer is required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]) operator.
-.RE
-.TP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, and using a
-token where it is invalid.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, and using a token where it is
+invalid.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
-.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, and attempting an operation when the
-stack has too few elements.
-.RE
-.TP
+.PP
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, and attempting an operation when
+the stack has too few elements.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (dc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (dc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
@@ -1069,7 +1270,7 @@ In interactive mode, dc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, dc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, dc(1) turns on \[dq]TTY mode.\[dq]
.PP
The prompt is enabled in TTY mode.
.PP
@@ -1086,7 +1287,7 @@ If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If dc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If dc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/dc/EH.1.md b/contrib/bc/manuals/dc/EH.1.md
index 6d1413d0dae4..3bdef59ef917 100644
--- a/contrib/bc/manuals/dc/EH.1.md
+++ b/contrib/bc/manuals/dc/EH.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -81,12 +81,26 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in dc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of dc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **?** command is used.
+
+ This is a **non-portable extension**.
+
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@@ -432,25 +446,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
-**s***r*
+**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
-**l***r*
+**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
-**S***r*
+**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
-**L***r*
+**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
- now accessible via the **l***r* command.
+ now accessible via the **l**_r_ command.
## Parameters
@@ -563,7 +577,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-**\>***r*
+**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@@ -575,7 +589,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**>***r***e***s*
+**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -584,7 +598,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\>***r*
+**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@@ -593,7 +607,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\>***r***e***s*
+**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -602,7 +616,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**\<***r*
+**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@@ -611,7 +625,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**\<***r***e***s*
+**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -620,7 +634,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\<***r*
+**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@@ -629,7 +643,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\<***r***e***s*
+**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -638,7 +652,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**=***r*
+**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@@ -647,7 +661,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**=***r***e***s*
+**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -656,7 +670,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!=***r*
+**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@@ -665,7 +679,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!=***r***e***s*
+**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -721,12 +735,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
-**:***r*
+**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
-**;***r*
+**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.
diff --git a/contrib/bc/manuals/dc/EHN.1 b/contrib/bc/manuals/dc/EHN.1
index 37f4a6656c65..8aa8f2460216 100644
--- a/contrib/bc/manuals/dc/EHN.1
+++ b/contrib/bc/manuals/dc/EHN.1
@@ -25,18 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+\f[B]dc\f[R] [\f[B]-hiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
-[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-read-prompt\f[R]] [\f[B]--extended-register\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -70,84 +70,115 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.SH OPTIONS
.PP
The following are the options that dc(1) accepts.
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.TP
+.PP
+: Print the version information (copyright header) and exit.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-Disables the prompt in TTY mode.
+.PP
+: Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
-See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
do not want a prompt or are not used to having them in dc(1).
Most of those users would want to put this option in
\f[B]DC_ENV_ARGS\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: Disables the read prompt in TTY mode.
+(The read prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a read prompt or are not used to having them in dc(1).
+Most of those users would want to put this option in
+\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
+This option is also useful in hash bang lines of dc(1) scripts that
+prompt for user input.
+.IP
+.nf
+\f[C]
+This option does not disable the regular prompt because the read prompt is
+only used when the **?** command is used.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-x\f[R] \f[B]--extended-register\f[R]
-Enables extended register mode.
+.PP
+: Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]DC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -190,7 +221,7 @@ Input is processed immediately when entered.
.PP
\f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to interpret constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
@@ -200,7 +231,7 @@ programs with the \f[B]T\f[R] command.
.PP
\f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
@@ -242,265 +273,332 @@ The valid commands are listed below.
.SS Printing
.PP
These commands are used for printing.
-.TP
+.PP
\f[B]p\f[R]
-Prints the value on top of the stack, whether number or string, and
-prints a newline after.
-.RS
.PP
+: Prints the value on top of the stack, whether number or string, and
+prints a newline after.
+.IP
+.nf
+\f[C]
This does not alter the stack.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]n\f[R]
-Prints the value on top of the stack, whether number or string, and pops
-it off of the stack.
-.TP
+.PP
+: Prints the value on top of the stack, whether number or string, and
+pops it off of the stack.
+.PP
\f[B]P\f[R]
-Pops a value off the stack.
-.RS
.PP
+: Pops a value off the stack.
+.IP
+.nf
+\f[C]
If the value is a number, it is truncated and the absolute value of the
-result is printed as though \f[B]obase\f[R] is \f[B]UCHAR_MAX+1\f[R] and
-each digit is interpreted as an ASCII character, making it a byte
-stream.
-.PP
+result is printed as though **obase** is **UCHAR_MAX+1** and each digit is
+interpreted as an ASCII character, making it a byte stream.
+
If the value is a string, it is printed without a trailing newline.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]f\f[R]
-Prints the entire contents of the stack, in order from newest to oldest,
-without altering anything.
-.RS
.PP
+: Prints the entire contents of the stack, in order from newest to
+oldest, without altering anything.
+.IP
+.nf
+\f[C]
Users should use this command when they get lost.
-.RE
+\f[R]
+.fi
.SS Arithmetic
.PP
These are the commands used for arithmetic.
-.TP
+.PP
\f[B]+\f[R]
-The top two values are popped off the stack, added, and the result is
+.PP
+: The top two values are popped off the stack, added, and the result is
pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]-\f[R]
-The top two values are popped off the stack, subtracted, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, subtracted, and the
+result is pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]*\f[R]
-The top two values are popped off the stack, multiplied, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, multiplied, and the
+result is pushed onto the stack.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The top two values are popped off the stack, divided, and the result is
-pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
-The first value popped off of the stack must be non-zero.
-.RE
-.TP
-\f[B]%\f[R]
-The top two values are popped off the stack, remaindered, and the result
+: The top two values are popped off the stack, divided, and the result
is pushed onto the stack.
-.RS
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be non-zero.
+\f[R]
+.fi
.PP
-Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
-\f[B]scale\f[R], and 2) Using the result of step 1 to calculate
-\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
-\f[B]max(scale+scale(b),scale(a))\f[R].
+\f[B]%\f[R]
.PP
+: The top two values are popped off the stack, remaindered, and the
+result is pushed onto the stack.
+.IP
+.nf
+\f[C]
+Remaindering is equivalent to 1) Computing **a/b** to current **scale**, and
+2) Using the result of step 1 to calculate **a-(a/b)\[rs]*b** to *scale*
+**max(scale+scale(b),scale(a))**.
+
The first value popped off of the stack must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]\[ti]\f[R]
-The top two values are popped off the stack, divided and remaindered,
+.PP
+: The top two values are popped off the stack, divided and remaindered,
and the results (divided first, remainder second) are pushed onto the
stack.
This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
\f[B]y\f[R] are only evaluated once.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be non-zero.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The top two values are popped off the stack, the second is raised to the
-power of the first, and the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top two values are popped off the stack, the second is raised to
+the power of the first, and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be an integer, and if that
value is negative, the second value popped off of the stack must be
non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]v\f[R]
-The top value is popped off the stack, its square root is computed, and
-the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top value is popped off the stack, its square root is computed,
+and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The value popped off of the stack must be non-negative.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]_\f[R]
-If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
-or other commands), then that number is input as a negative number.
-.RS
-.PP
-Otherwise, the top value on the stack is popped and copied, and the copy
-is negated and pushed onto the stack.
-This behavior without a number is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+.PP
+: If this command \f[I]immediately\f[R] precedes a number (i.e., no
+spaces or other commands), then that number is input as a negative
+number.
+.IP
+.nf
+\f[C]
+Otherwise, the top value on the stack is popped and copied, and the copy is
+negated and pushed onto the stack. This behavior without a number is a
+**non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]b\f[R]
-The top value is popped off the stack, and if it is zero, it is pushed
+.PP
+: The top value is popped off the stack, and if it is zero, it is pushed
back onto the stack.
Otherwise, its absolute value is pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]|\f[R]
-The top three values are popped off the stack, a modular exponentiation
-is computed, and the result is pushed onto the stack.
-.RS
.PP
+: The top three values are popped off the stack, a modular
+exponentiation is computed, and the result is pushed onto the stack.
+.IP
+.nf
+\f[C]
The first value popped is used as the reduction modulus and must be an
-integer and non-zero.
-The second value popped is used as the exponent and must be an integer
-and non-negative.
-The third value popped is the base and must be an integer.
+integer and non-zero. The second value popped is used as the exponent and
+must be an integer and non-negative. The third value popped is the base and
+must be an integer.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]G\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]N\f[R]
-The top value is popped off of the stack, and if it a \f[B]0\f[R], a
+.PP
+: The top value is popped off of the stack, and if it a \f[B]0\f[R], a
\f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B](\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]{\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than or equal to the second,
-or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than or equal to the
+second, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B])\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]}\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than or equal to the
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than or equal to the
second, or \f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]M\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If they are both non-zero, a \f[B]1\f[R] is pushed onto the stack.
If either of them is zero, or both of them are, then a \f[B]0\f[R] is
pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
+.IP
+.nf
+\f[C]
+This is like the **&&** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]m\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If at least one of them is non-zero, a \f[B]1\f[R] is pushed onto the
stack.
If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is like the **||** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Stack Control
.PP
These commands control the stack.
-.TP
+.PP
\f[B]c\f[R]
-Removes all items from (\[lq]clears\[rq]) the stack.
-.TP
+.PP
+: Removes all items from (\[dq]clears\[dq]) the stack.
+.PP
\f[B]d\f[R]
-Copies the item on top of the stack (\[lq]duplicates\[rq]) and pushes
+.PP
+: Copies the item on top of the stack (\[dq]duplicates\[dq]) and pushes
the copy onto the stack.
-.TP
+.PP
\f[B]r\f[R]
-Swaps (\[lq]reverses\[rq]) the two top items on the stack.
-.TP
+.PP
+: Swaps (\[dq]reverses\[dq]) the two top items on the stack.
+.PP
\f[B]R\f[R]
-Pops (\[lq]removes\[rq]) the top value from the stack.
+.PP
+: Pops (\[dq]removes\[dq]) the top value from the stack.
.SS Register Control
.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
-.TP
+.PP
\f[B]s\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack and stores it into register
+.PP
+: Pops the value off the top of the stack and stores it into register
\f[I]r\f[R].
-.TP
+.PP
\f[B]l\f[R]\f[I]r\f[R]
-Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
+.PP
+: Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
This does not alter the contents of \f[I]r\f[R].
-.TP
+.PP
\f[B]S\f[R]\f[I]r\f[R]
-Pops the value off the top of the (main) stack and pushes it onto the
+.PP
+: Pops the value off the top of the (main) stack and pushes it onto the
stack of register \f[I]r\f[R].
The previous value of the register becomes inaccessible.
-.TP
+.PP
\f[B]L\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack for register \f[I]r\f[R] and
+.PP
+: Pops the value off the top of the stack for register \f[I]r\f[R] and
push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
@@ -509,68 +607,86 @@ accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
and \f[B]scale\f[R].
Also see the \f[B]SYNTAX\f[R] section.
-.TP
+.PP
\f[B]i\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
inclusive.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]o\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]obase\f[R], which must be between \f[B]2\f[R] and
\f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]k\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]scale\f[R], which must be non-negative.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]I\f[R]
-Pushes the current value of \f[B]ibase\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]ibase\f[R] onto the main stack.
+.PP
\f[B]O\f[R]
-Pushes the current value of \f[B]obase\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]obase\f[R] onto the main stack.
+.PP
\f[B]K\f[R]
-Pushes the current value of \f[B]scale\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]scale\f[R] onto the main stack.
+.PP
\f[B]T\f[R]
-Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]U\f[R]
-Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]V\f[R]
-Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
-stack.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+: Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
+stack.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Strings
.PP
The following commands control strings.
@@ -587,233 +703,292 @@ Strings can also be executed as macros.
For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
printed with a newline after and then popped from the stack.
-.TP
-\f[B][\f[R]_characters_\f[B]]\f[R]
-Makes a string containing \f[I]characters\f[R] and pushes it onto the
-stack.
-.RS
.PP
-If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
-they must be balanced.
-Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
-character.
+\f[B][\f[R]\f[I]characters\f[R]\f[B]]\f[R]
.PP
+: Makes a string containing \f[I]characters\f[R] and pushes it onto the
+stack.
+.IP
+.nf
+\f[C]
+If there are brackets (**\[rs][** and **\[rs]]**) in the string, then they must be
+balanced. Unbalanced brackets can be escaped using a backslash (**\[rs]\[rs]**)
+character.
+
If there is a backslash character in the string, the character after it
-(even another backslash) is put into the string verbatim, but the
-(first) backslash is not.
-.RE
-.TP
-\f[B]a\f[R]
-The value on top of the stack is popped.
-.RS
+(even another backslash) is put into the string verbatim, but the (first)
+backslash is not.
+\f[R]
+.fi
.PP
-If it is a number, it is truncated and its absolute value is taken.
-The result mod \f[B]UCHAR_MAX+1\f[R] is calculated.
-If that result is \f[B]0\f[R], push an empty string; otherwise, push a
-one-character string where the character is the result of the mod
-interpreted as an ASCII character.
+\f[B]a\f[R]
.PP
-If it is a string, then a new string is made.
-If the original string is empty, the new string is empty.
-If it is not, then the first character of the original string is used to
-create the new string as a one-character string.
-The new string is then pushed onto the stack.
+: The value on top of the stack is popped.
+.IP
+.nf
+\f[C]
+If it is a number, it is truncated and its absolute value is taken. The
+result mod **UCHAR_MAX+1** is calculated. If that result is **0**, push an
+empty string; otherwise, push a one-character string where the character is
+the result of the mod interpreted as an ASCII character.
+
+If it is a string, then a new string is made. If the original string is
+empty, the new string is empty. If it is not, then the first character of
+the original string is used to create the new string as a one-character
+string. The new string is then pushed onto the stack.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]x\f[R]
-Pops a value off of the top of the stack.
-.RS
.PP
+: Pops a value off of the top of the stack.
+.IP
+.nf
+\f[C]
If it is a number, it is pushed back onto the stack.
-.PP
+
If it is a string, it is executed as a macro.
-.PP
+
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is greater than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
-.PP
-For example, \f[B]0 1>a\f[R] will execute the contents of register
-\f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
+.IP
+.nf
+\f[C]
+For example, **0 1>a** will execute the contents of register **a**, and
+**1 0>a** will not.
+
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not greater than the second (less than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is less than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not less than the second (greater than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is equal to the second, then the contents of register
\f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not equal to the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]?\f[R]
-Reads a line from the \f[B]stdin\f[R] and executes it.
+.PP
+: Reads a line from the \f[B]stdin\f[R] and executes it.
This is to allow macros to request input from users.
-.TP
+.PP
\f[B]q\f[R]
-During execution of a macro, this exits the execution of that macro and
-the execution of the macro that executed it.
+.PP
+: During execution of a macro, this exits the execution of that macro
+and the execution of the macro that executed it.
If there are no macros, or only one macro executing, dc(1) exits.
-.TP
+.PP
\f[B]Q\f[R]
-Pops a value from the stack which must be non-negative and is used the
+.PP
+: Pops a value from the stack which must be non-negative and is used the
number of macro executions to pop off of the execution stack.
If the number of levels to pop is greater than the number of executing
macros, dc(1) exits.
.SS Status
.PP
These commands query status of the stack or its top value.
-.TP
-\f[B]Z\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, calculates the number of significant decimal digits
-it has and pushes the result.
+\f[B]Z\f[R]
.PP
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, calculates the number of significant decimal digits it
+has and pushes the result.
+
If it is a string, pushes the number of characters the string has.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]X\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, pushes the \f[I]scale\f[R] of the value onto the
-stack.
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, pushes the *scale* of the value onto the stack.
+
+If it is a string, pushes **0**.
+\f[R]
+.fi
.PP
-If it is a string, pushes \f[B]0\f[R].
-.RE
-.TP
\f[B]z\f[R]
-Pushes the current stack depth (before execution of this command).
+.PP
+: Pushes the current stack depth (before execution of this command).
.SS Arrays
.PP
These commands manipulate arrays.
-.TP
+.PP
\f[B]:\f[R]\f[I]r\f[R]
-Pops the top two values off of the stack.
+.PP
+: Pops the top two values off of the stack.
The second value will be stored in the array \f[I]r\f[R] (see the
\f[B]REGISTERS\f[R] section), indexed by the first value.
-.TP
+.PP
\f[B];\f[R]\f[I]r\f[R]
-Pops the value on top of the stack and uses it as an index into the
+.PP
+: Pops the value on top of the stack and uses it as an index into the
array \f[I]r\f[R].
The selected value is then pushed onto the stack.
.SH REGISTERS
@@ -828,8 +1003,8 @@ their stack.
.PP
In non-extended register mode, a register name is just the single
character that follows any command that needs a register name.
-The only exception is a newline (\f[B]`\[rs]n'\f[R]); it is a parse
-error for a newline to be used as a register name.
+The only exception is a newline (\f[B]\[aq]\[rs]n\[aq]\f[R]); it is a
+parse error for a newline to be used as a register name.
.SS Extended Register Mode
.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
@@ -840,7 +1015,7 @@ If extended register mode is enabled (\f[B]-x\f[R] or
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
-(\f[B]`\[rs]n'\f[R]).
+(\f[B]\[aq]\[rs]n\[aq]\f[R]).
.PP
In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
@@ -885,59 +1060,71 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on dc(1):
-.TP
+.PP
\f[B]DC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
dc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]DC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]DC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]DC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]DC_BASE_POW\f[R].
-.TP
+.PP
\f[B]DC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]DC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
These limits are meant to be effectively non-existent; the limits are so
@@ -947,101 +1134,115 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
dc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]DC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to dc(1).
+.PP
+: This is another way to give command-line arguments to dc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time dc(1) runs.
Another use would be to use the \f[B]-e\f[R] option to set
\f[B]scale\f[R] to a value other than \f[B]0\f[R].
-.RS
-.PP
-The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **DC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some dc file.dc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]dc\[rs]\[dq] file.dc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]dc\[aq] file.dc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]DC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
including the backslash newline combo.
The default line length is \f[B]70\f[R].
-.TP
+.PP
\f[B]DC_EXPR_EXIT\f[R]
-If this variable exists (no matter the contents), dc(1) will exit
+.PP
+: If this variable exists (no matter the contents), dc(1) will exit
immediately after executing expressions and files given by the
\f[B]-e\f[R] and/or \f[B]-f\f[R] command-line options (and any
equivalents).
.SH EXIT STATUS
.PP
dc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**) operator.
+\f[R]
+.fi
.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, attempting to convert a negative number to a hardware
-integer, overflow when converting a number to a hardware integer, and
-attempting to use a non-integer where an integer is required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]) operator.
-.RE
-.TP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, and using a
-token where it is invalid.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, and using a token where it is
+invalid.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
-.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, and attempting an operation when the
-stack has too few elements.
-.RE
-.TP
+.PP
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, and attempting an operation when
+the stack has too few elements.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (dc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (dc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
@@ -1069,7 +1270,7 @@ In interactive mode, dc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, dc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, dc(1) turns on \[dq]TTY mode.\[dq]
.PP
The prompt is enabled in TTY mode.
.PP
@@ -1086,7 +1287,7 @@ If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If dc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If dc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/dc/EHN.1.md b/contrib/bc/manuals/dc/EHN.1.md
index 2e24a10a06dc..fc49cc7187c3 100644
--- a/contrib/bc/manuals/dc/EHN.1.md
+++ b/contrib/bc/manuals/dc/EHN.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -81,12 +81,26 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in dc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of dc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **?** command is used.
+
+ This is a **non-portable extension**.
+
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@@ -432,25 +446,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
-**s***r*
+**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
-**l***r*
+**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
-**S***r*
+**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
-**L***r*
+**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
- now accessible via the **l***r* command.
+ now accessible via the **l**_r_ command.
## Parameters
@@ -563,7 +577,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-**\>***r*
+**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@@ -575,7 +589,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**>***r***e***s*
+**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -584,7 +598,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\>***r*
+**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@@ -593,7 +607,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\>***r***e***s*
+**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -602,7 +616,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**\<***r*
+**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@@ -611,7 +625,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**\<***r***e***s*
+**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -620,7 +634,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\<***r*
+**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@@ -629,7 +643,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\<***r***e***s*
+**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -638,7 +652,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**=***r*
+**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@@ -647,7 +661,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**=***r***e***s*
+**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -656,7 +670,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!=***r*
+**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@@ -665,7 +679,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!=***r***e***s*
+**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -721,12 +735,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
-**:***r*
+**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
-**;***r*
+**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.
diff --git a/contrib/bc/manuals/dc/EHNP.1 b/contrib/bc/manuals/dc/EHNP.1
index f0ea848f819b..be491096703f 100644
--- a/contrib/bc/manuals/dc/EHNP.1
+++ b/contrib/bc/manuals/dc/EHNP.1
@@ -25,18 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+\f[B]dc\f[R] [\f[B]-hiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
-[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-read-prompt\f[R]] [\f[B]--extended-register\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -70,79 +70,100 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.SH OPTIONS
.PP
The following are the options that dc(1) accepts.
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.TP
+.PP
+: Print the version information (copyright header) and exit.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-This option is a no-op.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-x\f[R] \f[B]--extended-register\f[R]
-Enables extended register mode.
+.PP
+: Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]DC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -185,7 +206,7 @@ Input is processed immediately when entered.
.PP
\f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to interpret constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
@@ -195,7 +216,7 @@ programs with the \f[B]T\f[R] command.
.PP
\f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
@@ -237,265 +258,332 @@ The valid commands are listed below.
.SS Printing
.PP
These commands are used for printing.
-.TP
+.PP
\f[B]p\f[R]
-Prints the value on top of the stack, whether number or string, and
-prints a newline after.
-.RS
.PP
+: Prints the value on top of the stack, whether number or string, and
+prints a newline after.
+.IP
+.nf
+\f[C]
This does not alter the stack.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]n\f[R]
-Prints the value on top of the stack, whether number or string, and pops
-it off of the stack.
-.TP
+.PP
+: Prints the value on top of the stack, whether number or string, and
+pops it off of the stack.
+.PP
\f[B]P\f[R]
-Pops a value off the stack.
-.RS
.PP
+: Pops a value off the stack.
+.IP
+.nf
+\f[C]
If the value is a number, it is truncated and the absolute value of the
-result is printed as though \f[B]obase\f[R] is \f[B]UCHAR_MAX+1\f[R] and
-each digit is interpreted as an ASCII character, making it a byte
-stream.
-.PP
+result is printed as though **obase** is **UCHAR_MAX+1** and each digit is
+interpreted as an ASCII character, making it a byte stream.
+
If the value is a string, it is printed without a trailing newline.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]f\f[R]
-Prints the entire contents of the stack, in order from newest to oldest,
-without altering anything.
-.RS
.PP
+: Prints the entire contents of the stack, in order from newest to
+oldest, without altering anything.
+.IP
+.nf
+\f[C]
Users should use this command when they get lost.
-.RE
+\f[R]
+.fi
.SS Arithmetic
.PP
These are the commands used for arithmetic.
-.TP
+.PP
\f[B]+\f[R]
-The top two values are popped off the stack, added, and the result is
+.PP
+: The top two values are popped off the stack, added, and the result is
pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]-\f[R]
-The top two values are popped off the stack, subtracted, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, subtracted, and the
+result is pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]*\f[R]
-The top two values are popped off the stack, multiplied, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, multiplied, and the
+result is pushed onto the stack.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The top two values are popped off the stack, divided, and the result is
-pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
-The first value popped off of the stack must be non-zero.
-.RE
-.TP
-\f[B]%\f[R]
-The top two values are popped off the stack, remaindered, and the result
+: The top two values are popped off the stack, divided, and the result
is pushed onto the stack.
-.RS
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be non-zero.
+\f[R]
+.fi
.PP
-Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
-\f[B]scale\f[R], and 2) Using the result of step 1 to calculate
-\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
-\f[B]max(scale+scale(b),scale(a))\f[R].
+\f[B]%\f[R]
.PP
+: The top two values are popped off the stack, remaindered, and the
+result is pushed onto the stack.
+.IP
+.nf
+\f[C]
+Remaindering is equivalent to 1) Computing **a/b** to current **scale**, and
+2) Using the result of step 1 to calculate **a-(a/b)\[rs]*b** to *scale*
+**max(scale+scale(b),scale(a))**.
+
The first value popped off of the stack must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]\[ti]\f[R]
-The top two values are popped off the stack, divided and remaindered,
+.PP
+: The top two values are popped off the stack, divided and remaindered,
and the results (divided first, remainder second) are pushed onto the
stack.
This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
\f[B]y\f[R] are only evaluated once.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be non-zero.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The top two values are popped off the stack, the second is raised to the
-power of the first, and the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top two values are popped off the stack, the second is raised to
+the power of the first, and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be an integer, and if that
value is negative, the second value popped off of the stack must be
non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]v\f[R]
-The top value is popped off the stack, its square root is computed, and
-the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top value is popped off the stack, its square root is computed,
+and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The value popped off of the stack must be non-negative.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]_\f[R]
-If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
-or other commands), then that number is input as a negative number.
-.RS
-.PP
-Otherwise, the top value on the stack is popped and copied, and the copy
-is negated and pushed onto the stack.
-This behavior without a number is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+.PP
+: If this command \f[I]immediately\f[R] precedes a number (i.e., no
+spaces or other commands), then that number is input as a negative
+number.
+.IP
+.nf
+\f[C]
+Otherwise, the top value on the stack is popped and copied, and the copy is
+negated and pushed onto the stack. This behavior without a number is a
+**non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]b\f[R]
-The top value is popped off the stack, and if it is zero, it is pushed
+.PP
+: The top value is popped off the stack, and if it is zero, it is pushed
back onto the stack.
Otherwise, its absolute value is pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]|\f[R]
-The top three values are popped off the stack, a modular exponentiation
-is computed, and the result is pushed onto the stack.
-.RS
.PP
+: The top three values are popped off the stack, a modular
+exponentiation is computed, and the result is pushed onto the stack.
+.IP
+.nf
+\f[C]
The first value popped is used as the reduction modulus and must be an
-integer and non-zero.
-The second value popped is used as the exponent and must be an integer
-and non-negative.
-The third value popped is the base and must be an integer.
+integer and non-zero. The second value popped is used as the exponent and
+must be an integer and non-negative. The third value popped is the base and
+must be an integer.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]G\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]N\f[R]
-The top value is popped off of the stack, and if it a \f[B]0\f[R], a
+.PP
+: The top value is popped off of the stack, and if it a \f[B]0\f[R], a
\f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B](\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]{\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than or equal to the second,
-or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than or equal to the
+second, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B])\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]}\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than or equal to the
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than or equal to the
second, or \f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]M\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If they are both non-zero, a \f[B]1\f[R] is pushed onto the stack.
If either of them is zero, or both of them are, then a \f[B]0\f[R] is
pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
+.IP
+.nf
+\f[C]
+This is like the **&&** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]m\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If at least one of them is non-zero, a \f[B]1\f[R] is pushed onto the
stack.
If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is like the **||** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Stack Control
.PP
These commands control the stack.
-.TP
+.PP
\f[B]c\f[R]
-Removes all items from (\[lq]clears\[rq]) the stack.
-.TP
+.PP
+: Removes all items from (\[dq]clears\[dq]) the stack.
+.PP
\f[B]d\f[R]
-Copies the item on top of the stack (\[lq]duplicates\[rq]) and pushes
+.PP
+: Copies the item on top of the stack (\[dq]duplicates\[dq]) and pushes
the copy onto the stack.
-.TP
+.PP
\f[B]r\f[R]
-Swaps (\[lq]reverses\[rq]) the two top items on the stack.
-.TP
+.PP
+: Swaps (\[dq]reverses\[dq]) the two top items on the stack.
+.PP
\f[B]R\f[R]
-Pops (\[lq]removes\[rq]) the top value from the stack.
+.PP
+: Pops (\[dq]removes\[dq]) the top value from the stack.
.SS Register Control
.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
-.TP
+.PP
\f[B]s\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack and stores it into register
+.PP
+: Pops the value off the top of the stack and stores it into register
\f[I]r\f[R].
-.TP
+.PP
\f[B]l\f[R]\f[I]r\f[R]
-Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
+.PP
+: Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
This does not alter the contents of \f[I]r\f[R].
-.TP
+.PP
\f[B]S\f[R]\f[I]r\f[R]
-Pops the value off the top of the (main) stack and pushes it onto the
+.PP
+: Pops the value off the top of the (main) stack and pushes it onto the
stack of register \f[I]r\f[R].
The previous value of the register becomes inaccessible.
-.TP
+.PP
\f[B]L\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack for register \f[I]r\f[R] and
+.PP
+: Pops the value off the top of the stack for register \f[I]r\f[R] and
push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
@@ -504,68 +592,86 @@ accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
and \f[B]scale\f[R].
Also see the \f[B]SYNTAX\f[R] section.
-.TP
+.PP
\f[B]i\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
inclusive.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]o\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]obase\f[R], which must be between \f[B]2\f[R] and
\f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]k\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]scale\f[R], which must be non-negative.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]I\f[R]
-Pushes the current value of \f[B]ibase\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]ibase\f[R] onto the main stack.
+.PP
\f[B]O\f[R]
-Pushes the current value of \f[B]obase\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]obase\f[R] onto the main stack.
+.PP
\f[B]K\f[R]
-Pushes the current value of \f[B]scale\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]scale\f[R] onto the main stack.
+.PP
\f[B]T\f[R]
-Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]U\f[R]
-Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]V\f[R]
-Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
-stack.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+: Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
+stack.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Strings
.PP
The following commands control strings.
@@ -582,233 +688,292 @@ Strings can also be executed as macros.
For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
printed with a newline after and then popped from the stack.
-.TP
-\f[B][\f[R]_characters_\f[B]]\f[R]
-Makes a string containing \f[I]characters\f[R] and pushes it onto the
-stack.
-.RS
.PP
-If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
-they must be balanced.
-Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
-character.
+\f[B][\f[R]\f[I]characters\f[R]\f[B]]\f[R]
.PP
+: Makes a string containing \f[I]characters\f[R] and pushes it onto the
+stack.
+.IP
+.nf
+\f[C]
+If there are brackets (**\[rs][** and **\[rs]]**) in the string, then they must be
+balanced. Unbalanced brackets can be escaped using a backslash (**\[rs]\[rs]**)
+character.
+
If there is a backslash character in the string, the character after it
-(even another backslash) is put into the string verbatim, but the
-(first) backslash is not.
-.RE
-.TP
-\f[B]a\f[R]
-The value on top of the stack is popped.
-.RS
+(even another backslash) is put into the string verbatim, but the (first)
+backslash is not.
+\f[R]
+.fi
.PP
-If it is a number, it is truncated and its absolute value is taken.
-The result mod \f[B]UCHAR_MAX+1\f[R] is calculated.
-If that result is \f[B]0\f[R], push an empty string; otherwise, push a
-one-character string where the character is the result of the mod
-interpreted as an ASCII character.
+\f[B]a\f[R]
.PP
-If it is a string, then a new string is made.
-If the original string is empty, the new string is empty.
-If it is not, then the first character of the original string is used to
-create the new string as a one-character string.
-The new string is then pushed onto the stack.
+: The value on top of the stack is popped.
+.IP
+.nf
+\f[C]
+If it is a number, it is truncated and its absolute value is taken. The
+result mod **UCHAR_MAX+1** is calculated. If that result is **0**, push an
+empty string; otherwise, push a one-character string where the character is
+the result of the mod interpreted as an ASCII character.
+
+If it is a string, then a new string is made. If the original string is
+empty, the new string is empty. If it is not, then the first character of
+the original string is used to create the new string as a one-character
+string. The new string is then pushed onto the stack.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]x\f[R]
-Pops a value off of the top of the stack.
-.RS
.PP
+: Pops a value off of the top of the stack.
+.IP
+.nf
+\f[C]
If it is a number, it is pushed back onto the stack.
-.PP
+
If it is a string, it is executed as a macro.
-.PP
+
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is greater than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
-.PP
-For example, \f[B]0 1>a\f[R] will execute the contents of register
-\f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
+.IP
+.nf
+\f[C]
+For example, **0 1>a** will execute the contents of register **a**, and
+**1 0>a** will not.
+
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not greater than the second (less than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is less than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not less than the second (greater than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is equal to the second, then the contents of register
\f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not equal to the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]?\f[R]
-Reads a line from the \f[B]stdin\f[R] and executes it.
+.PP
+: Reads a line from the \f[B]stdin\f[R] and executes it.
This is to allow macros to request input from users.
-.TP
+.PP
\f[B]q\f[R]
-During execution of a macro, this exits the execution of that macro and
-the execution of the macro that executed it.
+.PP
+: During execution of a macro, this exits the execution of that macro
+and the execution of the macro that executed it.
If there are no macros, or only one macro executing, dc(1) exits.
-.TP
+.PP
\f[B]Q\f[R]
-Pops a value from the stack which must be non-negative and is used the
+.PP
+: Pops a value from the stack which must be non-negative and is used the
number of macro executions to pop off of the execution stack.
If the number of levels to pop is greater than the number of executing
macros, dc(1) exits.
.SS Status
.PP
These commands query status of the stack or its top value.
-.TP
-\f[B]Z\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, calculates the number of significant decimal digits
-it has and pushes the result.
+\f[B]Z\f[R]
.PP
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, calculates the number of significant decimal digits it
+has and pushes the result.
+
If it is a string, pushes the number of characters the string has.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]X\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, pushes the \f[I]scale\f[R] of the value onto the
-stack.
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, pushes the *scale* of the value onto the stack.
+
+If it is a string, pushes **0**.
+\f[R]
+.fi
.PP
-If it is a string, pushes \f[B]0\f[R].
-.RE
-.TP
\f[B]z\f[R]
-Pushes the current stack depth (before execution of this command).
+.PP
+: Pushes the current stack depth (before execution of this command).
.SS Arrays
.PP
These commands manipulate arrays.
-.TP
+.PP
\f[B]:\f[R]\f[I]r\f[R]
-Pops the top two values off of the stack.
+.PP
+: Pops the top two values off of the stack.
The second value will be stored in the array \f[I]r\f[R] (see the
\f[B]REGISTERS\f[R] section), indexed by the first value.
-.TP
+.PP
\f[B];\f[R]\f[I]r\f[R]
-Pops the value on top of the stack and uses it as an index into the
+.PP
+: Pops the value on top of the stack and uses it as an index into the
array \f[I]r\f[R].
The selected value is then pushed onto the stack.
.SH REGISTERS
@@ -823,8 +988,8 @@ their stack.
.PP
In non-extended register mode, a register name is just the single
character that follows any command that needs a register name.
-The only exception is a newline (\f[B]`\[rs]n'\f[R]); it is a parse
-error for a newline to be used as a register name.
+The only exception is a newline (\f[B]\[aq]\[rs]n\[aq]\f[R]); it is a
+parse error for a newline to be used as a register name.
.SS Extended Register Mode
.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
@@ -835,7 +1000,7 @@ If extended register mode is enabled (\f[B]-x\f[R] or
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
-(\f[B]`\[rs]n'\f[R]).
+(\f[B]\[aq]\[rs]n\[aq]\f[R]).
.PP
In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
@@ -880,59 +1045,71 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on dc(1):
-.TP
+.PP
\f[B]DC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
dc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]DC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]DC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]DC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]DC_BASE_POW\f[R].
-.TP
+.PP
\f[B]DC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]DC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
These limits are meant to be effectively non-existent; the limits are so
@@ -942,101 +1119,115 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
dc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]DC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to dc(1).
+.PP
+: This is another way to give command-line arguments to dc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time dc(1) runs.
Another use would be to use the \f[B]-e\f[R] option to set
\f[B]scale\f[R] to a value other than \f[B]0\f[R].
-.RS
-.PP
-The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **DC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some dc file.dc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]dc\[rs]\[dq] file.dc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]dc\[aq] file.dc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]DC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
including the backslash newline combo.
The default line length is \f[B]70\f[R].
-.TP
+.PP
\f[B]DC_EXPR_EXIT\f[R]
-If this variable exists (no matter the contents), dc(1) will exit
+.PP
+: If this variable exists (no matter the contents), dc(1) will exit
immediately after executing expressions and files given by the
\f[B]-e\f[R] and/or \f[B]-f\f[R] command-line options (and any
equivalents).
.SH EXIT STATUS
.PP
dc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**) operator.
+\f[R]
+.fi
.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, attempting to convert a negative number to a hardware
-integer, overflow when converting a number to a hardware integer, and
-attempting to use a non-integer where an integer is required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]) operator.
-.RE
-.TP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, and using a
-token where it is invalid.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, and using a token where it is
+invalid.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
-.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, and attempting an operation when the
-stack has too few elements.
-.RE
-.TP
+.PP
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, and attempting an operation when
+the stack has too few elements.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (dc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (dc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
@@ -1064,7 +1255,7 @@ In interactive mode, dc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, dc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, dc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is different from interactive mode because interactive mode is
required in the bc(1)
@@ -1079,7 +1270,7 @@ If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If dc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If dc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/dc/EHNP.1.md b/contrib/bc/manuals/dc/EHNP.1.md
index 5abed62294c2..edbf30b272e1 100644
--- a/contrib/bc/manuals/dc/EHNP.1.md
+++ b/contrib/bc/manuals/dc/EHNP.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -84,6 +84,12 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: This option is a no-op.
+
+ This is a **non-portable extension**.
+
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@@ -429,25 +435,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
-**s***r*
+**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
-**l***r*
+**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
-**S***r*
+**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
-**L***r*
+**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
- now accessible via the **l***r* command.
+ now accessible via the **l**_r_ command.
## Parameters
@@ -560,7 +566,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-**\>***r*
+**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@@ -572,7 +578,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**>***r***e***s*
+**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -581,7 +587,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\>***r*
+**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@@ -590,7 +596,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\>***r***e***s*
+**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -599,7 +605,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**\<***r*
+**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@@ -608,7 +614,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**\<***r***e***s*
+**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -617,7 +623,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\<***r*
+**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@@ -626,7 +632,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\<***r***e***s*
+**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -635,7 +641,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**=***r*
+**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@@ -644,7 +650,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**=***r***e***s*
+**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -653,7 +659,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!=***r*
+**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@@ -662,7 +668,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!=***r***e***s*
+**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -718,12 +724,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
-**:***r*
+**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
-**;***r*
+**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.
diff --git a/contrib/bc/manuals/dc/EHP.1 b/contrib/bc/manuals/dc/EHP.1
index 654c24309c56..797f0ef2bcfb 100644
--- a/contrib/bc/manuals/dc/EHP.1
+++ b/contrib/bc/manuals/dc/EHP.1
@@ -25,18 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+\f[B]dc\f[R] [\f[B]-hiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
-[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-read-prompt\f[R]] [\f[B]--extended-register\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -70,79 +70,100 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.SH OPTIONS
.PP
The following are the options that dc(1) accepts.
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.TP
+.PP
+: Print the version information (copyright header) and exit.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-This option is a no-op.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-x\f[R] \f[B]--extended-register\f[R]
-Enables extended register mode.
+.PP
+: Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]DC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -185,7 +206,7 @@ Input is processed immediately when entered.
.PP
\f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to interpret constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
@@ -195,7 +216,7 @@ programs with the \f[B]T\f[R] command.
.PP
\f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
@@ -237,265 +258,332 @@ The valid commands are listed below.
.SS Printing
.PP
These commands are used for printing.
-.TP
+.PP
\f[B]p\f[R]
-Prints the value on top of the stack, whether number or string, and
-prints a newline after.
-.RS
.PP
+: Prints the value on top of the stack, whether number or string, and
+prints a newline after.
+.IP
+.nf
+\f[C]
This does not alter the stack.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]n\f[R]
-Prints the value on top of the stack, whether number or string, and pops
-it off of the stack.
-.TP
+.PP
+: Prints the value on top of the stack, whether number or string, and
+pops it off of the stack.
+.PP
\f[B]P\f[R]
-Pops a value off the stack.
-.RS
.PP
+: Pops a value off the stack.
+.IP
+.nf
+\f[C]
If the value is a number, it is truncated and the absolute value of the
-result is printed as though \f[B]obase\f[R] is \f[B]UCHAR_MAX+1\f[R] and
-each digit is interpreted as an ASCII character, making it a byte
-stream.
-.PP
+result is printed as though **obase** is **UCHAR_MAX+1** and each digit is
+interpreted as an ASCII character, making it a byte stream.
+
If the value is a string, it is printed without a trailing newline.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]f\f[R]
-Prints the entire contents of the stack, in order from newest to oldest,
-without altering anything.
-.RS
.PP
+: Prints the entire contents of the stack, in order from newest to
+oldest, without altering anything.
+.IP
+.nf
+\f[C]
Users should use this command when they get lost.
-.RE
+\f[R]
+.fi
.SS Arithmetic
.PP
These are the commands used for arithmetic.
-.TP
+.PP
\f[B]+\f[R]
-The top two values are popped off the stack, added, and the result is
+.PP
+: The top two values are popped off the stack, added, and the result is
pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]-\f[R]
-The top two values are popped off the stack, subtracted, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, subtracted, and the
+result is pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]*\f[R]
-The top two values are popped off the stack, multiplied, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, multiplied, and the
+result is pushed onto the stack.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The top two values are popped off the stack, divided, and the result is
-pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
-The first value popped off of the stack must be non-zero.
-.RE
-.TP
-\f[B]%\f[R]
-The top two values are popped off the stack, remaindered, and the result
+: The top two values are popped off the stack, divided, and the result
is pushed onto the stack.
-.RS
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be non-zero.
+\f[R]
+.fi
.PP
-Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
-\f[B]scale\f[R], and 2) Using the result of step 1 to calculate
-\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
-\f[B]max(scale+scale(b),scale(a))\f[R].
+\f[B]%\f[R]
.PP
+: The top two values are popped off the stack, remaindered, and the
+result is pushed onto the stack.
+.IP
+.nf
+\f[C]
+Remaindering is equivalent to 1) Computing **a/b** to current **scale**, and
+2) Using the result of step 1 to calculate **a-(a/b)\[rs]*b** to *scale*
+**max(scale+scale(b),scale(a))**.
+
The first value popped off of the stack must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]\[ti]\f[R]
-The top two values are popped off the stack, divided and remaindered,
+.PP
+: The top two values are popped off the stack, divided and remaindered,
and the results (divided first, remainder second) are pushed onto the
stack.
This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
\f[B]y\f[R] are only evaluated once.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be non-zero.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The top two values are popped off the stack, the second is raised to the
-power of the first, and the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top two values are popped off the stack, the second is raised to
+the power of the first, and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be an integer, and if that
value is negative, the second value popped off of the stack must be
non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]v\f[R]
-The top value is popped off the stack, its square root is computed, and
-the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top value is popped off the stack, its square root is computed,
+and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The value popped off of the stack must be non-negative.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]_\f[R]
-If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
-or other commands), then that number is input as a negative number.
-.RS
-.PP
-Otherwise, the top value on the stack is popped and copied, and the copy
-is negated and pushed onto the stack.
-This behavior without a number is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+.PP
+: If this command \f[I]immediately\f[R] precedes a number (i.e., no
+spaces or other commands), then that number is input as a negative
+number.
+.IP
+.nf
+\f[C]
+Otherwise, the top value on the stack is popped and copied, and the copy is
+negated and pushed onto the stack. This behavior without a number is a
+**non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]b\f[R]
-The top value is popped off the stack, and if it is zero, it is pushed
+.PP
+: The top value is popped off the stack, and if it is zero, it is pushed
back onto the stack.
Otherwise, its absolute value is pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]|\f[R]
-The top three values are popped off the stack, a modular exponentiation
-is computed, and the result is pushed onto the stack.
-.RS
.PP
+: The top three values are popped off the stack, a modular
+exponentiation is computed, and the result is pushed onto the stack.
+.IP
+.nf
+\f[C]
The first value popped is used as the reduction modulus and must be an
-integer and non-zero.
-The second value popped is used as the exponent and must be an integer
-and non-negative.
-The third value popped is the base and must be an integer.
+integer and non-zero. The second value popped is used as the exponent and
+must be an integer and non-negative. The third value popped is the base and
+must be an integer.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]G\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]N\f[R]
-The top value is popped off of the stack, and if it a \f[B]0\f[R], a
+.PP
+: The top value is popped off of the stack, and if it a \f[B]0\f[R], a
\f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B](\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]{\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than or equal to the second,
-or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than or equal to the
+second, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B])\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]}\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than or equal to the
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than or equal to the
second, or \f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]M\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If they are both non-zero, a \f[B]1\f[R] is pushed onto the stack.
If either of them is zero, or both of them are, then a \f[B]0\f[R] is
pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
+.IP
+.nf
+\f[C]
+This is like the **&&** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]m\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If at least one of them is non-zero, a \f[B]1\f[R] is pushed onto the
stack.
If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is like the **||** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Stack Control
.PP
These commands control the stack.
-.TP
+.PP
\f[B]c\f[R]
-Removes all items from (\[lq]clears\[rq]) the stack.
-.TP
+.PP
+: Removes all items from (\[dq]clears\[dq]) the stack.
+.PP
\f[B]d\f[R]
-Copies the item on top of the stack (\[lq]duplicates\[rq]) and pushes
+.PP
+: Copies the item on top of the stack (\[dq]duplicates\[dq]) and pushes
the copy onto the stack.
-.TP
+.PP
\f[B]r\f[R]
-Swaps (\[lq]reverses\[rq]) the two top items on the stack.
-.TP
+.PP
+: Swaps (\[dq]reverses\[dq]) the two top items on the stack.
+.PP
\f[B]R\f[R]
-Pops (\[lq]removes\[rq]) the top value from the stack.
+.PP
+: Pops (\[dq]removes\[dq]) the top value from the stack.
.SS Register Control
.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
-.TP
+.PP
\f[B]s\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack and stores it into register
+.PP
+: Pops the value off the top of the stack and stores it into register
\f[I]r\f[R].
-.TP
+.PP
\f[B]l\f[R]\f[I]r\f[R]
-Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
+.PP
+: Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
This does not alter the contents of \f[I]r\f[R].
-.TP
+.PP
\f[B]S\f[R]\f[I]r\f[R]
-Pops the value off the top of the (main) stack and pushes it onto the
+.PP
+: Pops the value off the top of the (main) stack and pushes it onto the
stack of register \f[I]r\f[R].
The previous value of the register becomes inaccessible.
-.TP
+.PP
\f[B]L\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack for register \f[I]r\f[R] and
+.PP
+: Pops the value off the top of the stack for register \f[I]r\f[R] and
push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
@@ -504,68 +592,86 @@ accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
and \f[B]scale\f[R].
Also see the \f[B]SYNTAX\f[R] section.
-.TP
+.PP
\f[B]i\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
inclusive.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]o\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]obase\f[R], which must be between \f[B]2\f[R] and
\f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]k\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]scale\f[R], which must be non-negative.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]I\f[R]
-Pushes the current value of \f[B]ibase\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]ibase\f[R] onto the main stack.
+.PP
\f[B]O\f[R]
-Pushes the current value of \f[B]obase\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]obase\f[R] onto the main stack.
+.PP
\f[B]K\f[R]
-Pushes the current value of \f[B]scale\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]scale\f[R] onto the main stack.
+.PP
\f[B]T\f[R]
-Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]U\f[R]
-Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]V\f[R]
-Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
-stack.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+: Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
+stack.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Strings
.PP
The following commands control strings.
@@ -582,233 +688,292 @@ Strings can also be executed as macros.
For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
printed with a newline after and then popped from the stack.
-.TP
-\f[B][\f[R]_characters_\f[B]]\f[R]
-Makes a string containing \f[I]characters\f[R] and pushes it onto the
-stack.
-.RS
.PP
-If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
-they must be balanced.
-Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
-character.
+\f[B][\f[R]\f[I]characters\f[R]\f[B]]\f[R]
.PP
+: Makes a string containing \f[I]characters\f[R] and pushes it onto the
+stack.
+.IP
+.nf
+\f[C]
+If there are brackets (**\[rs][** and **\[rs]]**) in the string, then they must be
+balanced. Unbalanced brackets can be escaped using a backslash (**\[rs]\[rs]**)
+character.
+
If there is a backslash character in the string, the character after it
-(even another backslash) is put into the string verbatim, but the
-(first) backslash is not.
-.RE
-.TP
-\f[B]a\f[R]
-The value on top of the stack is popped.
-.RS
+(even another backslash) is put into the string verbatim, but the (first)
+backslash is not.
+\f[R]
+.fi
.PP
-If it is a number, it is truncated and its absolute value is taken.
-The result mod \f[B]UCHAR_MAX+1\f[R] is calculated.
-If that result is \f[B]0\f[R], push an empty string; otherwise, push a
-one-character string where the character is the result of the mod
-interpreted as an ASCII character.
+\f[B]a\f[R]
.PP
-If it is a string, then a new string is made.
-If the original string is empty, the new string is empty.
-If it is not, then the first character of the original string is used to
-create the new string as a one-character string.
-The new string is then pushed onto the stack.
+: The value on top of the stack is popped.
+.IP
+.nf
+\f[C]
+If it is a number, it is truncated and its absolute value is taken. The
+result mod **UCHAR_MAX+1** is calculated. If that result is **0**, push an
+empty string; otherwise, push a one-character string where the character is
+the result of the mod interpreted as an ASCII character.
+
+If it is a string, then a new string is made. If the original string is
+empty, the new string is empty. If it is not, then the first character of
+the original string is used to create the new string as a one-character
+string. The new string is then pushed onto the stack.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]x\f[R]
-Pops a value off of the top of the stack.
-.RS
.PP
+: Pops a value off of the top of the stack.
+.IP
+.nf
+\f[C]
If it is a number, it is pushed back onto the stack.
-.PP
+
If it is a string, it is executed as a macro.
-.PP
+
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is greater than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
-.PP
-For example, \f[B]0 1>a\f[R] will execute the contents of register
-\f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
+.IP
+.nf
+\f[C]
+For example, **0 1>a** will execute the contents of register **a**, and
+**1 0>a** will not.
+
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not greater than the second (less than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is less than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not less than the second (greater than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is equal to the second, then the contents of register
\f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not equal to the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]?\f[R]
-Reads a line from the \f[B]stdin\f[R] and executes it.
+.PP
+: Reads a line from the \f[B]stdin\f[R] and executes it.
This is to allow macros to request input from users.
-.TP
+.PP
\f[B]q\f[R]
-During execution of a macro, this exits the execution of that macro and
-the execution of the macro that executed it.
+.PP
+: During execution of a macro, this exits the execution of that macro
+and the execution of the macro that executed it.
If there are no macros, or only one macro executing, dc(1) exits.
-.TP
+.PP
\f[B]Q\f[R]
-Pops a value from the stack which must be non-negative and is used the
+.PP
+: Pops a value from the stack which must be non-negative and is used the
number of macro executions to pop off of the execution stack.
If the number of levels to pop is greater than the number of executing
macros, dc(1) exits.
.SS Status
.PP
These commands query status of the stack or its top value.
-.TP
-\f[B]Z\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, calculates the number of significant decimal digits
-it has and pushes the result.
+\f[B]Z\f[R]
.PP
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, calculates the number of significant decimal digits it
+has and pushes the result.
+
If it is a string, pushes the number of characters the string has.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]X\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, pushes the \f[I]scale\f[R] of the value onto the
-stack.
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, pushes the *scale* of the value onto the stack.
+
+If it is a string, pushes **0**.
+\f[R]
+.fi
.PP
-If it is a string, pushes \f[B]0\f[R].
-.RE
-.TP
\f[B]z\f[R]
-Pushes the current stack depth (before execution of this command).
+.PP
+: Pushes the current stack depth (before execution of this command).
.SS Arrays
.PP
These commands manipulate arrays.
-.TP
+.PP
\f[B]:\f[R]\f[I]r\f[R]
-Pops the top two values off of the stack.
+.PP
+: Pops the top two values off of the stack.
The second value will be stored in the array \f[I]r\f[R] (see the
\f[B]REGISTERS\f[R] section), indexed by the first value.
-.TP
+.PP
\f[B];\f[R]\f[I]r\f[R]
-Pops the value on top of the stack and uses it as an index into the
+.PP
+: Pops the value on top of the stack and uses it as an index into the
array \f[I]r\f[R].
The selected value is then pushed onto the stack.
.SH REGISTERS
@@ -823,8 +988,8 @@ their stack.
.PP
In non-extended register mode, a register name is just the single
character that follows any command that needs a register name.
-The only exception is a newline (\f[B]`\[rs]n'\f[R]); it is a parse
-error for a newline to be used as a register name.
+The only exception is a newline (\f[B]\[aq]\[rs]n\[aq]\f[R]); it is a
+parse error for a newline to be used as a register name.
.SS Extended Register Mode
.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
@@ -835,7 +1000,7 @@ If extended register mode is enabled (\f[B]-x\f[R] or
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
-(\f[B]`\[rs]n'\f[R]).
+(\f[B]\[aq]\[rs]n\[aq]\f[R]).
.PP
In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
@@ -880,59 +1045,71 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on dc(1):
-.TP
+.PP
\f[B]DC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
dc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]DC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]DC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]DC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]DC_BASE_POW\f[R].
-.TP
+.PP
\f[B]DC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]DC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
These limits are meant to be effectively non-existent; the limits are so
@@ -942,101 +1119,115 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
dc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]DC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to dc(1).
+.PP
+: This is another way to give command-line arguments to dc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time dc(1) runs.
Another use would be to use the \f[B]-e\f[R] option to set
\f[B]scale\f[R] to a value other than \f[B]0\f[R].
-.RS
-.PP
-The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **DC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some dc file.dc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]dc\[rs]\[dq] file.dc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]dc\[aq] file.dc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]DC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
including the backslash newline combo.
The default line length is \f[B]70\f[R].
-.TP
+.PP
\f[B]DC_EXPR_EXIT\f[R]
-If this variable exists (no matter the contents), dc(1) will exit
+.PP
+: If this variable exists (no matter the contents), dc(1) will exit
immediately after executing expressions and files given by the
\f[B]-e\f[R] and/or \f[B]-f\f[R] command-line options (and any
equivalents).
.SH EXIT STATUS
.PP
dc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**) operator.
+\f[R]
+.fi
.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, attempting to convert a negative number to a hardware
-integer, overflow when converting a number to a hardware integer, and
-attempting to use a non-integer where an integer is required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]) operator.
-.RE
-.TP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, and using a
-token where it is invalid.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, and using a token where it is
+invalid.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
-.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, and attempting an operation when the
-stack has too few elements.
-.RE
-.TP
+.PP
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, and attempting an operation when
+the stack has too few elements.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (dc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (dc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
@@ -1064,7 +1255,7 @@ In interactive mode, dc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, dc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, dc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is different from interactive mode because interactive mode is
required in the bc(1)
@@ -1079,7 +1270,7 @@ If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If dc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If dc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/dc/EHP.1.md b/contrib/bc/manuals/dc/EHP.1.md
index 17ebe0420492..d890cc3a0c72 100644
--- a/contrib/bc/manuals/dc/EHP.1.md
+++ b/contrib/bc/manuals/dc/EHP.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -84,6 +84,12 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: This option is a no-op.
+
+ This is a **non-portable extension**.
+
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@@ -429,25 +435,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
-**s***r*
+**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
-**l***r*
+**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
-**S***r*
+**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
-**L***r*
+**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
- now accessible via the **l***r* command.
+ now accessible via the **l**_r_ command.
## Parameters
@@ -560,7 +566,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-**\>***r*
+**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@@ -572,7 +578,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**>***r***e***s*
+**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -581,7 +587,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\>***r*
+**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@@ -590,7 +596,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\>***r***e***s*
+**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -599,7 +605,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**\<***r*
+**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@@ -608,7 +614,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**\<***r***e***s*
+**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -617,7 +623,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\<***r*
+**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@@ -626,7 +632,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\<***r***e***s*
+**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -635,7 +641,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**=***r*
+**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@@ -644,7 +650,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**=***r***e***s*
+**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -653,7 +659,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!=***r*
+**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@@ -662,7 +668,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!=***r***e***s*
+**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -718,12 +724,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
-**:***r*
+**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
-**;***r*
+**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.
diff --git a/contrib/bc/manuals/dc/EN.1 b/contrib/bc/manuals/dc/EN.1
index 6d522efdde45..242306dab617 100644
--- a/contrib/bc/manuals/dc/EN.1
+++ b/contrib/bc/manuals/dc/EN.1
@@ -25,18 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+\f[B]dc\f[R] [\f[B]-hiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
-[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-read-prompt\f[R]] [\f[B]--extended-register\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -70,84 +70,115 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.SH OPTIONS
.PP
The following are the options that dc(1) accepts.
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.TP
+.PP
+: Print the version information (copyright header) and exit.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-Disables the prompt in TTY mode.
+.PP
+: Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
-See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
do not want a prompt or are not used to having them in dc(1).
Most of those users would want to put this option in
\f[B]DC_ENV_ARGS\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: Disables the read prompt in TTY mode.
+(The read prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a read prompt or are not used to having them in dc(1).
+Most of those users would want to put this option in
+\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
+This option is also useful in hash bang lines of dc(1) scripts that
+prompt for user input.
+.IP
+.nf
+\f[C]
+This option does not disable the regular prompt because the read prompt is
+only used when the **?** command is used.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-x\f[R] \f[B]--extended-register\f[R]
-Enables extended register mode.
+.PP
+: Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]DC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -190,7 +221,7 @@ Input is processed immediately when entered.
.PP
\f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to interpret constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
@@ -200,7 +231,7 @@ programs with the \f[B]T\f[R] command.
.PP
\f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
@@ -242,265 +273,332 @@ The valid commands are listed below.
.SS Printing
.PP
These commands are used for printing.
-.TP
+.PP
\f[B]p\f[R]
-Prints the value on top of the stack, whether number or string, and
-prints a newline after.
-.RS
.PP
+: Prints the value on top of the stack, whether number or string, and
+prints a newline after.
+.IP
+.nf
+\f[C]
This does not alter the stack.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]n\f[R]
-Prints the value on top of the stack, whether number or string, and pops
-it off of the stack.
-.TP
+.PP
+: Prints the value on top of the stack, whether number or string, and
+pops it off of the stack.
+.PP
\f[B]P\f[R]
-Pops a value off the stack.
-.RS
.PP
+: Pops a value off the stack.
+.IP
+.nf
+\f[C]
If the value is a number, it is truncated and the absolute value of the
-result is printed as though \f[B]obase\f[R] is \f[B]UCHAR_MAX+1\f[R] and
-each digit is interpreted as an ASCII character, making it a byte
-stream.
-.PP
+result is printed as though **obase** is **UCHAR_MAX+1** and each digit is
+interpreted as an ASCII character, making it a byte stream.
+
If the value is a string, it is printed without a trailing newline.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]f\f[R]
-Prints the entire contents of the stack, in order from newest to oldest,
-without altering anything.
-.RS
.PP
+: Prints the entire contents of the stack, in order from newest to
+oldest, without altering anything.
+.IP
+.nf
+\f[C]
Users should use this command when they get lost.
-.RE
+\f[R]
+.fi
.SS Arithmetic
.PP
These are the commands used for arithmetic.
-.TP
+.PP
\f[B]+\f[R]
-The top two values are popped off the stack, added, and the result is
+.PP
+: The top two values are popped off the stack, added, and the result is
pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]-\f[R]
-The top two values are popped off the stack, subtracted, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, subtracted, and the
+result is pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]*\f[R]
-The top two values are popped off the stack, multiplied, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, multiplied, and the
+result is pushed onto the stack.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The top two values are popped off the stack, divided, and the result is
-pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
-The first value popped off of the stack must be non-zero.
-.RE
-.TP
-\f[B]%\f[R]
-The top two values are popped off the stack, remaindered, and the result
+: The top two values are popped off the stack, divided, and the result
is pushed onto the stack.
-.RS
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be non-zero.
+\f[R]
+.fi
.PP
-Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
-\f[B]scale\f[R], and 2) Using the result of step 1 to calculate
-\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
-\f[B]max(scale+scale(b),scale(a))\f[R].
+\f[B]%\f[R]
.PP
+: The top two values are popped off the stack, remaindered, and the
+result is pushed onto the stack.
+.IP
+.nf
+\f[C]
+Remaindering is equivalent to 1) Computing **a/b** to current **scale**, and
+2) Using the result of step 1 to calculate **a-(a/b)\[rs]*b** to *scale*
+**max(scale+scale(b),scale(a))**.
+
The first value popped off of the stack must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]\[ti]\f[R]
-The top two values are popped off the stack, divided and remaindered,
+.PP
+: The top two values are popped off the stack, divided and remaindered,
and the results (divided first, remainder second) are pushed onto the
stack.
This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
\f[B]y\f[R] are only evaluated once.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be non-zero.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The top two values are popped off the stack, the second is raised to the
-power of the first, and the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top two values are popped off the stack, the second is raised to
+the power of the first, and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be an integer, and if that
value is negative, the second value popped off of the stack must be
non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]v\f[R]
-The top value is popped off the stack, its square root is computed, and
-the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top value is popped off the stack, its square root is computed,
+and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The value popped off of the stack must be non-negative.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]_\f[R]
-If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
-or other commands), then that number is input as a negative number.
-.RS
-.PP
-Otherwise, the top value on the stack is popped and copied, and the copy
-is negated and pushed onto the stack.
-This behavior without a number is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+.PP
+: If this command \f[I]immediately\f[R] precedes a number (i.e., no
+spaces or other commands), then that number is input as a negative
+number.
+.IP
+.nf
+\f[C]
+Otherwise, the top value on the stack is popped and copied, and the copy is
+negated and pushed onto the stack. This behavior without a number is a
+**non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]b\f[R]
-The top value is popped off the stack, and if it is zero, it is pushed
+.PP
+: The top value is popped off the stack, and if it is zero, it is pushed
back onto the stack.
Otherwise, its absolute value is pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]|\f[R]
-The top three values are popped off the stack, a modular exponentiation
-is computed, and the result is pushed onto the stack.
-.RS
.PP
+: The top three values are popped off the stack, a modular
+exponentiation is computed, and the result is pushed onto the stack.
+.IP
+.nf
+\f[C]
The first value popped is used as the reduction modulus and must be an
-integer and non-zero.
-The second value popped is used as the exponent and must be an integer
-and non-negative.
-The third value popped is the base and must be an integer.
+integer and non-zero. The second value popped is used as the exponent and
+must be an integer and non-negative. The third value popped is the base and
+must be an integer.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]G\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]N\f[R]
-The top value is popped off of the stack, and if it a \f[B]0\f[R], a
+.PP
+: The top value is popped off of the stack, and if it a \f[B]0\f[R], a
\f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B](\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]{\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than or equal to the second,
-or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than or equal to the
+second, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B])\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]}\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than or equal to the
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than or equal to the
second, or \f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]M\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If they are both non-zero, a \f[B]1\f[R] is pushed onto the stack.
If either of them is zero, or both of them are, then a \f[B]0\f[R] is
pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
+.IP
+.nf
+\f[C]
+This is like the **&&** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]m\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If at least one of them is non-zero, a \f[B]1\f[R] is pushed onto the
stack.
If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is like the **||** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Stack Control
.PP
These commands control the stack.
-.TP
+.PP
\f[B]c\f[R]
-Removes all items from (\[lq]clears\[rq]) the stack.
-.TP
+.PP
+: Removes all items from (\[dq]clears\[dq]) the stack.
+.PP
\f[B]d\f[R]
-Copies the item on top of the stack (\[lq]duplicates\[rq]) and pushes
+.PP
+: Copies the item on top of the stack (\[dq]duplicates\[dq]) and pushes
the copy onto the stack.
-.TP
+.PP
\f[B]r\f[R]
-Swaps (\[lq]reverses\[rq]) the two top items on the stack.
-.TP
+.PP
+: Swaps (\[dq]reverses\[dq]) the two top items on the stack.
+.PP
\f[B]R\f[R]
-Pops (\[lq]removes\[rq]) the top value from the stack.
+.PP
+: Pops (\[dq]removes\[dq]) the top value from the stack.
.SS Register Control
.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
-.TP
+.PP
\f[B]s\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack and stores it into register
+.PP
+: Pops the value off the top of the stack and stores it into register
\f[I]r\f[R].
-.TP
+.PP
\f[B]l\f[R]\f[I]r\f[R]
-Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
+.PP
+: Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
This does not alter the contents of \f[I]r\f[R].
-.TP
+.PP
\f[B]S\f[R]\f[I]r\f[R]
-Pops the value off the top of the (main) stack and pushes it onto the
+.PP
+: Pops the value off the top of the (main) stack and pushes it onto the
stack of register \f[I]r\f[R].
The previous value of the register becomes inaccessible.
-.TP
+.PP
\f[B]L\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack for register \f[I]r\f[R] and
+.PP
+: Pops the value off the top of the stack for register \f[I]r\f[R] and
push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
@@ -509,68 +607,86 @@ accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
and \f[B]scale\f[R].
Also see the \f[B]SYNTAX\f[R] section.
-.TP
+.PP
\f[B]i\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
inclusive.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]o\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]obase\f[R], which must be between \f[B]2\f[R] and
\f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]k\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]scale\f[R], which must be non-negative.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]I\f[R]
-Pushes the current value of \f[B]ibase\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]ibase\f[R] onto the main stack.
+.PP
\f[B]O\f[R]
-Pushes the current value of \f[B]obase\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]obase\f[R] onto the main stack.
+.PP
\f[B]K\f[R]
-Pushes the current value of \f[B]scale\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]scale\f[R] onto the main stack.
+.PP
\f[B]T\f[R]
-Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]U\f[R]
-Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]V\f[R]
-Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
-stack.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+: Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
+stack.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Strings
.PP
The following commands control strings.
@@ -587,233 +703,292 @@ Strings can also be executed as macros.
For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
printed with a newline after and then popped from the stack.
-.TP
-\f[B][\f[R]_characters_\f[B]]\f[R]
-Makes a string containing \f[I]characters\f[R] and pushes it onto the
-stack.
-.RS
.PP
-If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
-they must be balanced.
-Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
-character.
+\f[B][\f[R]\f[I]characters\f[R]\f[B]]\f[R]
.PP
+: Makes a string containing \f[I]characters\f[R] and pushes it onto the
+stack.
+.IP
+.nf
+\f[C]
+If there are brackets (**\[rs][** and **\[rs]]**) in the string, then they must be
+balanced. Unbalanced brackets can be escaped using a backslash (**\[rs]\[rs]**)
+character.
+
If there is a backslash character in the string, the character after it
-(even another backslash) is put into the string verbatim, but the
-(first) backslash is not.
-.RE
-.TP
-\f[B]a\f[R]
-The value on top of the stack is popped.
-.RS
+(even another backslash) is put into the string verbatim, but the (first)
+backslash is not.
+\f[R]
+.fi
.PP
-If it is a number, it is truncated and its absolute value is taken.
-The result mod \f[B]UCHAR_MAX+1\f[R] is calculated.
-If that result is \f[B]0\f[R], push an empty string; otherwise, push a
-one-character string where the character is the result of the mod
-interpreted as an ASCII character.
+\f[B]a\f[R]
.PP
-If it is a string, then a new string is made.
-If the original string is empty, the new string is empty.
-If it is not, then the first character of the original string is used to
-create the new string as a one-character string.
-The new string is then pushed onto the stack.
+: The value on top of the stack is popped.
+.IP
+.nf
+\f[C]
+If it is a number, it is truncated and its absolute value is taken. The
+result mod **UCHAR_MAX+1** is calculated. If that result is **0**, push an
+empty string; otherwise, push a one-character string where the character is
+the result of the mod interpreted as an ASCII character.
+
+If it is a string, then a new string is made. If the original string is
+empty, the new string is empty. If it is not, then the first character of
+the original string is used to create the new string as a one-character
+string. The new string is then pushed onto the stack.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]x\f[R]
-Pops a value off of the top of the stack.
-.RS
.PP
+: Pops a value off of the top of the stack.
+.IP
+.nf
+\f[C]
If it is a number, it is pushed back onto the stack.
-.PP
+
If it is a string, it is executed as a macro.
-.PP
+
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is greater than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
-.PP
-For example, \f[B]0 1>a\f[R] will execute the contents of register
-\f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
+.IP
+.nf
+\f[C]
+For example, **0 1>a** will execute the contents of register **a**, and
+**1 0>a** will not.
+
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not greater than the second (less than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is less than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not less than the second (greater than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is equal to the second, then the contents of register
\f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not equal to the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]?\f[R]
-Reads a line from the \f[B]stdin\f[R] and executes it.
+.PP
+: Reads a line from the \f[B]stdin\f[R] and executes it.
This is to allow macros to request input from users.
-.TP
+.PP
\f[B]q\f[R]
-During execution of a macro, this exits the execution of that macro and
-the execution of the macro that executed it.
+.PP
+: During execution of a macro, this exits the execution of that macro
+and the execution of the macro that executed it.
If there are no macros, or only one macro executing, dc(1) exits.
-.TP
+.PP
\f[B]Q\f[R]
-Pops a value from the stack which must be non-negative and is used the
+.PP
+: Pops a value from the stack which must be non-negative and is used the
number of macro executions to pop off of the execution stack.
If the number of levels to pop is greater than the number of executing
macros, dc(1) exits.
.SS Status
.PP
These commands query status of the stack or its top value.
-.TP
-\f[B]Z\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, calculates the number of significant decimal digits
-it has and pushes the result.
+\f[B]Z\f[R]
.PP
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, calculates the number of significant decimal digits it
+has and pushes the result.
+
If it is a string, pushes the number of characters the string has.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]X\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, pushes the \f[I]scale\f[R] of the value onto the
-stack.
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, pushes the *scale* of the value onto the stack.
+
+If it is a string, pushes **0**.
+\f[R]
+.fi
.PP
-If it is a string, pushes \f[B]0\f[R].
-.RE
-.TP
\f[B]z\f[R]
-Pushes the current stack depth (before execution of this command).
+.PP
+: Pushes the current stack depth (before execution of this command).
.SS Arrays
.PP
These commands manipulate arrays.
-.TP
+.PP
\f[B]:\f[R]\f[I]r\f[R]
-Pops the top two values off of the stack.
+.PP
+: Pops the top two values off of the stack.
The second value will be stored in the array \f[I]r\f[R] (see the
\f[B]REGISTERS\f[R] section), indexed by the first value.
-.TP
+.PP
\f[B];\f[R]\f[I]r\f[R]
-Pops the value on top of the stack and uses it as an index into the
+.PP
+: Pops the value on top of the stack and uses it as an index into the
array \f[I]r\f[R].
The selected value is then pushed onto the stack.
.SH REGISTERS
@@ -828,8 +1003,8 @@ their stack.
.PP
In non-extended register mode, a register name is just the single
character that follows any command that needs a register name.
-The only exception is a newline (\f[B]`\[rs]n'\f[R]); it is a parse
-error for a newline to be used as a register name.
+The only exception is a newline (\f[B]\[aq]\[rs]n\[aq]\f[R]); it is a
+parse error for a newline to be used as a register name.
.SS Extended Register Mode
.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
@@ -840,7 +1015,7 @@ If extended register mode is enabled (\f[B]-x\f[R] or
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
-(\f[B]`\[rs]n'\f[R]).
+(\f[B]\[aq]\[rs]n\[aq]\f[R]).
.PP
In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
@@ -885,59 +1060,71 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on dc(1):
-.TP
+.PP
\f[B]DC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
dc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]DC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]DC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]DC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]DC_BASE_POW\f[R].
-.TP
+.PP
\f[B]DC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]DC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
These limits are meant to be effectively non-existent; the limits are so
@@ -947,101 +1134,115 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
dc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]DC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to dc(1).
+.PP
+: This is another way to give command-line arguments to dc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time dc(1) runs.
Another use would be to use the \f[B]-e\f[R] option to set
\f[B]scale\f[R] to a value other than \f[B]0\f[R].
-.RS
-.PP
-The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **DC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some dc file.dc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]dc\[rs]\[dq] file.dc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]dc\[aq] file.dc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]DC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
including the backslash newline combo.
The default line length is \f[B]70\f[R].
-.TP
+.PP
\f[B]DC_EXPR_EXIT\f[R]
-If this variable exists (no matter the contents), dc(1) will exit
+.PP
+: If this variable exists (no matter the contents), dc(1) will exit
immediately after executing expressions and files given by the
\f[B]-e\f[R] and/or \f[B]-f\f[R] command-line options (and any
equivalents).
.SH EXIT STATUS
.PP
dc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**) operator.
+\f[R]
+.fi
.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, attempting to convert a negative number to a hardware
-integer, overflow when converting a number to a hardware integer, and
-attempting to use a non-integer where an integer is required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]) operator.
-.RE
-.TP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, and using a
-token where it is invalid.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, and using a token where it is
+invalid.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
-.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, and attempting an operation when the
-stack has too few elements.
-.RE
-.TP
+.PP
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, and attempting an operation when
+the stack has too few elements.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (dc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (dc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
@@ -1069,7 +1270,7 @@ In interactive mode, dc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, dc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, dc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is required for history to be enabled (see the \f[B]COMMAND
LINE HISTORY\f[R] section).
@@ -1091,7 +1292,7 @@ If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If dc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If dc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/dc/EN.1.md b/contrib/bc/manuals/dc/EN.1.md
index 4c0297fdab7f..dbd7e8d8e52d 100644
--- a/contrib/bc/manuals/dc/EN.1.md
+++ b/contrib/bc/manuals/dc/EN.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -81,12 +81,26 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in dc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of dc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **?** command is used.
+
+ This is a **non-portable extension**.
+
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@@ -432,25 +446,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
-**s***r*
+**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
-**l***r*
+**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
-**S***r*
+**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
-**L***r*
+**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
- now accessible via the **l***r* command.
+ now accessible via the **l**_r_ command.
## Parameters
@@ -563,7 +577,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-**\>***r*
+**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@@ -575,7 +589,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**>***r***e***s*
+**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -584,7 +598,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\>***r*
+**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@@ -593,7 +607,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\>***r***e***s*
+**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -602,7 +616,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**\<***r*
+**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@@ -611,7 +625,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**\<***r***e***s*
+**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -620,7 +634,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\<***r*
+**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@@ -629,7 +643,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\<***r***e***s*
+**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -638,7 +652,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**=***r*
+**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@@ -647,7 +661,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**=***r***e***s*
+**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -656,7 +670,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!=***r*
+**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@@ -665,7 +679,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!=***r***e***s*
+**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -721,12 +735,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
-**:***r*
+**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
-**;***r*
+**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.
diff --git a/contrib/bc/manuals/dc/ENP.1 b/contrib/bc/manuals/dc/ENP.1
index c9659423dc26..4f23bebed353 100644
--- a/contrib/bc/manuals/dc/ENP.1
+++ b/contrib/bc/manuals/dc/ENP.1
@@ -25,18 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+\f[B]dc\f[R] [\f[B]-hiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
-[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-read-prompt\f[R]] [\f[B]--extended-register\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -70,79 +70,100 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.SH OPTIONS
.PP
The following are the options that dc(1) accepts.
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.TP
+.PP
+: Print the version information (copyright header) and exit.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-This option is a no-op.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-x\f[R] \f[B]--extended-register\f[R]
-Enables extended register mode.
+.PP
+: Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]DC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -185,7 +206,7 @@ Input is processed immediately when entered.
.PP
\f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to interpret constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
@@ -195,7 +216,7 @@ programs with the \f[B]T\f[R] command.
.PP
\f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
@@ -237,265 +258,332 @@ The valid commands are listed below.
.SS Printing
.PP
These commands are used for printing.
-.TP
+.PP
\f[B]p\f[R]
-Prints the value on top of the stack, whether number or string, and
-prints a newline after.
-.RS
.PP
+: Prints the value on top of the stack, whether number or string, and
+prints a newline after.
+.IP
+.nf
+\f[C]
This does not alter the stack.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]n\f[R]
-Prints the value on top of the stack, whether number or string, and pops
-it off of the stack.
-.TP
+.PP
+: Prints the value on top of the stack, whether number or string, and
+pops it off of the stack.
+.PP
\f[B]P\f[R]
-Pops a value off the stack.
-.RS
.PP
+: Pops a value off the stack.
+.IP
+.nf
+\f[C]
If the value is a number, it is truncated and the absolute value of the
-result is printed as though \f[B]obase\f[R] is \f[B]UCHAR_MAX+1\f[R] and
-each digit is interpreted as an ASCII character, making it a byte
-stream.
-.PP
+result is printed as though **obase** is **UCHAR_MAX+1** and each digit is
+interpreted as an ASCII character, making it a byte stream.
+
If the value is a string, it is printed without a trailing newline.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]f\f[R]
-Prints the entire contents of the stack, in order from newest to oldest,
-without altering anything.
-.RS
.PP
+: Prints the entire contents of the stack, in order from newest to
+oldest, without altering anything.
+.IP
+.nf
+\f[C]
Users should use this command when they get lost.
-.RE
+\f[R]
+.fi
.SS Arithmetic
.PP
These are the commands used for arithmetic.
-.TP
+.PP
\f[B]+\f[R]
-The top two values are popped off the stack, added, and the result is
+.PP
+: The top two values are popped off the stack, added, and the result is
pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]-\f[R]
-The top two values are popped off the stack, subtracted, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, subtracted, and the
+result is pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]*\f[R]
-The top two values are popped off the stack, multiplied, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, multiplied, and the
+result is pushed onto the stack.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The top two values are popped off the stack, divided, and the result is
-pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
-The first value popped off of the stack must be non-zero.
-.RE
-.TP
-\f[B]%\f[R]
-The top two values are popped off the stack, remaindered, and the result
+: The top two values are popped off the stack, divided, and the result
is pushed onto the stack.
-.RS
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be non-zero.
+\f[R]
+.fi
.PP
-Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
-\f[B]scale\f[R], and 2) Using the result of step 1 to calculate
-\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
-\f[B]max(scale+scale(b),scale(a))\f[R].
+\f[B]%\f[R]
.PP
+: The top two values are popped off the stack, remaindered, and the
+result is pushed onto the stack.
+.IP
+.nf
+\f[C]
+Remaindering is equivalent to 1) Computing **a/b** to current **scale**, and
+2) Using the result of step 1 to calculate **a-(a/b)\[rs]*b** to *scale*
+**max(scale+scale(b),scale(a))**.
+
The first value popped off of the stack must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]\[ti]\f[R]
-The top two values are popped off the stack, divided and remaindered,
+.PP
+: The top two values are popped off the stack, divided and remaindered,
and the results (divided first, remainder second) are pushed onto the
stack.
This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
\f[B]y\f[R] are only evaluated once.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be non-zero.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The top two values are popped off the stack, the second is raised to the
-power of the first, and the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top two values are popped off the stack, the second is raised to
+the power of the first, and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be an integer, and if that
value is negative, the second value popped off of the stack must be
non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]v\f[R]
-The top value is popped off the stack, its square root is computed, and
-the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top value is popped off the stack, its square root is computed,
+and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The value popped off of the stack must be non-negative.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]_\f[R]
-If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
-or other commands), then that number is input as a negative number.
-.RS
-.PP
-Otherwise, the top value on the stack is popped and copied, and the copy
-is negated and pushed onto the stack.
-This behavior without a number is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+.PP
+: If this command \f[I]immediately\f[R] precedes a number (i.e., no
+spaces or other commands), then that number is input as a negative
+number.
+.IP
+.nf
+\f[C]
+Otherwise, the top value on the stack is popped and copied, and the copy is
+negated and pushed onto the stack. This behavior without a number is a
+**non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]b\f[R]
-The top value is popped off the stack, and if it is zero, it is pushed
+.PP
+: The top value is popped off the stack, and if it is zero, it is pushed
back onto the stack.
Otherwise, its absolute value is pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]|\f[R]
-The top three values are popped off the stack, a modular exponentiation
-is computed, and the result is pushed onto the stack.
-.RS
.PP
+: The top three values are popped off the stack, a modular
+exponentiation is computed, and the result is pushed onto the stack.
+.IP
+.nf
+\f[C]
The first value popped is used as the reduction modulus and must be an
-integer and non-zero.
-The second value popped is used as the exponent and must be an integer
-and non-negative.
-The third value popped is the base and must be an integer.
+integer and non-zero. The second value popped is used as the exponent and
+must be an integer and non-negative. The third value popped is the base and
+must be an integer.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]G\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]N\f[R]
-The top value is popped off of the stack, and if it a \f[B]0\f[R], a
+.PP
+: The top value is popped off of the stack, and if it a \f[B]0\f[R], a
\f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B](\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]{\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than or equal to the second,
-or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than or equal to the
+second, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B])\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]}\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than or equal to the
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than or equal to the
second, or \f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]M\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If they are both non-zero, a \f[B]1\f[R] is pushed onto the stack.
If either of them is zero, or both of them are, then a \f[B]0\f[R] is
pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
+.IP
+.nf
+\f[C]
+This is like the **&&** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]m\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If at least one of them is non-zero, a \f[B]1\f[R] is pushed onto the
stack.
If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is like the **||** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Stack Control
.PP
These commands control the stack.
-.TP
+.PP
\f[B]c\f[R]
-Removes all items from (\[lq]clears\[rq]) the stack.
-.TP
+.PP
+: Removes all items from (\[dq]clears\[dq]) the stack.
+.PP
\f[B]d\f[R]
-Copies the item on top of the stack (\[lq]duplicates\[rq]) and pushes
+.PP
+: Copies the item on top of the stack (\[dq]duplicates\[dq]) and pushes
the copy onto the stack.
-.TP
+.PP
\f[B]r\f[R]
-Swaps (\[lq]reverses\[rq]) the two top items on the stack.
-.TP
+.PP
+: Swaps (\[dq]reverses\[dq]) the two top items on the stack.
+.PP
\f[B]R\f[R]
-Pops (\[lq]removes\[rq]) the top value from the stack.
+.PP
+: Pops (\[dq]removes\[dq]) the top value from the stack.
.SS Register Control
.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
-.TP
+.PP
\f[B]s\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack and stores it into register
+.PP
+: Pops the value off the top of the stack and stores it into register
\f[I]r\f[R].
-.TP
+.PP
\f[B]l\f[R]\f[I]r\f[R]
-Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
+.PP
+: Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
This does not alter the contents of \f[I]r\f[R].
-.TP
+.PP
\f[B]S\f[R]\f[I]r\f[R]
-Pops the value off the top of the (main) stack and pushes it onto the
+.PP
+: Pops the value off the top of the (main) stack and pushes it onto the
stack of register \f[I]r\f[R].
The previous value of the register becomes inaccessible.
-.TP
+.PP
\f[B]L\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack for register \f[I]r\f[R] and
+.PP
+: Pops the value off the top of the stack for register \f[I]r\f[R] and
push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
@@ -504,68 +592,86 @@ accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
and \f[B]scale\f[R].
Also see the \f[B]SYNTAX\f[R] section.
-.TP
+.PP
\f[B]i\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
inclusive.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]o\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]obase\f[R], which must be between \f[B]2\f[R] and
\f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]k\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]scale\f[R], which must be non-negative.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]I\f[R]
-Pushes the current value of \f[B]ibase\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]ibase\f[R] onto the main stack.
+.PP
\f[B]O\f[R]
-Pushes the current value of \f[B]obase\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]obase\f[R] onto the main stack.
+.PP
\f[B]K\f[R]
-Pushes the current value of \f[B]scale\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]scale\f[R] onto the main stack.
+.PP
\f[B]T\f[R]
-Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]U\f[R]
-Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]V\f[R]
-Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
-stack.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+: Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
+stack.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Strings
.PP
The following commands control strings.
@@ -582,233 +688,292 @@ Strings can also be executed as macros.
For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
printed with a newline after and then popped from the stack.
-.TP
-\f[B][\f[R]_characters_\f[B]]\f[R]
-Makes a string containing \f[I]characters\f[R] and pushes it onto the
-stack.
-.RS
.PP
-If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
-they must be balanced.
-Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
-character.
+\f[B][\f[R]\f[I]characters\f[R]\f[B]]\f[R]
.PP
+: Makes a string containing \f[I]characters\f[R] and pushes it onto the
+stack.
+.IP
+.nf
+\f[C]
+If there are brackets (**\[rs][** and **\[rs]]**) in the string, then they must be
+balanced. Unbalanced brackets can be escaped using a backslash (**\[rs]\[rs]**)
+character.
+
If there is a backslash character in the string, the character after it
-(even another backslash) is put into the string verbatim, but the
-(first) backslash is not.
-.RE
-.TP
-\f[B]a\f[R]
-The value on top of the stack is popped.
-.RS
+(even another backslash) is put into the string verbatim, but the (first)
+backslash is not.
+\f[R]
+.fi
.PP
-If it is a number, it is truncated and its absolute value is taken.
-The result mod \f[B]UCHAR_MAX+1\f[R] is calculated.
-If that result is \f[B]0\f[R], push an empty string; otherwise, push a
-one-character string where the character is the result of the mod
-interpreted as an ASCII character.
+\f[B]a\f[R]
.PP
-If it is a string, then a new string is made.
-If the original string is empty, the new string is empty.
-If it is not, then the first character of the original string is used to
-create the new string as a one-character string.
-The new string is then pushed onto the stack.
+: The value on top of the stack is popped.
+.IP
+.nf
+\f[C]
+If it is a number, it is truncated and its absolute value is taken. The
+result mod **UCHAR_MAX+1** is calculated. If that result is **0**, push an
+empty string; otherwise, push a one-character string where the character is
+the result of the mod interpreted as an ASCII character.
+
+If it is a string, then a new string is made. If the original string is
+empty, the new string is empty. If it is not, then the first character of
+the original string is used to create the new string as a one-character
+string. The new string is then pushed onto the stack.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]x\f[R]
-Pops a value off of the top of the stack.
-.RS
.PP
+: Pops a value off of the top of the stack.
+.IP
+.nf
+\f[C]
If it is a number, it is pushed back onto the stack.
-.PP
+
If it is a string, it is executed as a macro.
-.PP
+
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is greater than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
-.PP
-For example, \f[B]0 1>a\f[R] will execute the contents of register
-\f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
+.IP
+.nf
+\f[C]
+For example, **0 1>a** will execute the contents of register **a**, and
+**1 0>a** will not.
+
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not greater than the second (less than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is less than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not less than the second (greater than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is equal to the second, then the contents of register
\f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not equal to the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]?\f[R]
-Reads a line from the \f[B]stdin\f[R] and executes it.
+.PP
+: Reads a line from the \f[B]stdin\f[R] and executes it.
This is to allow macros to request input from users.
-.TP
+.PP
\f[B]q\f[R]
-During execution of a macro, this exits the execution of that macro and
-the execution of the macro that executed it.
+.PP
+: During execution of a macro, this exits the execution of that macro
+and the execution of the macro that executed it.
If there are no macros, or only one macro executing, dc(1) exits.
-.TP
+.PP
\f[B]Q\f[R]
-Pops a value from the stack which must be non-negative and is used the
+.PP
+: Pops a value from the stack which must be non-negative and is used the
number of macro executions to pop off of the execution stack.
If the number of levels to pop is greater than the number of executing
macros, dc(1) exits.
.SS Status
.PP
These commands query status of the stack or its top value.
-.TP
-\f[B]Z\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, calculates the number of significant decimal digits
-it has and pushes the result.
+\f[B]Z\f[R]
.PP
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, calculates the number of significant decimal digits it
+has and pushes the result.
+
If it is a string, pushes the number of characters the string has.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]X\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, pushes the \f[I]scale\f[R] of the value onto the
-stack.
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, pushes the *scale* of the value onto the stack.
+
+If it is a string, pushes **0**.
+\f[R]
+.fi
.PP
-If it is a string, pushes \f[B]0\f[R].
-.RE
-.TP
\f[B]z\f[R]
-Pushes the current stack depth (before execution of this command).
+.PP
+: Pushes the current stack depth (before execution of this command).
.SS Arrays
.PP
These commands manipulate arrays.
-.TP
+.PP
\f[B]:\f[R]\f[I]r\f[R]
-Pops the top two values off of the stack.
+.PP
+: Pops the top two values off of the stack.
The second value will be stored in the array \f[I]r\f[R] (see the
\f[B]REGISTERS\f[R] section), indexed by the first value.
-.TP
+.PP
\f[B];\f[R]\f[I]r\f[R]
-Pops the value on top of the stack and uses it as an index into the
+.PP
+: Pops the value on top of the stack and uses it as an index into the
array \f[I]r\f[R].
The selected value is then pushed onto the stack.
.SH REGISTERS
@@ -823,8 +988,8 @@ their stack.
.PP
In non-extended register mode, a register name is just the single
character that follows any command that needs a register name.
-The only exception is a newline (\f[B]`\[rs]n'\f[R]); it is a parse
-error for a newline to be used as a register name.
+The only exception is a newline (\f[B]\[aq]\[rs]n\[aq]\f[R]); it is a
+parse error for a newline to be used as a register name.
.SS Extended Register Mode
.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
@@ -835,7 +1000,7 @@ If extended register mode is enabled (\f[B]-x\f[R] or
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
-(\f[B]`\[rs]n'\f[R]).
+(\f[B]\[aq]\[rs]n\[aq]\f[R]).
.PP
In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
@@ -880,59 +1045,71 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on dc(1):
-.TP
+.PP
\f[B]DC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
dc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]DC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]DC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]DC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]DC_BASE_POW\f[R].
-.TP
+.PP
\f[B]DC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]DC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
These limits are meant to be effectively non-existent; the limits are so
@@ -942,101 +1119,115 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
dc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]DC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to dc(1).
+.PP
+: This is another way to give command-line arguments to dc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time dc(1) runs.
Another use would be to use the \f[B]-e\f[R] option to set
\f[B]scale\f[R] to a value other than \f[B]0\f[R].
-.RS
-.PP
-The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **DC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some dc file.dc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]dc\[rs]\[dq] file.dc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]dc\[aq] file.dc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]DC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
including the backslash newline combo.
The default line length is \f[B]70\f[R].
-.TP
+.PP
\f[B]DC_EXPR_EXIT\f[R]
-If this variable exists (no matter the contents), dc(1) will exit
+.PP
+: If this variable exists (no matter the contents), dc(1) will exit
immediately after executing expressions and files given by the
\f[B]-e\f[R] and/or \f[B]-f\f[R] command-line options (and any
equivalents).
.SH EXIT STATUS
.PP
dc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**) operator.
+\f[R]
+.fi
.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, attempting to convert a negative number to a hardware
-integer, overflow when converting a number to a hardware integer, and
-attempting to use a non-integer where an integer is required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]) operator.
-.RE
-.TP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, and using a
-token where it is invalid.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, and using a token where it is
+invalid.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
-.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, and attempting an operation when the
-stack has too few elements.
-.RE
-.TP
+.PP
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, and attempting an operation when
+the stack has too few elements.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (dc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (dc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
@@ -1064,7 +1255,7 @@ In interactive mode, dc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, dc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, dc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is required for history to be enabled (see the \f[B]COMMAND
LINE HISTORY\f[R] section).
@@ -1084,7 +1275,7 @@ If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If dc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If dc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/dc/ENP.1.md b/contrib/bc/manuals/dc/ENP.1.md
index 4025c643b956..a2facd8d8cdd 100644
--- a/contrib/bc/manuals/dc/ENP.1.md
+++ b/contrib/bc/manuals/dc/ENP.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -84,6 +84,12 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: This option is a no-op.
+
+ This is a **non-portable extension**.
+
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@@ -429,25 +435,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
-**s***r*
+**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
-**l***r*
+**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
-**S***r*
+**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
-**L***r*
+**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
- now accessible via the **l***r* command.
+ now accessible via the **l**_r_ command.
## Parameters
@@ -560,7 +566,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-**\>***r*
+**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@@ -572,7 +578,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**>***r***e***s*
+**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -581,7 +587,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\>***r*
+**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@@ -590,7 +596,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\>***r***e***s*
+**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -599,7 +605,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**\<***r*
+**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@@ -608,7 +614,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**\<***r***e***s*
+**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -617,7 +623,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\<***r*
+**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@@ -626,7 +632,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\<***r***e***s*
+**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -635,7 +641,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**=***r*
+**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@@ -644,7 +650,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**=***r***e***s*
+**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -653,7 +659,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!=***r*
+**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@@ -662,7 +668,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!=***r***e***s*
+**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -718,12 +724,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
-**:***r*
+**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
-**;***r*
+**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.
diff --git a/contrib/bc/manuals/dc/EP.1 b/contrib/bc/manuals/dc/EP.1
index 1dd0da3235e7..ad6277c249b0 100644
--- a/contrib/bc/manuals/dc/EP.1
+++ b/contrib/bc/manuals/dc/EP.1
@@ -25,18 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+\f[B]dc\f[R] [\f[B]-hiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
-[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-read-prompt\f[R]] [\f[B]--extended-register\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -70,79 +70,100 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.SH OPTIONS
.PP
The following are the options that dc(1) accepts.
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.TP
+.PP
+: Print the version information (copyright header) and exit.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-This option is a no-op.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-x\f[R] \f[B]--extended-register\f[R]
-Enables extended register mode.
+.PP
+: Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]DC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -185,7 +206,7 @@ Input is processed immediately when entered.
.PP
\f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to interpret constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
@@ -195,7 +216,7 @@ programs with the \f[B]T\f[R] command.
.PP
\f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
@@ -237,265 +258,332 @@ The valid commands are listed below.
.SS Printing
.PP
These commands are used for printing.
-.TP
+.PP
\f[B]p\f[R]
-Prints the value on top of the stack, whether number or string, and
-prints a newline after.
-.RS
.PP
+: Prints the value on top of the stack, whether number or string, and
+prints a newline after.
+.IP
+.nf
+\f[C]
This does not alter the stack.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]n\f[R]
-Prints the value on top of the stack, whether number or string, and pops
-it off of the stack.
-.TP
+.PP
+: Prints the value on top of the stack, whether number or string, and
+pops it off of the stack.
+.PP
\f[B]P\f[R]
-Pops a value off the stack.
-.RS
.PP
+: Pops a value off the stack.
+.IP
+.nf
+\f[C]
If the value is a number, it is truncated and the absolute value of the
-result is printed as though \f[B]obase\f[R] is \f[B]UCHAR_MAX+1\f[R] and
-each digit is interpreted as an ASCII character, making it a byte
-stream.
-.PP
+result is printed as though **obase** is **UCHAR_MAX+1** and each digit is
+interpreted as an ASCII character, making it a byte stream.
+
If the value is a string, it is printed without a trailing newline.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]f\f[R]
-Prints the entire contents of the stack, in order from newest to oldest,
-without altering anything.
-.RS
.PP
+: Prints the entire contents of the stack, in order from newest to
+oldest, without altering anything.
+.IP
+.nf
+\f[C]
Users should use this command when they get lost.
-.RE
+\f[R]
+.fi
.SS Arithmetic
.PP
These are the commands used for arithmetic.
-.TP
+.PP
\f[B]+\f[R]
-The top two values are popped off the stack, added, and the result is
+.PP
+: The top two values are popped off the stack, added, and the result is
pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]-\f[R]
-The top two values are popped off the stack, subtracted, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, subtracted, and the
+result is pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]*\f[R]
-The top two values are popped off the stack, multiplied, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, multiplied, and the
+result is pushed onto the stack.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The top two values are popped off the stack, divided, and the result is
-pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
-The first value popped off of the stack must be non-zero.
-.RE
-.TP
-\f[B]%\f[R]
-The top two values are popped off the stack, remaindered, and the result
+: The top two values are popped off the stack, divided, and the result
is pushed onto the stack.
-.RS
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be non-zero.
+\f[R]
+.fi
.PP
-Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
-\f[B]scale\f[R], and 2) Using the result of step 1 to calculate
-\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
-\f[B]max(scale+scale(b),scale(a))\f[R].
+\f[B]%\f[R]
.PP
+: The top two values are popped off the stack, remaindered, and the
+result is pushed onto the stack.
+.IP
+.nf
+\f[C]
+Remaindering is equivalent to 1) Computing **a/b** to current **scale**, and
+2) Using the result of step 1 to calculate **a-(a/b)\[rs]*b** to *scale*
+**max(scale+scale(b),scale(a))**.
+
The first value popped off of the stack must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]\[ti]\f[R]
-The top two values are popped off the stack, divided and remaindered,
+.PP
+: The top two values are popped off the stack, divided and remaindered,
and the results (divided first, remainder second) are pushed onto the
stack.
This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
\f[B]y\f[R] are only evaluated once.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be non-zero.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The top two values are popped off the stack, the second is raised to the
-power of the first, and the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top two values are popped off the stack, the second is raised to
+the power of the first, and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be an integer, and if that
value is negative, the second value popped off of the stack must be
non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]v\f[R]
-The top value is popped off the stack, its square root is computed, and
-the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top value is popped off the stack, its square root is computed,
+and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The value popped off of the stack must be non-negative.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]_\f[R]
-If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
-or other commands), then that number is input as a negative number.
-.RS
-.PP
-Otherwise, the top value on the stack is popped and copied, and the copy
-is negated and pushed onto the stack.
-This behavior without a number is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+.PP
+: If this command \f[I]immediately\f[R] precedes a number (i.e., no
+spaces or other commands), then that number is input as a negative
+number.
+.IP
+.nf
+\f[C]
+Otherwise, the top value on the stack is popped and copied, and the copy is
+negated and pushed onto the stack. This behavior without a number is a
+**non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]b\f[R]
-The top value is popped off the stack, and if it is zero, it is pushed
+.PP
+: The top value is popped off the stack, and if it is zero, it is pushed
back onto the stack.
Otherwise, its absolute value is pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]|\f[R]
-The top three values are popped off the stack, a modular exponentiation
-is computed, and the result is pushed onto the stack.
-.RS
.PP
+: The top three values are popped off the stack, a modular
+exponentiation is computed, and the result is pushed onto the stack.
+.IP
+.nf
+\f[C]
The first value popped is used as the reduction modulus and must be an
-integer and non-zero.
-The second value popped is used as the exponent and must be an integer
-and non-negative.
-The third value popped is the base and must be an integer.
+integer and non-zero. The second value popped is used as the exponent and
+must be an integer and non-negative. The third value popped is the base and
+must be an integer.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]G\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]N\f[R]
-The top value is popped off of the stack, and if it a \f[B]0\f[R], a
+.PP
+: The top value is popped off of the stack, and if it a \f[B]0\f[R], a
\f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B](\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]{\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than or equal to the second,
-or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than or equal to the
+second, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B])\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]}\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than or equal to the
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than or equal to the
second, or \f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]M\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If they are both non-zero, a \f[B]1\f[R] is pushed onto the stack.
If either of them is zero, or both of them are, then a \f[B]0\f[R] is
pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
+.IP
+.nf
+\f[C]
+This is like the **&&** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]m\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If at least one of them is non-zero, a \f[B]1\f[R] is pushed onto the
stack.
If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is like the **||** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Stack Control
.PP
These commands control the stack.
-.TP
+.PP
\f[B]c\f[R]
-Removes all items from (\[lq]clears\[rq]) the stack.
-.TP
+.PP
+: Removes all items from (\[dq]clears\[dq]) the stack.
+.PP
\f[B]d\f[R]
-Copies the item on top of the stack (\[lq]duplicates\[rq]) and pushes
+.PP
+: Copies the item on top of the stack (\[dq]duplicates\[dq]) and pushes
the copy onto the stack.
-.TP
+.PP
\f[B]r\f[R]
-Swaps (\[lq]reverses\[rq]) the two top items on the stack.
-.TP
+.PP
+: Swaps (\[dq]reverses\[dq]) the two top items on the stack.
+.PP
\f[B]R\f[R]
-Pops (\[lq]removes\[rq]) the top value from the stack.
+.PP
+: Pops (\[dq]removes\[dq]) the top value from the stack.
.SS Register Control
.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
-.TP
+.PP
\f[B]s\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack and stores it into register
+.PP
+: Pops the value off the top of the stack and stores it into register
\f[I]r\f[R].
-.TP
+.PP
\f[B]l\f[R]\f[I]r\f[R]
-Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
+.PP
+: Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
This does not alter the contents of \f[I]r\f[R].
-.TP
+.PP
\f[B]S\f[R]\f[I]r\f[R]
-Pops the value off the top of the (main) stack and pushes it onto the
+.PP
+: Pops the value off the top of the (main) stack and pushes it onto the
stack of register \f[I]r\f[R].
The previous value of the register becomes inaccessible.
-.TP
+.PP
\f[B]L\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack for register \f[I]r\f[R] and
+.PP
+: Pops the value off the top of the stack for register \f[I]r\f[R] and
push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
@@ -504,68 +592,86 @@ accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
and \f[B]scale\f[R].
Also see the \f[B]SYNTAX\f[R] section.
-.TP
+.PP
\f[B]i\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
inclusive.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]o\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]obase\f[R], which must be between \f[B]2\f[R] and
\f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]k\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]scale\f[R], which must be non-negative.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]I\f[R]
-Pushes the current value of \f[B]ibase\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]ibase\f[R] onto the main stack.
+.PP
\f[B]O\f[R]
-Pushes the current value of \f[B]obase\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]obase\f[R] onto the main stack.
+.PP
\f[B]K\f[R]
-Pushes the current value of \f[B]scale\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]scale\f[R] onto the main stack.
+.PP
\f[B]T\f[R]
-Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]U\f[R]
-Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]V\f[R]
-Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
-stack.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+: Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
+stack.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Strings
.PP
The following commands control strings.
@@ -582,233 +688,292 @@ Strings can also be executed as macros.
For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
printed with a newline after and then popped from the stack.
-.TP
-\f[B][\f[R]_characters_\f[B]]\f[R]
-Makes a string containing \f[I]characters\f[R] and pushes it onto the
-stack.
-.RS
.PP
-If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
-they must be balanced.
-Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
-character.
+\f[B][\f[R]\f[I]characters\f[R]\f[B]]\f[R]
.PP
+: Makes a string containing \f[I]characters\f[R] and pushes it onto the
+stack.
+.IP
+.nf
+\f[C]
+If there are brackets (**\[rs][** and **\[rs]]**) in the string, then they must be
+balanced. Unbalanced brackets can be escaped using a backslash (**\[rs]\[rs]**)
+character.
+
If there is a backslash character in the string, the character after it
-(even another backslash) is put into the string verbatim, but the
-(first) backslash is not.
-.RE
-.TP
-\f[B]a\f[R]
-The value on top of the stack is popped.
-.RS
+(even another backslash) is put into the string verbatim, but the (first)
+backslash is not.
+\f[R]
+.fi
.PP
-If it is a number, it is truncated and its absolute value is taken.
-The result mod \f[B]UCHAR_MAX+1\f[R] is calculated.
-If that result is \f[B]0\f[R], push an empty string; otherwise, push a
-one-character string where the character is the result of the mod
-interpreted as an ASCII character.
+\f[B]a\f[R]
.PP
-If it is a string, then a new string is made.
-If the original string is empty, the new string is empty.
-If it is not, then the first character of the original string is used to
-create the new string as a one-character string.
-The new string is then pushed onto the stack.
+: The value on top of the stack is popped.
+.IP
+.nf
+\f[C]
+If it is a number, it is truncated and its absolute value is taken. The
+result mod **UCHAR_MAX+1** is calculated. If that result is **0**, push an
+empty string; otherwise, push a one-character string where the character is
+the result of the mod interpreted as an ASCII character.
+
+If it is a string, then a new string is made. If the original string is
+empty, the new string is empty. If it is not, then the first character of
+the original string is used to create the new string as a one-character
+string. The new string is then pushed onto the stack.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]x\f[R]
-Pops a value off of the top of the stack.
-.RS
.PP
+: Pops a value off of the top of the stack.
+.IP
+.nf
+\f[C]
If it is a number, it is pushed back onto the stack.
-.PP
+
If it is a string, it is executed as a macro.
-.PP
+
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is greater than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
-.PP
-For example, \f[B]0 1>a\f[R] will execute the contents of register
-\f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
+.IP
+.nf
+\f[C]
+For example, **0 1>a** will execute the contents of register **a**, and
+**1 0>a** will not.
+
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not greater than the second (less than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is less than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not less than the second (greater than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is equal to the second, then the contents of register
\f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not equal to the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]?\f[R]
-Reads a line from the \f[B]stdin\f[R] and executes it.
+.PP
+: Reads a line from the \f[B]stdin\f[R] and executes it.
This is to allow macros to request input from users.
-.TP
+.PP
\f[B]q\f[R]
-During execution of a macro, this exits the execution of that macro and
-the execution of the macro that executed it.
+.PP
+: During execution of a macro, this exits the execution of that macro
+and the execution of the macro that executed it.
If there are no macros, or only one macro executing, dc(1) exits.
-.TP
+.PP
\f[B]Q\f[R]
-Pops a value from the stack which must be non-negative and is used the
+.PP
+: Pops a value from the stack which must be non-negative and is used the
number of macro executions to pop off of the execution stack.
If the number of levels to pop is greater than the number of executing
macros, dc(1) exits.
.SS Status
.PP
These commands query status of the stack or its top value.
-.TP
-\f[B]Z\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, calculates the number of significant decimal digits
-it has and pushes the result.
+\f[B]Z\f[R]
.PP
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, calculates the number of significant decimal digits it
+has and pushes the result.
+
If it is a string, pushes the number of characters the string has.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]X\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, pushes the \f[I]scale\f[R] of the value onto the
-stack.
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, pushes the *scale* of the value onto the stack.
+
+If it is a string, pushes **0**.
+\f[R]
+.fi
.PP
-If it is a string, pushes \f[B]0\f[R].
-.RE
-.TP
\f[B]z\f[R]
-Pushes the current stack depth (before execution of this command).
+.PP
+: Pushes the current stack depth (before execution of this command).
.SS Arrays
.PP
These commands manipulate arrays.
-.TP
+.PP
\f[B]:\f[R]\f[I]r\f[R]
-Pops the top two values off of the stack.
+.PP
+: Pops the top two values off of the stack.
The second value will be stored in the array \f[I]r\f[R] (see the
\f[B]REGISTERS\f[R] section), indexed by the first value.
-.TP
+.PP
\f[B];\f[R]\f[I]r\f[R]
-Pops the value on top of the stack and uses it as an index into the
+.PP
+: Pops the value on top of the stack and uses it as an index into the
array \f[I]r\f[R].
The selected value is then pushed onto the stack.
.SH REGISTERS
@@ -823,8 +988,8 @@ their stack.
.PP
In non-extended register mode, a register name is just the single
character that follows any command that needs a register name.
-The only exception is a newline (\f[B]`\[rs]n'\f[R]); it is a parse
-error for a newline to be used as a register name.
+The only exception is a newline (\f[B]\[aq]\[rs]n\[aq]\f[R]); it is a
+parse error for a newline to be used as a register name.
.SS Extended Register Mode
.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
@@ -835,7 +1000,7 @@ If extended register mode is enabled (\f[B]-x\f[R] or
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
-(\f[B]`\[rs]n'\f[R]).
+(\f[B]\[aq]\[rs]n\[aq]\f[R]).
.PP
In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
@@ -880,59 +1045,71 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on dc(1):
-.TP
+.PP
\f[B]DC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
dc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]DC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]DC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]DC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]DC_BASE_POW\f[R].
-.TP
+.PP
\f[B]DC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]DC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
These limits are meant to be effectively non-existent; the limits are so
@@ -942,101 +1119,115 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
dc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]DC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to dc(1).
+.PP
+: This is another way to give command-line arguments to dc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time dc(1) runs.
Another use would be to use the \f[B]-e\f[R] option to set
\f[B]scale\f[R] to a value other than \f[B]0\f[R].
-.RS
-.PP
-The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **DC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some dc file.dc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]dc\[rs]\[dq] file.dc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]dc\[aq] file.dc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]DC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
including the backslash newline combo.
The default line length is \f[B]70\f[R].
-.TP
+.PP
\f[B]DC_EXPR_EXIT\f[R]
-If this variable exists (no matter the contents), dc(1) will exit
+.PP
+: If this variable exists (no matter the contents), dc(1) will exit
immediately after executing expressions and files given by the
\f[B]-e\f[R] and/or \f[B]-f\f[R] command-line options (and any
equivalents).
.SH EXIT STATUS
.PP
dc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**) operator.
+\f[R]
+.fi
.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, attempting to convert a negative number to a hardware
-integer, overflow when converting a number to a hardware integer, and
-attempting to use a non-integer where an integer is required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]) operator.
-.RE
-.TP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, and using a
-token where it is invalid.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, and using a token where it is
+invalid.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
-.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, and attempting an operation when the
-stack has too few elements.
-.RE
-.TP
+.PP
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, and attempting an operation when
+the stack has too few elements.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (dc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (dc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
@@ -1064,7 +1255,7 @@ In interactive mode, dc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, dc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, dc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is required for history to be enabled (see the \f[B]COMMAND
LINE HISTORY\f[R] section).
@@ -1084,7 +1275,7 @@ If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If dc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If dc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/dc/EP.1.md b/contrib/bc/manuals/dc/EP.1.md
index fcb15291262d..32b7f35fe92e 100644
--- a/contrib/bc/manuals/dc/EP.1.md
+++ b/contrib/bc/manuals/dc/EP.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -84,6 +84,12 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: This option is a no-op.
+
+ This is a **non-portable extension**.
+
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@@ -429,25 +435,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
-**s***r*
+**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
-**l***r*
+**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
-**S***r*
+**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
-**L***r*
+**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
- now accessible via the **l***r* command.
+ now accessible via the **l**_r_ command.
## Parameters
@@ -560,7 +566,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-**\>***r*
+**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@@ -572,7 +578,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**>***r***e***s*
+**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -581,7 +587,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\>***r*
+**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@@ -590,7 +596,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\>***r***e***s*
+**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -599,7 +605,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**\<***r*
+**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@@ -608,7 +614,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**\<***r***e***s*
+**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -617,7 +623,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\<***r*
+**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@@ -626,7 +632,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\<***r***e***s*
+**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -635,7 +641,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**=***r*
+**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@@ -644,7 +650,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**=***r***e***s*
+**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -653,7 +659,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!=***r*
+**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@@ -662,7 +668,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!=***r***e***s*
+**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -718,12 +724,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
-**:***r*
+**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
-**;***r*
+**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.
diff --git a/contrib/bc/manuals/dc/H.1 b/contrib/bc/manuals/dc/H.1
index 15fe0edb0d2d..9d7ef21b3d1f 100644
--- a/contrib/bc/manuals/dc/H.1
+++ b/contrib/bc/manuals/dc/H.1
@@ -25,18 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+\f[B]dc\f[R] [\f[B]-hiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
-[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-read-prompt\f[R]] [\f[B]--extended-register\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -70,84 +70,115 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.SH OPTIONS
.PP
The following are the options that dc(1) accepts.
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.TP
+.PP
+: Print the version information (copyright header) and exit.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-Disables the prompt in TTY mode.
+.PP
+: Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
-See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
do not want a prompt or are not used to having them in dc(1).
Most of those users would want to put this option in
\f[B]DC_ENV_ARGS\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: Disables the read prompt in TTY mode.
+(The read prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a read prompt or are not used to having them in dc(1).
+Most of those users would want to put this option in
+\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
+This option is also useful in hash bang lines of dc(1) scripts that
+prompt for user input.
+.IP
+.nf
+\f[C]
+This option does not disable the regular prompt because the read prompt is
+only used when the **?** command is used.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-x\f[R] \f[B]--extended-register\f[R]
-Enables extended register mode.
+.PP
+: Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]DC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -190,7 +221,7 @@ Input is processed immediately when entered.
.PP
\f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to interpret constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
@@ -200,7 +231,7 @@ programs with the \f[B]T\f[R] command.
.PP
\f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
@@ -236,13 +267,13 @@ Likewise, when a value is assigned to \f[B]seed\f[R], it is not
guaranteed that querying \f[B]seed\f[R] immediately after will return
the same value.
In addition, the value of \f[B]seed\f[R] will change after any call to
-the \f[B]\[cq]\f[R] command or the \f[B]\[dq]\f[R] command that does not
+the \f[B]\[aq]\f[R] command or the \f[B]\[dq]\f[R] command that does not
get receive a value of \f[B]0\f[R] or \f[B]1\f[R].
-The maximum integer returned by the \f[B]\[cq]\f[R] command can be
+The maximum integer returned by the \f[B]\[aq]\f[R] command can be
queried with the \f[B]W\f[R] command.
.PP
\f[B]Note\f[R]: The values returned by the pseudo-random number
-generator with the \f[B]\[cq]\f[R] and \f[B]\[dq]\f[R] commands are
+generator with the \f[B]\[aq]\f[R] and \f[B]\[dq]\f[R] commands are
guaranteed to \f[B]NOT\f[R] be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator.
However, they \f[I]are\f[R] guaranteed to be reproducible with identical
@@ -311,272 +342,340 @@ To deactivate them, just assign a different value to \f[B]obase\f[R].
.PP
Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
-.TP
+.PP
\f[B]p\f[R]
-Prints the value on top of the stack, whether number or string, and
-prints a newline after.
-.RS
.PP
+: Prints the value on top of the stack, whether number or string, and
+prints a newline after.
+.IP
+.nf
+\f[C]
This does not alter the stack.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]n\f[R]
-Prints the value on top of the stack, whether number or string, and pops
-it off of the stack.
-.TP
+.PP
+: Prints the value on top of the stack, whether number or string, and
+pops it off of the stack.
+.PP
\f[B]P\f[R]
-Pops a value off the stack.
-.RS
.PP
+: Pops a value off the stack.
+.IP
+.nf
+\f[C]
If the value is a number, it is truncated and the absolute value of the
-result is printed as though \f[B]obase\f[R] is \f[B]UCHAR_MAX+1\f[R] and
-each digit is interpreted as an ASCII character, making it a byte
-stream.
-.PP
+result is printed as though **obase** is **UCHAR_MAX+1** and each digit is
+interpreted as an ASCII character, making it a byte stream.
+
If the value is a string, it is printed without a trailing newline.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]f\f[R]
-Prints the entire contents of the stack, in order from newest to oldest,
-without altering anything.
-.RS
.PP
+: Prints the entire contents of the stack, in order from newest to
+oldest, without altering anything.
+.IP
+.nf
+\f[C]
Users should use this command when they get lost.
-.RE
+\f[R]
+.fi
.SS Arithmetic
.PP
These are the commands used for arithmetic.
-.TP
+.PP
\f[B]+\f[R]
-The top two values are popped off the stack, added, and the result is
+.PP
+: The top two values are popped off the stack, added, and the result is
pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]-\f[R]
-The top two values are popped off the stack, subtracted, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, subtracted, and the
+result is pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]*\f[R]
-The top two values are popped off the stack, multiplied, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, multiplied, and the
+result is pushed onto the stack.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The top two values are popped off the stack, divided, and the result is
-pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
-The first value popped off of the stack must be non-zero.
-.RE
-.TP
-\f[B]%\f[R]
-The top two values are popped off the stack, remaindered, and the result
+: The top two values are popped off the stack, divided, and the result
is pushed onto the stack.
-.RS
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be non-zero.
+\f[R]
+.fi
.PP
-Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
-\f[B]scale\f[R], and 2) Using the result of step 1 to calculate
-\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
-\f[B]max(scale+scale(b),scale(a))\f[R].
+\f[B]%\f[R]
.PP
+: The top two values are popped off the stack, remaindered, and the
+result is pushed onto the stack.
+.IP
+.nf
+\f[C]
+Remaindering is equivalent to 1) Computing **a/b** to current **scale**, and
+2) Using the result of step 1 to calculate **a-(a/b)\[rs]*b** to *scale*
+**max(scale+scale(b),scale(a))**.
+
The first value popped off of the stack must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]\[ti]\f[R]
-The top two values are popped off the stack, divided and remaindered,
+.PP
+: The top two values are popped off the stack, divided and remaindered,
and the results (divided first, remainder second) are pushed onto the
stack.
This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
\f[B]y\f[R] are only evaluated once.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be non-zero.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The top two values are popped off the stack, the second is raised to the
-power of the first, and the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top two values are popped off the stack, the second is raised to
+the power of the first, and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be an integer, and if that
value is negative, the second value popped off of the stack must be
non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]v\f[R]
-The top value is popped off the stack, its square root is computed, and
-the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top value is popped off the stack, its square root is computed,
+and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The value popped off of the stack must be non-negative.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]_\f[R]
-If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
-or other commands), then that number is input as a negative number.
-.RS
-.PP
-Otherwise, the top value on the stack is popped and copied, and the copy
-is negated and pushed onto the stack.
-This behavior without a number is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+.PP
+: If this command \f[I]immediately\f[R] precedes a number (i.e., no
+spaces or other commands), then that number is input as a negative
+number.
+.IP
+.nf
+\f[C]
+Otherwise, the top value on the stack is popped and copied, and the copy is
+negated and pushed onto the stack. This behavior without a number is a
+**non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]b\f[R]
-The top value is popped off the stack, and if it is zero, it is pushed
+.PP
+: The top value is popped off the stack, and if it is zero, it is pushed
back onto the stack.
Otherwise, its absolute value is pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]|\f[R]
-The top three values are popped off the stack, a modular exponentiation
-is computed, and the result is pushed onto the stack.
-.RS
.PP
+: The top three values are popped off the stack, a modular
+exponentiation is computed, and the result is pushed onto the stack.
+.IP
+.nf
+\f[C]
The first value popped is used as the reduction modulus and must be an
-integer and non-zero.
-The second value popped is used as the exponent and must be an integer
-and non-negative.
-The third value popped is the base and must be an integer.
+integer and non-zero. The second value popped is used as the exponent and
+must be an integer and non-negative. The third value popped is the base and
+must be an integer.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]$\f[R]
-The top value is popped off the stack and copied, and the copy is
+.PP
+: The top value is popped off the stack and copied, and the copy is
truncated and pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[at]\f[R]
-The top two values are popped off the stack, and the precision of the
+.PP
+: The top two values are popped off the stack, and the precision of the
second is set to the value of the first, whether by truncation or
extension.
-.RS
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]H\f[R]
-The top two values are popped off the stack, and the second is shifted
-left (radix shifted right) to the value of the first.
-.RS
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+: The top two values are popped off the stack, and the second is shifted
+left (radix shifted right) to the value of the first.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]h\f[R]
-The top two values are popped off the stack, and the second is shifted
-right (radix shifted left) to the value of the first.
-.RS
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+: The top two values are popped off the stack, and the second is shifted
+right (radix shifted left) to the value of the first.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]G\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]N\f[R]
-The top value is popped off of the stack, and if it a \f[B]0\f[R], a
+.PP
+: The top value is popped off of the stack, and if it a \f[B]0\f[R], a
\f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B](\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]{\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than or equal to the second,
-or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than or equal to the
+second, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B])\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]}\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than or equal to the
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than or equal to the
second, or \f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]M\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If they are both non-zero, a \f[B]1\f[R] is pushed onto the stack.
If either of them is zero, or both of them are, then a \f[B]0\f[R] is
pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is like the **&&** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]m\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If at least one of them is non-zero, a \f[B]1\f[R] is pushed onto the
stack.
If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is like the **||** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Pseudo-Random Number Generator
.PP
dc(1) has a built-in pseudo-random number generator.
@@ -586,20 +685,24 @@ controls the pseudo-random number generator.)
.PP
The pseudo-random number generator is guaranteed to \f[B]NOT\f[R] be
cryptographically secure.
-.TP
-\f[B]\[cq]\f[R]
-Generates an integer between 0 and \f[B]DC_RAND_MAX\f[R], inclusive (see
-the \f[B]LIMITS\f[R] section).
-.RS
.PP
+\f[B]\[aq]\f[R]
+.PP
+: Generates an integer between 0 and \f[B]DC_RAND_MAX\f[R], inclusive
+(see the \f[B]LIMITS\f[R] section).
+.IP
+.nf
+\f[C]
The generated integer is made as unbiased as possible, subject to the
limitations of the pseudo-random number generator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[dq]\f[R]
-Pops a value off of the stack, which is used as an \f[B]exclusive\f[R]
+.PP
+: Pops a value off of the stack, which is used as an \f[B]exclusive\f[R]
upper bound on the integer that will be generated.
If the bound is negative or is a non-integer, an error is raised, and
dc(1) resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R]
@@ -614,48 +717,58 @@ Using this command will change the value of \f[B]seed\f[R], unless the
operand is \f[B]0\f[R] or \f[B]1\f[R].
In that case, \f[B]0\f[R] is pushed onto the stack, and \f[B]seed\f[R]
is \f[I]not\f[R] changed.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The generated integer is made as unbiased as possible, subject to the
limitations of the pseudo-random number generator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Stack Control
.PP
These commands control the stack.
-.TP
+.PP
\f[B]c\f[R]
-Removes all items from (\[lq]clears\[rq]) the stack.
-.TP
+.PP
+: Removes all items from (\[dq]clears\[dq]) the stack.
+.PP
\f[B]d\f[R]
-Copies the item on top of the stack (\[lq]duplicates\[rq]) and pushes
+.PP
+: Copies the item on top of the stack (\[dq]duplicates\[dq]) and pushes
the copy onto the stack.
-.TP
+.PP
\f[B]r\f[R]
-Swaps (\[lq]reverses\[rq]) the two top items on the stack.
-.TP
+.PP
+: Swaps (\[dq]reverses\[dq]) the two top items on the stack.
+.PP
\f[B]R\f[R]
-Pops (\[lq]removes\[rq]) the top value from the stack.
+.PP
+: Pops (\[dq]removes\[dq]) the top value from the stack.
.SS Register Control
.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
-.TP
+.PP
\f[B]s\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack and stores it into register
+.PP
+: Pops the value off the top of the stack and stores it into register
\f[I]r\f[R].
-.TP
+.PP
\f[B]l\f[R]\f[I]r\f[R]
-Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
+.PP
+: Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
This does not alter the contents of \f[I]r\f[R].
-.TP
+.PP
\f[B]S\f[R]\f[I]r\f[R]
-Pops the value off the top of the (main) stack and pushes it onto the
+.PP
+: Pops the value off the top of the (main) stack and pushes it onto the
stack of register \f[I]r\f[R].
The previous value of the register becomes inaccessible.
-.TP
+.PP
\f[B]L\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack for register \f[I]r\f[R] and
+.PP
+: Pops the value off the top of the stack for register \f[I]r\f[R] and
push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
@@ -664,113 +777,137 @@ accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
\f[B]scale\f[R], and \f[B]seed\f[R].
Also see the \f[B]SYNTAX\f[R] section.
-.TP
+.PP
\f[B]i\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
inclusive.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]o\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]obase\f[R], which must be between \f[B]0\f[R] and
\f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section and
the \f[B]NUMBERS\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]k\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]scale\f[R], which must be non-negative.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]j\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]seed\f[R].
The meaning of \f[B]seed\f[R] is dependent on the current pseudo-random
number generator but is guaranteed to not change except for new major
versions.
-.RS
+.IP
+.nf
+\f[C]
+The *scale* and sign of the value may be significant.
+
+If a previously used **seed** value is used again, the pseudo-random number
+generator is guaranteed to produce the same sequence of pseudo-random
+numbers as it did when the **seed** value was previously used.
+
+The exact value assigned to **seed** is not guaranteed to be returned if the
+**J** command is used. However, if **seed** *does* return a different value,
+both values, when assigned to **seed**, are guaranteed to produce the same
+sequence of pseudo-random numbers. This means that certain values assigned
+to **seed** will not produce unique sequences of pseudo-random numbers.
+
+There is no limit to the length (number of significant decimal digits) or
+*scale* of the value that can be assigned to **seed**.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The \f[I]scale\f[R] and sign of the value may be significant.
+\f[B]I\f[R]
.PP
-If a previously used \f[B]seed\f[R] value is used again, the
-pseudo-random number generator is guaranteed to produce the same
-sequence of pseudo-random numbers as it did when the \f[B]seed\f[R]
-value was previously used.
+: Pushes the current value of \f[B]ibase\f[R] onto the main stack.
.PP
-The exact value assigned to \f[B]seed\f[R] is not guaranteed to be
-returned if the \f[B]J\f[R] command is used.
-However, if \f[B]seed\f[R] \f[I]does\f[R] return a different value, both
-values, when assigned to \f[B]seed\f[R], are guaranteed to produce the
-same sequence of pseudo-random numbers.
-This means that certain values assigned to \f[B]seed\f[R] will not
-produce unique sequences of pseudo-random numbers.
+\f[B]O\f[R]
.PP
-There is no limit to the length (number of significant decimal digits)
-or \f[I]scale\f[R] of the value that can be assigned to \f[B]seed\f[R].
+: Pushes the current value of \f[B]obase\f[R] onto the main stack.
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]I\f[R]
-Pushes the current value of \f[B]ibase\f[R] onto the main stack.
-.TP
-\f[B]O\f[R]
-Pushes the current value of \f[B]obase\f[R] onto the main stack.
-.TP
\f[B]K\f[R]
-Pushes the current value of \f[B]scale\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]scale\f[R] onto the main stack.
+.PP
\f[B]J\f[R]
-Pushes the current value of \f[B]seed\f[R] onto the main stack.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Pushes the current value of \f[B]seed\f[R] onto the main stack.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]T\f[R]
-Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]U\f[R]
-Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]V\f[R]
-Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]W\f[R]
-Pushes the maximum (inclusive) integer that can be generated with the
-\f[B]\[cq]\f[R] pseudo-random number generator command.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+: Pushes the maximum (inclusive) integer that can be generated with the
+\f[B]\[aq]\f[R] pseudo-random number generator command.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Strings
.PP
The following commands control strings.
@@ -787,233 +924,292 @@ Strings can also be executed as macros.
For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
printed with a newline after and then popped from the stack.
-.TP
-\f[B][\f[R]_characters_\f[B]]\f[R]
-Makes a string containing \f[I]characters\f[R] and pushes it onto the
-stack.
-.RS
.PP
-If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
-they must be balanced.
-Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
-character.
+\f[B][\f[R]\f[I]characters\f[R]\f[B]]\f[R]
.PP
+: Makes a string containing \f[I]characters\f[R] and pushes it onto the
+stack.
+.IP
+.nf
+\f[C]
+If there are brackets (**\[rs][** and **\[rs]]**) in the string, then they must be
+balanced. Unbalanced brackets can be escaped using a backslash (**\[rs]\[rs]**)
+character.
+
If there is a backslash character in the string, the character after it
-(even another backslash) is put into the string verbatim, but the
-(first) backslash is not.
-.RE
-.TP
-\f[B]a\f[R]
-The value on top of the stack is popped.
-.RS
+(even another backslash) is put into the string verbatim, but the (first)
+backslash is not.
+\f[R]
+.fi
.PP
-If it is a number, it is truncated and its absolute value is taken.
-The result mod \f[B]UCHAR_MAX+1\f[R] is calculated.
-If that result is \f[B]0\f[R], push an empty string; otherwise, push a
-one-character string where the character is the result of the mod
-interpreted as an ASCII character.
+\f[B]a\f[R]
.PP
-If it is a string, then a new string is made.
-If the original string is empty, the new string is empty.
-If it is not, then the first character of the original string is used to
-create the new string as a one-character string.
-The new string is then pushed onto the stack.
+: The value on top of the stack is popped.
+.IP
+.nf
+\f[C]
+If it is a number, it is truncated and its absolute value is taken. The
+result mod **UCHAR_MAX+1** is calculated. If that result is **0**, push an
+empty string; otherwise, push a one-character string where the character is
+the result of the mod interpreted as an ASCII character.
+
+If it is a string, then a new string is made. If the original string is
+empty, the new string is empty. If it is not, then the first character of
+the original string is used to create the new string as a one-character
+string. The new string is then pushed onto the stack.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]x\f[R]
-Pops a value off of the top of the stack.
-.RS
.PP
+: Pops a value off of the top of the stack.
+.IP
+.nf
+\f[C]
If it is a number, it is pushed back onto the stack.
-.PP
+
If it is a string, it is executed as a macro.
-.PP
+
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is greater than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
-.PP
-For example, \f[B]0 1>a\f[R] will execute the contents of register
-\f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
+.IP
+.nf
+\f[C]
+For example, **0 1>a** will execute the contents of register **a**, and
+**1 0>a** will not.
+
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not greater than the second (less than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is less than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not less than the second (greater than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is equal to the second, then the contents of register
\f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not equal to the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]?\f[R]
-Reads a line from the \f[B]stdin\f[R] and executes it.
+.PP
+: Reads a line from the \f[B]stdin\f[R] and executes it.
This is to allow macros to request input from users.
-.TP
+.PP
\f[B]q\f[R]
-During execution of a macro, this exits the execution of that macro and
-the execution of the macro that executed it.
+.PP
+: During execution of a macro, this exits the execution of that macro
+and the execution of the macro that executed it.
If there are no macros, or only one macro executing, dc(1) exits.
-.TP
+.PP
\f[B]Q\f[R]
-Pops a value from the stack which must be non-negative and is used the
+.PP
+: Pops a value from the stack which must be non-negative and is used the
number of macro executions to pop off of the execution stack.
If the number of levels to pop is greater than the number of executing
macros, dc(1) exits.
.SS Status
.PP
These commands query status of the stack or its top value.
-.TP
-\f[B]Z\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, calculates the number of significant decimal digits
-it has and pushes the result.
+\f[B]Z\f[R]
.PP
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, calculates the number of significant decimal digits it
+has and pushes the result.
+
If it is a string, pushes the number of characters the string has.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]X\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, pushes the \f[I]scale\f[R] of the value onto the
-stack.
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, pushes the *scale* of the value onto the stack.
+
+If it is a string, pushes **0**.
+\f[R]
+.fi
.PP
-If it is a string, pushes \f[B]0\f[R].
-.RE
-.TP
\f[B]z\f[R]
-Pushes the current stack depth (before execution of this command).
+.PP
+: Pushes the current stack depth (before execution of this command).
.SS Arrays
.PP
These commands manipulate arrays.
-.TP
+.PP
\f[B]:\f[R]\f[I]r\f[R]
-Pops the top two values off of the stack.
+.PP
+: Pops the top two values off of the stack.
The second value will be stored in the array \f[I]r\f[R] (see the
\f[B]REGISTERS\f[R] section), indexed by the first value.
-.TP
+.PP
\f[B];\f[R]\f[I]r\f[R]
-Pops the value on top of the stack and uses it as an index into the
+.PP
+: Pops the value on top of the stack and uses it as an index into the
array \f[I]r\f[R].
The selected value is then pushed onto the stack.
.SH REGISTERS
@@ -1028,8 +1224,8 @@ their stack.
.PP
In non-extended register mode, a register name is just the single
character that follows any command that needs a register name.
-The only exception is a newline (\f[B]`\[rs]n'\f[R]); it is a parse
-error for a newline to be used as a register name.
+The only exception is a newline (\f[B]\[aq]\[rs]n\[aq]\f[R]); it is a
+parse error for a newline to be used as a register name.
.SS Extended Register Mode
.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
@@ -1040,7 +1236,7 @@ If extended register mode is enabled (\f[B]-x\f[R] or
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
-(\f[B]`\[rs]n'\f[R]).
+(\f[B]\[aq]\[rs]n\[aq]\f[R]).
.PP
In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
@@ -1085,64 +1281,77 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on dc(1):
-.TP
+.PP
\f[B]DC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
dc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]DC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]DC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]DC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]DC_BASE_POW\f[R].
-.TP
+.PP
\f[B]DC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_RAND_MAX\f[R]
-The maximum integer (inclusive) returned by the \f[B]\[cq]\f[R] command,
-if dc(1).
+.PP
+: The maximum integer (inclusive) returned by the \f[B]\[aq]\f[R]
+command, if dc(1).
Set at \f[B]2\[ha]DC_LONG_BIT-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]DC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
These limits are meant to be effectively non-existent; the limits are so
@@ -1152,104 +1361,117 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
dc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]DC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to dc(1).
+.PP
+: This is another way to give command-line arguments to dc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time dc(1) runs.
Another use would be to use the \f[B]-e\f[R] option to set
\f[B]scale\f[R] to a value other than \f[B]0\f[R].
-.RS
-.PP
-The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **DC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some dc file.dc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]dc\[rs]\[dq] file.dc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]dc\[aq] file.dc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]DC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
including the backslash newline combo.
The default line length is \f[B]70\f[R].
-.TP
+.PP
\f[B]DC_EXPR_EXIT\f[R]
-If this variable exists (no matter the contents), dc(1) will exit
+.PP
+: If this variable exists (no matter the contents), dc(1) will exit
immediately after executing expressions and files given by the
\f[B]-e\f[R] and/or \f[B]-f\f[R] command-line options (and any
equivalents).
.SH EXIT STATUS
.PP
dc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, using a negative number as a bound for the
-pseudo-random number generator, attempting to convert a negative number
-to a hardware integer, overflow when converting a number to a hardware
-integer, and attempting to use a non-integer where an integer is
-required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
-(\f[B]H\f[R]), and right shift (\f[B]h\f[R]) operators.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, using a negative number as a bound for the pseudo-random number
+generator, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**), places (**\[rs]\[at]**), left shift (**H**), and right shift (**h**)
+operators.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, and using a
-token where it is invalid.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, and using a token where it is
+invalid.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
-.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, and attempting an operation when the
-stack has too few elements.
-.RE
-.TP
+.PP
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, and attempting an operation when
+the stack has too few elements.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (dc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (dc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
@@ -1277,7 +1499,7 @@ In interactive mode, dc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, dc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, dc(1) turns on \[dq]TTY mode.\[dq]
.PP
The prompt is enabled in TTY mode.
.PP
@@ -1294,7 +1516,7 @@ If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If dc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If dc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/dc/H.1.md b/contrib/bc/manuals/dc/H.1.md
index de83e3088f9c..0114f7556a49 100644
--- a/contrib/bc/manuals/dc/H.1.md
+++ b/contrib/bc/manuals/dc/H.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -81,12 +81,26 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in dc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of dc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **?** command is used.
+
+ This is a **non-portable extension**.
+
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@@ -556,25 +570,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
-**s***r*
+**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
-**l***r*
+**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
-**S***r*
+**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
-**L***r*
+**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
- now accessible via the **l***r* command.
+ now accessible via the **l**_r_ command.
## Parameters
@@ -723,7 +737,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-**\>***r*
+**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@@ -735,7 +749,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**>***r***e***s*
+**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -744,7 +758,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\>***r*
+**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@@ -753,7 +767,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\>***r***e***s*
+**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -762,7 +776,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**\<***r*
+**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@@ -771,7 +785,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**\<***r***e***s*
+**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -780,7 +794,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\<***r*
+**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@@ -789,7 +803,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\<***r***e***s*
+**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -798,7 +812,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**=***r*
+**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@@ -807,7 +821,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**=***r***e***s*
+**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -816,7 +830,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!=***r*
+**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@@ -825,7 +839,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!=***r***e***s*
+**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -881,12 +895,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
-**:***r*
+**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
-**;***r*
+**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.
diff --git a/contrib/bc/manuals/dc/HN.1 b/contrib/bc/manuals/dc/HN.1
index a617bb473ec1..c04b7463f6bc 100644
--- a/contrib/bc/manuals/dc/HN.1
+++ b/contrib/bc/manuals/dc/HN.1
@@ -25,18 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+\f[B]dc\f[R] [\f[B]-hiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
-[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-read-prompt\f[R]] [\f[B]--extended-register\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -70,84 +70,115 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.SH OPTIONS
.PP
The following are the options that dc(1) accepts.
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.TP
+.PP
+: Print the version information (copyright header) and exit.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-Disables the prompt in TTY mode.
+.PP
+: Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
-See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
do not want a prompt or are not used to having them in dc(1).
Most of those users would want to put this option in
\f[B]DC_ENV_ARGS\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: Disables the read prompt in TTY mode.
+(The read prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a read prompt or are not used to having them in dc(1).
+Most of those users would want to put this option in
+\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
+This option is also useful in hash bang lines of dc(1) scripts that
+prompt for user input.
+.IP
+.nf
+\f[C]
+This option does not disable the regular prompt because the read prompt is
+only used when the **?** command is used.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-x\f[R] \f[B]--extended-register\f[R]
-Enables extended register mode.
+.PP
+: Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]DC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -190,7 +221,7 @@ Input is processed immediately when entered.
.PP
\f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to interpret constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
@@ -200,7 +231,7 @@ programs with the \f[B]T\f[R] command.
.PP
\f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
@@ -236,13 +267,13 @@ Likewise, when a value is assigned to \f[B]seed\f[R], it is not
guaranteed that querying \f[B]seed\f[R] immediately after will return
the same value.
In addition, the value of \f[B]seed\f[R] will change after any call to
-the \f[B]\[cq]\f[R] command or the \f[B]\[dq]\f[R] command that does not
+the \f[B]\[aq]\f[R] command or the \f[B]\[dq]\f[R] command that does not
get receive a value of \f[B]0\f[R] or \f[B]1\f[R].
-The maximum integer returned by the \f[B]\[cq]\f[R] command can be
+The maximum integer returned by the \f[B]\[aq]\f[R] command can be
queried with the \f[B]W\f[R] command.
.PP
\f[B]Note\f[R]: The values returned by the pseudo-random number
-generator with the \f[B]\[cq]\f[R] and \f[B]\[dq]\f[R] commands are
+generator with the \f[B]\[aq]\f[R] and \f[B]\[dq]\f[R] commands are
guaranteed to \f[B]NOT\f[R] be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator.
However, they \f[I]are\f[R] guaranteed to be reproducible with identical
@@ -311,272 +342,340 @@ To deactivate them, just assign a different value to \f[B]obase\f[R].
.PP
Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
-.TP
+.PP
\f[B]p\f[R]
-Prints the value on top of the stack, whether number or string, and
-prints a newline after.
-.RS
.PP
+: Prints the value on top of the stack, whether number or string, and
+prints a newline after.
+.IP
+.nf
+\f[C]
This does not alter the stack.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]n\f[R]
-Prints the value on top of the stack, whether number or string, and pops
-it off of the stack.
-.TP
+.PP
+: Prints the value on top of the stack, whether number or string, and
+pops it off of the stack.
+.PP
\f[B]P\f[R]
-Pops a value off the stack.
-.RS
.PP
+: Pops a value off the stack.
+.IP
+.nf
+\f[C]
If the value is a number, it is truncated and the absolute value of the
-result is printed as though \f[B]obase\f[R] is \f[B]UCHAR_MAX+1\f[R] and
-each digit is interpreted as an ASCII character, making it a byte
-stream.
-.PP
+result is printed as though **obase** is **UCHAR_MAX+1** and each digit is
+interpreted as an ASCII character, making it a byte stream.
+
If the value is a string, it is printed without a trailing newline.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]f\f[R]
-Prints the entire contents of the stack, in order from newest to oldest,
-without altering anything.
-.RS
.PP
+: Prints the entire contents of the stack, in order from newest to
+oldest, without altering anything.
+.IP
+.nf
+\f[C]
Users should use this command when they get lost.
-.RE
+\f[R]
+.fi
.SS Arithmetic
.PP
These are the commands used for arithmetic.
-.TP
+.PP
\f[B]+\f[R]
-The top two values are popped off the stack, added, and the result is
+.PP
+: The top two values are popped off the stack, added, and the result is
pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]-\f[R]
-The top two values are popped off the stack, subtracted, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, subtracted, and the
+result is pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]*\f[R]
-The top two values are popped off the stack, multiplied, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, multiplied, and the
+result is pushed onto the stack.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The top two values are popped off the stack, divided, and the result is
-pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
-The first value popped off of the stack must be non-zero.
-.RE
-.TP
-\f[B]%\f[R]
-The top two values are popped off the stack, remaindered, and the result
+: The top two values are popped off the stack, divided, and the result
is pushed onto the stack.
-.RS
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be non-zero.
+\f[R]
+.fi
.PP
-Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
-\f[B]scale\f[R], and 2) Using the result of step 1 to calculate
-\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
-\f[B]max(scale+scale(b),scale(a))\f[R].
+\f[B]%\f[R]
.PP
+: The top two values are popped off the stack, remaindered, and the
+result is pushed onto the stack.
+.IP
+.nf
+\f[C]
+Remaindering is equivalent to 1) Computing **a/b** to current **scale**, and
+2) Using the result of step 1 to calculate **a-(a/b)\[rs]*b** to *scale*
+**max(scale+scale(b),scale(a))**.
+
The first value popped off of the stack must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]\[ti]\f[R]
-The top two values are popped off the stack, divided and remaindered,
+.PP
+: The top two values are popped off the stack, divided and remaindered,
and the results (divided first, remainder second) are pushed onto the
stack.
This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
\f[B]y\f[R] are only evaluated once.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be non-zero.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The top two values are popped off the stack, the second is raised to the
-power of the first, and the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top two values are popped off the stack, the second is raised to
+the power of the first, and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be an integer, and if that
value is negative, the second value popped off of the stack must be
non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]v\f[R]
-The top value is popped off the stack, its square root is computed, and
-the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top value is popped off the stack, its square root is computed,
+and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The value popped off of the stack must be non-negative.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]_\f[R]
-If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
-or other commands), then that number is input as a negative number.
-.RS
-.PP
-Otherwise, the top value on the stack is popped and copied, and the copy
-is negated and pushed onto the stack.
-This behavior without a number is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+.PP
+: If this command \f[I]immediately\f[R] precedes a number (i.e., no
+spaces or other commands), then that number is input as a negative
+number.
+.IP
+.nf
+\f[C]
+Otherwise, the top value on the stack is popped and copied, and the copy is
+negated and pushed onto the stack. This behavior without a number is a
+**non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]b\f[R]
-The top value is popped off the stack, and if it is zero, it is pushed
+.PP
+: The top value is popped off the stack, and if it is zero, it is pushed
back onto the stack.
Otherwise, its absolute value is pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]|\f[R]
-The top three values are popped off the stack, a modular exponentiation
-is computed, and the result is pushed onto the stack.
-.RS
.PP
+: The top three values are popped off the stack, a modular
+exponentiation is computed, and the result is pushed onto the stack.
+.IP
+.nf
+\f[C]
The first value popped is used as the reduction modulus and must be an
-integer and non-zero.
-The second value popped is used as the exponent and must be an integer
-and non-negative.
-The third value popped is the base and must be an integer.
+integer and non-zero. The second value popped is used as the exponent and
+must be an integer and non-negative. The third value popped is the base and
+must be an integer.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]$\f[R]
-The top value is popped off the stack and copied, and the copy is
+.PP
+: The top value is popped off the stack and copied, and the copy is
truncated and pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[at]\f[R]
-The top two values are popped off the stack, and the precision of the
+.PP
+: The top two values are popped off the stack, and the precision of the
second is set to the value of the first, whether by truncation or
extension.
-.RS
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]H\f[R]
-The top two values are popped off the stack, and the second is shifted
-left (radix shifted right) to the value of the first.
-.RS
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+: The top two values are popped off the stack, and the second is shifted
+left (radix shifted right) to the value of the first.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]h\f[R]
-The top two values are popped off the stack, and the second is shifted
-right (radix shifted left) to the value of the first.
-.RS
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+: The top two values are popped off the stack, and the second is shifted
+right (radix shifted left) to the value of the first.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]G\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]N\f[R]
-The top value is popped off of the stack, and if it a \f[B]0\f[R], a
+.PP
+: The top value is popped off of the stack, and if it a \f[B]0\f[R], a
\f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B](\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]{\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than or equal to the second,
-or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than or equal to the
+second, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B])\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]}\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than or equal to the
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than or equal to the
second, or \f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]M\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If they are both non-zero, a \f[B]1\f[R] is pushed onto the stack.
If either of them is zero, or both of them are, then a \f[B]0\f[R] is
pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is like the **&&** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]m\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If at least one of them is non-zero, a \f[B]1\f[R] is pushed onto the
stack.
If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is like the **||** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Pseudo-Random Number Generator
.PP
dc(1) has a built-in pseudo-random number generator.
@@ -586,20 +685,24 @@ controls the pseudo-random number generator.)
.PP
The pseudo-random number generator is guaranteed to \f[B]NOT\f[R] be
cryptographically secure.
-.TP
-\f[B]\[cq]\f[R]
-Generates an integer between 0 and \f[B]DC_RAND_MAX\f[R], inclusive (see
-the \f[B]LIMITS\f[R] section).
-.RS
.PP
+\f[B]\[aq]\f[R]
+.PP
+: Generates an integer between 0 and \f[B]DC_RAND_MAX\f[R], inclusive
+(see the \f[B]LIMITS\f[R] section).
+.IP
+.nf
+\f[C]
The generated integer is made as unbiased as possible, subject to the
limitations of the pseudo-random number generator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[dq]\f[R]
-Pops a value off of the stack, which is used as an \f[B]exclusive\f[R]
+.PP
+: Pops a value off of the stack, which is used as an \f[B]exclusive\f[R]
upper bound on the integer that will be generated.
If the bound is negative or is a non-integer, an error is raised, and
dc(1) resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R]
@@ -614,48 +717,58 @@ Using this command will change the value of \f[B]seed\f[R], unless the
operand is \f[B]0\f[R] or \f[B]1\f[R].
In that case, \f[B]0\f[R] is pushed onto the stack, and \f[B]seed\f[R]
is \f[I]not\f[R] changed.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The generated integer is made as unbiased as possible, subject to the
limitations of the pseudo-random number generator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Stack Control
.PP
These commands control the stack.
-.TP
+.PP
\f[B]c\f[R]
-Removes all items from (\[lq]clears\[rq]) the stack.
-.TP
+.PP
+: Removes all items from (\[dq]clears\[dq]) the stack.
+.PP
\f[B]d\f[R]
-Copies the item on top of the stack (\[lq]duplicates\[rq]) and pushes
+.PP
+: Copies the item on top of the stack (\[dq]duplicates\[dq]) and pushes
the copy onto the stack.
-.TP
+.PP
\f[B]r\f[R]
-Swaps (\[lq]reverses\[rq]) the two top items on the stack.
-.TP
+.PP
+: Swaps (\[dq]reverses\[dq]) the two top items on the stack.
+.PP
\f[B]R\f[R]
-Pops (\[lq]removes\[rq]) the top value from the stack.
+.PP
+: Pops (\[dq]removes\[dq]) the top value from the stack.
.SS Register Control
.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
-.TP
+.PP
\f[B]s\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack and stores it into register
+.PP
+: Pops the value off the top of the stack and stores it into register
\f[I]r\f[R].
-.TP
+.PP
\f[B]l\f[R]\f[I]r\f[R]
-Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
+.PP
+: Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
This does not alter the contents of \f[I]r\f[R].
-.TP
+.PP
\f[B]S\f[R]\f[I]r\f[R]
-Pops the value off the top of the (main) stack and pushes it onto the
+.PP
+: Pops the value off the top of the (main) stack and pushes it onto the
stack of register \f[I]r\f[R].
The previous value of the register becomes inaccessible.
-.TP
+.PP
\f[B]L\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack for register \f[I]r\f[R] and
+.PP
+: Pops the value off the top of the stack for register \f[I]r\f[R] and
push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
@@ -664,113 +777,137 @@ accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
\f[B]scale\f[R], and \f[B]seed\f[R].
Also see the \f[B]SYNTAX\f[R] section.
-.TP
+.PP
\f[B]i\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
inclusive.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]o\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]obase\f[R], which must be between \f[B]0\f[R] and
\f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section and
the \f[B]NUMBERS\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]k\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]scale\f[R], which must be non-negative.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]j\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]seed\f[R].
The meaning of \f[B]seed\f[R] is dependent on the current pseudo-random
number generator but is guaranteed to not change except for new major
versions.
-.RS
+.IP
+.nf
+\f[C]
+The *scale* and sign of the value may be significant.
+
+If a previously used **seed** value is used again, the pseudo-random number
+generator is guaranteed to produce the same sequence of pseudo-random
+numbers as it did when the **seed** value was previously used.
+
+The exact value assigned to **seed** is not guaranteed to be returned if the
+**J** command is used. However, if **seed** *does* return a different value,
+both values, when assigned to **seed**, are guaranteed to produce the same
+sequence of pseudo-random numbers. This means that certain values assigned
+to **seed** will not produce unique sequences of pseudo-random numbers.
+
+There is no limit to the length (number of significant decimal digits) or
+*scale* of the value that can be assigned to **seed**.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The \f[I]scale\f[R] and sign of the value may be significant.
+\f[B]I\f[R]
.PP
-If a previously used \f[B]seed\f[R] value is used again, the
-pseudo-random number generator is guaranteed to produce the same
-sequence of pseudo-random numbers as it did when the \f[B]seed\f[R]
-value was previously used.
+: Pushes the current value of \f[B]ibase\f[R] onto the main stack.
.PP
-The exact value assigned to \f[B]seed\f[R] is not guaranteed to be
-returned if the \f[B]J\f[R] command is used.
-However, if \f[B]seed\f[R] \f[I]does\f[R] return a different value, both
-values, when assigned to \f[B]seed\f[R], are guaranteed to produce the
-same sequence of pseudo-random numbers.
-This means that certain values assigned to \f[B]seed\f[R] will not
-produce unique sequences of pseudo-random numbers.
+\f[B]O\f[R]
.PP
-There is no limit to the length (number of significant decimal digits)
-or \f[I]scale\f[R] of the value that can be assigned to \f[B]seed\f[R].
+: Pushes the current value of \f[B]obase\f[R] onto the main stack.
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]I\f[R]
-Pushes the current value of \f[B]ibase\f[R] onto the main stack.
-.TP
-\f[B]O\f[R]
-Pushes the current value of \f[B]obase\f[R] onto the main stack.
-.TP
\f[B]K\f[R]
-Pushes the current value of \f[B]scale\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]scale\f[R] onto the main stack.
+.PP
\f[B]J\f[R]
-Pushes the current value of \f[B]seed\f[R] onto the main stack.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Pushes the current value of \f[B]seed\f[R] onto the main stack.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]T\f[R]
-Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]U\f[R]
-Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]V\f[R]
-Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]W\f[R]
-Pushes the maximum (inclusive) integer that can be generated with the
-\f[B]\[cq]\f[R] pseudo-random number generator command.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+: Pushes the maximum (inclusive) integer that can be generated with the
+\f[B]\[aq]\f[R] pseudo-random number generator command.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Strings
.PP
The following commands control strings.
@@ -787,233 +924,292 @@ Strings can also be executed as macros.
For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
printed with a newline after and then popped from the stack.
-.TP
-\f[B][\f[R]_characters_\f[B]]\f[R]
-Makes a string containing \f[I]characters\f[R] and pushes it onto the
-stack.
-.RS
.PP
-If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
-they must be balanced.
-Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
-character.
+\f[B][\f[R]\f[I]characters\f[R]\f[B]]\f[R]
.PP
+: Makes a string containing \f[I]characters\f[R] and pushes it onto the
+stack.
+.IP
+.nf
+\f[C]
+If there are brackets (**\[rs][** and **\[rs]]**) in the string, then they must be
+balanced. Unbalanced brackets can be escaped using a backslash (**\[rs]\[rs]**)
+character.
+
If there is a backslash character in the string, the character after it
-(even another backslash) is put into the string verbatim, but the
-(first) backslash is not.
-.RE
-.TP
-\f[B]a\f[R]
-The value on top of the stack is popped.
-.RS
+(even another backslash) is put into the string verbatim, but the (first)
+backslash is not.
+\f[R]
+.fi
.PP
-If it is a number, it is truncated and its absolute value is taken.
-The result mod \f[B]UCHAR_MAX+1\f[R] is calculated.
-If that result is \f[B]0\f[R], push an empty string; otherwise, push a
-one-character string where the character is the result of the mod
-interpreted as an ASCII character.
+\f[B]a\f[R]
.PP
-If it is a string, then a new string is made.
-If the original string is empty, the new string is empty.
-If it is not, then the first character of the original string is used to
-create the new string as a one-character string.
-The new string is then pushed onto the stack.
+: The value on top of the stack is popped.
+.IP
+.nf
+\f[C]
+If it is a number, it is truncated and its absolute value is taken. The
+result mod **UCHAR_MAX+1** is calculated. If that result is **0**, push an
+empty string; otherwise, push a one-character string where the character is
+the result of the mod interpreted as an ASCII character.
+
+If it is a string, then a new string is made. If the original string is
+empty, the new string is empty. If it is not, then the first character of
+the original string is used to create the new string as a one-character
+string. The new string is then pushed onto the stack.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]x\f[R]
-Pops a value off of the top of the stack.
-.RS
.PP
+: Pops a value off of the top of the stack.
+.IP
+.nf
+\f[C]
If it is a number, it is pushed back onto the stack.
-.PP
+
If it is a string, it is executed as a macro.
-.PP
+
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is greater than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
-.PP
-For example, \f[B]0 1>a\f[R] will execute the contents of register
-\f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
+.IP
+.nf
+\f[C]
+For example, **0 1>a** will execute the contents of register **a**, and
+**1 0>a** will not.
+
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not greater than the second (less than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is less than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not less than the second (greater than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is equal to the second, then the contents of register
\f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not equal to the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]?\f[R]
-Reads a line from the \f[B]stdin\f[R] and executes it.
+.PP
+: Reads a line from the \f[B]stdin\f[R] and executes it.
This is to allow macros to request input from users.
-.TP
+.PP
\f[B]q\f[R]
-During execution of a macro, this exits the execution of that macro and
-the execution of the macro that executed it.
+.PP
+: During execution of a macro, this exits the execution of that macro
+and the execution of the macro that executed it.
If there are no macros, or only one macro executing, dc(1) exits.
-.TP
+.PP
\f[B]Q\f[R]
-Pops a value from the stack which must be non-negative and is used the
+.PP
+: Pops a value from the stack which must be non-negative and is used the
number of macro executions to pop off of the execution stack.
If the number of levels to pop is greater than the number of executing
macros, dc(1) exits.
.SS Status
.PP
These commands query status of the stack or its top value.
-.TP
-\f[B]Z\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, calculates the number of significant decimal digits
-it has and pushes the result.
+\f[B]Z\f[R]
.PP
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, calculates the number of significant decimal digits it
+has and pushes the result.
+
If it is a string, pushes the number of characters the string has.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]X\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, pushes the \f[I]scale\f[R] of the value onto the
-stack.
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, pushes the *scale* of the value onto the stack.
+
+If it is a string, pushes **0**.
+\f[R]
+.fi
.PP
-If it is a string, pushes \f[B]0\f[R].
-.RE
-.TP
\f[B]z\f[R]
-Pushes the current stack depth (before execution of this command).
+.PP
+: Pushes the current stack depth (before execution of this command).
.SS Arrays
.PP
These commands manipulate arrays.
-.TP
+.PP
\f[B]:\f[R]\f[I]r\f[R]
-Pops the top two values off of the stack.
+.PP
+: Pops the top two values off of the stack.
The second value will be stored in the array \f[I]r\f[R] (see the
\f[B]REGISTERS\f[R] section), indexed by the first value.
-.TP
+.PP
\f[B];\f[R]\f[I]r\f[R]
-Pops the value on top of the stack and uses it as an index into the
+.PP
+: Pops the value on top of the stack and uses it as an index into the
array \f[I]r\f[R].
The selected value is then pushed onto the stack.
.SH REGISTERS
@@ -1028,8 +1224,8 @@ their stack.
.PP
In non-extended register mode, a register name is just the single
character that follows any command that needs a register name.
-The only exception is a newline (\f[B]`\[rs]n'\f[R]); it is a parse
-error for a newline to be used as a register name.
+The only exception is a newline (\f[B]\[aq]\[rs]n\[aq]\f[R]); it is a
+parse error for a newline to be used as a register name.
.SS Extended Register Mode
.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
@@ -1040,7 +1236,7 @@ If extended register mode is enabled (\f[B]-x\f[R] or
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
-(\f[B]`\[rs]n'\f[R]).
+(\f[B]\[aq]\[rs]n\[aq]\f[R]).
.PP
In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
@@ -1085,64 +1281,77 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on dc(1):
-.TP
+.PP
\f[B]DC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
dc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]DC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]DC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]DC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]DC_BASE_POW\f[R].
-.TP
+.PP
\f[B]DC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_RAND_MAX\f[R]
-The maximum integer (inclusive) returned by the \f[B]\[cq]\f[R] command,
-if dc(1).
+.PP
+: The maximum integer (inclusive) returned by the \f[B]\[aq]\f[R]
+command, if dc(1).
Set at \f[B]2\[ha]DC_LONG_BIT-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]DC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
These limits are meant to be effectively non-existent; the limits are so
@@ -1152,104 +1361,117 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
dc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]DC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to dc(1).
+.PP
+: This is another way to give command-line arguments to dc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time dc(1) runs.
Another use would be to use the \f[B]-e\f[R] option to set
\f[B]scale\f[R] to a value other than \f[B]0\f[R].
-.RS
-.PP
-The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **DC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some dc file.dc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]dc\[rs]\[dq] file.dc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]dc\[aq] file.dc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]DC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
including the backslash newline combo.
The default line length is \f[B]70\f[R].
-.TP
+.PP
\f[B]DC_EXPR_EXIT\f[R]
-If this variable exists (no matter the contents), dc(1) will exit
+.PP
+: If this variable exists (no matter the contents), dc(1) will exit
immediately after executing expressions and files given by the
\f[B]-e\f[R] and/or \f[B]-f\f[R] command-line options (and any
equivalents).
.SH EXIT STATUS
.PP
dc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, using a negative number as a bound for the
-pseudo-random number generator, attempting to convert a negative number
-to a hardware integer, overflow when converting a number to a hardware
-integer, and attempting to use a non-integer where an integer is
-required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
-(\f[B]H\f[R]), and right shift (\f[B]h\f[R]) operators.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, using a negative number as a bound for the pseudo-random number
+generator, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**), places (**\[rs]\[at]**), left shift (**H**), and right shift (**h**)
+operators.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, and using a
-token where it is invalid.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, and using a token where it is
+invalid.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
-.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, and attempting an operation when the
-stack has too few elements.
-.RE
-.TP
+.PP
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, and attempting an operation when
+the stack has too few elements.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (dc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (dc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
@@ -1277,7 +1499,7 @@ In interactive mode, dc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, dc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, dc(1) turns on \[dq]TTY mode.\[dq]
.PP
The prompt is enabled in TTY mode.
.PP
@@ -1294,7 +1516,7 @@ If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If dc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If dc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/dc/HN.1.md b/contrib/bc/manuals/dc/HN.1.md
index 005579cd02c8..92f040cffb13 100644
--- a/contrib/bc/manuals/dc/HN.1.md
+++ b/contrib/bc/manuals/dc/HN.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -81,12 +81,26 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in dc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of dc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **?** command is used.
+
+ This is a **non-portable extension**.
+
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@@ -556,25 +570,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
-**s***r*
+**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
-**l***r*
+**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
-**S***r*
+**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
-**L***r*
+**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
- now accessible via the **l***r* command.
+ now accessible via the **l**_r_ command.
## Parameters
@@ -723,7 +737,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-**\>***r*
+**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@@ -735,7 +749,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**>***r***e***s*
+**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -744,7 +758,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\>***r*
+**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@@ -753,7 +767,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\>***r***e***s*
+**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -762,7 +776,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**\<***r*
+**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@@ -771,7 +785,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**\<***r***e***s*
+**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -780,7 +794,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\<***r*
+**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@@ -789,7 +803,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\<***r***e***s*
+**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -798,7 +812,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**=***r*
+**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@@ -807,7 +821,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**=***r***e***s*
+**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -816,7 +830,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!=***r*
+**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@@ -825,7 +839,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!=***r***e***s*
+**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -881,12 +895,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
-**:***r*
+**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
-**;***r*
+**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.
diff --git a/contrib/bc/manuals/dc/HNP.1 b/contrib/bc/manuals/dc/HNP.1
index 7eb4b8b19f3d..bec07f5ad64f 100644
--- a/contrib/bc/manuals/dc/HNP.1
+++ b/contrib/bc/manuals/dc/HNP.1
@@ -25,18 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+\f[B]dc\f[R] [\f[B]-hiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
-[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-read-prompt\f[R]] [\f[B]--extended-register\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -70,79 +70,100 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.SH OPTIONS
.PP
The following are the options that dc(1) accepts.
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.TP
+.PP
+: Print the version information (copyright header) and exit.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-This option is a no-op.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-x\f[R] \f[B]--extended-register\f[R]
-Enables extended register mode.
+.PP
+: Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]DC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -185,7 +206,7 @@ Input is processed immediately when entered.
.PP
\f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to interpret constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
@@ -195,7 +216,7 @@ programs with the \f[B]T\f[R] command.
.PP
\f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
@@ -231,13 +252,13 @@ Likewise, when a value is assigned to \f[B]seed\f[R], it is not
guaranteed that querying \f[B]seed\f[R] immediately after will return
the same value.
In addition, the value of \f[B]seed\f[R] will change after any call to
-the \f[B]\[cq]\f[R] command or the \f[B]\[dq]\f[R] command that does not
+the \f[B]\[aq]\f[R] command or the \f[B]\[dq]\f[R] command that does not
get receive a value of \f[B]0\f[R] or \f[B]1\f[R].
-The maximum integer returned by the \f[B]\[cq]\f[R] command can be
+The maximum integer returned by the \f[B]\[aq]\f[R] command can be
queried with the \f[B]W\f[R] command.
.PP
\f[B]Note\f[R]: The values returned by the pseudo-random number
-generator with the \f[B]\[cq]\f[R] and \f[B]\[dq]\f[R] commands are
+generator with the \f[B]\[aq]\f[R] and \f[B]\[dq]\f[R] commands are
guaranteed to \f[B]NOT\f[R] be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator.
However, they \f[I]are\f[R] guaranteed to be reproducible with identical
@@ -306,272 +327,340 @@ To deactivate them, just assign a different value to \f[B]obase\f[R].
.PP
Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
-.TP
+.PP
\f[B]p\f[R]
-Prints the value on top of the stack, whether number or string, and
-prints a newline after.
-.RS
.PP
+: Prints the value on top of the stack, whether number or string, and
+prints a newline after.
+.IP
+.nf
+\f[C]
This does not alter the stack.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]n\f[R]
-Prints the value on top of the stack, whether number or string, and pops
-it off of the stack.
-.TP
+.PP
+: Prints the value on top of the stack, whether number or string, and
+pops it off of the stack.
+.PP
\f[B]P\f[R]
-Pops a value off the stack.
-.RS
.PP
+: Pops a value off the stack.
+.IP
+.nf
+\f[C]
If the value is a number, it is truncated and the absolute value of the
-result is printed as though \f[B]obase\f[R] is \f[B]UCHAR_MAX+1\f[R] and
-each digit is interpreted as an ASCII character, making it a byte
-stream.
-.PP
+result is printed as though **obase** is **UCHAR_MAX+1** and each digit is
+interpreted as an ASCII character, making it a byte stream.
+
If the value is a string, it is printed without a trailing newline.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]f\f[R]
-Prints the entire contents of the stack, in order from newest to oldest,
-without altering anything.
-.RS
.PP
+: Prints the entire contents of the stack, in order from newest to
+oldest, without altering anything.
+.IP
+.nf
+\f[C]
Users should use this command when they get lost.
-.RE
+\f[R]
+.fi
.SS Arithmetic
.PP
These are the commands used for arithmetic.
-.TP
+.PP
\f[B]+\f[R]
-The top two values are popped off the stack, added, and the result is
+.PP
+: The top two values are popped off the stack, added, and the result is
pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]-\f[R]
-The top two values are popped off the stack, subtracted, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, subtracted, and the
+result is pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]*\f[R]
-The top two values are popped off the stack, multiplied, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, multiplied, and the
+result is pushed onto the stack.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The top two values are popped off the stack, divided, and the result is
-pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
-The first value popped off of the stack must be non-zero.
-.RE
-.TP
-\f[B]%\f[R]
-The top two values are popped off the stack, remaindered, and the result
+: The top two values are popped off the stack, divided, and the result
is pushed onto the stack.
-.RS
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be non-zero.
+\f[R]
+.fi
.PP
-Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
-\f[B]scale\f[R], and 2) Using the result of step 1 to calculate
-\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
-\f[B]max(scale+scale(b),scale(a))\f[R].
+\f[B]%\f[R]
.PP
+: The top two values are popped off the stack, remaindered, and the
+result is pushed onto the stack.
+.IP
+.nf
+\f[C]
+Remaindering is equivalent to 1) Computing **a/b** to current **scale**, and
+2) Using the result of step 1 to calculate **a-(a/b)\[rs]*b** to *scale*
+**max(scale+scale(b),scale(a))**.
+
The first value popped off of the stack must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]\[ti]\f[R]
-The top two values are popped off the stack, divided and remaindered,
+.PP
+: The top two values are popped off the stack, divided and remaindered,
and the results (divided first, remainder second) are pushed onto the
stack.
This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
\f[B]y\f[R] are only evaluated once.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be non-zero.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The top two values are popped off the stack, the second is raised to the
-power of the first, and the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top two values are popped off the stack, the second is raised to
+the power of the first, and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be an integer, and if that
value is negative, the second value popped off of the stack must be
non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]v\f[R]
-The top value is popped off the stack, its square root is computed, and
-the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top value is popped off the stack, its square root is computed,
+and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The value popped off of the stack must be non-negative.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]_\f[R]
-If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
-or other commands), then that number is input as a negative number.
-.RS
-.PP
-Otherwise, the top value on the stack is popped and copied, and the copy
-is negated and pushed onto the stack.
-This behavior without a number is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+.PP
+: If this command \f[I]immediately\f[R] precedes a number (i.e., no
+spaces or other commands), then that number is input as a negative
+number.
+.IP
+.nf
+\f[C]
+Otherwise, the top value on the stack is popped and copied, and the copy is
+negated and pushed onto the stack. This behavior without a number is a
+**non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]b\f[R]
-The top value is popped off the stack, and if it is zero, it is pushed
+.PP
+: The top value is popped off the stack, and if it is zero, it is pushed
back onto the stack.
Otherwise, its absolute value is pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]|\f[R]
-The top three values are popped off the stack, a modular exponentiation
-is computed, and the result is pushed onto the stack.
-.RS
.PP
+: The top three values are popped off the stack, a modular
+exponentiation is computed, and the result is pushed onto the stack.
+.IP
+.nf
+\f[C]
The first value popped is used as the reduction modulus and must be an
-integer and non-zero.
-The second value popped is used as the exponent and must be an integer
-and non-negative.
-The third value popped is the base and must be an integer.
+integer and non-zero. The second value popped is used as the exponent and
+must be an integer and non-negative. The third value popped is the base and
+must be an integer.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]$\f[R]
-The top value is popped off the stack and copied, and the copy is
+.PP
+: The top value is popped off the stack and copied, and the copy is
truncated and pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[at]\f[R]
-The top two values are popped off the stack, and the precision of the
+.PP
+: The top two values are popped off the stack, and the precision of the
second is set to the value of the first, whether by truncation or
extension.
-.RS
-.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]H\f[R]
-The top two values are popped off the stack, and the second is shifted
-left (radix shifted right) to the value of the first.
-.RS
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+: The top two values are popped off the stack, and the second is shifted
+left (radix shifted right) to the value of the first.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]h\f[R]
-The top two values are popped off the stack, and the second is shifted
-right (radix shifted left) to the value of the first.
-.RS
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+: The top two values are popped off the stack, and the second is shifted
+right (radix shifted left) to the value of the first.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]G\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]N\f[R]
-The top value is popped off of the stack, and if it a \f[B]0\f[R], a
+.PP
+: The top value is popped off of the stack, and if it a \f[B]0\f[R], a
\f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B](\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]{\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than or equal to the second,
-or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than or equal to the
+second, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B])\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]}\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than or equal to the
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than or equal to the
second, or \f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]M\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If they are both non-zero, a \f[B]1\f[R] is pushed onto the stack.
If either of them is zero, or both of them are, then a \f[B]0\f[R] is
pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is like the **&&** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]m\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If at least one of them is non-zero, a \f[B]1\f[R] is pushed onto the
stack.
If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is like the **||** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Pseudo-Random Number Generator
.PP
dc(1) has a built-in pseudo-random number generator.
@@ -581,20 +670,24 @@ controls the pseudo-random number generator.)
.PP
The pseudo-random number generator is guaranteed to \f[B]NOT\f[R] be
cryptographically secure.
-.TP
-\f[B]\[cq]\f[R]
-Generates an integer between 0 and \f[B]DC_RAND_MAX\f[R], inclusive (see
-the \f[B]LIMITS\f[R] section).
-.RS
.PP
+\f[B]\[aq]\f[R]
+.PP
+: Generates an integer between 0 and \f[B]DC_RAND_MAX\f[R], inclusive
+(see the \f[B]LIMITS\f[R] section).
+.IP
+.nf
+\f[C]
The generated integer is made as unbiased as possible, subject to the
limitations of the pseudo-random number generator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[dq]\f[R]
-Pops a value off of the stack, which is used as an \f[B]exclusive\f[R]
+.PP
+: Pops a value off of the stack, which is used as an \f[B]exclusive\f[R]
upper bound on the integer that will be generated.
If the bound is negative or is a non-integer, an error is raised, and
dc(1) resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R]
@@ -609,48 +702,58 @@ Using this command will change the value of \f[B]seed\f[R], unless the
operand is \f[B]0\f[R] or \f[B]1\f[R].
In that case, \f[B]0\f[R] is pushed onto the stack, and \f[B]seed\f[R]
is \f[I]not\f[R] changed.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The generated integer is made as unbiased as possible, subject to the
limitations of the pseudo-random number generator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Stack Control
.PP
These commands control the stack.
-.TP
+.PP
\f[B]c\f[R]
-Removes all items from (\[lq]clears\[rq]) the stack.
-.TP
+.PP
+: Removes all items from (\[dq]clears\[dq]) the stack.
+.PP
\f[B]d\f[R]
-Copies the item on top of the stack (\[lq]duplicates\[rq]) and pushes
+.PP
+: Copies the item on top of the stack (\[dq]duplicates\[dq]) and pushes
the copy onto the stack.
-.TP
+.PP
\f[B]r\f[R]
-Swaps (\[lq]reverses\[rq]) the two top items on the stack.
-.TP
+.PP
+: Swaps (\[dq]reverses\[dq]) the two top items on the stack.
+.PP
\f[B]R\f[R]
-Pops (\[lq]removes\[rq]) the top value from the stack.
+.PP
+: Pops (\[dq]removes\[dq]) the top value from the stack.
.SS Register Control
.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
-.TP
+.PP
\f[B]s\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack and stores it into register
+.PP
+: Pops the value off the top of the stack and stores it into register
\f[I]r\f[R].
-.TP
+.PP
\f[B]l\f[R]\f[I]r\f[R]
-Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
+.PP
+: Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
This does not alter the contents of \f[I]r\f[R].
-.TP
+.PP
\f[B]S\f[R]\f[I]r\f[R]
-Pops the value off the top of the (main) stack and pushes it onto the
+.PP
+: Pops the value off the top of the (main) stack and pushes it onto the
stack of register \f[I]r\f[R].
The previous value of the register becomes inaccessible.
-.TP
+.PP
\f[B]L\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack for register \f[I]r\f[R] and
+.PP
+: Pops the value off the top of the stack for register \f[I]r\f[R] and
push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
@@ -659,113 +762,137 @@ accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
\f[B]scale\f[R], and \f[B]seed\f[R].
Also see the \f[B]SYNTAX\f[R] section.
-.TP
+.PP
\f[B]i\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
inclusive.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]o\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]obase\f[R], which must be between \f[B]0\f[R] and
\f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section and
the \f[B]NUMBERS\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]k\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]scale\f[R], which must be non-negative.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]j\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]seed\f[R].
The meaning of \f[B]seed\f[R] is dependent on the current pseudo-random
number generator but is guaranteed to not change except for new major
versions.
-.RS
+.IP
+.nf
+\f[C]
+The *scale* and sign of the value may be significant.
+
+If a previously used **seed** value is used again, the pseudo-random number
+generator is guaranteed to produce the same sequence of pseudo-random
+numbers as it did when the **seed** value was previously used.
+
+The exact value assigned to **seed** is not guaranteed to be returned if the
+**J** command is used. However, if **seed** *does* return a different value,
+both values, when assigned to **seed**, are guaranteed to produce the same
+sequence of pseudo-random numbers. This means that certain values assigned
+to **seed** will not produce unique sequences of pseudo-random numbers.
+
+There is no limit to the length (number of significant decimal digits) or
+*scale* of the value that can be assigned to **seed**.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The \f[I]scale\f[R] and sign of the value may be significant.
+\f[B]I\f[R]
.PP
-If a previously used \f[B]seed\f[R] value is used again, the
-pseudo-random number generator is guaranteed to produce the same
-sequence of pseudo-random numbers as it did when the \f[B]seed\f[R]
-value was previously used.
+: Pushes the current value of \f[B]ibase\f[R] onto the main stack.
.PP
-The exact value assigned to \f[B]seed\f[R] is not guaranteed to be
-returned if the \f[B]J\f[R] command is used.
-However, if \f[B]seed\f[R] \f[I]does\f[R] return a different value, both
-values, when assigned to \f[B]seed\f[R], are guaranteed to produce the
-same sequence of pseudo-random numbers.
-This means that certain values assigned to \f[B]seed\f[R] will not
-produce unique sequences of pseudo-random numbers.
+\f[B]O\f[R]
.PP
-There is no limit to the length (number of significant decimal digits)
-or \f[I]scale\f[R] of the value that can be assigned to \f[B]seed\f[R].
+: Pushes the current value of \f[B]obase\f[R] onto the main stack.
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]I\f[R]
-Pushes the current value of \f[B]ibase\f[R] onto the main stack.
-.TP
-\f[B]O\f[R]
-Pushes the current value of \f[B]obase\f[R] onto the main stack.
-.TP
\f[B]K\f[R]
-Pushes the current value of \f[B]scale\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]scale\f[R] onto the main stack.
+.PP
\f[B]J\f[R]
-Pushes the current value of \f[B]seed\f[R] onto the main stack.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Pushes the current value of \f[B]seed\f[R] onto the main stack.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]T\f[R]
-Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]U\f[R]
-Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]V\f[R]
-Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]W\f[R]
-Pushes the maximum (inclusive) integer that can be generated with the
-\f[B]\[cq]\f[R] pseudo-random number generator command.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+: Pushes the maximum (inclusive) integer that can be generated with the
+\f[B]\[aq]\f[R] pseudo-random number generator command.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Strings
.PP
The following commands control strings.
@@ -782,233 +909,292 @@ Strings can also be executed as macros.
For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
printed with a newline after and then popped from the stack.
-.TP
-\f[B][\f[R]_characters_\f[B]]\f[R]
-Makes a string containing \f[I]characters\f[R] and pushes it onto the
-stack.
-.RS
.PP
-If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
-they must be balanced.
-Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
-character.
+\f[B][\f[R]\f[I]characters\f[R]\f[B]]\f[R]
.PP
+: Makes a string containing \f[I]characters\f[R] and pushes it onto the
+stack.
+.IP
+.nf
+\f[C]
+If there are brackets (**\[rs][** and **\[rs]]**) in the string, then they must be
+balanced. Unbalanced brackets can be escaped using a backslash (**\[rs]\[rs]**)
+character.
+
If there is a backslash character in the string, the character after it
-(even another backslash) is put into the string verbatim, but the
-(first) backslash is not.
-.RE
-.TP
-\f[B]a\f[R]
-The value on top of the stack is popped.
-.RS
+(even another backslash) is put into the string verbatim, but the (first)
+backslash is not.
+\f[R]
+.fi
.PP
-If it is a number, it is truncated and its absolute value is taken.
-The result mod \f[B]UCHAR_MAX+1\f[R] is calculated.
-If that result is \f[B]0\f[R], push an empty string; otherwise, push a
-one-character string where the character is the result of the mod
-interpreted as an ASCII character.
+\f[B]a\f[R]
.PP
-If it is a string, then a new string is made.
-If the original string is empty, the new string is empty.
-If it is not, then the first character of the original string is used to
-create the new string as a one-character string.
-The new string is then pushed onto the stack.
+: The value on top of the stack is popped.
+.IP
+.nf
+\f[C]
+If it is a number, it is truncated and its absolute value is taken. The
+result mod **UCHAR_MAX+1** is calculated. If that result is **0**, push an
+empty string; otherwise, push a one-character string where the character is
+the result of the mod interpreted as an ASCII character.
+
+If it is a string, then a new string is made. If the original string is
+empty, the new string is empty. If it is not, then the first character of
+the original string is used to create the new string as a one-character
+string. The new string is then pushed onto the stack.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]x\f[R]
-Pops a value off of the top of the stack.
-.RS
.PP
+: Pops a value off of the top of the stack.
+.IP
+.nf
+\f[C]
If it is a number, it is pushed back onto the stack.
-.PP
+
If it is a string, it is executed as a macro.
-.PP
+
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is greater than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
-.PP
-For example, \f[B]0 1>a\f[R] will execute the contents of register
-\f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
+.IP
+.nf
+\f[C]
+For example, **0 1>a** will execute the contents of register **a**, and
+**1 0>a** will not.
+
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not greater than the second (less than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is less than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not less than the second (greater than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is equal to the second, then the contents of register
\f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not equal to the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]?\f[R]
-Reads a line from the \f[B]stdin\f[R] and executes it.
+.PP
+: Reads a line from the \f[B]stdin\f[R] and executes it.
This is to allow macros to request input from users.
-.TP
+.PP
\f[B]q\f[R]
-During execution of a macro, this exits the execution of that macro and
-the execution of the macro that executed it.
+.PP
+: During execution of a macro, this exits the execution of that macro
+and the execution of the macro that executed it.
If there are no macros, or only one macro executing, dc(1) exits.
-.TP
+.PP
\f[B]Q\f[R]
-Pops a value from the stack which must be non-negative and is used the
+.PP
+: Pops a value from the stack which must be non-negative and is used the
number of macro executions to pop off of the execution stack.
If the number of levels to pop is greater than the number of executing
macros, dc(1) exits.
.SS Status
.PP
These commands query status of the stack or its top value.
-.TP
-\f[B]Z\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, calculates the number of significant decimal digits
-it has and pushes the result.
+\f[B]Z\f[R]
.PP
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, calculates the number of significant decimal digits it
+has and pushes the result.
+
If it is a string, pushes the number of characters the string has.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]X\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, pushes the \f[I]scale\f[R] of the value onto the
-stack.
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, pushes the *scale* of the value onto the stack.
+
+If it is a string, pushes **0**.
+\f[R]
+.fi
.PP
-If it is a string, pushes \f[B]0\f[R].
-.RE
-.TP
\f[B]z\f[R]
-Pushes the current stack depth (before execution of this command).
+.PP
+: Pushes the current stack depth (before execution of this command).
.SS Arrays
.PP
These commands manipulate arrays.
-.TP
+.PP
\f[B]:\f[R]\f[I]r\f[R]
-Pops the top two values off of the stack.
+.PP
+: Pops the top two values off of the stack.
The second value will be stored in the array \f[I]r\f[R] (see the
\f[B]REGISTERS\f[R] section), indexed by the first value.
-.TP
+.PP
\f[B];\f[R]\f[I]r\f[R]
-Pops the value on top of the stack and uses it as an index into the
+.PP
+: Pops the value on top of the stack and uses it as an index into the
array \f[I]r\f[R].
The selected value is then pushed onto the stack.
.SH REGISTERS
@@ -1023,8 +1209,8 @@ their stack.
.PP
In non-extended register mode, a register name is just the single
character that follows any command that needs a register name.
-The only exception is a newline (\f[B]`\[rs]n'\f[R]); it is a parse
-error for a newline to be used as a register name.
+The only exception is a newline (\f[B]\[aq]\[rs]n\[aq]\f[R]); it is a
+parse error for a newline to be used as a register name.
.SS Extended Register Mode
.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
@@ -1035,7 +1221,7 @@ If extended register mode is enabled (\f[B]-x\f[R] or
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
-(\f[B]`\[rs]n'\f[R]).
+(\f[B]\[aq]\[rs]n\[aq]\f[R]).
.PP
In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
@@ -1080,64 +1266,77 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on dc(1):
-.TP
+.PP
\f[B]DC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
dc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]DC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]DC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]DC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]DC_BASE_POW\f[R].
-.TP
+.PP
\f[B]DC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_RAND_MAX\f[R]
-The maximum integer (inclusive) returned by the \f[B]\[cq]\f[R] command,
-if dc(1).
+.PP
+: The maximum integer (inclusive) returned by the \f[B]\[aq]\f[R]
+command, if dc(1).
Set at \f[B]2\[ha]DC_LONG_BIT-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]DC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
These limits are meant to be effectively non-existent; the limits are so
@@ -1147,104 +1346,117 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
dc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]DC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to dc(1).
+.PP
+: This is another way to give command-line arguments to dc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time dc(1) runs.
Another use would be to use the \f[B]-e\f[R] option to set
\f[B]scale\f[R] to a value other than \f[B]0\f[R].
-.RS
-.PP
-The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **DC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some dc file.dc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]dc\[rs]\[dq] file.dc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]dc\[aq] file.dc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]DC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
including the backslash newline combo.
The default line length is \f[B]70\f[R].
-.TP
+.PP
\f[B]DC_EXPR_EXIT\f[R]
-If this variable exists (no matter the contents), dc(1) will exit
+.PP
+: If this variable exists (no matter the contents), dc(1) will exit
immediately after executing expressions and files given by the
\f[B]-e\f[R] and/or \f[B]-f\f[R] command-line options (and any
equivalents).
.SH EXIT STATUS
.PP
dc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, using a negative number as a bound for the
-pseudo-random number generator, attempting to convert a negative number
-to a hardware integer, overflow when converting a number to a hardware
-integer, and attempting to use a non-integer where an integer is
-required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
-(\f[B]H\f[R]), and right shift (\f[B]h\f[R]) operators.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, using a negative number as a bound for the pseudo-random number
+generator, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**), places (**\[rs]\[at]**), left shift (**H**), and right shift (**h**)
+operators.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, and using a
-token where it is invalid.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, and using a token where it is
+invalid.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
-.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, and attempting an operation when the
-stack has too few elements.
-.RE
-.TP
+.PP
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, and attempting an operation when
+the stack has too few elements.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (dc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (dc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
@@ -1272,7 +1484,7 @@ In interactive mode, dc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, dc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, dc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is different from interactive mode because interactive mode is
required in the bc(1)
@@ -1287,7 +1499,7 @@ If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If dc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If dc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/dc/HNP.1.md b/contrib/bc/manuals/dc/HNP.1.md
index d099d6f9cdcf..a93b3271ec85 100644
--- a/contrib/bc/manuals/dc/HNP.1.md
+++ b/contrib/bc/manuals/dc/HNP.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -84,6 +84,12 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: This option is a no-op.
+
+ This is a **non-portable extension**.
+
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@@ -553,25 +559,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
-**s***r*
+**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
-**l***r*
+**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
-**S***r*
+**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
-**L***r*
+**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
- now accessible via the **l***r* command.
+ now accessible via the **l**_r_ command.
## Parameters
@@ -720,7 +726,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-**\>***r*
+**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@@ -732,7 +738,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**>***r***e***s*
+**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -741,7 +747,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\>***r*
+**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@@ -750,7 +756,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\>***r***e***s*
+**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -759,7 +765,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**\<***r*
+**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@@ -768,7 +774,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**\<***r***e***s*
+**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -777,7 +783,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\<***r*
+**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@@ -786,7 +792,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\<***r***e***s*
+**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -795,7 +801,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**=***r*
+**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@@ -804,7 +810,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**=***r***e***s*
+**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -813,7 +819,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!=***r*
+**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@@ -822,7 +828,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!=***r***e***s*
+**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -878,12 +884,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
-**:***r*
+**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
-**;***r*
+**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.
diff --git a/contrib/bc/manuals/dc/HP.1 b/contrib/bc/manuals/dc/HP.1
index cea646c8a3f3..a28ee9a9cae2 100644
--- a/contrib/bc/manuals/dc/HP.1
+++ b/contrib/bc/manuals/dc/HP.1
@@ -25,18 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+\f[B]dc\f[R] [\f[B]-hiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
-[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-read-prompt\f[R]] [\f[B]--extended-register\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -70,79 +70,100 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.SH OPTIONS
.PP
The following are the options that dc(1) accepts.
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.TP
+.PP
+: Print the version information (copyright header) and exit.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-This option is a no-op.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-x\f[R] \f[B]--extended-register\f[R]
-Enables extended register mode.
+.PP
+: Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]DC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -185,7 +206,7 @@ Input is processed immediately when entered.
.PP
\f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to interpret constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
@@ -195,7 +216,7 @@ programs with the \f[B]T\f[R] command.
.PP
\f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
@@ -231,13 +252,13 @@ Likewise, when a value is assigned to \f[B]seed\f[R], it is not
guaranteed that querying \f[B]seed\f[R] immediately after will return
the same value.
In addition, the value of \f[B]seed\f[R] will change after any call to
-the \f[B]\[cq]\f[R] command or the \f[B]\[dq]\f[R] command that does not
+the \f[B]\[aq]\f[R] command or the \f[B]\[dq]\f[R] command that does not
get receive a value of \f[B]0\f[R] or \f[B]1\f[R].
-The maximum integer returned by the \f[B]\[cq]\f[R] command can be
+The maximum integer returned by the \f[B]\[aq]\f[R] command can be
queried with the \f[B]W\f[R] command.
.PP
\f[B]Note\f[R]: The values returned by the pseudo-random number
-generator with the \f[B]\[cq]\f[R] and \f[B]\[dq]\f[R] commands are
+generator with the \f[B]\[aq]\f[R] and \f[B]\[dq]\f[R] commands are
guaranteed to \f[B]NOT\f[R] be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator.
However, they \f[I]are\f[R] guaranteed to be reproducible with identical
@@ -306,272 +327,340 @@ To deactivate them, just assign a different value to \f[B]obase\f[R].
.PP
Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
-.TP
+.PP
\f[B]p\f[R]
-Prints the value on top of the stack, whether number or string, and
-prints a newline after.
-.RS
.PP
+: Prints the value on top of the stack, whether number or string, and
+prints a newline after.
+.IP
+.nf
+\f[C]
This does not alter the stack.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]n\f[R]
-Prints the value on top of the stack, whether number or string, and pops
-it off of the stack.
-.TP
+.PP
+: Prints the value on top of the stack, whether number or string, and
+pops it off of the stack.
+.PP
\f[B]P\f[R]
-Pops a value off the stack.
-.RS
.PP
+: Pops a value off the stack.
+.IP
+.nf
+\f[C]
If the value is a number, it is truncated and the absolute value of the
-result is printed as though \f[B]obase\f[R] is \f[B]UCHAR_MAX+1\f[R] and
-each digit is interpreted as an ASCII character, making it a byte
-stream.
-.PP
+result is printed as though **obase** is **UCHAR_MAX+1** and each digit is
+interpreted as an ASCII character, making it a byte stream.
+
If the value is a string, it is printed without a trailing newline.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]f\f[R]
-Prints the entire contents of the stack, in order from newest to oldest,
-without altering anything.
-.RS
.PP
+: Prints the entire contents of the stack, in order from newest to
+oldest, without altering anything.
+.IP
+.nf
+\f[C]
Users should use this command when they get lost.
-.RE
+\f[R]
+.fi
.SS Arithmetic
.PP
These are the commands used for arithmetic.
-.TP
+.PP
\f[B]+\f[R]
-The top two values are popped off the stack, added, and the result is
+.PP
+: The top two values are popped off the stack, added, and the result is
pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]-\f[R]
-The top two values are popped off the stack, subtracted, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, subtracted, and the
+result is pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]*\f[R]
-The top two values are popped off the stack, multiplied, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, multiplied, and the
+result is pushed onto the stack.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The top two values are popped off the stack, divided, and the result is
-pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
-The first value popped off of the stack must be non-zero.
-.RE
-.TP
-\f[B]%\f[R]
-The top two values are popped off the stack, remaindered, and the result
+: The top two values are popped off the stack, divided, and the result
is pushed onto the stack.
-.RS
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be non-zero.
+\f[R]
+.fi
.PP
-Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
-\f[B]scale\f[R], and 2) Using the result of step 1 to calculate
-\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
-\f[B]max(scale+scale(b),scale(a))\f[R].
+\f[B]%\f[R]
.PP
+: The top two values are popped off the stack, remaindered, and the
+result is pushed onto the stack.
+.IP
+.nf
+\f[C]
+Remaindering is equivalent to 1) Computing **a/b** to current **scale**, and
+2) Using the result of step 1 to calculate **a-(a/b)\[rs]*b** to *scale*
+**max(scale+scale(b),scale(a))**.
+
The first value popped off of the stack must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]\[ti]\f[R]
-The top two values are popped off the stack, divided and remaindered,
+.PP
+: The top two values are popped off the stack, divided and remaindered,
and the results (divided first, remainder second) are pushed onto the
stack.
This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
\f[B]y\f[R] are only evaluated once.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be non-zero.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The top two values are popped off the stack, the second is raised to the
-power of the first, and the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top two values are popped off the stack, the second is raised to
+the power of the first, and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be an integer, and if that
value is negative, the second value popped off of the stack must be
non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]v\f[R]
-The top value is popped off the stack, its square root is computed, and
-the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top value is popped off the stack, its square root is computed,
+and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The value popped off of the stack must be non-negative.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]_\f[R]
-If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
-or other commands), then that number is input as a negative number.
-.RS
-.PP
-Otherwise, the top value on the stack is popped and copied, and the copy
-is negated and pushed onto the stack.
-This behavior without a number is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+.PP
+: If this command \f[I]immediately\f[R] precedes a number (i.e., no
+spaces or other commands), then that number is input as a negative
+number.
+.IP
+.nf
+\f[C]
+Otherwise, the top value on the stack is popped and copied, and the copy is
+negated and pushed onto the stack. This behavior without a number is a
+**non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]b\f[R]
-The top value is popped off the stack, and if it is zero, it is pushed
+.PP
+: The top value is popped off the stack, and if it is zero, it is pushed
back onto the stack.
Otherwise, its absolute value is pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]|\f[R]
-The top three values are popped off the stack, a modular exponentiation
-is computed, and the result is pushed onto the stack.
-.RS
.PP
+: The top three values are popped off the stack, a modular
+exponentiation is computed, and the result is pushed onto the stack.
+.IP
+.nf
+\f[C]
The first value popped is used as the reduction modulus and must be an
-integer and non-zero.
-The second value popped is used as the exponent and must be an integer
-and non-negative.
-The third value popped is the base and must be an integer.
+integer and non-zero. The second value popped is used as the exponent and
+must be an integer and non-negative. The third value popped is the base and
+must be an integer.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]$\f[R]
-The top value is popped off the stack and copied, and the copy is
+.PP
+: The top value is popped off the stack and copied, and the copy is
truncated and pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[at]\f[R]
-The top two values are popped off the stack, and the precision of the
+.PP
+: The top two values are popped off the stack, and the precision of the
second is set to the value of the first, whether by truncation or
extension.
-.RS
-.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]H\f[R]
-The top two values are popped off the stack, and the second is shifted
-left (radix shifted right) to the value of the first.
-.RS
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+: The top two values are popped off the stack, and the second is shifted
+left (radix shifted right) to the value of the first.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]h\f[R]
-The top two values are popped off the stack, and the second is shifted
-right (radix shifted left) to the value of the first.
-.RS
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+: The top two values are popped off the stack, and the second is shifted
+right (radix shifted left) to the value of the first.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]G\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]N\f[R]
-The top value is popped off of the stack, and if it a \f[B]0\f[R], a
+.PP
+: The top value is popped off of the stack, and if it a \f[B]0\f[R], a
\f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B](\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]{\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than or equal to the second,
-or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than or equal to the
+second, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B])\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]}\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than or equal to the
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than or equal to the
second, or \f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]M\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If they are both non-zero, a \f[B]1\f[R] is pushed onto the stack.
If either of them is zero, or both of them are, then a \f[B]0\f[R] is
pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is like the **&&** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]m\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If at least one of them is non-zero, a \f[B]1\f[R] is pushed onto the
stack.
If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is like the **||** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Pseudo-Random Number Generator
.PP
dc(1) has a built-in pseudo-random number generator.
@@ -581,20 +670,24 @@ controls the pseudo-random number generator.)
.PP
The pseudo-random number generator is guaranteed to \f[B]NOT\f[R] be
cryptographically secure.
-.TP
-\f[B]\[cq]\f[R]
-Generates an integer between 0 and \f[B]DC_RAND_MAX\f[R], inclusive (see
-the \f[B]LIMITS\f[R] section).
-.RS
.PP
+\f[B]\[aq]\f[R]
+.PP
+: Generates an integer between 0 and \f[B]DC_RAND_MAX\f[R], inclusive
+(see the \f[B]LIMITS\f[R] section).
+.IP
+.nf
+\f[C]
The generated integer is made as unbiased as possible, subject to the
limitations of the pseudo-random number generator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[dq]\f[R]
-Pops a value off of the stack, which is used as an \f[B]exclusive\f[R]
+.PP
+: Pops a value off of the stack, which is used as an \f[B]exclusive\f[R]
upper bound on the integer that will be generated.
If the bound is negative or is a non-integer, an error is raised, and
dc(1) resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R]
@@ -609,48 +702,58 @@ Using this command will change the value of \f[B]seed\f[R], unless the
operand is \f[B]0\f[R] or \f[B]1\f[R].
In that case, \f[B]0\f[R] is pushed onto the stack, and \f[B]seed\f[R]
is \f[I]not\f[R] changed.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The generated integer is made as unbiased as possible, subject to the
limitations of the pseudo-random number generator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Stack Control
.PP
These commands control the stack.
-.TP
+.PP
\f[B]c\f[R]
-Removes all items from (\[lq]clears\[rq]) the stack.
-.TP
+.PP
+: Removes all items from (\[dq]clears\[dq]) the stack.
+.PP
\f[B]d\f[R]
-Copies the item on top of the stack (\[lq]duplicates\[rq]) and pushes
+.PP
+: Copies the item on top of the stack (\[dq]duplicates\[dq]) and pushes
the copy onto the stack.
-.TP
+.PP
\f[B]r\f[R]
-Swaps (\[lq]reverses\[rq]) the two top items on the stack.
-.TP
+.PP
+: Swaps (\[dq]reverses\[dq]) the two top items on the stack.
+.PP
\f[B]R\f[R]
-Pops (\[lq]removes\[rq]) the top value from the stack.
+.PP
+: Pops (\[dq]removes\[dq]) the top value from the stack.
.SS Register Control
.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
-.TP
+.PP
\f[B]s\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack and stores it into register
+.PP
+: Pops the value off the top of the stack and stores it into register
\f[I]r\f[R].
-.TP
+.PP
\f[B]l\f[R]\f[I]r\f[R]
-Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
+.PP
+: Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
This does not alter the contents of \f[I]r\f[R].
-.TP
+.PP
\f[B]S\f[R]\f[I]r\f[R]
-Pops the value off the top of the (main) stack and pushes it onto the
+.PP
+: Pops the value off the top of the (main) stack and pushes it onto the
stack of register \f[I]r\f[R].
The previous value of the register becomes inaccessible.
-.TP
+.PP
\f[B]L\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack for register \f[I]r\f[R] and
+.PP
+: Pops the value off the top of the stack for register \f[I]r\f[R] and
push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
@@ -659,113 +762,137 @@ accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
\f[B]scale\f[R], and \f[B]seed\f[R].
Also see the \f[B]SYNTAX\f[R] section.
-.TP
+.PP
\f[B]i\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
inclusive.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]o\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]obase\f[R], which must be between \f[B]0\f[R] and
\f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section and
the \f[B]NUMBERS\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]k\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]scale\f[R], which must be non-negative.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]j\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]seed\f[R].
The meaning of \f[B]seed\f[R] is dependent on the current pseudo-random
number generator but is guaranteed to not change except for new major
versions.
-.RS
+.IP
+.nf
+\f[C]
+The *scale* and sign of the value may be significant.
+
+If a previously used **seed** value is used again, the pseudo-random number
+generator is guaranteed to produce the same sequence of pseudo-random
+numbers as it did when the **seed** value was previously used.
+
+The exact value assigned to **seed** is not guaranteed to be returned if the
+**J** command is used. However, if **seed** *does* return a different value,
+both values, when assigned to **seed**, are guaranteed to produce the same
+sequence of pseudo-random numbers. This means that certain values assigned
+to **seed** will not produce unique sequences of pseudo-random numbers.
+
+There is no limit to the length (number of significant decimal digits) or
+*scale* of the value that can be assigned to **seed**.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The \f[I]scale\f[R] and sign of the value may be significant.
+\f[B]I\f[R]
.PP
-If a previously used \f[B]seed\f[R] value is used again, the
-pseudo-random number generator is guaranteed to produce the same
-sequence of pseudo-random numbers as it did when the \f[B]seed\f[R]
-value was previously used.
+: Pushes the current value of \f[B]ibase\f[R] onto the main stack.
.PP
-The exact value assigned to \f[B]seed\f[R] is not guaranteed to be
-returned if the \f[B]J\f[R] command is used.
-However, if \f[B]seed\f[R] \f[I]does\f[R] return a different value, both
-values, when assigned to \f[B]seed\f[R], are guaranteed to produce the
-same sequence of pseudo-random numbers.
-This means that certain values assigned to \f[B]seed\f[R] will not
-produce unique sequences of pseudo-random numbers.
+\f[B]O\f[R]
.PP
-There is no limit to the length (number of significant decimal digits)
-or \f[I]scale\f[R] of the value that can be assigned to \f[B]seed\f[R].
+: Pushes the current value of \f[B]obase\f[R] onto the main stack.
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]I\f[R]
-Pushes the current value of \f[B]ibase\f[R] onto the main stack.
-.TP
-\f[B]O\f[R]
-Pushes the current value of \f[B]obase\f[R] onto the main stack.
-.TP
\f[B]K\f[R]
-Pushes the current value of \f[B]scale\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]scale\f[R] onto the main stack.
+.PP
\f[B]J\f[R]
-Pushes the current value of \f[B]seed\f[R] onto the main stack.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Pushes the current value of \f[B]seed\f[R] onto the main stack.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]T\f[R]
-Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]U\f[R]
-Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]V\f[R]
-Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]W\f[R]
-Pushes the maximum (inclusive) integer that can be generated with the
-\f[B]\[cq]\f[R] pseudo-random number generator command.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+: Pushes the maximum (inclusive) integer that can be generated with the
+\f[B]\[aq]\f[R] pseudo-random number generator command.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Strings
.PP
The following commands control strings.
@@ -782,233 +909,292 @@ Strings can also be executed as macros.
For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
printed with a newline after and then popped from the stack.
-.TP
-\f[B][\f[R]_characters_\f[B]]\f[R]
-Makes a string containing \f[I]characters\f[R] and pushes it onto the
-stack.
-.RS
.PP
-If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
-they must be balanced.
-Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
-character.
+\f[B][\f[R]\f[I]characters\f[R]\f[B]]\f[R]
.PP
+: Makes a string containing \f[I]characters\f[R] and pushes it onto the
+stack.
+.IP
+.nf
+\f[C]
+If there are brackets (**\[rs][** and **\[rs]]**) in the string, then they must be
+balanced. Unbalanced brackets can be escaped using a backslash (**\[rs]\[rs]**)
+character.
+
If there is a backslash character in the string, the character after it
-(even another backslash) is put into the string verbatim, but the
-(first) backslash is not.
-.RE
-.TP
-\f[B]a\f[R]
-The value on top of the stack is popped.
-.RS
+(even another backslash) is put into the string verbatim, but the (first)
+backslash is not.
+\f[R]
+.fi
.PP
-If it is a number, it is truncated and its absolute value is taken.
-The result mod \f[B]UCHAR_MAX+1\f[R] is calculated.
-If that result is \f[B]0\f[R], push an empty string; otherwise, push a
-one-character string where the character is the result of the mod
-interpreted as an ASCII character.
+\f[B]a\f[R]
.PP
-If it is a string, then a new string is made.
-If the original string is empty, the new string is empty.
-If it is not, then the first character of the original string is used to
-create the new string as a one-character string.
-The new string is then pushed onto the stack.
+: The value on top of the stack is popped.
+.IP
+.nf
+\f[C]
+If it is a number, it is truncated and its absolute value is taken. The
+result mod **UCHAR_MAX+1** is calculated. If that result is **0**, push an
+empty string; otherwise, push a one-character string where the character is
+the result of the mod interpreted as an ASCII character.
+
+If it is a string, then a new string is made. If the original string is
+empty, the new string is empty. If it is not, then the first character of
+the original string is used to create the new string as a one-character
+string. The new string is then pushed onto the stack.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]x\f[R]
-Pops a value off of the top of the stack.
-.RS
.PP
+: Pops a value off of the top of the stack.
+.IP
+.nf
+\f[C]
If it is a number, it is pushed back onto the stack.
-.PP
+
If it is a string, it is executed as a macro.
-.PP
+
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is greater than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
-.PP
-For example, \f[B]0 1>a\f[R] will execute the contents of register
-\f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
+.IP
+.nf
+\f[C]
+For example, **0 1>a** will execute the contents of register **a**, and
+**1 0>a** will not.
+
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not greater than the second (less than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is less than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not less than the second (greater than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is equal to the second, then the contents of register
\f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not equal to the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]?\f[R]
-Reads a line from the \f[B]stdin\f[R] and executes it.
+.PP
+: Reads a line from the \f[B]stdin\f[R] and executes it.
This is to allow macros to request input from users.
-.TP
+.PP
\f[B]q\f[R]
-During execution of a macro, this exits the execution of that macro and
-the execution of the macro that executed it.
+.PP
+: During execution of a macro, this exits the execution of that macro
+and the execution of the macro that executed it.
If there are no macros, or only one macro executing, dc(1) exits.
-.TP
+.PP
\f[B]Q\f[R]
-Pops a value from the stack which must be non-negative and is used the
+.PP
+: Pops a value from the stack which must be non-negative and is used the
number of macro executions to pop off of the execution stack.
If the number of levels to pop is greater than the number of executing
macros, dc(1) exits.
.SS Status
.PP
These commands query status of the stack or its top value.
-.TP
-\f[B]Z\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, calculates the number of significant decimal digits
-it has and pushes the result.
+\f[B]Z\f[R]
.PP
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, calculates the number of significant decimal digits it
+has and pushes the result.
+
If it is a string, pushes the number of characters the string has.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]X\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, pushes the \f[I]scale\f[R] of the value onto the
-stack.
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, pushes the *scale* of the value onto the stack.
+
+If it is a string, pushes **0**.
+\f[R]
+.fi
.PP
-If it is a string, pushes \f[B]0\f[R].
-.RE
-.TP
\f[B]z\f[R]
-Pushes the current stack depth (before execution of this command).
+.PP
+: Pushes the current stack depth (before execution of this command).
.SS Arrays
.PP
These commands manipulate arrays.
-.TP
+.PP
\f[B]:\f[R]\f[I]r\f[R]
-Pops the top two values off of the stack.
+.PP
+: Pops the top two values off of the stack.
The second value will be stored in the array \f[I]r\f[R] (see the
\f[B]REGISTERS\f[R] section), indexed by the first value.
-.TP
+.PP
\f[B];\f[R]\f[I]r\f[R]
-Pops the value on top of the stack and uses it as an index into the
+.PP
+: Pops the value on top of the stack and uses it as an index into the
array \f[I]r\f[R].
The selected value is then pushed onto the stack.
.SH REGISTERS
@@ -1023,8 +1209,8 @@ their stack.
.PP
In non-extended register mode, a register name is just the single
character that follows any command that needs a register name.
-The only exception is a newline (\f[B]`\[rs]n'\f[R]); it is a parse
-error for a newline to be used as a register name.
+The only exception is a newline (\f[B]\[aq]\[rs]n\[aq]\f[R]); it is a
+parse error for a newline to be used as a register name.
.SS Extended Register Mode
.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
@@ -1035,7 +1221,7 @@ If extended register mode is enabled (\f[B]-x\f[R] or
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
-(\f[B]`\[rs]n'\f[R]).
+(\f[B]\[aq]\[rs]n\[aq]\f[R]).
.PP
In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
@@ -1080,64 +1266,77 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on dc(1):
-.TP
+.PP
\f[B]DC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
dc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]DC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]DC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]DC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]DC_BASE_POW\f[R].
-.TP
+.PP
\f[B]DC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_RAND_MAX\f[R]
-The maximum integer (inclusive) returned by the \f[B]\[cq]\f[R] command,
-if dc(1).
+.PP
+: The maximum integer (inclusive) returned by the \f[B]\[aq]\f[R]
+command, if dc(1).
Set at \f[B]2\[ha]DC_LONG_BIT-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]DC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
These limits are meant to be effectively non-existent; the limits are so
@@ -1147,104 +1346,117 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
dc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]DC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to dc(1).
+.PP
+: This is another way to give command-line arguments to dc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time dc(1) runs.
Another use would be to use the \f[B]-e\f[R] option to set
\f[B]scale\f[R] to a value other than \f[B]0\f[R].
-.RS
-.PP
-The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **DC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some dc file.dc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]dc\[rs]\[dq] file.dc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]dc\[aq] file.dc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]DC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
including the backslash newline combo.
The default line length is \f[B]70\f[R].
-.TP
+.PP
\f[B]DC_EXPR_EXIT\f[R]
-If this variable exists (no matter the contents), dc(1) will exit
+.PP
+: If this variable exists (no matter the contents), dc(1) will exit
immediately after executing expressions and files given by the
\f[B]-e\f[R] and/or \f[B]-f\f[R] command-line options (and any
equivalents).
.SH EXIT STATUS
.PP
dc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, using a negative number as a bound for the
-pseudo-random number generator, attempting to convert a negative number
-to a hardware integer, overflow when converting a number to a hardware
-integer, and attempting to use a non-integer where an integer is
-required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
-(\f[B]H\f[R]), and right shift (\f[B]h\f[R]) operators.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, using a negative number as a bound for the pseudo-random number
+generator, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**), places (**\[rs]\[at]**), left shift (**H**), and right shift (**h**)
+operators.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, and using a
-token where it is invalid.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, and using a token where it is
+invalid.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
-.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, and attempting an operation when the
-stack has too few elements.
-.RE
-.TP
+.PP
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, and attempting an operation when
+the stack has too few elements.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (dc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (dc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
@@ -1272,7 +1484,7 @@ In interactive mode, dc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, dc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, dc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is different from interactive mode because interactive mode is
required in the bc(1)
@@ -1287,7 +1499,7 @@ If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If dc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If dc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/dc/HP.1.md b/contrib/bc/manuals/dc/HP.1.md
index 93938790f460..dcc59f1896d5 100644
--- a/contrib/bc/manuals/dc/HP.1.md
+++ b/contrib/bc/manuals/dc/HP.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -84,6 +84,12 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: This option is a no-op.
+
+ This is a **non-portable extension**.
+
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@@ -553,25 +559,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
-**s***r*
+**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
-**l***r*
+**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
-**S***r*
+**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
-**L***r*
+**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
- now accessible via the **l***r* command.
+ now accessible via the **l**_r_ command.
## Parameters
@@ -720,7 +726,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-**\>***r*
+**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@@ -732,7 +738,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**>***r***e***s*
+**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -741,7 +747,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\>***r*
+**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@@ -750,7 +756,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\>***r***e***s*
+**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -759,7 +765,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**\<***r*
+**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@@ -768,7 +774,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**\<***r***e***s*
+**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -777,7 +783,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\<***r*
+**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@@ -786,7 +792,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\<***r***e***s*
+**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -795,7 +801,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**=***r*
+**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@@ -804,7 +810,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**=***r***e***s*
+**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -813,7 +819,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!=***r*
+**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@@ -822,7 +828,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!=***r***e***s*
+**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -878,12 +884,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
-**:***r*
+**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
-**;***r*
+**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.
diff --git a/contrib/bc/manuals/dc/N.1 b/contrib/bc/manuals/dc/N.1
index 6f4f01c48354..41cc7449c3a6 100644
--- a/contrib/bc/manuals/dc/N.1
+++ b/contrib/bc/manuals/dc/N.1
@@ -25,18 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+\f[B]dc\f[R] [\f[B]-hiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
-[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-read-prompt\f[R]] [\f[B]--extended-register\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -70,84 +70,115 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.SH OPTIONS
.PP
The following are the options that dc(1) accepts.
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.TP
+.PP
+: Print the version information (copyright header) and exit.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-Disables the prompt in TTY mode.
+.PP
+: Disables the prompt in TTY mode.
(The prompt is only enabled in TTY mode.
-See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
do not want a prompt or are not used to having them in dc(1).
Most of those users would want to put this option in
\f[B]DC_ENV_ARGS\f[R].
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: Disables the read prompt in TTY mode.
+(The read prompt is only enabled in TTY mode.
+See the \f[B]TTY MODE\f[R] section.) This is mostly for those users that
+do not want a read prompt or are not used to having them in dc(1).
+Most of those users would want to put this option in
+\f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
+This option is also useful in hash bang lines of dc(1) scripts that
+prompt for user input.
+.IP
+.nf
+\f[C]
+This option does not disable the regular prompt because the read prompt is
+only used when the **?** command is used.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-x\f[R] \f[B]--extended-register\f[R]
-Enables extended register mode.
+.PP
+: Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]DC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -190,7 +221,7 @@ Input is processed immediately when entered.
.PP
\f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to interpret constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
@@ -200,7 +231,7 @@ programs with the \f[B]T\f[R] command.
.PP
\f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
@@ -236,13 +267,13 @@ Likewise, when a value is assigned to \f[B]seed\f[R], it is not
guaranteed that querying \f[B]seed\f[R] immediately after will return
the same value.
In addition, the value of \f[B]seed\f[R] will change after any call to
-the \f[B]\[cq]\f[R] command or the \f[B]\[dq]\f[R] command that does not
+the \f[B]\[aq]\f[R] command or the \f[B]\[dq]\f[R] command that does not
get receive a value of \f[B]0\f[R] or \f[B]1\f[R].
-The maximum integer returned by the \f[B]\[cq]\f[R] command can be
+The maximum integer returned by the \f[B]\[aq]\f[R] command can be
queried with the \f[B]W\f[R] command.
.PP
\f[B]Note\f[R]: The values returned by the pseudo-random number
-generator with the \f[B]\[cq]\f[R] and \f[B]\[dq]\f[R] commands are
+generator with the \f[B]\[aq]\f[R] and \f[B]\[dq]\f[R] commands are
guaranteed to \f[B]NOT\f[R] be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator.
However, they \f[I]are\f[R] guaranteed to be reproducible with identical
@@ -311,272 +342,340 @@ To deactivate them, just assign a different value to \f[B]obase\f[R].
.PP
Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
-.TP
+.PP
\f[B]p\f[R]
-Prints the value on top of the stack, whether number or string, and
-prints a newline after.
-.RS
.PP
+: Prints the value on top of the stack, whether number or string, and
+prints a newline after.
+.IP
+.nf
+\f[C]
This does not alter the stack.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]n\f[R]
-Prints the value on top of the stack, whether number or string, and pops
-it off of the stack.
-.TP
+.PP
+: Prints the value on top of the stack, whether number or string, and
+pops it off of the stack.
+.PP
\f[B]P\f[R]
-Pops a value off the stack.
-.RS
.PP
+: Pops a value off the stack.
+.IP
+.nf
+\f[C]
If the value is a number, it is truncated and the absolute value of the
-result is printed as though \f[B]obase\f[R] is \f[B]UCHAR_MAX+1\f[R] and
-each digit is interpreted as an ASCII character, making it a byte
-stream.
-.PP
+result is printed as though **obase** is **UCHAR_MAX+1** and each digit is
+interpreted as an ASCII character, making it a byte stream.
+
If the value is a string, it is printed without a trailing newline.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]f\f[R]
-Prints the entire contents of the stack, in order from newest to oldest,
-without altering anything.
-.RS
.PP
+: Prints the entire contents of the stack, in order from newest to
+oldest, without altering anything.
+.IP
+.nf
+\f[C]
Users should use this command when they get lost.
-.RE
+\f[R]
+.fi
.SS Arithmetic
.PP
These are the commands used for arithmetic.
-.TP
+.PP
\f[B]+\f[R]
-The top two values are popped off the stack, added, and the result is
+.PP
+: The top two values are popped off the stack, added, and the result is
pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]-\f[R]
-The top two values are popped off the stack, subtracted, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, subtracted, and the
+result is pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]*\f[R]
-The top two values are popped off the stack, multiplied, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, multiplied, and the
+result is pushed onto the stack.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The top two values are popped off the stack, divided, and the result is
-pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
-The first value popped off of the stack must be non-zero.
-.RE
-.TP
-\f[B]%\f[R]
-The top two values are popped off the stack, remaindered, and the result
+: The top two values are popped off the stack, divided, and the result
is pushed onto the stack.
-.RS
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be non-zero.
+\f[R]
+.fi
.PP
-Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
-\f[B]scale\f[R], and 2) Using the result of step 1 to calculate
-\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
-\f[B]max(scale+scale(b),scale(a))\f[R].
+\f[B]%\f[R]
.PP
+: The top two values are popped off the stack, remaindered, and the
+result is pushed onto the stack.
+.IP
+.nf
+\f[C]
+Remaindering is equivalent to 1) Computing **a/b** to current **scale**, and
+2) Using the result of step 1 to calculate **a-(a/b)\[rs]*b** to *scale*
+**max(scale+scale(b),scale(a))**.
+
The first value popped off of the stack must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]\[ti]\f[R]
-The top two values are popped off the stack, divided and remaindered,
+.PP
+: The top two values are popped off the stack, divided and remaindered,
and the results (divided first, remainder second) are pushed onto the
stack.
This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
\f[B]y\f[R] are only evaluated once.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be non-zero.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The top two values are popped off the stack, the second is raised to the
-power of the first, and the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top two values are popped off the stack, the second is raised to
+the power of the first, and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be an integer, and if that
value is negative, the second value popped off of the stack must be
non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]v\f[R]
-The top value is popped off the stack, its square root is computed, and
-the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top value is popped off the stack, its square root is computed,
+and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The value popped off of the stack must be non-negative.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]_\f[R]
-If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
-or other commands), then that number is input as a negative number.
-.RS
-.PP
-Otherwise, the top value on the stack is popped and copied, and the copy
-is negated and pushed onto the stack.
-This behavior without a number is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+.PP
+: If this command \f[I]immediately\f[R] precedes a number (i.e., no
+spaces or other commands), then that number is input as a negative
+number.
+.IP
+.nf
+\f[C]
+Otherwise, the top value on the stack is popped and copied, and the copy is
+negated and pushed onto the stack. This behavior without a number is a
+**non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]b\f[R]
-The top value is popped off the stack, and if it is zero, it is pushed
+.PP
+: The top value is popped off the stack, and if it is zero, it is pushed
back onto the stack.
Otherwise, its absolute value is pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]|\f[R]
-The top three values are popped off the stack, a modular exponentiation
-is computed, and the result is pushed onto the stack.
-.RS
.PP
+: The top three values are popped off the stack, a modular
+exponentiation is computed, and the result is pushed onto the stack.
+.IP
+.nf
+\f[C]
The first value popped is used as the reduction modulus and must be an
-integer and non-zero.
-The second value popped is used as the exponent and must be an integer
-and non-negative.
-The third value popped is the base and must be an integer.
+integer and non-zero. The second value popped is used as the exponent and
+must be an integer and non-negative. The third value popped is the base and
+must be an integer.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]$\f[R]
-The top value is popped off the stack and copied, and the copy is
+.PP
+: The top value is popped off the stack and copied, and the copy is
truncated and pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[at]\f[R]
-The top two values are popped off the stack, and the precision of the
+.PP
+: The top two values are popped off the stack, and the precision of the
second is set to the value of the first, whether by truncation or
extension.
-.RS
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]H\f[R]
-The top two values are popped off the stack, and the second is shifted
-left (radix shifted right) to the value of the first.
-.RS
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+: The top two values are popped off the stack, and the second is shifted
+left (radix shifted right) to the value of the first.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]h\f[R]
-The top two values are popped off the stack, and the second is shifted
-right (radix shifted left) to the value of the first.
-.RS
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+: The top two values are popped off the stack, and the second is shifted
+right (radix shifted left) to the value of the first.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]G\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]N\f[R]
-The top value is popped off of the stack, and if it a \f[B]0\f[R], a
+.PP
+: The top value is popped off of the stack, and if it a \f[B]0\f[R], a
\f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B](\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]{\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than or equal to the second,
-or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than or equal to the
+second, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B])\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]}\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than or equal to the
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than or equal to the
second, or \f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]M\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If they are both non-zero, a \f[B]1\f[R] is pushed onto the stack.
If either of them is zero, or both of them are, then a \f[B]0\f[R] is
pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is like the **&&** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]m\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If at least one of them is non-zero, a \f[B]1\f[R] is pushed onto the
stack.
If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is like the **||** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Pseudo-Random Number Generator
.PP
dc(1) has a built-in pseudo-random number generator.
@@ -586,20 +685,24 @@ controls the pseudo-random number generator.)
.PP
The pseudo-random number generator is guaranteed to \f[B]NOT\f[R] be
cryptographically secure.
-.TP
-\f[B]\[cq]\f[R]
-Generates an integer between 0 and \f[B]DC_RAND_MAX\f[R], inclusive (see
-the \f[B]LIMITS\f[R] section).
-.RS
.PP
+\f[B]\[aq]\f[R]
+.PP
+: Generates an integer between 0 and \f[B]DC_RAND_MAX\f[R], inclusive
+(see the \f[B]LIMITS\f[R] section).
+.IP
+.nf
+\f[C]
The generated integer is made as unbiased as possible, subject to the
limitations of the pseudo-random number generator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[dq]\f[R]
-Pops a value off of the stack, which is used as an \f[B]exclusive\f[R]
+.PP
+: Pops a value off of the stack, which is used as an \f[B]exclusive\f[R]
upper bound on the integer that will be generated.
If the bound is negative or is a non-integer, an error is raised, and
dc(1) resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R]
@@ -614,48 +717,58 @@ Using this command will change the value of \f[B]seed\f[R], unless the
operand is \f[B]0\f[R] or \f[B]1\f[R].
In that case, \f[B]0\f[R] is pushed onto the stack, and \f[B]seed\f[R]
is \f[I]not\f[R] changed.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The generated integer is made as unbiased as possible, subject to the
limitations of the pseudo-random number generator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Stack Control
.PP
These commands control the stack.
-.TP
+.PP
\f[B]c\f[R]
-Removes all items from (\[lq]clears\[rq]) the stack.
-.TP
+.PP
+: Removes all items from (\[dq]clears\[dq]) the stack.
+.PP
\f[B]d\f[R]
-Copies the item on top of the stack (\[lq]duplicates\[rq]) and pushes
+.PP
+: Copies the item on top of the stack (\[dq]duplicates\[dq]) and pushes
the copy onto the stack.
-.TP
+.PP
\f[B]r\f[R]
-Swaps (\[lq]reverses\[rq]) the two top items on the stack.
-.TP
+.PP
+: Swaps (\[dq]reverses\[dq]) the two top items on the stack.
+.PP
\f[B]R\f[R]
-Pops (\[lq]removes\[rq]) the top value from the stack.
+.PP
+: Pops (\[dq]removes\[dq]) the top value from the stack.
.SS Register Control
.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
-.TP
+.PP
\f[B]s\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack and stores it into register
+.PP
+: Pops the value off the top of the stack and stores it into register
\f[I]r\f[R].
-.TP
+.PP
\f[B]l\f[R]\f[I]r\f[R]
-Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
+.PP
+: Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
This does not alter the contents of \f[I]r\f[R].
-.TP
+.PP
\f[B]S\f[R]\f[I]r\f[R]
-Pops the value off the top of the (main) stack and pushes it onto the
+.PP
+: Pops the value off the top of the (main) stack and pushes it onto the
stack of register \f[I]r\f[R].
The previous value of the register becomes inaccessible.
-.TP
+.PP
\f[B]L\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack for register \f[I]r\f[R] and
+.PP
+: Pops the value off the top of the stack for register \f[I]r\f[R] and
push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
@@ -664,113 +777,137 @@ accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
\f[B]scale\f[R], and \f[B]seed\f[R].
Also see the \f[B]SYNTAX\f[R] section.
-.TP
+.PP
\f[B]i\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
inclusive.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]o\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]obase\f[R], which must be between \f[B]0\f[R] and
\f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section and
the \f[B]NUMBERS\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]k\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]scale\f[R], which must be non-negative.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]j\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]seed\f[R].
The meaning of \f[B]seed\f[R] is dependent on the current pseudo-random
number generator but is guaranteed to not change except for new major
versions.
-.RS
+.IP
+.nf
+\f[C]
+The *scale* and sign of the value may be significant.
+
+If a previously used **seed** value is used again, the pseudo-random number
+generator is guaranteed to produce the same sequence of pseudo-random
+numbers as it did when the **seed** value was previously used.
+
+The exact value assigned to **seed** is not guaranteed to be returned if the
+**J** command is used. However, if **seed** *does* return a different value,
+both values, when assigned to **seed**, are guaranteed to produce the same
+sequence of pseudo-random numbers. This means that certain values assigned
+to **seed** will not produce unique sequences of pseudo-random numbers.
+
+There is no limit to the length (number of significant decimal digits) or
+*scale* of the value that can be assigned to **seed**.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The \f[I]scale\f[R] and sign of the value may be significant.
+\f[B]I\f[R]
.PP
-If a previously used \f[B]seed\f[R] value is used again, the
-pseudo-random number generator is guaranteed to produce the same
-sequence of pseudo-random numbers as it did when the \f[B]seed\f[R]
-value was previously used.
+: Pushes the current value of \f[B]ibase\f[R] onto the main stack.
.PP
-The exact value assigned to \f[B]seed\f[R] is not guaranteed to be
-returned if the \f[B]J\f[R] command is used.
-However, if \f[B]seed\f[R] \f[I]does\f[R] return a different value, both
-values, when assigned to \f[B]seed\f[R], are guaranteed to produce the
-same sequence of pseudo-random numbers.
-This means that certain values assigned to \f[B]seed\f[R] will not
-produce unique sequences of pseudo-random numbers.
+\f[B]O\f[R]
.PP
-There is no limit to the length (number of significant decimal digits)
-or \f[I]scale\f[R] of the value that can be assigned to \f[B]seed\f[R].
+: Pushes the current value of \f[B]obase\f[R] onto the main stack.
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]I\f[R]
-Pushes the current value of \f[B]ibase\f[R] onto the main stack.
-.TP
-\f[B]O\f[R]
-Pushes the current value of \f[B]obase\f[R] onto the main stack.
-.TP
\f[B]K\f[R]
-Pushes the current value of \f[B]scale\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]scale\f[R] onto the main stack.
+.PP
\f[B]J\f[R]
-Pushes the current value of \f[B]seed\f[R] onto the main stack.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Pushes the current value of \f[B]seed\f[R] onto the main stack.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]T\f[R]
-Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]U\f[R]
-Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]V\f[R]
-Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]W\f[R]
-Pushes the maximum (inclusive) integer that can be generated with the
-\f[B]\[cq]\f[R] pseudo-random number generator command.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+: Pushes the maximum (inclusive) integer that can be generated with the
+\f[B]\[aq]\f[R] pseudo-random number generator command.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Strings
.PP
The following commands control strings.
@@ -787,233 +924,292 @@ Strings can also be executed as macros.
For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
printed with a newline after and then popped from the stack.
-.TP
-\f[B][\f[R]_characters_\f[B]]\f[R]
-Makes a string containing \f[I]characters\f[R] and pushes it onto the
-stack.
-.RS
.PP
-If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
-they must be balanced.
-Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
-character.
+\f[B][\f[R]\f[I]characters\f[R]\f[B]]\f[R]
.PP
+: Makes a string containing \f[I]characters\f[R] and pushes it onto the
+stack.
+.IP
+.nf
+\f[C]
+If there are brackets (**\[rs][** and **\[rs]]**) in the string, then they must be
+balanced. Unbalanced brackets can be escaped using a backslash (**\[rs]\[rs]**)
+character.
+
If there is a backslash character in the string, the character after it
-(even another backslash) is put into the string verbatim, but the
-(first) backslash is not.
-.RE
-.TP
-\f[B]a\f[R]
-The value on top of the stack is popped.
-.RS
+(even another backslash) is put into the string verbatim, but the (first)
+backslash is not.
+\f[R]
+.fi
.PP
-If it is a number, it is truncated and its absolute value is taken.
-The result mod \f[B]UCHAR_MAX+1\f[R] is calculated.
-If that result is \f[B]0\f[R], push an empty string; otherwise, push a
-one-character string where the character is the result of the mod
-interpreted as an ASCII character.
+\f[B]a\f[R]
.PP
-If it is a string, then a new string is made.
-If the original string is empty, the new string is empty.
-If it is not, then the first character of the original string is used to
-create the new string as a one-character string.
-The new string is then pushed onto the stack.
+: The value on top of the stack is popped.
+.IP
+.nf
+\f[C]
+If it is a number, it is truncated and its absolute value is taken. The
+result mod **UCHAR_MAX+1** is calculated. If that result is **0**, push an
+empty string; otherwise, push a one-character string where the character is
+the result of the mod interpreted as an ASCII character.
+
+If it is a string, then a new string is made. If the original string is
+empty, the new string is empty. If it is not, then the first character of
+the original string is used to create the new string as a one-character
+string. The new string is then pushed onto the stack.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]x\f[R]
-Pops a value off of the top of the stack.
-.RS
.PP
+: Pops a value off of the top of the stack.
+.IP
+.nf
+\f[C]
If it is a number, it is pushed back onto the stack.
-.PP
+
If it is a string, it is executed as a macro.
-.PP
+
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is greater than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
-.PP
-For example, \f[B]0 1>a\f[R] will execute the contents of register
-\f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
+.IP
+.nf
+\f[C]
+For example, **0 1>a** will execute the contents of register **a**, and
+**1 0>a** will not.
+
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not greater than the second (less than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is less than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not less than the second (greater than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is equal to the second, then the contents of register
\f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not equal to the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]?\f[R]
-Reads a line from the \f[B]stdin\f[R] and executes it.
+.PP
+: Reads a line from the \f[B]stdin\f[R] and executes it.
This is to allow macros to request input from users.
-.TP
+.PP
\f[B]q\f[R]
-During execution of a macro, this exits the execution of that macro and
-the execution of the macro that executed it.
+.PP
+: During execution of a macro, this exits the execution of that macro
+and the execution of the macro that executed it.
If there are no macros, or only one macro executing, dc(1) exits.
-.TP
+.PP
\f[B]Q\f[R]
-Pops a value from the stack which must be non-negative and is used the
+.PP
+: Pops a value from the stack which must be non-negative and is used the
number of macro executions to pop off of the execution stack.
If the number of levels to pop is greater than the number of executing
macros, dc(1) exits.
.SS Status
.PP
These commands query status of the stack or its top value.
-.TP
-\f[B]Z\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, calculates the number of significant decimal digits
-it has and pushes the result.
+\f[B]Z\f[R]
.PP
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, calculates the number of significant decimal digits it
+has and pushes the result.
+
If it is a string, pushes the number of characters the string has.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]X\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, pushes the \f[I]scale\f[R] of the value onto the
-stack.
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, pushes the *scale* of the value onto the stack.
+
+If it is a string, pushes **0**.
+\f[R]
+.fi
.PP
-If it is a string, pushes \f[B]0\f[R].
-.RE
-.TP
\f[B]z\f[R]
-Pushes the current stack depth (before execution of this command).
+.PP
+: Pushes the current stack depth (before execution of this command).
.SS Arrays
.PP
These commands manipulate arrays.
-.TP
+.PP
\f[B]:\f[R]\f[I]r\f[R]
-Pops the top two values off of the stack.
+.PP
+: Pops the top two values off of the stack.
The second value will be stored in the array \f[I]r\f[R] (see the
\f[B]REGISTERS\f[R] section), indexed by the first value.
-.TP
+.PP
\f[B];\f[R]\f[I]r\f[R]
-Pops the value on top of the stack and uses it as an index into the
+.PP
+: Pops the value on top of the stack and uses it as an index into the
array \f[I]r\f[R].
The selected value is then pushed onto the stack.
.SH REGISTERS
@@ -1028,8 +1224,8 @@ their stack.
.PP
In non-extended register mode, a register name is just the single
character that follows any command that needs a register name.
-The only exception is a newline (\f[B]`\[rs]n'\f[R]); it is a parse
-error for a newline to be used as a register name.
+The only exception is a newline (\f[B]\[aq]\[rs]n\[aq]\f[R]); it is a
+parse error for a newline to be used as a register name.
.SS Extended Register Mode
.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
@@ -1040,7 +1236,7 @@ If extended register mode is enabled (\f[B]-x\f[R] or
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
-(\f[B]`\[rs]n'\f[R]).
+(\f[B]\[aq]\[rs]n\[aq]\f[R]).
.PP
In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
@@ -1085,64 +1281,77 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on dc(1):
-.TP
+.PP
\f[B]DC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
dc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]DC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]DC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]DC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]DC_BASE_POW\f[R].
-.TP
+.PP
\f[B]DC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_RAND_MAX\f[R]
-The maximum integer (inclusive) returned by the \f[B]\[cq]\f[R] command,
-if dc(1).
+.PP
+: The maximum integer (inclusive) returned by the \f[B]\[aq]\f[R]
+command, if dc(1).
Set at \f[B]2\[ha]DC_LONG_BIT-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]DC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
These limits are meant to be effectively non-existent; the limits are so
@@ -1152,104 +1361,117 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
dc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]DC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to dc(1).
+.PP
+: This is another way to give command-line arguments to dc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time dc(1) runs.
Another use would be to use the \f[B]-e\f[R] option to set
\f[B]scale\f[R] to a value other than \f[B]0\f[R].
-.RS
-.PP
-The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **DC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some dc file.dc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]dc\[rs]\[dq] file.dc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]dc\[aq] file.dc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]DC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
including the backslash newline combo.
The default line length is \f[B]70\f[R].
-.TP
+.PP
\f[B]DC_EXPR_EXIT\f[R]
-If this variable exists (no matter the contents), dc(1) will exit
+.PP
+: If this variable exists (no matter the contents), dc(1) will exit
immediately after executing expressions and files given by the
\f[B]-e\f[R] and/or \f[B]-f\f[R] command-line options (and any
equivalents).
.SH EXIT STATUS
.PP
dc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, using a negative number as a bound for the
-pseudo-random number generator, attempting to convert a negative number
-to a hardware integer, overflow when converting a number to a hardware
-integer, and attempting to use a non-integer where an integer is
-required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
-(\f[B]H\f[R]), and right shift (\f[B]h\f[R]) operators.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, using a negative number as a bound for the pseudo-random number
+generator, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**), places (**\[rs]\[at]**), left shift (**H**), and right shift (**h**)
+operators.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, and using a
-token where it is invalid.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, and using a token where it is
+invalid.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
-.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, and attempting an operation when the
-stack has too few elements.
-.RE
-.TP
+.PP
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, and attempting an operation when
+the stack has too few elements.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (dc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (dc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
@@ -1277,7 +1499,7 @@ In interactive mode, dc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, dc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, dc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is required for history to be enabled (see the \f[B]COMMAND
LINE HISTORY\f[R] section).
@@ -1299,7 +1521,7 @@ If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If dc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If dc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/dc/N.1.md b/contrib/bc/manuals/dc/N.1.md
index 43876cfb24a6..d790c960b5c7 100644
--- a/contrib/bc/manuals/dc/N.1.md
+++ b/contrib/bc/manuals/dc/N.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -81,12 +81,26 @@ The following are the options that dc(1) accepts.
**-P**, **-\-no-prompt**
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
- See the **TTY MODE** section) This is mostly for those users that do not
+ See the **TTY MODE** section.) This is mostly for those users that do not
want a prompt or are not used to having them in dc(1). Most of those users
would want to put this option in **DC_ENV_ARGS**.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: Disables the read prompt in TTY mode. (The read prompt is only enabled in
+ TTY mode. See the **TTY MODE** section.) This is mostly for those users that
+ do not want a read prompt or are not used to having them in dc(1). Most of
+ those users would want to put this option in **BC_ENV_ARGS** (see the
+ **ENVIRONMENT VARIABLES** section). This option is also useful in hash bang
+ lines of dc(1) scripts that prompt for user input.
+
+ This option does not disable the regular prompt because the read prompt is
+ only used when the **?** command is used.
+
+ This is a **non-portable extension**.
+
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@@ -556,25 +570,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
-**s***r*
+**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
-**l***r*
+**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
-**S***r*
+**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
-**L***r*
+**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
- now accessible via the **l***r* command.
+ now accessible via the **l**_r_ command.
## Parameters
@@ -723,7 +737,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-**\>***r*
+**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@@ -735,7 +749,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**>***r***e***s*
+**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -744,7 +758,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\>***r*
+**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@@ -753,7 +767,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\>***r***e***s*
+**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -762,7 +776,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**\<***r*
+**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@@ -771,7 +785,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**\<***r***e***s*
+**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -780,7 +794,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\<***r*
+**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@@ -789,7 +803,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\<***r***e***s*
+**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -798,7 +812,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**=***r*
+**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@@ -807,7 +821,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**=***r***e***s*
+**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -816,7 +830,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!=***r*
+**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@@ -825,7 +839,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!=***r***e***s*
+**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -881,12 +895,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
-**:***r*
+**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
-**;***r*
+**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.
diff --git a/contrib/bc/manuals/dc/NP.1 b/contrib/bc/manuals/dc/NP.1
index ad4a69957c1c..75a56bbe3538 100644
--- a/contrib/bc/manuals/dc/NP.1
+++ b/contrib/bc/manuals/dc/NP.1
@@ -25,18 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+\f[B]dc\f[R] [\f[B]-hiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
-[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-read-prompt\f[R]] [\f[B]--extended-register\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -70,79 +70,100 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.SH OPTIONS
.PP
The following are the options that dc(1) accepts.
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.TP
+.PP
+: Print the version information (copyright header) and exit.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-This option is a no-op.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-x\f[R] \f[B]--extended-register\f[R]
-Enables extended register mode.
+.PP
+: Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]DC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -185,7 +206,7 @@ Input is processed immediately when entered.
.PP
\f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to interpret constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
@@ -195,7 +216,7 @@ programs with the \f[B]T\f[R] command.
.PP
\f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
@@ -231,13 +252,13 @@ Likewise, when a value is assigned to \f[B]seed\f[R], it is not
guaranteed that querying \f[B]seed\f[R] immediately after will return
the same value.
In addition, the value of \f[B]seed\f[R] will change after any call to
-the \f[B]\[cq]\f[R] command or the \f[B]\[dq]\f[R] command that does not
+the \f[B]\[aq]\f[R] command or the \f[B]\[dq]\f[R] command that does not
get receive a value of \f[B]0\f[R] or \f[B]1\f[R].
-The maximum integer returned by the \f[B]\[cq]\f[R] command can be
+The maximum integer returned by the \f[B]\[aq]\f[R] command can be
queried with the \f[B]W\f[R] command.
.PP
\f[B]Note\f[R]: The values returned by the pseudo-random number
-generator with the \f[B]\[cq]\f[R] and \f[B]\[dq]\f[R] commands are
+generator with the \f[B]\[aq]\f[R] and \f[B]\[dq]\f[R] commands are
guaranteed to \f[B]NOT\f[R] be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator.
However, they \f[I]are\f[R] guaranteed to be reproducible with identical
@@ -306,272 +327,340 @@ To deactivate them, just assign a different value to \f[B]obase\f[R].
.PP
Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
-.TP
+.PP
\f[B]p\f[R]
-Prints the value on top of the stack, whether number or string, and
-prints a newline after.
-.RS
.PP
+: Prints the value on top of the stack, whether number or string, and
+prints a newline after.
+.IP
+.nf
+\f[C]
This does not alter the stack.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]n\f[R]
-Prints the value on top of the stack, whether number or string, and pops
-it off of the stack.
-.TP
+.PP
+: Prints the value on top of the stack, whether number or string, and
+pops it off of the stack.
+.PP
\f[B]P\f[R]
-Pops a value off the stack.
-.RS
.PP
+: Pops a value off the stack.
+.IP
+.nf
+\f[C]
If the value is a number, it is truncated and the absolute value of the
-result is printed as though \f[B]obase\f[R] is \f[B]UCHAR_MAX+1\f[R] and
-each digit is interpreted as an ASCII character, making it a byte
-stream.
-.PP
+result is printed as though **obase** is **UCHAR_MAX+1** and each digit is
+interpreted as an ASCII character, making it a byte stream.
+
If the value is a string, it is printed without a trailing newline.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]f\f[R]
-Prints the entire contents of the stack, in order from newest to oldest,
-without altering anything.
-.RS
.PP
+: Prints the entire contents of the stack, in order from newest to
+oldest, without altering anything.
+.IP
+.nf
+\f[C]
Users should use this command when they get lost.
-.RE
+\f[R]
+.fi
.SS Arithmetic
.PP
These are the commands used for arithmetic.
-.TP
+.PP
\f[B]+\f[R]
-The top two values are popped off the stack, added, and the result is
+.PP
+: The top two values are popped off the stack, added, and the result is
pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]-\f[R]
-The top two values are popped off the stack, subtracted, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, subtracted, and the
+result is pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]*\f[R]
-The top two values are popped off the stack, multiplied, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, multiplied, and the
+result is pushed onto the stack.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The top two values are popped off the stack, divided, and the result is
-pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
-The first value popped off of the stack must be non-zero.
-.RE
-.TP
-\f[B]%\f[R]
-The top two values are popped off the stack, remaindered, and the result
+: The top two values are popped off the stack, divided, and the result
is pushed onto the stack.
-.RS
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be non-zero.
+\f[R]
+.fi
.PP
-Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
-\f[B]scale\f[R], and 2) Using the result of step 1 to calculate
-\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
-\f[B]max(scale+scale(b),scale(a))\f[R].
+\f[B]%\f[R]
.PP
+: The top two values are popped off the stack, remaindered, and the
+result is pushed onto the stack.
+.IP
+.nf
+\f[C]
+Remaindering is equivalent to 1) Computing **a/b** to current **scale**, and
+2) Using the result of step 1 to calculate **a-(a/b)\[rs]*b** to *scale*
+**max(scale+scale(b),scale(a))**.
+
The first value popped off of the stack must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]\[ti]\f[R]
-The top two values are popped off the stack, divided and remaindered,
+.PP
+: The top two values are popped off the stack, divided and remaindered,
and the results (divided first, remainder second) are pushed onto the
stack.
This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
\f[B]y\f[R] are only evaluated once.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be non-zero.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The top two values are popped off the stack, the second is raised to the
-power of the first, and the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top two values are popped off the stack, the second is raised to
+the power of the first, and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be an integer, and if that
value is negative, the second value popped off of the stack must be
non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]v\f[R]
-The top value is popped off the stack, its square root is computed, and
-the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top value is popped off the stack, its square root is computed,
+and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The value popped off of the stack must be non-negative.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]_\f[R]
-If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
-or other commands), then that number is input as a negative number.
-.RS
-.PP
-Otherwise, the top value on the stack is popped and copied, and the copy
-is negated and pushed onto the stack.
-This behavior without a number is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+.PP
+: If this command \f[I]immediately\f[R] precedes a number (i.e., no
+spaces or other commands), then that number is input as a negative
+number.
+.IP
+.nf
+\f[C]
+Otherwise, the top value on the stack is popped and copied, and the copy is
+negated and pushed onto the stack. This behavior without a number is a
+**non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]b\f[R]
-The top value is popped off the stack, and if it is zero, it is pushed
+.PP
+: The top value is popped off the stack, and if it is zero, it is pushed
back onto the stack.
Otherwise, its absolute value is pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]|\f[R]
-The top three values are popped off the stack, a modular exponentiation
-is computed, and the result is pushed onto the stack.
-.RS
.PP
+: The top three values are popped off the stack, a modular
+exponentiation is computed, and the result is pushed onto the stack.
+.IP
+.nf
+\f[C]
The first value popped is used as the reduction modulus and must be an
-integer and non-zero.
-The second value popped is used as the exponent and must be an integer
-and non-negative.
-The third value popped is the base and must be an integer.
+integer and non-zero. The second value popped is used as the exponent and
+must be an integer and non-negative. The third value popped is the base and
+must be an integer.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]$\f[R]
-The top value is popped off the stack and copied, and the copy is
+.PP
+: The top value is popped off the stack and copied, and the copy is
truncated and pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[at]\f[R]
-The top two values are popped off the stack, and the precision of the
+.PP
+: The top two values are popped off the stack, and the precision of the
second is set to the value of the first, whether by truncation or
extension.
-.RS
-.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]H\f[R]
-The top two values are popped off the stack, and the second is shifted
-left (radix shifted right) to the value of the first.
-.RS
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+: The top two values are popped off the stack, and the second is shifted
+left (radix shifted right) to the value of the first.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]h\f[R]
-The top two values are popped off the stack, and the second is shifted
-right (radix shifted left) to the value of the first.
-.RS
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+: The top two values are popped off the stack, and the second is shifted
+right (radix shifted left) to the value of the first.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]G\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]N\f[R]
-The top value is popped off of the stack, and if it a \f[B]0\f[R], a
+.PP
+: The top value is popped off of the stack, and if it a \f[B]0\f[R], a
\f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B](\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]{\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than or equal to the second,
-or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than or equal to the
+second, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B])\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]}\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than or equal to the
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than or equal to the
second, or \f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]M\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If they are both non-zero, a \f[B]1\f[R] is pushed onto the stack.
If either of them is zero, or both of them are, then a \f[B]0\f[R] is
pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is like the **&&** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]m\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If at least one of them is non-zero, a \f[B]1\f[R] is pushed onto the
stack.
If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is like the **||** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Pseudo-Random Number Generator
.PP
dc(1) has a built-in pseudo-random number generator.
@@ -581,20 +670,24 @@ controls the pseudo-random number generator.)
.PP
The pseudo-random number generator is guaranteed to \f[B]NOT\f[R] be
cryptographically secure.
-.TP
-\f[B]\[cq]\f[R]
-Generates an integer between 0 and \f[B]DC_RAND_MAX\f[R], inclusive (see
-the \f[B]LIMITS\f[R] section).
-.RS
.PP
+\f[B]\[aq]\f[R]
+.PP
+: Generates an integer between 0 and \f[B]DC_RAND_MAX\f[R], inclusive
+(see the \f[B]LIMITS\f[R] section).
+.IP
+.nf
+\f[C]
The generated integer is made as unbiased as possible, subject to the
limitations of the pseudo-random number generator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[dq]\f[R]
-Pops a value off of the stack, which is used as an \f[B]exclusive\f[R]
+.PP
+: Pops a value off of the stack, which is used as an \f[B]exclusive\f[R]
upper bound on the integer that will be generated.
If the bound is negative or is a non-integer, an error is raised, and
dc(1) resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R]
@@ -609,48 +702,58 @@ Using this command will change the value of \f[B]seed\f[R], unless the
operand is \f[B]0\f[R] or \f[B]1\f[R].
In that case, \f[B]0\f[R] is pushed onto the stack, and \f[B]seed\f[R]
is \f[I]not\f[R] changed.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The generated integer is made as unbiased as possible, subject to the
limitations of the pseudo-random number generator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Stack Control
.PP
These commands control the stack.
-.TP
+.PP
\f[B]c\f[R]
-Removes all items from (\[lq]clears\[rq]) the stack.
-.TP
+.PP
+: Removes all items from (\[dq]clears\[dq]) the stack.
+.PP
\f[B]d\f[R]
-Copies the item on top of the stack (\[lq]duplicates\[rq]) and pushes
+.PP
+: Copies the item on top of the stack (\[dq]duplicates\[dq]) and pushes
the copy onto the stack.
-.TP
+.PP
\f[B]r\f[R]
-Swaps (\[lq]reverses\[rq]) the two top items on the stack.
-.TP
+.PP
+: Swaps (\[dq]reverses\[dq]) the two top items on the stack.
+.PP
\f[B]R\f[R]
-Pops (\[lq]removes\[rq]) the top value from the stack.
+.PP
+: Pops (\[dq]removes\[dq]) the top value from the stack.
.SS Register Control
.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
-.TP
+.PP
\f[B]s\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack and stores it into register
+.PP
+: Pops the value off the top of the stack and stores it into register
\f[I]r\f[R].
-.TP
+.PP
\f[B]l\f[R]\f[I]r\f[R]
-Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
+.PP
+: Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
This does not alter the contents of \f[I]r\f[R].
-.TP
+.PP
\f[B]S\f[R]\f[I]r\f[R]
-Pops the value off the top of the (main) stack and pushes it onto the
+.PP
+: Pops the value off the top of the (main) stack and pushes it onto the
stack of register \f[I]r\f[R].
The previous value of the register becomes inaccessible.
-.TP
+.PP
\f[B]L\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack for register \f[I]r\f[R] and
+.PP
+: Pops the value off the top of the stack for register \f[I]r\f[R] and
push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
@@ -659,113 +762,137 @@ accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
\f[B]scale\f[R], and \f[B]seed\f[R].
Also see the \f[B]SYNTAX\f[R] section.
-.TP
+.PP
\f[B]i\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
inclusive.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]o\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]obase\f[R], which must be between \f[B]0\f[R] and
\f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section and
the \f[B]NUMBERS\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]k\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]scale\f[R], which must be non-negative.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]j\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]seed\f[R].
The meaning of \f[B]seed\f[R] is dependent on the current pseudo-random
number generator but is guaranteed to not change except for new major
versions.
-.RS
+.IP
+.nf
+\f[C]
+The *scale* and sign of the value may be significant.
+
+If a previously used **seed** value is used again, the pseudo-random number
+generator is guaranteed to produce the same sequence of pseudo-random
+numbers as it did when the **seed** value was previously used.
+
+The exact value assigned to **seed** is not guaranteed to be returned if the
+**J** command is used. However, if **seed** *does* return a different value,
+both values, when assigned to **seed**, are guaranteed to produce the same
+sequence of pseudo-random numbers. This means that certain values assigned
+to **seed** will not produce unique sequences of pseudo-random numbers.
+
+There is no limit to the length (number of significant decimal digits) or
+*scale* of the value that can be assigned to **seed**.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The \f[I]scale\f[R] and sign of the value may be significant.
+\f[B]I\f[R]
.PP
-If a previously used \f[B]seed\f[R] value is used again, the
-pseudo-random number generator is guaranteed to produce the same
-sequence of pseudo-random numbers as it did when the \f[B]seed\f[R]
-value was previously used.
+: Pushes the current value of \f[B]ibase\f[R] onto the main stack.
.PP
-The exact value assigned to \f[B]seed\f[R] is not guaranteed to be
-returned if the \f[B]J\f[R] command is used.
-However, if \f[B]seed\f[R] \f[I]does\f[R] return a different value, both
-values, when assigned to \f[B]seed\f[R], are guaranteed to produce the
-same sequence of pseudo-random numbers.
-This means that certain values assigned to \f[B]seed\f[R] will not
-produce unique sequences of pseudo-random numbers.
+\f[B]O\f[R]
.PP
-There is no limit to the length (number of significant decimal digits)
-or \f[I]scale\f[R] of the value that can be assigned to \f[B]seed\f[R].
+: Pushes the current value of \f[B]obase\f[R] onto the main stack.
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]I\f[R]
-Pushes the current value of \f[B]ibase\f[R] onto the main stack.
-.TP
-\f[B]O\f[R]
-Pushes the current value of \f[B]obase\f[R] onto the main stack.
-.TP
\f[B]K\f[R]
-Pushes the current value of \f[B]scale\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]scale\f[R] onto the main stack.
+.PP
\f[B]J\f[R]
-Pushes the current value of \f[B]seed\f[R] onto the main stack.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Pushes the current value of \f[B]seed\f[R] onto the main stack.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]T\f[R]
-Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]U\f[R]
-Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]V\f[R]
-Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]W\f[R]
-Pushes the maximum (inclusive) integer that can be generated with the
-\f[B]\[cq]\f[R] pseudo-random number generator command.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+: Pushes the maximum (inclusive) integer that can be generated with the
+\f[B]\[aq]\f[R] pseudo-random number generator command.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Strings
.PP
The following commands control strings.
@@ -782,233 +909,292 @@ Strings can also be executed as macros.
For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
printed with a newline after and then popped from the stack.
-.TP
-\f[B][\f[R]_characters_\f[B]]\f[R]
-Makes a string containing \f[I]characters\f[R] and pushes it onto the
-stack.
-.RS
.PP
-If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
-they must be balanced.
-Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
-character.
+\f[B][\f[R]\f[I]characters\f[R]\f[B]]\f[R]
.PP
+: Makes a string containing \f[I]characters\f[R] and pushes it onto the
+stack.
+.IP
+.nf
+\f[C]
+If there are brackets (**\[rs][** and **\[rs]]**) in the string, then they must be
+balanced. Unbalanced brackets can be escaped using a backslash (**\[rs]\[rs]**)
+character.
+
If there is a backslash character in the string, the character after it
-(even another backslash) is put into the string verbatim, but the
-(first) backslash is not.
-.RE
-.TP
-\f[B]a\f[R]
-The value on top of the stack is popped.
-.RS
+(even another backslash) is put into the string verbatim, but the (first)
+backslash is not.
+\f[R]
+.fi
.PP
-If it is a number, it is truncated and its absolute value is taken.
-The result mod \f[B]UCHAR_MAX+1\f[R] is calculated.
-If that result is \f[B]0\f[R], push an empty string; otherwise, push a
-one-character string where the character is the result of the mod
-interpreted as an ASCII character.
+\f[B]a\f[R]
.PP
-If it is a string, then a new string is made.
-If the original string is empty, the new string is empty.
-If it is not, then the first character of the original string is used to
-create the new string as a one-character string.
-The new string is then pushed onto the stack.
+: The value on top of the stack is popped.
+.IP
+.nf
+\f[C]
+If it is a number, it is truncated and its absolute value is taken. The
+result mod **UCHAR_MAX+1** is calculated. If that result is **0**, push an
+empty string; otherwise, push a one-character string where the character is
+the result of the mod interpreted as an ASCII character.
+
+If it is a string, then a new string is made. If the original string is
+empty, the new string is empty. If it is not, then the first character of
+the original string is used to create the new string as a one-character
+string. The new string is then pushed onto the stack.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]x\f[R]
-Pops a value off of the top of the stack.
-.RS
.PP
+: Pops a value off of the top of the stack.
+.IP
+.nf
+\f[C]
If it is a number, it is pushed back onto the stack.
-.PP
+
If it is a string, it is executed as a macro.
-.PP
+
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is greater than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
-.PP
-For example, \f[B]0 1>a\f[R] will execute the contents of register
-\f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
+.IP
+.nf
+\f[C]
+For example, **0 1>a** will execute the contents of register **a**, and
+**1 0>a** will not.
+
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not greater than the second (less than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is less than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not less than the second (greater than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is equal to the second, then the contents of register
\f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not equal to the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]?\f[R]
-Reads a line from the \f[B]stdin\f[R] and executes it.
+.PP
+: Reads a line from the \f[B]stdin\f[R] and executes it.
This is to allow macros to request input from users.
-.TP
+.PP
\f[B]q\f[R]
-During execution of a macro, this exits the execution of that macro and
-the execution of the macro that executed it.
+.PP
+: During execution of a macro, this exits the execution of that macro
+and the execution of the macro that executed it.
If there are no macros, or only one macro executing, dc(1) exits.
-.TP
+.PP
\f[B]Q\f[R]
-Pops a value from the stack which must be non-negative and is used the
+.PP
+: Pops a value from the stack which must be non-negative and is used the
number of macro executions to pop off of the execution stack.
If the number of levels to pop is greater than the number of executing
macros, dc(1) exits.
.SS Status
.PP
These commands query status of the stack or its top value.
-.TP
-\f[B]Z\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, calculates the number of significant decimal digits
-it has and pushes the result.
+\f[B]Z\f[R]
.PP
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, calculates the number of significant decimal digits it
+has and pushes the result.
+
If it is a string, pushes the number of characters the string has.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]X\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, pushes the \f[I]scale\f[R] of the value onto the
-stack.
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, pushes the *scale* of the value onto the stack.
+
+If it is a string, pushes **0**.
+\f[R]
+.fi
.PP
-If it is a string, pushes \f[B]0\f[R].
-.RE
-.TP
\f[B]z\f[R]
-Pushes the current stack depth (before execution of this command).
+.PP
+: Pushes the current stack depth (before execution of this command).
.SS Arrays
.PP
These commands manipulate arrays.
-.TP
+.PP
\f[B]:\f[R]\f[I]r\f[R]
-Pops the top two values off of the stack.
+.PP
+: Pops the top two values off of the stack.
The second value will be stored in the array \f[I]r\f[R] (see the
\f[B]REGISTERS\f[R] section), indexed by the first value.
-.TP
+.PP
\f[B];\f[R]\f[I]r\f[R]
-Pops the value on top of the stack and uses it as an index into the
+.PP
+: Pops the value on top of the stack and uses it as an index into the
array \f[I]r\f[R].
The selected value is then pushed onto the stack.
.SH REGISTERS
@@ -1023,8 +1209,8 @@ their stack.
.PP
In non-extended register mode, a register name is just the single
character that follows any command that needs a register name.
-The only exception is a newline (\f[B]`\[rs]n'\f[R]); it is a parse
-error for a newline to be used as a register name.
+The only exception is a newline (\f[B]\[aq]\[rs]n\[aq]\f[R]); it is a
+parse error for a newline to be used as a register name.
.SS Extended Register Mode
.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
@@ -1035,7 +1221,7 @@ If extended register mode is enabled (\f[B]-x\f[R] or
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
-(\f[B]`\[rs]n'\f[R]).
+(\f[B]\[aq]\[rs]n\[aq]\f[R]).
.PP
In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
@@ -1080,64 +1266,77 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on dc(1):
-.TP
+.PP
\f[B]DC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
dc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]DC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]DC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]DC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]DC_BASE_POW\f[R].
-.TP
+.PP
\f[B]DC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_RAND_MAX\f[R]
-The maximum integer (inclusive) returned by the \f[B]\[cq]\f[R] command,
-if dc(1).
+.PP
+: The maximum integer (inclusive) returned by the \f[B]\[aq]\f[R]
+command, if dc(1).
Set at \f[B]2\[ha]DC_LONG_BIT-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]DC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
These limits are meant to be effectively non-existent; the limits are so
@@ -1147,104 +1346,117 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
dc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]DC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to dc(1).
+.PP
+: This is another way to give command-line arguments to dc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time dc(1) runs.
Another use would be to use the \f[B]-e\f[R] option to set
\f[B]scale\f[R] to a value other than \f[B]0\f[R].
-.RS
-.PP
-The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **DC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some dc file.dc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]dc\[rs]\[dq] file.dc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]dc\[aq] file.dc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]DC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
including the backslash newline combo.
The default line length is \f[B]70\f[R].
-.TP
+.PP
\f[B]DC_EXPR_EXIT\f[R]
-If this variable exists (no matter the contents), dc(1) will exit
+.PP
+: If this variable exists (no matter the contents), dc(1) will exit
immediately after executing expressions and files given by the
\f[B]-e\f[R] and/or \f[B]-f\f[R] command-line options (and any
equivalents).
.SH EXIT STATUS
.PP
dc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, using a negative number as a bound for the
-pseudo-random number generator, attempting to convert a negative number
-to a hardware integer, overflow when converting a number to a hardware
-integer, and attempting to use a non-integer where an integer is
-required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
-(\f[B]H\f[R]), and right shift (\f[B]h\f[R]) operators.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, using a negative number as a bound for the pseudo-random number
+generator, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**), places (**\[rs]\[at]**), left shift (**H**), and right shift (**h**)
+operators.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, and using a
-token where it is invalid.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, and using a token where it is
+invalid.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
-.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, and attempting an operation when the
-stack has too few elements.
-.RE
-.TP
+.PP
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, and attempting an operation when
+the stack has too few elements.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (dc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (dc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
@@ -1272,7 +1484,7 @@ In interactive mode, dc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, dc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, dc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is required for history to be enabled (see the \f[B]COMMAND
LINE HISTORY\f[R] section).
@@ -1292,7 +1504,7 @@ If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If dc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If dc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/dc/NP.1.md b/contrib/bc/manuals/dc/NP.1.md
index b1f29d76f06e..4533a534e84c 100644
--- a/contrib/bc/manuals/dc/NP.1.md
+++ b/contrib/bc/manuals/dc/NP.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -84,6 +84,12 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: This option is a no-op.
+
+ This is a **non-portable extension**.
+
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@@ -553,25 +559,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
-**s***r*
+**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
-**l***r*
+**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
-**S***r*
+**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
-**L***r*
+**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
- now accessible via the **l***r* command.
+ now accessible via the **l**_r_ command.
## Parameters
@@ -720,7 +726,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-**\>***r*
+**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@@ -732,7 +738,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**>***r***e***s*
+**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -741,7 +747,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\>***r*
+**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@@ -750,7 +756,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\>***r***e***s*
+**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -759,7 +765,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**\<***r*
+**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@@ -768,7 +774,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**\<***r***e***s*
+**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -777,7 +783,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\<***r*
+**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@@ -786,7 +792,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\<***r***e***s*
+**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -795,7 +801,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**=***r*
+**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@@ -804,7 +810,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**=***r***e***s*
+**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -813,7 +819,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!=***r*
+**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@@ -822,7 +828,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!=***r***e***s*
+**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -878,12 +884,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
-**:***r*
+**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
-**;***r*
+**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.
diff --git a/contrib/bc/manuals/dc/P.1 b/contrib/bc/manuals/dc/P.1
index 2bbe54c37604..6ee6d0f7bd2f 100644
--- a/contrib/bc/manuals/dc/P.1
+++ b/contrib/bc/manuals/dc/P.1
@@ -25,18 +25,18 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
.SH SYNOPSIS
.PP
-\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
+\f[B]dc\f[R] [\f[B]-hiPRvVx\f[R]] [\f[B]--version\f[R]]
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
-[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
-[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
-\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
-[\f[I]file\f[R]\&...]
+[\f[B]--no-read-prompt\f[R]] [\f[B]--extended-register\f[R]]
+[\f[B]-e\f[R] \f[I]expr\f[R]] [\f[B]--expression\f[R]=\f[I]expr\f[R]...]
+[\f[B]-f\f[R] \f[I]file\f[R]...] [\f[B]--file\f[R]=\f[I]file\f[R]...]
+[\f[I]file\f[R]...]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -70,79 +70,100 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
.SH OPTIONS
.PP
The following are the options that dc(1) accepts.
-.TP
+.PP
\f[B]-h\f[R], \f[B]--help\f[R]
-Prints a usage message and quits.
-.TP
+.PP
+: Prints a usage message and quits.
+.PP
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
-Print the version information (copyright header) and exit.
-.TP
+.PP
+: Print the version information (copyright header) and exit.
+.PP
\f[B]-i\f[R], \f[B]--interactive\f[R]
-Forces interactive mode.
+.PP
+: Forces interactive mode.
(See the \f[B]INTERACTIVE MODE\f[R] section.)
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
-This option is a no-op.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
+\f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
+.PP
+: This option is a no-op.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]-x\f[R] \f[B]--extended-register\f[R]
-Enables extended register mode.
+.PP
+: Enables extended register mode.
See the \f[I]Extended Register Mode\f[R] subsection of the
\f[B]REGISTERS\f[R] section for more information.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
-Evaluates \f[I]expr\f[R].
+.PP
+: Evaluates \f[I]expr\f[R].
If multiple expressions are given, they are evaluated in order.
If files are given as well (see below), the expressions and files are
evaluated in the order given.
This means that if a file is given before an expression, the file is
read in and evaluated first.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
-\f[B]DC_ENV_ARGS\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**, whether on the
+command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
+**-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after **-f-**
+or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
-Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
+.PP
+: Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
were read through \f[B]stdin\f[R].
If expressions are also given (see above), the expressions are evaluated
in the order given.
-.RS
-.PP
-If this option is given on the command-line (i.e., not in
-\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
-then after processing all expressions and files, dc(1) will exit, unless
-\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
-\f[B]-f\f[R] or \f[B]--file\f[R].
-However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
-\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
-\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
-exit.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
+see the **ENVIRONMENT VARIABLES** section), then after processing all
+expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
+as an argument at least once to **-f** or **-\[rs]-file**. However, if any other
+**-e**, **-\[rs]-expression**, **-f**, or **-\[rs]-file** arguments are given after
+**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDOUT
@@ -185,7 +206,7 @@ Input is processed immediately when entered.
.PP
\f[B]ibase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to interpret constant numbers.
-It is the \[lq]input\[rq] base, or the number base used for interpreting
+It is the \[dq]input\[dq] base, or the number base used for interpreting
input numbers.
\f[B]ibase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]ibase\f[R] is \f[B]16\f[R].
@@ -195,7 +216,7 @@ programs with the \f[B]T\f[R] command.
.PP
\f[B]obase\f[R] is a register (see the \f[B]REGISTERS\f[R] section) that
determines how to output results.
-It is the \[lq]output\[rq] base, or the number base used for outputting
+It is the \[dq]output\[dq] base, or the number base used for outputting
numbers.
\f[B]obase\f[R] is initially \f[B]10\f[R].
The max allowable value for \f[B]obase\f[R] is \f[B]DC_BASE_MAX\f[R] and
@@ -231,13 +252,13 @@ Likewise, when a value is assigned to \f[B]seed\f[R], it is not
guaranteed that querying \f[B]seed\f[R] immediately after will return
the same value.
In addition, the value of \f[B]seed\f[R] will change after any call to
-the \f[B]\[cq]\f[R] command or the \f[B]\[dq]\f[R] command that does not
+the \f[B]\[aq]\f[R] command or the \f[B]\[dq]\f[R] command that does not
get receive a value of \f[B]0\f[R] or \f[B]1\f[R].
-The maximum integer returned by the \f[B]\[cq]\f[R] command can be
+The maximum integer returned by the \f[B]\[aq]\f[R] command can be
queried with the \f[B]W\f[R] command.
.PP
\f[B]Note\f[R]: The values returned by the pseudo-random number
-generator with the \f[B]\[cq]\f[R] and \f[B]\[dq]\f[R] commands are
+generator with the \f[B]\[aq]\f[R] and \f[B]\[dq]\f[R] commands are
guaranteed to \f[B]NOT\f[R] be cryptographically secure.
This is a consequence of using a seeded pseudo-random number generator.
However, they \f[I]are\f[R] guaranteed to be reproducible with identical
@@ -306,272 +327,340 @@ To deactivate them, just assign a different value to \f[B]obase\f[R].
.PP
Printing numbers in scientific notation and/or engineering notation is a
\f[B]non-portable extension\f[R].
-.TP
+.PP
\f[B]p\f[R]
-Prints the value on top of the stack, whether number or string, and
-prints a newline after.
-.RS
.PP
+: Prints the value on top of the stack, whether number or string, and
+prints a newline after.
+.IP
+.nf
+\f[C]
This does not alter the stack.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]n\f[R]
-Prints the value on top of the stack, whether number or string, and pops
-it off of the stack.
-.TP
+.PP
+: Prints the value on top of the stack, whether number or string, and
+pops it off of the stack.
+.PP
\f[B]P\f[R]
-Pops a value off the stack.
-.RS
.PP
+: Pops a value off the stack.
+.IP
+.nf
+\f[C]
If the value is a number, it is truncated and the absolute value of the
-result is printed as though \f[B]obase\f[R] is \f[B]UCHAR_MAX+1\f[R] and
-each digit is interpreted as an ASCII character, making it a byte
-stream.
-.PP
+result is printed as though **obase** is **UCHAR_MAX+1** and each digit is
+interpreted as an ASCII character, making it a byte stream.
+
If the value is a string, it is printed without a trailing newline.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]f\f[R]
-Prints the entire contents of the stack, in order from newest to oldest,
-without altering anything.
-.RS
.PP
+: Prints the entire contents of the stack, in order from newest to
+oldest, without altering anything.
+.IP
+.nf
+\f[C]
Users should use this command when they get lost.
-.RE
+\f[R]
+.fi
.SS Arithmetic
.PP
These are the commands used for arithmetic.
-.TP
+.PP
\f[B]+\f[R]
-The top two values are popped off the stack, added, and the result is
+.PP
+: The top two values are popped off the stack, added, and the result is
pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]-\f[R]
-The top two values are popped off the stack, subtracted, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, subtracted, and the
+result is pushed onto the stack.
The \f[I]scale\f[R] of the result is equal to the max \f[I]scale\f[R] of
both operands.
-.TP
+.PP
\f[B]*\f[R]
-The top two values are popped off the stack, multiplied, and the result
-is pushed onto the stack.
+.PP
+: The top two values are popped off the stack, multiplied, and the
+result is pushed onto the stack.
If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
\f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
\f[I]scale\f[R] of the result is equal to
\f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
\f[B]max()\f[R] return the obvious values.
-.TP
+.PP
\f[B]/\f[R]
-The top two values are popped off the stack, divided, and the result is
-pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
-The first value popped off of the stack must be non-zero.
-.RE
-.TP
-\f[B]%\f[R]
-The top two values are popped off the stack, remaindered, and the result
+: The top two values are popped off the stack, divided, and the result
is pushed onto the stack.
-.RS
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be non-zero.
+\f[R]
+.fi
.PP
-Remaindering is equivalent to 1) Computing \f[B]a/b\f[R] to current
-\f[B]scale\f[R], and 2) Using the result of step 1 to calculate
-\f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
-\f[B]max(scale+scale(b),scale(a))\f[R].
+\f[B]%\f[R]
.PP
+: The top two values are popped off the stack, remaindered, and the
+result is pushed onto the stack.
+.IP
+.nf
+\f[C]
+Remaindering is equivalent to 1) Computing **a/b** to current **scale**, and
+2) Using the result of step 1 to calculate **a-(a/b)\[rs]*b** to *scale*
+**max(scale+scale(b),scale(a))**.
+
The first value popped off of the stack must be non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]\[ti]\f[R]
-The top two values are popped off the stack, divided and remaindered,
+.PP
+: The top two values are popped off the stack, divided and remaindered,
and the results (divided first, remainder second) are pushed onto the
stack.
This is equivalent to \f[B]x y / x y %\f[R] except that \f[B]x\f[R] and
\f[B]y\f[R] are only evaluated once.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be non-zero.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[ha]\f[R]
-The top two values are popped off the stack, the second is raised to the
-power of the first, and the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top two values are popped off the stack, the second is raised to
+the power of the first, and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The first value popped off of the stack must be an integer, and if that
value is negative, the second value popped off of the stack must be
non-zero.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]v\f[R]
-The top value is popped off the stack, its square root is computed, and
-the result is pushed onto the stack.
-The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
-.RS
.PP
+: The top value is popped off the stack, its square root is computed,
+and the result is pushed onto the stack.
+The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
+.IP
+.nf
+\f[C]
The value popped off of the stack must be non-negative.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]_\f[R]
-If this command \f[I]immediately\f[R] precedes a number (i.e., no spaces
-or other commands), then that number is input as a negative number.
-.RS
-.PP
-Otherwise, the top value on the stack is popped and copied, and the copy
-is negated and pushed onto the stack.
-This behavior without a number is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+.PP
+: If this command \f[I]immediately\f[R] precedes a number (i.e., no
+spaces or other commands), then that number is input as a negative
+number.
+.IP
+.nf
+\f[C]
+Otherwise, the top value on the stack is popped and copied, and the copy is
+negated and pushed onto the stack. This behavior without a number is a
+**non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]b\f[R]
-The top value is popped off the stack, and if it is zero, it is pushed
+.PP
+: The top value is popped off the stack, and if it is zero, it is pushed
back onto the stack.
Otherwise, its absolute value is pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]|\f[R]
-The top three values are popped off the stack, a modular exponentiation
-is computed, and the result is pushed onto the stack.
-.RS
.PP
+: The top three values are popped off the stack, a modular
+exponentiation is computed, and the result is pushed onto the stack.
+.IP
+.nf
+\f[C]
The first value popped is used as the reduction modulus and must be an
-integer and non-zero.
-The second value popped is used as the exponent and must be an integer
-and non-negative.
-The third value popped is the base and must be an integer.
+integer and non-zero. The second value popped is used as the exponent and
+must be an integer and non-negative. The third value popped is the base and
+must be an integer.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]$\f[R]
-The top value is popped off the stack and copied, and the copy is
+.PP
+: The top value is popped off the stack and copied, and the copy is
truncated and pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[at]\f[R]
-The top two values are popped off the stack, and the precision of the
+.PP
+: The top two values are popped off the stack, and the precision of the
second is set to the value of the first, whether by truncation or
extension.
-.RS
-.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]H\f[R]
-The top two values are popped off the stack, and the second is shifted
-left (radix shifted right) to the value of the first.
-.RS
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+: The top two values are popped off the stack, and the second is shifted
+left (radix shifted right) to the value of the first.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]h\f[R]
-The top two values are popped off the stack, and the second is shifted
-right (radix shifted left) to the value of the first.
-.RS
.PP
-The first value popped off of the stack must be an integer and
-non-negative.
+: The top two values are popped off the stack, and the second is shifted
+right (radix shifted left) to the value of the first.
+.IP
+.nf
+\f[C]
+The first value popped off of the stack must be an integer and non-negative.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]G\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if they are equal, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]N\f[R]
-The top value is popped off of the stack, and if it a \f[B]0\f[R], a
+.PP
+: The top value is popped off of the stack, and if it a \f[B]0\f[R], a
\f[B]1\f[R] is pushed; otherwise, a \f[B]0\f[R] is pushed.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B](\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]{\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is less than or equal to the second,
-or \f[B]0\f[R] otherwise.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is less than or equal to the
+second, or \f[B]0\f[R] otherwise.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B])\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than the second, or
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than the second, or
\f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]}\f[R]
-The top two values are popped off of the stack, they are compared, and a
-\f[B]1\f[R] is pushed if the first is greater than or equal to the
+.PP
+: The top two values are popped off of the stack, they are compared, and
+a \f[B]1\f[R] is pushed if the first is greater than or equal to the
second, or \f[B]0\f[R] otherwise.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]M\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If they are both non-zero, a \f[B]1\f[R] is pushed onto the stack.
If either of them is zero, or both of them are, then a \f[B]0\f[R] is
pushed onto the stack.
-.RS
+.IP
+.nf
+\f[C]
+This is like the **&&** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is like the \f[B]&&\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]m\f[R]
-The top two values are popped off of the stack.
+.PP
+: The top two values are popped off of the stack.
If at least one of them is non-zero, a \f[B]1\f[R] is pushed onto the
stack.
If both of them are zero, then a \f[B]0\f[R] is pushed onto the stack.
-.RS
-.PP
-This is like the \f[B]||\f[R] operator in bc(1), and it is \f[I]not\f[R]
-a short-circuit operator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+.IP
+.nf
+\f[C]
+This is like the **||** operator in bc(1), and it is *not* a short-circuit
+operator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Pseudo-Random Number Generator
.PP
dc(1) has a built-in pseudo-random number generator.
@@ -581,20 +670,24 @@ controls the pseudo-random number generator.)
.PP
The pseudo-random number generator is guaranteed to \f[B]NOT\f[R] be
cryptographically secure.
-.TP
-\f[B]\[cq]\f[R]
-Generates an integer between 0 and \f[B]DC_RAND_MAX\f[R], inclusive (see
-the \f[B]LIMITS\f[R] section).
-.RS
.PP
+\f[B]\[aq]\f[R]
+.PP
+: Generates an integer between 0 and \f[B]DC_RAND_MAX\f[R], inclusive
+(see the \f[B]LIMITS\f[R] section).
+.IP
+.nf
+\f[C]
The generated integer is made as unbiased as possible, subject to the
limitations of the pseudo-random number generator.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]\[dq]\f[R]
-Pops a value off of the stack, which is used as an \f[B]exclusive\f[R]
+.PP
+: Pops a value off of the stack, which is used as an \f[B]exclusive\f[R]
upper bound on the integer that will be generated.
If the bound is negative or is a non-integer, an error is raised, and
dc(1) resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R]
@@ -609,48 +702,58 @@ Using this command will change the value of \f[B]seed\f[R], unless the
operand is \f[B]0\f[R] or \f[B]1\f[R].
In that case, \f[B]0\f[R] is pushed onto the stack, and \f[B]seed\f[R]
is \f[I]not\f[R] changed.
-.RS
-.PP
+.IP
+.nf
+\f[C]
The generated integer is made as unbiased as possible, subject to the
limitations of the pseudo-random number generator.
-.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Stack Control
.PP
These commands control the stack.
-.TP
+.PP
\f[B]c\f[R]
-Removes all items from (\[lq]clears\[rq]) the stack.
-.TP
+.PP
+: Removes all items from (\[dq]clears\[dq]) the stack.
+.PP
\f[B]d\f[R]
-Copies the item on top of the stack (\[lq]duplicates\[rq]) and pushes
+.PP
+: Copies the item on top of the stack (\[dq]duplicates\[dq]) and pushes
the copy onto the stack.
-.TP
+.PP
\f[B]r\f[R]
-Swaps (\[lq]reverses\[rq]) the two top items on the stack.
-.TP
+.PP
+: Swaps (\[dq]reverses\[dq]) the two top items on the stack.
+.PP
\f[B]R\f[R]
-Pops (\[lq]removes\[rq]) the top value from the stack.
+.PP
+: Pops (\[dq]removes\[dq]) the top value from the stack.
.SS Register Control
.PP
These commands control registers (see the \f[B]REGISTERS\f[R] section).
-.TP
+.PP
\f[B]s\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack and stores it into register
+.PP
+: Pops the value off the top of the stack and stores it into register
\f[I]r\f[R].
-.TP
+.PP
\f[B]l\f[R]\f[I]r\f[R]
-Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
+.PP
+: Copies the value in register \f[I]r\f[R] and pushes it onto the stack.
This does not alter the contents of \f[I]r\f[R].
-.TP
+.PP
\f[B]S\f[R]\f[I]r\f[R]
-Pops the value off the top of the (main) stack and pushes it onto the
+.PP
+: Pops the value off the top of the (main) stack and pushes it onto the
stack of register \f[I]r\f[R].
The previous value of the register becomes inaccessible.
-.TP
+.PP
\f[B]L\f[R]\f[I]r\f[R]
-Pops the value off the top of the stack for register \f[I]r\f[R] and
+.PP
+: Pops the value off the top of the stack for register \f[I]r\f[R] and
push it onto the main stack.
The previous value in the stack for register \f[I]r\f[R], if any, is now
accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
@@ -659,113 +762,137 @@ accessible via the \f[B]l\f[R]\f[I]r\f[R] command.
These commands control the values of \f[B]ibase\f[R], \f[B]obase\f[R],
\f[B]scale\f[R], and \f[B]seed\f[R].
Also see the \f[B]SYNTAX\f[R] section.
-.TP
+.PP
\f[B]i\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]ibase\f[R], which must be between \f[B]2\f[R] and \f[B]16\f[R],
inclusive.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]o\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]obase\f[R], which must be between \f[B]0\f[R] and
\f[B]DC_BASE_MAX\f[R], inclusive (see the \f[B]LIMITS\f[R] section and
the \f[B]NUMBERS\f[R] section).
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]k\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]scale\f[R], which must be non-negative.
-.RS
+.IP
+.nf
+\f[C]
+If the value on top of the stack has any *scale*, the *scale* is ignored.
+\f[R]
+.fi
.PP
-If the value on top of the stack has any \f[I]scale\f[R], the
-\f[I]scale\f[R] is ignored.
-.RE
-.TP
\f[B]j\f[R]
-Pops the value off of the top of the stack and uses it to set
+.PP
+: Pops the value off of the top of the stack and uses it to set
\f[B]seed\f[R].
The meaning of \f[B]seed\f[R] is dependent on the current pseudo-random
number generator but is guaranteed to not change except for new major
versions.
-.RS
+.IP
+.nf
+\f[C]
+The *scale* and sign of the value may be significant.
+
+If a previously used **seed** value is used again, the pseudo-random number
+generator is guaranteed to produce the same sequence of pseudo-random
+numbers as it did when the **seed** value was previously used.
+
+The exact value assigned to **seed** is not guaranteed to be returned if the
+**J** command is used. However, if **seed** *does* return a different value,
+both values, when assigned to **seed**, are guaranteed to produce the same
+sequence of pseudo-random numbers. This means that certain values assigned
+to **seed** will not produce unique sequences of pseudo-random numbers.
+
+There is no limit to the length (number of significant decimal digits) or
+*scale* of the value that can be assigned to **seed**.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-The \f[I]scale\f[R] and sign of the value may be significant.
+\f[B]I\f[R]
.PP
-If a previously used \f[B]seed\f[R] value is used again, the
-pseudo-random number generator is guaranteed to produce the same
-sequence of pseudo-random numbers as it did when the \f[B]seed\f[R]
-value was previously used.
+: Pushes the current value of \f[B]ibase\f[R] onto the main stack.
.PP
-The exact value assigned to \f[B]seed\f[R] is not guaranteed to be
-returned if the \f[B]J\f[R] command is used.
-However, if \f[B]seed\f[R] \f[I]does\f[R] return a different value, both
-values, when assigned to \f[B]seed\f[R], are guaranteed to produce the
-same sequence of pseudo-random numbers.
-This means that certain values assigned to \f[B]seed\f[R] will not
-produce unique sequences of pseudo-random numbers.
+\f[B]O\f[R]
.PP
-There is no limit to the length (number of significant decimal digits)
-or \f[I]scale\f[R] of the value that can be assigned to \f[B]seed\f[R].
+: Pushes the current value of \f[B]obase\f[R] onto the main stack.
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
-\f[B]I\f[R]
-Pushes the current value of \f[B]ibase\f[R] onto the main stack.
-.TP
-\f[B]O\f[R]
-Pushes the current value of \f[B]obase\f[R] onto the main stack.
-.TP
\f[B]K\f[R]
-Pushes the current value of \f[B]scale\f[R] onto the main stack.
-.TP
+.PP
+: Pushes the current value of \f[B]scale\f[R] onto the main stack.
+.PP
\f[B]J\f[R]
-Pushes the current value of \f[B]seed\f[R] onto the main stack.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
+: Pushes the current value of \f[B]seed\f[R] onto the main stack.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
+.PP
\f[B]T\f[R]
-Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]ibase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]U\f[R]
-Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]obase\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]V\f[R]
-Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
+.PP
+: Pushes the maximum allowable value of \f[B]scale\f[R] onto the main
stack.
-.RS
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]W\f[R]
-Pushes the maximum (inclusive) integer that can be generated with the
-\f[B]\[cq]\f[R] pseudo-random number generator command.
-.RS
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
+: Pushes the maximum (inclusive) integer that can be generated with the
+\f[B]\[aq]\f[R] pseudo-random number generator command.
+.IP
+.nf
+\f[C]
+This is a **non-portable extension**.
+\f[R]
+.fi
.SS Strings
.PP
The following commands control strings.
@@ -782,233 +909,292 @@ Strings can also be executed as macros.
For example, if the string \f[B][1pR]\f[R] is executed as a macro, then
the code \f[B]1pR\f[R] is executed, meaning that the \f[B]1\f[R] will be
printed with a newline after and then popped from the stack.
-.TP
-\f[B][\f[R]_characters_\f[B]]\f[R]
-Makes a string containing \f[I]characters\f[R] and pushes it onto the
-stack.
-.RS
.PP
-If there are brackets (\f[B][\f[R] and \f[B]]\f[R]) in the string, then
-they must be balanced.
-Unbalanced brackets can be escaped using a backslash (\f[B]\[rs]\f[R])
-character.
+\f[B][\f[R]\f[I]characters\f[R]\f[B]]\f[R]
.PP
+: Makes a string containing \f[I]characters\f[R] and pushes it onto the
+stack.
+.IP
+.nf
+\f[C]
+If there are brackets (**\[rs][** and **\[rs]]**) in the string, then they must be
+balanced. Unbalanced brackets can be escaped using a backslash (**\[rs]\[rs]**)
+character.
+
If there is a backslash character in the string, the character after it
-(even another backslash) is put into the string verbatim, but the
-(first) backslash is not.
-.RE
-.TP
-\f[B]a\f[R]
-The value on top of the stack is popped.
-.RS
+(even another backslash) is put into the string verbatim, but the (first)
+backslash is not.
+\f[R]
+.fi
.PP
-If it is a number, it is truncated and its absolute value is taken.
-The result mod \f[B]UCHAR_MAX+1\f[R] is calculated.
-If that result is \f[B]0\f[R], push an empty string; otherwise, push a
-one-character string where the character is the result of the mod
-interpreted as an ASCII character.
+\f[B]a\f[R]
.PP
-If it is a string, then a new string is made.
-If the original string is empty, the new string is empty.
-If it is not, then the first character of the original string is used to
-create the new string as a one-character string.
-The new string is then pushed onto the stack.
+: The value on top of the stack is popped.
+.IP
+.nf
+\f[C]
+If it is a number, it is truncated and its absolute value is taken. The
+result mod **UCHAR_MAX+1** is calculated. If that result is **0**, push an
+empty string; otherwise, push a one-character string where the character is
+the result of the mod interpreted as an ASCII character.
+
+If it is a string, then a new string is made. If the original string is
+empty, the new string is empty. If it is not, then the first character of
+the original string is used to create the new string as a one-character
+string. The new string is then pushed onto the stack.
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]x\f[R]
-Pops a value off of the top of the stack.
-.RS
.PP
+: Pops a value off of the top of the stack.
+.IP
+.nf
+\f[C]
If it is a number, it is pushed back onto the stack.
-.PP
+
If it is a string, it is executed as a macro.
-.PP
+
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is greater than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
-.PP
-For example, \f[B]0 1>a\f[R] will execute the contents of register
-\f[B]a\f[R], and \f[B]1 0>a\f[R] will not.
+.IP
+.nf
+\f[C]
+For example, **0 1>a** will execute the contents of register **a**, and
+**1 0>a** will not.
+
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not greater than the second (less than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!>\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is less than the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not less than the second (greater than or equal
to), then the contents of register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!<\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is equal to the second, then the contents of register
\f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]
-Pops two values off of the stack that must be numbers and compares them.
+.PP
+: Pops two values off of the stack that must be numbers and compares
+them.
If the first value is not equal to the second, then the contents of
register \f[I]r\f[R] are executed.
-.RS
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+\f[R]
+.fi
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
-.RE
-.TP
\f[B]!=\f[R]\f[I]r\f[R]\f[B]e\f[R]\f[I]s\f[R]
-Like the above, but will execute register \f[I]s\f[R] if the comparison
-fails.
-.RS
.PP
-If either or both of the values are not numbers, dc(1) will raise an
-error and reset (see the \f[B]RESET\f[R] section).
+: Like the above, but will execute register \f[I]s\f[R] if the
+comparison fails.
+.IP
+.nf
+\f[C]
+If either or both of the values are not numbers, dc(1) will raise an error
+and reset (see the **RESET** section).
+
+This is a **non-portable extension**.
+\f[R]
+.fi
.PP
-This is a \f[B]non-portable extension\f[R].
-.RE
-.TP
\f[B]?\f[R]
-Reads a line from the \f[B]stdin\f[R] and executes it.
+.PP
+: Reads a line from the \f[B]stdin\f[R] and executes it.
This is to allow macros to request input from users.
-.TP
+.PP
\f[B]q\f[R]
-During execution of a macro, this exits the execution of that macro and
-the execution of the macro that executed it.
+.PP
+: During execution of a macro, this exits the execution of that macro
+and the execution of the macro that executed it.
If there are no macros, or only one macro executing, dc(1) exits.
-.TP
+.PP
\f[B]Q\f[R]
-Pops a value from the stack which must be non-negative and is used the
+.PP
+: Pops a value from the stack which must be non-negative and is used the
number of macro executions to pop off of the execution stack.
If the number of levels to pop is greater than the number of executing
macros, dc(1) exits.
.SS Status
.PP
These commands query status of the stack or its top value.
-.TP
-\f[B]Z\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, calculates the number of significant decimal digits
-it has and pushes the result.
+\f[B]Z\f[R]
.PP
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, calculates the number of significant decimal digits it
+has and pushes the result.
+
If it is a string, pushes the number of characters the string has.
-.RE
-.TP
+\f[R]
+.fi
+.PP
\f[B]X\f[R]
-Pops a value off of the stack.
-.RS
.PP
-If it is a number, pushes the \f[I]scale\f[R] of the value onto the
-stack.
+: Pops a value off of the stack.
+.IP
+.nf
+\f[C]
+If it is a number, pushes the *scale* of the value onto the stack.
+
+If it is a string, pushes **0**.
+\f[R]
+.fi
.PP
-If it is a string, pushes \f[B]0\f[R].
-.RE
-.TP
\f[B]z\f[R]
-Pushes the current stack depth (before execution of this command).
+.PP
+: Pushes the current stack depth (before execution of this command).
.SS Arrays
.PP
These commands manipulate arrays.
-.TP
+.PP
\f[B]:\f[R]\f[I]r\f[R]
-Pops the top two values off of the stack.
+.PP
+: Pops the top two values off of the stack.
The second value will be stored in the array \f[I]r\f[R] (see the
\f[B]REGISTERS\f[R] section), indexed by the first value.
-.TP
+.PP
\f[B];\f[R]\f[I]r\f[R]
-Pops the value on top of the stack and uses it as an index into the
+.PP
+: Pops the value on top of the stack and uses it as an index into the
array \f[I]r\f[R].
The selected value is then pushed onto the stack.
.SH REGISTERS
@@ -1023,8 +1209,8 @@ their stack.
.PP
In non-extended register mode, a register name is just the single
character that follows any command that needs a register name.
-The only exception is a newline (\f[B]`\[rs]n'\f[R]); it is a parse
-error for a newline to be used as a register name.
+The only exception is a newline (\f[B]\[aq]\[rs]n\[aq]\f[R]); it is a
+parse error for a newline to be used as a register name.
.SS Extended Register Mode
.PP
Unlike most other dc(1) implentations, this dc(1) provides nearly
@@ -1035,7 +1221,7 @@ If extended register mode is enabled (\f[B]-x\f[R] or
normal single character registers are used \f[I]unless\f[R] the
character immediately following a command that needs a register name is
a space (according to \f[B]isspace()\f[R]) and not a newline
-(\f[B]`\[rs]n'\f[R]).
+(\f[B]\[aq]\[rs]n\[aq]\f[R]).
.PP
In that case, the register name is found according to the regex
\f[B][a-z][a-z0-9_]*\f[R] (like bc(1) identifiers), and it is a parse
@@ -1080,64 +1266,77 @@ always at least twice as large as the integer type used to store digits.
.SH LIMITS
.PP
The following are the limits on dc(1):
-.TP
+.PP
\f[B]DC_LONG_BIT\f[R]
-The number of bits in the \f[B]long\f[R] type in the environment where
+.PP
+: The number of bits in the \f[B]long\f[R] type in the environment where
dc(1) was built.
This determines how many decimal digits can be stored in a single large
integer (see the \f[B]PERFORMANCE\f[R] section).
-.TP
+.PP
\f[B]DC_BASE_DIGS\f[R]
-The number of decimal digits per large integer (see the
+.PP
+: The number of decimal digits per large integer (see the
\f[B]PERFORMANCE\f[R] section).
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_POW\f[R]
-The max decimal number that each large integer can store (see
+.PP
+: The max decimal number that each large integer can store (see
\f[B]DC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
Depends on \f[B]DC_BASE_DIGS\f[R].
-.TP
+.PP
\f[B]DC_OVERFLOW_MAX\f[R]
-The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
+.PP
+: The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
section) can hold.
Depends on \f[B]DC_LONG_BIT\f[R].
-.TP
+.PP
\f[B]DC_BASE_MAX\f[R]
-The maximum output base.
+.PP
+: The maximum output base.
Set at \f[B]DC_BASE_POW\f[R].
-.TP
+.PP
\f[B]DC_DIM_MAX\f[R]
-The maximum size of arrays.
+.PP
+: The maximum size of arrays.
Set at \f[B]SIZE_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_SCALE_MAX\f[R]
-The maximum \f[B]scale\f[R].
+.PP
+: The maximum \f[B]scale\f[R].
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_STRING_MAX\f[R]
-The maximum length of strings.
+.PP
+: The maximum length of strings.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NAME_MAX\f[R]
-The maximum length of identifiers.
+.PP
+: The maximum length of identifiers.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_NUM_MAX\f[R]
-The maximum length of a number (in decimal digits), which includes
+.PP
+: The maximum length of a number (in decimal digits), which includes
digits after the decimal point.
Set at \f[B]DC_OVERFLOW_MAX-1\f[R].
-.TP
+.PP
\f[B]DC_RAND_MAX\f[R]
-The maximum integer (inclusive) returned by the \f[B]\[cq]\f[R] command,
-if dc(1).
+.PP
+: The maximum integer (inclusive) returned by the \f[B]\[aq]\f[R]
+command, if dc(1).
Set at \f[B]2\[ha]DC_LONG_BIT-1\f[R].
-.TP
+.PP
Exponent
-The maximum allowable exponent (positive or negative).
+.PP
+: The maximum allowable exponent (positive or negative).
Set at \f[B]DC_OVERFLOW_MAX\f[R].
-.TP
+.PP
Number of vars
-The maximum number of vars/arrays.
+.PP
+: The maximum number of vars/arrays.
Set at \f[B]SIZE_MAX-1\f[R].
.PP
These limits are meant to be effectively non-existent; the limits are so
@@ -1147,104 +1346,117 @@ In fact, memory should be exhausted before these limits should be hit.
.SH ENVIRONMENT VARIABLES
.PP
dc(1) recognizes the following environment variables:
-.TP
+.PP
\f[B]DC_ENV_ARGS\f[R]
-This is another way to give command-line arguments to dc(1).
+.PP
+: This is another way to give command-line arguments to dc(1).
They should be in the same format as all other command-line arguments.
These are always processed first, so any files given in
\f[B]DC_ENV_ARGS\f[R] will be processed before arguments and files given
on the command-line.
-This gives the user the ability to set up \[lq]standard\[rq] options and
+This gives the user the ability to set up \[dq]standard\[dq] options and
files to be used at every invocation.
The most useful thing for such files to contain would be useful
functions that the user might want every time dc(1) runs.
Another use would be to use the \f[B]-e\f[R] option to set
\f[B]scale\f[R] to a value other than \f[B]0\f[R].
-.RS
-.PP
-The code that parses \f[B]DC_ENV_ARGS\f[R] will correctly handle quoted
-arguments, but it does not understand escape sequences.
-For example, the string \f[B]\[lq]/home/gavin/some dc file.dc\[rq]\f[R]
-will be correctly parsed, but the string \f[B]\[lq]/home/gavin/some
-\[dq]dc\[dq] file.dc\[rq]\f[R] will include the backslashes.
-.PP
-The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
-\f[B]\[lq]\f[R]. Thus, if you have a file with any number of single
-quotes in the name, you can use double quotes as the outside quotes, as
-in \f[B]\[rq]some `dc' file.dc\[dq]\f[R], and vice versa if you have a
-file with double quotes.
-However, handling a file with both kinds of quotes in
-\f[B]DC_ENV_ARGS\f[R] is not supported due to the complexity of the
-parsing, though such files are still supported on the command-line where
-the parsing is done by the shell.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+The code that parses **DC_ENV_ARGS** will correctly handle quoted arguments,
+but it does not understand escape sequences. For example, the string
+**\[dq]/home/gavin/some dc file.dc\[dq]** will be correctly parsed, but the string
+**\[dq]/home/gavin/some \[rs]\[dq]dc\[rs]\[dq] file.dc\[dq]** will include the backslashes.
+
+The quote parsing will handle either kind of quotes, **\[aq]** or **\[dq]**. Thus,
+if you have a file with any number of single quotes in the name, you can use
+double quotes as the outside quotes, as in **\[dq]some \[aq]dc\[aq] file.dc\[dq]**, and vice
+versa if you have a file with double quotes. However, handling a file with
+both kinds of quotes in **DC_ENV_ARGS** is not supported due to the
+complexity of the parsing, though such files are still supported on the
+command-line where the parsing is done by the shell.
+\f[R]
+.fi
+.PP
\f[B]DC_LINE_LENGTH\f[R]
-If this environment variable exists and contains an integer that is
+.PP
+: If this environment variable exists and contains an integer that is
greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
(\f[B]2\[ha]16-1\f[R]), dc(1) will output lines to that length,
including the backslash newline combo.
The default line length is \f[B]70\f[R].
-.TP
+.PP
\f[B]DC_EXPR_EXIT\f[R]
-If this variable exists (no matter the contents), dc(1) will exit
+.PP
+: If this variable exists (no matter the contents), dc(1) will exit
immediately after executing expressions and files given by the
\f[B]-e\f[R] and/or \f[B]-f\f[R] command-line options (and any
equivalents).
.SH EXIT STATUS
.PP
dc(1) returns the following exit statuses:
-.TP
+.PP
\f[B]0\f[R]
-No error.
-.TP
+.PP
+: No error.
+.PP
\f[B]1\f[R]
-A math error occurred.
+.PP
+: A math error occurred.
This follows standard practice of using \f[B]1\f[R] for expected errors,
since math errors will happen in the process of normal execution.
-.RS
-.PP
-Math errors include divide by \f[B]0\f[R], taking the square root of a
-negative number, using a negative number as a bound for the
-pseudo-random number generator, attempting to convert a negative number
-to a hardware integer, overflow when converting a number to a hardware
-integer, and attempting to use a non-integer where an integer is
-required.
-.PP
-Converting to a hardware integer happens for the second operand of the
-power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
-(\f[B]H\f[R]), and right shift (\f[B]h\f[R]) operators.
-.RE
-.TP
+.IP
+.nf
+\f[C]
+Math errors include divide by **0**, taking the square root of a negative
+number, using a negative number as a bound for the pseudo-random number
+generator, attempting to convert a negative number to a hardware integer,
+overflow when converting a number to a hardware integer, and attempting to
+use a non-integer where an integer is required.
+
+Converting to a hardware integer happens for the second operand of the power
+(**\[rs]\[ha]**), places (**\[rs]\[at]**), left shift (**H**), and right shift (**h**)
+operators.
+\f[R]
+.fi
+.PP
\f[B]2\f[R]
-A parse error occurred.
-.RS
-.PP
-Parse errors include unexpected \f[B]EOF\f[R], using an invalid
-character, failing to find the end of a string or comment, and using a
-token where it is invalid.
-.RE
-.TP
+.PP
+: A parse error occurred.
+.IP
+.nf
+\f[C]
+Parse errors include unexpected **EOF**, using an invalid character, failing
+to find the end of a string or comment, and using a token where it is
+invalid.
+\f[R]
+.fi
+.PP
\f[B]3\f[R]
-A runtime error occurred.
-.RS
-.PP
-Runtime errors include assigning an invalid number to \f[B]ibase\f[R],
-\f[B]obase\f[R], or \f[B]scale\f[R]; give a bad expression to a
-\f[B]read()\f[R] call, calling \f[B]read()\f[R] inside of a
-\f[B]read()\f[R] call, type errors, and attempting an operation when the
-stack has too few elements.
-.RE
-.TP
+.PP
+: A runtime error occurred.
+.IP
+.nf
+\f[C]
+Runtime errors include assigning an invalid number to **ibase**, **obase**,
+or **scale**; give a bad expression to a **read()** call, calling **read()**
+inside of a **read()** call, type errors, and attempting an operation when
+the stack has too few elements.
+\f[R]
+.fi
+.PP
\f[B]4\f[R]
-A fatal error occurred.
-.RS
.PP
-Fatal errors include memory allocation errors, I/O errors, failing to
-open files, attempting to use files that do not have only ASCII
-characters (dc(1) only accepts ASCII characters), attempting to open a
-directory as a file, and giving invalid command-line options.
-.RE
+: A fatal error occurred.
+.IP
+.nf
+\f[C]
+Fatal errors include memory allocation errors, I/O errors, failing to open
+files, attempting to use files that do not have only ASCII characters (dc(1)
+only accepts ASCII characters), attempting to open a directory as a file,
+and giving invalid command-line options.
+\f[R]
+.fi
.PP
The exit status \f[B]4\f[R] is special; when a fatal error occurs, dc(1)
always exits and returns \f[B]4\f[R], no matter what mode dc(1) is in.
@@ -1272,7 +1484,7 @@ In interactive mode, dc(1) attempts to recover from errors (see the
.SH TTY MODE
.PP
If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
-connected to a TTY, dc(1) turns on \[lq]TTY mode.\[rq]
+connected to a TTY, dc(1) turns on \[dq]TTY mode.\[dq]
.PP
TTY mode is required for history to be enabled (see the \f[B]COMMAND
LINE HISTORY\f[R] section).
@@ -1292,7 +1504,7 @@ If dc(1) is in TTY mode (see the \f[B]TTY MODE\f[R] section), it will
reset (see the \f[B]RESET\f[R] section).
Otherwise, it will clean up and exit.
.PP
-Note that \[lq]current input\[rq] can mean one of two things.
+Note that \[dq]current input\[dq] can mean one of two things.
If dc(1) is processing input from \f[B]stdin\f[R] in TTY mode, it will
ask for more input.
If dc(1) is processing input from a file in TTY mode, it will stop
diff --git a/contrib/bc/manuals/dc/P.1.md b/contrib/bc/manuals/dc/P.1.md
index 0101b68fb872..ccb71bf549fa 100644
--- a/contrib/bc/manuals/dc/P.1.md
+++ b/contrib/bc/manuals/dc/P.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
+**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
# DESCRIPTION
@@ -84,6 +84,12 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
+**-R**, **-\-no-read-prompt**
+
+: This option is a no-op.
+
+ This is a **non-portable extension**.
+
**-x** **-\-extended-register**
: Enables extended register mode. See the *Extended Register Mode* subsection
@@ -553,25 +559,25 @@ These commands control the stack.
These commands control registers (see the **REGISTERS** section).
-**s***r*
+**s**_r_
: Pops the value off the top of the stack and stores it into register *r*.
-**l***r*
+**l**_r_
: Copies the value in register *r* and pushes it onto the stack. This does not
alter the contents of *r*.
-**S***r*
+**S**_r_
: Pops the value off the top of the (main) stack and pushes it onto the stack
of register *r*. The previous value of the register becomes inaccessible.
-**L***r*
+**L**_r_
: Pops the value off the top of the stack for register *r* and push it onto
the main stack. The previous value in the stack for register *r*, if any, is
- now accessible via the **l***r* command.
+ now accessible via the **l**_r_ command.
## Parameters
@@ -720,7 +726,7 @@ will be printed with a newline after and then popped from the stack.
This behavior is the norm whenever a macro is executed, whether by this
command or by the conditional execution commands below.
-**\>***r*
+**\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is greater than the second, then the contents of register
@@ -732,7 +738,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**>***r***e***s*
+**>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -741,7 +747,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\>***r*
+**!\>**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not greater than the second (less than or equal to), then
@@ -750,7 +756,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\>***r***e***s*
+**!\>**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -759,7 +765,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**\<***r*
+**\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is less than the second, then the contents of register *r*
@@ -768,7 +774,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**\<***r***e***s*
+**\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -777,7 +783,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!\<***r*
+**!\<**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not less than the second (greater than or equal to), then
@@ -786,7 +792,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!\<***r***e***s*
+**!\<**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -795,7 +801,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**=***r*
+**=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is equal to the second, then the contents of register *r*
@@ -804,7 +810,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**=***r***e***s*
+**=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -813,7 +819,7 @@ will be printed with a newline after and then popped from the stack.
This is a **non-portable extension**.
-**!=***r*
+**!=**_r_
: Pops two values off of the stack that must be numbers and compares them. If
the first value is not equal to the second, then the contents of register
@@ -822,7 +828,7 @@ will be printed with a newline after and then popped from the stack.
If either or both of the values are not numbers, dc(1) will raise an error
and reset (see the **RESET** section).
-**!=***r***e***s*
+**!=**_r_**e**_s_
: Like the above, but will execute register *s* if the comparison fails.
@@ -878,12 +884,12 @@ These commands query status of the stack or its top value.
These commands manipulate arrays.
-**:***r*
+**:**_r_
: Pops the top two values off of the stack. The second value will be stored in
the array *r* (see the **REGISTERS** section), indexed by the first value.
-**;***r*
+**;**_r_
: Pops the value on top of the stack and uses it as an index into the array
*r*. The selected value is then pushed onto the stack.
diff --git a/contrib/bc/manuals/header_bc.txt b/contrib/bc/manuals/header_bc.txt
index e07d2e79a1ce..594138f68956 100644
--- a/contrib/bc/manuals/header_bc.txt
+++ b/contrib/bc/manuals/header_bc.txt
@@ -1 +1 @@
-.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"
diff --git a/contrib/bc/manuals/header_bcl.txt b/contrib/bc/manuals/header_bcl.txt
index 5933f01f2732..26bbefa1b61e 100644
--- a/contrib/bc/manuals/header_bcl.txt
+++ b/contrib/bc/manuals/header_bcl.txt
@@ -1 +1 @@
-.TH "BCL" "3" "March 2021" "Gavin D. Howard" "Libraries Manual"
+.TH "BCL" "3" "April 2021" "Gavin D. Howard" "Libraries Manual"
diff --git a/contrib/bc/manuals/header_dc.txt b/contrib/bc/manuals/header_dc.txt
index 227aac310a0e..e1e2c98373f5 100644
--- a/contrib/bc/manuals/header_dc.txt
+++ b/contrib/bc/manuals/header_dc.txt
@@ -1 +1 @@
-.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "April 2021" "Gavin D. Howard" "General Commands Manual"