summaryrefslogtreecommitdiff
path: root/manuals
diff options
context:
space:
mode:
Diffstat (limited to 'manuals')
-rw-r--r--manuals/bc/A.1128
-rw-r--r--manuals/bc/A.1.md141
-rw-r--r--manuals/bc/E.1100
-rw-r--r--manuals/bc/E.1.md121
-rw-r--r--manuals/bc/EH.1100
-rw-r--r--manuals/bc/EH.1.md121
-rw-r--r--manuals/bc/EHN.1100
-rw-r--r--manuals/bc/EHN.1.md121
-rw-r--r--manuals/bc/EN.1100
-rw-r--r--manuals/bc/EN.1.md121
-rw-r--r--manuals/bc/H.1128
-rw-r--r--manuals/bc/H.1.md141
-rw-r--r--manuals/bc/HN.1128
-rw-r--r--manuals/bc/HN.1.md141
-rw-r--r--manuals/bc/N.1128
-rw-r--r--manuals/bc/N.1.md141
-rw-r--r--manuals/bcl.316
-rw-r--r--manuals/bcl.3.md10
-rw-r--r--manuals/build.md39
-rw-r--r--manuals/dc/A.177
-rw-r--r--manuals/dc/A.1.md59
-rw-r--r--manuals/dc/E.160
-rw-r--r--manuals/dc/E.1.md48
-rw-r--r--manuals/dc/EH.160
-rw-r--r--manuals/dc/EH.1.md48
-rw-r--r--manuals/dc/EHN.160
-rw-r--r--manuals/dc/EHN.1.md48
-rw-r--r--manuals/dc/EN.160
-rw-r--r--manuals/dc/EN.1.md48
-rw-r--r--manuals/dc/H.177
-rw-r--r--manuals/dc/H.1.md59
-rw-r--r--manuals/dc/HN.177
-rw-r--r--manuals/dc/HN.1.md59
-rw-r--r--manuals/dc/N.177
-rw-r--r--manuals/dc/N.1.md59
35 files changed, 2177 insertions, 824 deletions
diff --git a/manuals/bc/A.1 b/manuals/bc/A.1
index 038932d52ada..f19ed3c9ac78 100644
--- a/manuals/bc/A.1
+++ b/manuals/bc/A.1
@@ -25,7 +25,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "June 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "June 2022" "Gavin D. Howard" "General Commands Manual"
+.nh
+.ad l
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
@@ -38,13 +40,17 @@ bc - arbitrary-precision decimal arithmetic language and calculator
[\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[I]file\f[R]\&...] [\f[B]-I\f[R] \f[I]ibase\f[R]]
+[\f[B]--ibase\f[R]=\f[I]ibase\f[R]] [\f[B]-O\f[R] \f[I]obase\f[R]]
+[\f[B]--obase\f[R]=\f[I]obase\f[R]] [\f[B]-S\f[R] \f[I]scale\f[R]]
+[\f[B]--scale\f[R]=\f[I]scale\f[R]] [\f[B]-E\f[R] \f[I]seed\f[R]]
+[\f[B]--seed\f[R]=\f[I]seed\f[R]]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
1991 by POSIX.
-(The current standard is
-here (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).)
+(The current standard is at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .)
The language provides unlimited precision decimal arithmetic and is
somewhat C-like, but there are differences.
Such differences will be noted in this document.
@@ -287,26 +293,32 @@ multiple times.
Keywords are \f[I]not\f[R] redefined when parsing the builtin math
library (see the \f[B]LIBRARY\f[R] section).
.PP
-It is a fatal error to redefine keywords mandated by the POSIX standard.
+It is a fatal error to redefine keywords mandated by the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
It is a fatal error to attempt to redefine words that this bc(1) does
not reserve as keywords.
.RE
.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
-bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
+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.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given
+unless the \f[B]BC_BANNER\f[R] environment variable is set and contains
+a non-zero integer or if this bc(1) was built with the header displayed
+by default.
+If \f[I]any\f[R] of that is the case, then this option \f[I]does\f[R]
+prevent bc(1) from printing the header.
.RS
.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
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-and error if any extensions are used.
+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
.PP
This is a \f[B]non-portable extension\f[R].
@@ -382,13 +394,57 @@ exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
+.TP
+\f[B]-I\f[R] \f[I]ibase\f[R], \f[B]--ibase\f[R]=\f[I]ibase\f[R]
+Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
+assuming that \f[I]ibase\f[R] is in base 10.
+It is a fatal error if \f[I]ibase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-O\f[R] \f[I]obase\f[R], \f[B]--obase\f[R]=\f[I]obase\f[R]
+Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
+assuming that \f[I]obase\f[R] is in base 10.
+It is a fatal error if \f[I]obase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-S\f[R] \f[I]scale\f[R], \f[B]--scale\f[R]=\f[I]scale\f[R]
+Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
+assuming that \f[I]scale\f[R] is in base 10.
+It is a fatal error if \f[I]scale\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-E\f[R] \f[I]seed\f[R], \f[B]--seed\f[R]=\f[I]seed\f[R]
+Sets the builtin variable \f[B]seed\f[R] to the value \f[I]seed\f[R]
+assuming that \f[I]seed\f[R] is in base 10.
+It is a fatal error if \f[I]seed\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
.PP
If no files or expressions are given by the \f[B]-f\f[R],
\f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then
-bc(1) read from \f[B]stdin\f[R].
+bc(1) reads from \f[B]stdin\f[R].
.PP
However, there are a few caveats to this.
.PP
@@ -435,8 +491,8 @@ redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
.PP
The syntax for bc(1) programs is mostly C-like, with some differences.
-This bc(1) follows the POSIX
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+This bc(1) follows the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
which is a much more thorough resource for the language this bc(1)
accepts.
This section is meant to be a summary and a listing of all the
@@ -1020,8 +1076,8 @@ 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].
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
+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].
@@ -1328,8 +1384,8 @@ when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
are given.
.SS Standard Library
.PP
-The
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
+The standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
.TP
\f[B]s(x)\f[R]
@@ -1385,7 +1441,8 @@ Functions\f[R] subsection below).
The extended library is \f[I]not\f[R] loaded when the
\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R]
options are given since they are not part of the library defined by the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
+standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
The extended library is a \f[B]non-portable extension\f[R].
.TP
@@ -1404,13 +1461,13 @@ Functions\f[R] subsection below).
.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
-the rounding mode round half away from
-\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
+the rounding mode round half away from \f[B]0\f[R]
+(https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
.TP
\f[B]ceil(x, p)\f[R]
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).
+the rounding mode round away from \f[B]0\f[R]
+(https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero).
.TP
\f[B]f(x)\f[R]
Returns the factorial of the truncated absolute value of \f[B]x\f[R].
@@ -2275,11 +2332,11 @@ subsection of the \f[B]FUNCTIONS\f[R] section).
.RE
.SS Transcendental Functions
.PP
-All transcendental functions can return slightly inaccurate results (up
-to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place)).
-This is unavoidable, and this
-article (https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT) explains
-why it is impossible and unnecessary to calculate exact results for the
+All transcendental functions can return slightly inaccurate results, up
+to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place).
+This is unavoidable, and the article at
+https://people.eecs.berkeley.edu/\[ti]wkahan/LOG10HAF.TXT explains why
+it is impossible and unnecessary to calculate exact results for the
transcendental functions.
.PP
Because of the possible inaccuracy, I recommend that users call those
@@ -2558,8 +2615,7 @@ If any expressions or expression files are given on the command-line
with \f[B]-e\f[R], \f[B]--expression\f[R], \f[B]-f\f[R], or
\f[B]--file\f[R], then if this environment variable exists and contains
an integer, a non-zero value makes bc(1) exit after executing the
-expressions and expression files, and a non-zero value makes bc(1) not
-exit.
+expressions and expression files, and a zero value makes bc(1) not exit.
.RS
.PP
This environment variable overrides the default, which can be queried
@@ -2646,8 +2702,8 @@ checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
-Per the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+Per the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
@@ -2680,8 +2736,8 @@ The default setting can be queried with the \f[B]-h\f[R] or
\f[B]--help\f[R] options.
.PP
TTY mode is different from interactive mode because interactive mode is
-required in the bc(1)
-specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+required in the bc(1) standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
to be connected to a terminal.
.SS Command-Line History
@@ -2776,8 +2832,8 @@ dc(1)
.SH STANDARDS
.PP
bc(1) is compliant with the IEEE Std 1003.1-2017
-(\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-specification.
+(\[lq]POSIX.1-2017\[rq]) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
The flags \f[B]-efghiqsvVw\f[R], all long options, and the extensions
noted above are extensions to that specification.
.PP
diff --git a/manuals/bc/A.1.md b/manuals/bc/A.1.md
index 112e98078cf0..6061260ee087 100644
--- a/manuals/bc/A.1.md
+++ b/manuals/bc/A.1.md
@@ -34,14 +34,15 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**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*...]
+**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*...] [**-I** *ibase*] [**-\-ibase**=*ibase*] [**-O** *obase*] [**-\-obase**=*obase*] [**-S** *scale*] [**-\-scale**=*scale*] [**-E** *seed*] [**-\-seed**=*seed*]
# DESCRIPTION
bc(1) is an interactive processor for a language first standardized in 1991 by
-POSIX. (The current standard is [here][1].) The language provides unlimited
-precision decimal arithmetic and is somewhat C-like, but there are differences.
-Such differences will be noted in this document.
+POSIX. (The current standard is at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .) The
+language provides unlimited precision decimal arithmetic and is somewhat C-like,
+but there are differences. Such differences will be noted in this document.
After parsing and handling options, this bc(1) reads any files given on the
command line and executes them before reading from **stdin**.
@@ -223,23 +224,29 @@ The following are the options that bc(1) accepts.
Keywords are *not* redefined when parsing the builtin math library (see the
**LIBRARY** section).
- It is a fatal error to redefine keywords mandated by the POSIX standard. It
- is a fatal error to attempt to redefine words that this bc(1) does not
- reserve as keywords.
+ It is a fatal error to redefine keywords mandated by the POSIX standard
+ (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html). It is
+ a fatal error to attempt to redefine words that this bc(1) does not reserve
+ as keywords.
**-q**, **-\-quiet**
-: This option is for compatibility with the [GNU bc(1)][2]; 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 **-v**, **-V**, or
- **-\-version** options are given.
+: 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 **-v**, **-V**, or **-\-version** options are given
+ unless the **BC_BANNER** environment variable is set and contains a non-zero
+ integer or if this bc(1) was built with the header displayed by default. If
+ *any* of that is the case, then this option *does* prevent bc(1) from
+ printing the header.
This is a **non-portable extension**.
**-s**, **-\-standard**
-: Process exactly the language defined by the [standard][1] and error if any
- extensions are used.
+: Process exactly the language defined by the standard
+ (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) and
+ error if any extensions are used.
This is a **non-portable extension**.
@@ -299,12 +306,48 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
+**-I** *ibase*, **-\-ibase**=*ibase*
+
+: Sets the builtin variable **ibase** to the value *ibase* assuming that
+ *ibase* is in base 10. It is a fatal error if *ibase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-O** *obase*, **-\-obase**=*obase*
+
+: Sets the builtin variable **obase** to the value *obase* assuming that
+ *obase* is in base 10. It is a fatal error if *obase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-S** *scale*, **-\-scale**=*scale*
+
+: Sets the builtin variable **scale** to the value *scale* assuming that
+ *scale* is in base 10. It is a fatal error if *scale* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-E** *seed*, **-\-seed**=*seed*
+
+: Sets the builtin variable **seed** to the value *seed* assuming that *seed*
+ is in base 10. It is a fatal error if *seed* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
All long options are **non-portable extensions**.
# STDIN
If no files or expressions are given by the **-f**, **-\-file**, **-e**, or
-**-\-expression** options, then bc(1) read from **stdin**.
+**-\-expression** options, then bc(1) reads from **stdin**.
However, there are a few caveats to this.
@@ -350,9 +393,10 @@ it is recommended that those scripts be changed to redirect **stderr** to
# SYNTAX
The syntax for bc(1) programs is mostly C-like, with some differences. This
-bc(1) follows the [POSIX standard][1], which is a much more thorough resource
-for the language this bc(1) accepts. This section is meant to be a summary and a
-listing of all the extensions to the standard.
+bc(1) follows the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), which is a
+much more thorough resource for the language this bc(1) accepts. This section is
+meant to be a summary and a listing of all the extensions to the standard.
In the sections below, **E** means expression, **S** means statement, and **I**
means identifier.
@@ -805,9 +849,10 @@ The operators will be described in more detail below.
**assignment** operators, which means that **a=b\>c** is interpreted as
**(a=b)\>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**.
+ 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 **non-portable extension**.
**&&**
@@ -1054,7 +1099,9 @@ equivalents are given.
## Standard Library
-The [standard][1] defines the following functions for the math library:
+The standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) defines the
+following functions for the math library:
**s(x)**
@@ -1102,7 +1149,8 @@ The [standard][1] defines the following functions for the math library:
The extended library is *not* loaded when the **-s**/**-\-standard** or
**-w**/**-\-warn** options are given since they are not part of the library
-defined by the [standard][1].
+defined by the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
The extended library is a **non-portable extension**.
@@ -1119,12 +1167,14 @@ The extended library is a **non-portable extension**.
**r(x, p)**
: Returns **x** rounded to **p** decimal places according to the rounding mode
- [round half away from **0**][3].
+ round half away from **0**
+ (https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
**ceil(x, p)**
: Returns **x** rounded to **p** decimal places according to the rounding mode
- [round away from **0**][6].
+ round away from **0**
+ (https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero).
**f(x)**
@@ -1888,10 +1938,11 @@ The extended library is a **non-portable extension**.
## Transcendental Functions
-All transcendental functions can return slightly inaccurate results (up to 1
-[ULP][4]). This is unavoidable, and [this article][5] explains why it is
-impossible and unnecessary to calculate exact results for the transcendental
-functions.
+All transcendental functions can return slightly inaccurate results, up to 1 ULP
+(https://en.wikipedia.org/wiki/Unit_in_the_last_place). This is unavoidable, and
+the article at https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT explains
+why it is impossible and unnecessary to calculate exact results for the
+transcendental functions.
Because of the possible inaccuracy, I recommend that users call those functions
with the precision (**scale**) set to at least 1 higher than is necessary. If
@@ -2134,8 +2185,8 @@ bc(1) recognizes the following environment variables:
: If any expressions or expression files are given on the command-line with
**-e**, **-\-expression**, **-f**, or **-\-file**, then if this environment
variable exists and contains an integer, a non-zero value makes bc(1) exit
- after executing the expressions and expression files, and a non-zero value
- makes bc(1) not exit.
+ after executing the expressions and expression files, and a zero value makes
+ bc(1) not exit.
This environment variable overrides the default, which can be queried with
the **-h** or **-\-help** options.
@@ -2215,10 +2266,12 @@ checking, and its normal behavior can be forced by using the **-i** flag or
# INTERACTIVE MODE
-Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
-Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
-turn it on in other situations.
+Per the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), bc(1) has
+an interactive mode and a non-interactive mode. Interactive mode is turned on
+automatically when both **stdin** and **stdout** are hooked to a terminal, but
+the **-i** flag and **-\-interactive** option can turn it on in other
+situations.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
section), and in normal execution, flushes **stdout** as soon as execution is
@@ -2244,8 +2297,10 @@ setting is used. The default setting can be queried with the **-h** or
**-\-help** options.
TTY mode is different from interactive mode because interactive mode is required
-in the [bc(1) specification][1], and interactive mode requires only **stdin**
-and **stdout** to be connected to a terminal.
+in the bc(1) standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), and
+interactive mode requires only **stdin** and **stdout** to be connected to a
+terminal.
## Command-Line History
@@ -2331,9 +2386,10 @@ dc(1)
# STANDARDS
-bc(1) is compliant with the [IEEE Std 1003.1-2017 (“POSIX.1-2017”)][1]
-specification. The flags **-efghiqsvVw**, all long options, and the extensions
-noted above are extensions to that specification.
+bc(1) is compliant with the IEEE Std 1003.1-2017 (“POSIX.1-2017”) specification
+at https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html . The
+flags **-efghiqsvVw**, all long options, and the extensions noted above are
+extensions to that specification.
Note that the specification explicitly says that bc(1) only accepts numbers that
use a period (**.**) as a radix point, regardless of the value of
@@ -2349,10 +2405,3 @@ None are known. Report bugs at https://git.yzena.com/gavin/bc.
# AUTHORS
Gavin D. Howard <gavin@yzena.com> and contributors.
-
-[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html
-[2]: https://www.gnu.org/software/bc/
-[3]: https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero
-[4]: https://en.wikipedia.org/wiki/Unit_in_the_last_place
-[5]: https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT
-[6]: https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero
diff --git a/manuals/bc/E.1 b/manuals/bc/E.1
index 6ee1e063ebde..d57b8b50c4af 100644
--- a/manuals/bc/E.1
+++ b/manuals/bc/E.1
@@ -25,7 +25,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "June 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "June 2022" "Gavin D. Howard" "General Commands Manual"
+.nh
+.ad l
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
@@ -43,8 +45,8 @@ bc - arbitrary-precision decimal arithmetic language and calculator
.PP
bc(1) is an interactive processor for a language first standardized in
1991 by POSIX.
-(The current standard is
-here (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).)
+(The current standard is at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .)
The language provides unlimited precision decimal arithmetic and is
somewhat C-like, but there are differences.
Such differences will be noted in this document.
@@ -256,26 +258,32 @@ multiple times.
Keywords are \f[I]not\f[R] redefined when parsing the builtin math
library (see the \f[B]LIBRARY\f[R] section).
.PP
-It is a fatal error to redefine keywords mandated by the POSIX standard.
+It is a fatal error to redefine keywords mandated by the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
It is a fatal error to attempt to redefine words that this bc(1) does
not reserve as keywords.
.RE
.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
-bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
+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.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given
+unless the \f[B]BC_BANNER\f[R] environment variable is set and contains
+a non-zero integer or if this bc(1) was built with the header displayed
+by default.
+If \f[I]any\f[R] of that is the case, then this option \f[I]does\f[R]
+prevent bc(1) from printing the header.
.RS
.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
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-and error if any extensions are used.
+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
.PP
This is a \f[B]non-portable extension\f[R].
@@ -351,13 +359,46 @@ exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
+.TP
+\f[B]-I\f[R] \f[I]ibase\f[R], \f[B]--ibase\f[R]=\f[I]ibase\f[R]
+Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
+assuming that \f[I]ibase\f[R] is in base 10.
+It is a fatal error if \f[I]ibase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-O\f[R] \f[I]obase\f[R], \f[B]--obase\f[R]=\f[I]obase\f[R]
+Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
+assuming that \f[I]obase\f[R] is in base 10.
+It is a fatal error if \f[I]obase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-S\f[R] \f[I]scale\f[R], \f[B]--scale\f[R]=\f[I]scale\f[R]
+Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
+assuming that \f[I]scale\f[R] is in base 10.
+It is a fatal error if \f[I]scale\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
.PP
If no files or expressions are given by the \f[B]-f\f[R],
\f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then
-bc(1) read from \f[B]stdin\f[R].
+bc(1) reads from \f[B]stdin\f[R].
.PP
However, there are a few caveats to this.
.PP
@@ -404,8 +445,8 @@ redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
.PP
The syntax for bc(1) programs is mostly C-like, with some differences.
-This bc(1) follows the POSIX
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+This bc(1) follows the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
which is a much more thorough resource for the language this bc(1)
accepts.
This section is meant to be a summary and a listing of all the
@@ -812,8 +853,8 @@ 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].
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
+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].
@@ -1102,8 +1143,8 @@ All of the functions below are available when the \f[B]-l\f[R] or
\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
-The
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
+The standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
.TP
\f[B]s(x)\f[R]
@@ -1156,11 +1197,11 @@ Functions\f[R] subsection below).
.RE
.SS Transcendental Functions
.PP
-All transcendental functions can return slightly inaccurate results (up
-to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place)).
-This is unavoidable, and this
-article (https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT) explains
-why it is impossible and unnecessary to calculate exact results for the
+All transcendental functions can return slightly inaccurate results, up
+to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place).
+This is unavoidable, and the article at
+https://people.eecs.berkeley.edu/\[ti]wkahan/LOG10HAF.TXT explains why
+it is impossible and unnecessary to calculate exact results for the
transcendental functions.
.PP
Because of the possible inaccuracy, I recommend that users call those
@@ -1406,8 +1447,7 @@ If any expressions or expression files are given on the command-line
with \f[B]-e\f[R], \f[B]--expression\f[R], \f[B]-f\f[R], or
\f[B]--file\f[R], then if this environment variable exists and contains
an integer, a non-zero value makes bc(1) exit after executing the
-expressions and expression files, and a non-zero value makes bc(1) not
-exit.
+expressions and expression files, and a zero value makes bc(1) not exit.
.RS
.PP
This environment variable overrides the default, which can be queried
@@ -1492,8 +1532,8 @@ checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
-Per the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+Per the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
@@ -1526,8 +1566,8 @@ The default setting can be queried with the \f[B]-h\f[R] or
\f[B]--help\f[R] options.
.PP
TTY mode is different from interactive mode because interactive mode is
-required in the bc(1)
-specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+required in the bc(1) standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
to be connected to a terminal.
.SS Command-Line History
@@ -1622,8 +1662,8 @@ dc(1)
.SH STANDARDS
.PP
bc(1) is compliant with the IEEE Std 1003.1-2017
-(\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-specification.
+(\[lq]POSIX.1-2017\[rq]) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
The flags \f[B]-efghiqsvVw\f[R], all long options, and the extensions
noted above are extensions to that specification.
.PP
diff --git a/manuals/bc/E.1.md b/manuals/bc/E.1.md
index ba6e44c248c2..6c562cf69d24 100644
--- a/manuals/bc/E.1.md
+++ b/manuals/bc/E.1.md
@@ -39,9 +39,10 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# DESCRIPTION
bc(1) is an interactive processor for a language first standardized in 1991 by
-POSIX. (The current standard is [here][1].) The language provides unlimited
-precision decimal arithmetic and is somewhat C-like, but there are differences.
-Such differences will be noted in this document.
+POSIX. (The current standard is at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .) The
+language provides unlimited precision decimal arithmetic and is somewhat C-like,
+but there are differences. Such differences will be noted in this document.
After parsing and handling options, this bc(1) reads any files given on the
command line and executes them before reading from **stdin**.
@@ -203,23 +204,29 @@ The following are the options that bc(1) accepts.
Keywords are *not* redefined when parsing the builtin math library (see the
**LIBRARY** section).
- It is a fatal error to redefine keywords mandated by the POSIX standard. It
- is a fatal error to attempt to redefine words that this bc(1) does not
- reserve as keywords.
+ It is a fatal error to redefine keywords mandated by the POSIX standard
+ (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html). It is
+ a fatal error to attempt to redefine words that this bc(1) does not reserve
+ as keywords.
**-q**, **-\-quiet**
-: This option is for compatibility with the [GNU bc(1)][2]; 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 **-v**, **-V**, or
- **-\-version** options are given.
+: 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 **-v**, **-V**, or **-\-version** options are given
+ unless the **BC_BANNER** environment variable is set and contains a non-zero
+ integer or if this bc(1) was built with the header displayed by default. If
+ *any* of that is the case, then this option *does* prevent bc(1) from
+ printing the header.
This is a **non-portable extension**.
**-s**, **-\-standard**
-: Process exactly the language defined by the [standard][1] and error if any
- extensions are used.
+: Process exactly the language defined by the standard
+ (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) and
+ error if any extensions are used.
This is a **non-portable extension**.
@@ -279,12 +286,39 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
+**-I** *ibase*, **-\-ibase**=*ibase*
+
+: Sets the builtin variable **ibase** to the value *ibase* assuming that
+ *ibase* is in base 10. It is a fatal error if *ibase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-O** *obase*, **-\-obase**=*obase*
+
+: Sets the builtin variable **obase** to the value *obase* assuming that
+ *obase* is in base 10. It is a fatal error if *obase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-S** *scale*, **-\-scale**=*scale*
+
+: Sets the builtin variable **scale** to the value *scale* assuming that
+ *scale* is in base 10. It is a fatal error if *scale* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
All long options are **non-portable extensions**.
# STDIN
If no files or expressions are given by the **-f**, **-\-file**, **-e**, or
-**-\-expression** options, then bc(1) read from **stdin**.
+**-\-expression** options, then bc(1) reads from **stdin**.
However, there are a few caveats to this.
@@ -330,9 +364,10 @@ it is recommended that those scripts be changed to redirect **stderr** to
# SYNTAX
The syntax for bc(1) programs is mostly C-like, with some differences. This
-bc(1) follows the [POSIX standard][1], which is a much more thorough resource
-for the language this bc(1) accepts. This section is meant to be a summary and a
-listing of all the extensions to the standard.
+bc(1) follows the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), which is a
+much more thorough resource for the language this bc(1) accepts. This section is
+meant to be a summary and a listing of all the extensions to the standard.
In the sections below, **E** means expression, **S** means statement, and **I**
means identifier.
@@ -648,9 +683,10 @@ The operators will be described in more detail below.
**assignment** operators, which means that **a=b\>c** is interpreted as
**(a=b)\>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**.
+ 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 **non-portable extension**.
**&&**
@@ -883,7 +919,9 @@ command-line flags are given.
## Standard Library
-The [standard][1] defines the following functions for the math library:
+The standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) defines the
+following functions for the math library:
**s(x)**
@@ -929,10 +967,11 @@ The [standard][1] defines the following functions for the math library:
## Transcendental Functions
-All transcendental functions can return slightly inaccurate results (up to 1
-[ULP][4]). This is unavoidable, and [this article][5] explains why it is
-impossible and unnecessary to calculate exact results for the transcendental
-functions.
+All transcendental functions can return slightly inaccurate results, up to 1 ULP
+(https://en.wikipedia.org/wiki/Unit_in_the_last_place). This is unavoidable, and
+the article at https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT explains
+why it is impossible and unnecessary to calculate exact results for the
+transcendental functions.
Because of the possible inaccuracy, I recommend that users call those functions
with the precision (**scale**) set to at least 1 higher than is necessary. If
@@ -1154,8 +1193,8 @@ bc(1) recognizes the following environment variables:
: If any expressions or expression files are given on the command-line with
**-e**, **-\-expression**, **-f**, or **-\-file**, then if this environment
variable exists and contains an integer, a non-zero value makes bc(1) exit
- after executing the expressions and expression files, and a non-zero value
- makes bc(1) not exit.
+ after executing the expressions and expression files, and a zero value makes
+ bc(1) not exit.
This environment variable overrides the default, which can be queried with
the **-h** or **-\-help** options.
@@ -1233,10 +1272,12 @@ checking, and its normal behavior can be forced by using the **-i** flag or
# INTERACTIVE MODE
-Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
-Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
-turn it on in other situations.
+Per the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), bc(1) has
+an interactive mode and a non-interactive mode. Interactive mode is turned on
+automatically when both **stdin** and **stdout** are hooked to a terminal, but
+the **-i** flag and **-\-interactive** option can turn it on in other
+situations.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
section), and in normal execution, flushes **stdout** as soon as execution is
@@ -1262,8 +1303,10 @@ setting is used. The default setting can be queried with the **-h** or
**-\-help** options.
TTY mode is different from interactive mode because interactive mode is required
-in the [bc(1) specification][1], and interactive mode requires only **stdin**
-and **stdout** to be connected to a terminal.
+in the bc(1) standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), and
+interactive mode requires only **stdin** and **stdout** to be connected to a
+terminal.
## Command-Line History
@@ -1349,9 +1392,10 @@ dc(1)
# STANDARDS
-bc(1) is compliant with the [IEEE Std 1003.1-2017 (“POSIX.1-2017”)][1]
-specification. The flags **-efghiqsvVw**, all long options, and the extensions
-noted above are extensions to that specification.
+bc(1) is compliant with the IEEE Std 1003.1-2017 (“POSIX.1-2017”) specification
+at https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html . The
+flags **-efghiqsvVw**, all long options, and the extensions noted above are
+extensions to that specification.
Note that the specification explicitly says that bc(1) only accepts numbers that
use a period (**.**) as a radix point, regardless of the value of
@@ -1367,10 +1411,3 @@ None are known. Report bugs at https://git.yzena.com/gavin/bc.
# AUTHORS
Gavin D. Howard <gavin@yzena.com> and contributors.
-
-[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html
-[2]: https://www.gnu.org/software/bc/
-[3]: https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero
-[4]: https://en.wikipedia.org/wiki/Unit_in_the_last_place
-[5]: https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT
-[6]: https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero
diff --git a/manuals/bc/EH.1 b/manuals/bc/EH.1
index 4509583a0141..95b94ae90e8e 100644
--- a/manuals/bc/EH.1
+++ b/manuals/bc/EH.1
@@ -25,7 +25,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "June 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "June 2022" "Gavin D. Howard" "General Commands Manual"
+.nh
+.ad l
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
@@ -43,8 +45,8 @@ bc - arbitrary-precision decimal arithmetic language and calculator
.PP
bc(1) is an interactive processor for a language first standardized in
1991 by POSIX.
-(The current standard is
-here (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).)
+(The current standard is at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .)
The language provides unlimited precision decimal arithmetic and is
somewhat C-like, but there are differences.
Such differences will be noted in this document.
@@ -256,26 +258,32 @@ multiple times.
Keywords are \f[I]not\f[R] redefined when parsing the builtin math
library (see the \f[B]LIBRARY\f[R] section).
.PP
-It is a fatal error to redefine keywords mandated by the POSIX standard.
+It is a fatal error to redefine keywords mandated by the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
It is a fatal error to attempt to redefine words that this bc(1) does
not reserve as keywords.
.RE
.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
-bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
+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.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given
+unless the \f[B]BC_BANNER\f[R] environment variable is set and contains
+a non-zero integer or if this bc(1) was built with the header displayed
+by default.
+If \f[I]any\f[R] of that is the case, then this option \f[I]does\f[R]
+prevent bc(1) from printing the header.
.RS
.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
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-and error if any extensions are used.
+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
.PP
This is a \f[B]non-portable extension\f[R].
@@ -351,13 +359,46 @@ exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
+.TP
+\f[B]-I\f[R] \f[I]ibase\f[R], \f[B]--ibase\f[R]=\f[I]ibase\f[R]
+Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
+assuming that \f[I]ibase\f[R] is in base 10.
+It is a fatal error if \f[I]ibase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-O\f[R] \f[I]obase\f[R], \f[B]--obase\f[R]=\f[I]obase\f[R]
+Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
+assuming that \f[I]obase\f[R] is in base 10.
+It is a fatal error if \f[I]obase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-S\f[R] \f[I]scale\f[R], \f[B]--scale\f[R]=\f[I]scale\f[R]
+Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
+assuming that \f[I]scale\f[R] is in base 10.
+It is a fatal error if \f[I]scale\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
.PP
If no files or expressions are given by the \f[B]-f\f[R],
\f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then
-bc(1) read from \f[B]stdin\f[R].
+bc(1) reads from \f[B]stdin\f[R].
.PP
However, there are a few caveats to this.
.PP
@@ -404,8 +445,8 @@ redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
.PP
The syntax for bc(1) programs is mostly C-like, with some differences.
-This bc(1) follows the POSIX
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+This bc(1) follows the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
which is a much more thorough resource for the language this bc(1)
accepts.
This section is meant to be a summary and a listing of all the
@@ -812,8 +853,8 @@ 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].
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
+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].
@@ -1102,8 +1143,8 @@ All of the functions below are available when the \f[B]-l\f[R] or
\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
-The
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
+The standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
.TP
\f[B]s(x)\f[R]
@@ -1156,11 +1197,11 @@ Functions\f[R] subsection below).
.RE
.SS Transcendental Functions
.PP
-All transcendental functions can return slightly inaccurate results (up
-to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place)).
-This is unavoidable, and this
-article (https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT) explains
-why it is impossible and unnecessary to calculate exact results for the
+All transcendental functions can return slightly inaccurate results, up
+to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place).
+This is unavoidable, and the article at
+https://people.eecs.berkeley.edu/\[ti]wkahan/LOG10HAF.TXT explains why
+it is impossible and unnecessary to calculate exact results for the
transcendental functions.
.PP
Because of the possible inaccuracy, I recommend that users call those
@@ -1406,8 +1447,7 @@ If any expressions or expression files are given on the command-line
with \f[B]-e\f[R], \f[B]--expression\f[R], \f[B]-f\f[R], or
\f[B]--file\f[R], then if this environment variable exists and contains
an integer, a non-zero value makes bc(1) exit after executing the
-expressions and expression files, and a non-zero value makes bc(1) not
-exit.
+expressions and expression files, and a zero value makes bc(1) not exit.
.RS
.PP
This environment variable overrides the default, which can be queried
@@ -1492,8 +1532,8 @@ checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
-Per the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+Per the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
@@ -1526,8 +1566,8 @@ The default setting can be queried with the \f[B]-h\f[R] or
\f[B]--help\f[R] options.
.PP
TTY mode is different from interactive mode because interactive mode is
-required in the bc(1)
-specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+required in the bc(1) standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
to be connected to a terminal.
.SS Prompt
@@ -1593,8 +1633,8 @@ dc(1)
.SH STANDARDS
.PP
bc(1) is compliant with the IEEE Std 1003.1-2017
-(\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-specification.
+(\[lq]POSIX.1-2017\[rq]) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
The flags \f[B]-efghiqsvVw\f[R], all long options, and the extensions
noted above are extensions to that specification.
.PP
diff --git a/manuals/bc/EH.1.md b/manuals/bc/EH.1.md
index 2178c375cb92..82c3d6c36159 100644
--- a/manuals/bc/EH.1.md
+++ b/manuals/bc/EH.1.md
@@ -39,9 +39,10 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# DESCRIPTION
bc(1) is an interactive processor for a language first standardized in 1991 by
-POSIX. (The current standard is [here][1].) The language provides unlimited
-precision decimal arithmetic and is somewhat C-like, but there are differences.
-Such differences will be noted in this document.
+POSIX. (The current standard is at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .) The
+language provides unlimited precision decimal arithmetic and is somewhat C-like,
+but there are differences. Such differences will be noted in this document.
After parsing and handling options, this bc(1) reads any files given on the
command line and executes them before reading from **stdin**.
@@ -203,23 +204,29 @@ The following are the options that bc(1) accepts.
Keywords are *not* redefined when parsing the builtin math library (see the
**LIBRARY** section).
- It is a fatal error to redefine keywords mandated by the POSIX standard. It
- is a fatal error to attempt to redefine words that this bc(1) does not
- reserve as keywords.
+ It is a fatal error to redefine keywords mandated by the POSIX standard
+ (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html). It is
+ a fatal error to attempt to redefine words that this bc(1) does not reserve
+ as keywords.
**-q**, **-\-quiet**
-: This option is for compatibility with the [GNU bc(1)][2]; 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 **-v**, **-V**, or
- **-\-version** options are given.
+: 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 **-v**, **-V**, or **-\-version** options are given
+ unless the **BC_BANNER** environment variable is set and contains a non-zero
+ integer or if this bc(1) was built with the header displayed by default. If
+ *any* of that is the case, then this option *does* prevent bc(1) from
+ printing the header.
This is a **non-portable extension**.
**-s**, **-\-standard**
-: Process exactly the language defined by the [standard][1] and error if any
- extensions are used.
+: Process exactly the language defined by the standard
+ (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) and
+ error if any extensions are used.
This is a **non-portable extension**.
@@ -279,12 +286,39 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
+**-I** *ibase*, **-\-ibase**=*ibase*
+
+: Sets the builtin variable **ibase** to the value *ibase* assuming that
+ *ibase* is in base 10. It is a fatal error if *ibase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-O** *obase*, **-\-obase**=*obase*
+
+: Sets the builtin variable **obase** to the value *obase* assuming that
+ *obase* is in base 10. It is a fatal error if *obase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-S** *scale*, **-\-scale**=*scale*
+
+: Sets the builtin variable **scale** to the value *scale* assuming that
+ *scale* is in base 10. It is a fatal error if *scale* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
All long options are **non-portable extensions**.
# STDIN
If no files or expressions are given by the **-f**, **-\-file**, **-e**, or
-**-\-expression** options, then bc(1) read from **stdin**.
+**-\-expression** options, then bc(1) reads from **stdin**.
However, there are a few caveats to this.
@@ -330,9 +364,10 @@ it is recommended that those scripts be changed to redirect **stderr** to
# SYNTAX
The syntax for bc(1) programs is mostly C-like, with some differences. This
-bc(1) follows the [POSIX standard][1], which is a much more thorough resource
-for the language this bc(1) accepts. This section is meant to be a summary and a
-listing of all the extensions to the standard.
+bc(1) follows the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), which is a
+much more thorough resource for the language this bc(1) accepts. This section is
+meant to be a summary and a listing of all the extensions to the standard.
In the sections below, **E** means expression, **S** means statement, and **I**
means identifier.
@@ -648,9 +683,10 @@ The operators will be described in more detail below.
**assignment** operators, which means that **a=b\>c** is interpreted as
**(a=b)\>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**.
+ 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 **non-portable extension**.
**&&**
@@ -883,7 +919,9 @@ command-line flags are given.
## Standard Library
-The [standard][1] defines the following functions for the math library:
+The standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) defines the
+following functions for the math library:
**s(x)**
@@ -929,10 +967,11 @@ The [standard][1] defines the following functions for the math library:
## Transcendental Functions
-All transcendental functions can return slightly inaccurate results (up to 1
-[ULP][4]). This is unavoidable, and [this article][5] explains why it is
-impossible and unnecessary to calculate exact results for the transcendental
-functions.
+All transcendental functions can return slightly inaccurate results, up to 1 ULP
+(https://en.wikipedia.org/wiki/Unit_in_the_last_place). This is unavoidable, and
+the article at https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT explains
+why it is impossible and unnecessary to calculate exact results for the
+transcendental functions.
Because of the possible inaccuracy, I recommend that users call those functions
with the precision (**scale**) set to at least 1 higher than is necessary. If
@@ -1154,8 +1193,8 @@ bc(1) recognizes the following environment variables:
: If any expressions or expression files are given on the command-line with
**-e**, **-\-expression**, **-f**, or **-\-file**, then if this environment
variable exists and contains an integer, a non-zero value makes bc(1) exit
- after executing the expressions and expression files, and a non-zero value
- makes bc(1) not exit.
+ after executing the expressions and expression files, and a zero value makes
+ bc(1) not exit.
This environment variable overrides the default, which can be queried with
the **-h** or **-\-help** options.
@@ -1233,10 +1272,12 @@ checking, and its normal behavior can be forced by using the **-i** flag or
# INTERACTIVE MODE
-Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
-Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
-turn it on in other situations.
+Per the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), bc(1) has
+an interactive mode and a non-interactive mode. Interactive mode is turned on
+automatically when both **stdin** and **stdout** are hooked to a terminal, but
+the **-i** flag and **-\-interactive** option can turn it on in other
+situations.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
section), and in normal execution, flushes **stdout** as soon as execution is
@@ -1262,8 +1303,10 @@ setting is used. The default setting can be queried with the **-h** or
**-\-help** options.
TTY mode is different from interactive mode because interactive mode is required
-in the [bc(1) specification][1], and interactive mode requires only **stdin**
-and **stdout** to be connected to a terminal.
+in the bc(1) standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), and
+interactive mode requires only **stdin** and **stdout** to be connected to a
+terminal.
## Prompt
@@ -1323,9 +1366,10 @@ dc(1)
# STANDARDS
-bc(1) is compliant with the [IEEE Std 1003.1-2017 (“POSIX.1-2017”)][1]
-specification. The flags **-efghiqsvVw**, all long options, and the extensions
-noted above are extensions to that specification.
+bc(1) is compliant with the IEEE Std 1003.1-2017 (“POSIX.1-2017”) specification
+at https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html . The
+flags **-efghiqsvVw**, all long options, and the extensions noted above are
+extensions to that specification.
Note that the specification explicitly says that bc(1) only accepts numbers that
use a period (**.**) as a radix point, regardless of the value of
@@ -1341,10 +1385,3 @@ None are known. Report bugs at https://git.yzena.com/gavin/bc.
# AUTHORS
Gavin D. Howard <gavin@yzena.com> and contributors.
-
-[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html
-[2]: https://www.gnu.org/software/bc/
-[3]: https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero
-[4]: https://en.wikipedia.org/wiki/Unit_in_the_last_place
-[5]: https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT
-[6]: https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero
diff --git a/manuals/bc/EHN.1 b/manuals/bc/EHN.1
index 6b49f3651d5a..ca88115a5864 100644
--- a/manuals/bc/EHN.1
+++ b/manuals/bc/EHN.1
@@ -25,7 +25,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "June 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "June 2022" "Gavin D. Howard" "General Commands Manual"
+.nh
+.ad l
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
@@ -43,8 +45,8 @@ bc - arbitrary-precision decimal arithmetic language and calculator
.PP
bc(1) is an interactive processor for a language first standardized in
1991 by POSIX.
-(The current standard is
-here (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).)
+(The current standard is at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .)
The language provides unlimited precision decimal arithmetic and is
somewhat C-like, but there are differences.
Such differences will be noted in this document.
@@ -256,26 +258,32 @@ multiple times.
Keywords are \f[I]not\f[R] redefined when parsing the builtin math
library (see the \f[B]LIBRARY\f[R] section).
.PP
-It is a fatal error to redefine keywords mandated by the POSIX standard.
+It is a fatal error to redefine keywords mandated by the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
It is a fatal error to attempt to redefine words that this bc(1) does
not reserve as keywords.
.RE
.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
-bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
+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.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given
+unless the \f[B]BC_BANNER\f[R] environment variable is set and contains
+a non-zero integer or if this bc(1) was built with the header displayed
+by default.
+If \f[I]any\f[R] of that is the case, then this option \f[I]does\f[R]
+prevent bc(1) from printing the header.
.RS
.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
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-and error if any extensions are used.
+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
.PP
This is a \f[B]non-portable extension\f[R].
@@ -351,13 +359,46 @@ exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
+.TP
+\f[B]-I\f[R] \f[I]ibase\f[R], \f[B]--ibase\f[R]=\f[I]ibase\f[R]
+Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
+assuming that \f[I]ibase\f[R] is in base 10.
+It is a fatal error if \f[I]ibase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-O\f[R] \f[I]obase\f[R], \f[B]--obase\f[R]=\f[I]obase\f[R]
+Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
+assuming that \f[I]obase\f[R] is in base 10.
+It is a fatal error if \f[I]obase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-S\f[R] \f[I]scale\f[R], \f[B]--scale\f[R]=\f[I]scale\f[R]
+Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
+assuming that \f[I]scale\f[R] is in base 10.
+It is a fatal error if \f[I]scale\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
.PP
If no files or expressions are given by the \f[B]-f\f[R],
\f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then
-bc(1) read from \f[B]stdin\f[R].
+bc(1) reads from \f[B]stdin\f[R].
.PP
However, there are a few caveats to this.
.PP
@@ -404,8 +445,8 @@ redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
.PP
The syntax for bc(1) programs is mostly C-like, with some differences.
-This bc(1) follows the POSIX
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+This bc(1) follows the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
which is a much more thorough resource for the language this bc(1)
accepts.
This section is meant to be a summary and a listing of all the
@@ -812,8 +853,8 @@ 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].
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
+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].
@@ -1102,8 +1143,8 @@ All of the functions below are available when the \f[B]-l\f[R] or
\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
-The
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
+The standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
.TP
\f[B]s(x)\f[R]
@@ -1156,11 +1197,11 @@ Functions\f[R] subsection below).
.RE
.SS Transcendental Functions
.PP
-All transcendental functions can return slightly inaccurate results (up
-to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place)).
-This is unavoidable, and this
-article (https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT) explains
-why it is impossible and unnecessary to calculate exact results for the
+All transcendental functions can return slightly inaccurate results, up
+to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place).
+This is unavoidable, and the article at
+https://people.eecs.berkeley.edu/\[ti]wkahan/LOG10HAF.TXT explains why
+it is impossible and unnecessary to calculate exact results for the
transcendental functions.
.PP
Because of the possible inaccuracy, I recommend that users call those
@@ -1406,8 +1447,7 @@ If any expressions or expression files are given on the command-line
with \f[B]-e\f[R], \f[B]--expression\f[R], \f[B]-f\f[R], or
\f[B]--file\f[R], then if this environment variable exists and contains
an integer, a non-zero value makes bc(1) exit after executing the
-expressions and expression files, and a non-zero value makes bc(1) not
-exit.
+expressions and expression files, and a zero value makes bc(1) not exit.
.RS
.PP
This environment variable overrides the default, which can be queried
@@ -1492,8 +1532,8 @@ checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
-Per the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+Per the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
@@ -1526,8 +1566,8 @@ The default setting can be queried with the \f[B]-h\f[R] or
\f[B]--help\f[R] options.
.PP
TTY mode is different from interactive mode because interactive mode is
-required in the bc(1)
-specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+required in the bc(1) standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
to be connected to a terminal.
.SS Prompt
@@ -1589,8 +1629,8 @@ dc(1)
.SH STANDARDS
.PP
bc(1) is compliant with the IEEE Std 1003.1-2017
-(\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-specification.
+(\[lq]POSIX.1-2017\[rq]) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
The flags \f[B]-efghiqsvVw\f[R], all long options, and the extensions
noted above are extensions to that specification.
.PP
diff --git a/manuals/bc/EHN.1.md b/manuals/bc/EHN.1.md
index 3b60d3d0251b..d3873ba6ac97 100644
--- a/manuals/bc/EHN.1.md
+++ b/manuals/bc/EHN.1.md
@@ -39,9 +39,10 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# DESCRIPTION
bc(1) is an interactive processor for a language first standardized in 1991 by
-POSIX. (The current standard is [here][1].) The language provides unlimited
-precision decimal arithmetic and is somewhat C-like, but there are differences.
-Such differences will be noted in this document.
+POSIX. (The current standard is at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .) The
+language provides unlimited precision decimal arithmetic and is somewhat C-like,
+but there are differences. Such differences will be noted in this document.
After parsing and handling options, this bc(1) reads any files given on the
command line and executes them before reading from **stdin**.
@@ -203,23 +204,29 @@ The following are the options that bc(1) accepts.
Keywords are *not* redefined when parsing the builtin math library (see the
**LIBRARY** section).
- It is a fatal error to redefine keywords mandated by the POSIX standard. It
- is a fatal error to attempt to redefine words that this bc(1) does not
- reserve as keywords.
+ It is a fatal error to redefine keywords mandated by the POSIX standard
+ (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html). It is
+ a fatal error to attempt to redefine words that this bc(1) does not reserve
+ as keywords.
**-q**, **-\-quiet**
-: This option is for compatibility with the [GNU bc(1)][2]; 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 **-v**, **-V**, or
- **-\-version** options are given.
+: 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 **-v**, **-V**, or **-\-version** options are given
+ unless the **BC_BANNER** environment variable is set and contains a non-zero
+ integer or if this bc(1) was built with the header displayed by default. If
+ *any* of that is the case, then this option *does* prevent bc(1) from
+ printing the header.
This is a **non-portable extension**.
**-s**, **-\-standard**
-: Process exactly the language defined by the [standard][1] and error if any
- extensions are used.
+: Process exactly the language defined by the standard
+ (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) and
+ error if any extensions are used.
This is a **non-portable extension**.
@@ -279,12 +286,39 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
+**-I** *ibase*, **-\-ibase**=*ibase*
+
+: Sets the builtin variable **ibase** to the value *ibase* assuming that
+ *ibase* is in base 10. It is a fatal error if *ibase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-O** *obase*, **-\-obase**=*obase*
+
+: Sets the builtin variable **obase** to the value *obase* assuming that
+ *obase* is in base 10. It is a fatal error if *obase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-S** *scale*, **-\-scale**=*scale*
+
+: Sets the builtin variable **scale** to the value *scale* assuming that
+ *scale* is in base 10. It is a fatal error if *scale* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
All long options are **non-portable extensions**.
# STDIN
If no files or expressions are given by the **-f**, **-\-file**, **-e**, or
-**-\-expression** options, then bc(1) read from **stdin**.
+**-\-expression** options, then bc(1) reads from **stdin**.
However, there are a few caveats to this.
@@ -330,9 +364,10 @@ it is recommended that those scripts be changed to redirect **stderr** to
# SYNTAX
The syntax for bc(1) programs is mostly C-like, with some differences. This
-bc(1) follows the [POSIX standard][1], which is a much more thorough resource
-for the language this bc(1) accepts. This section is meant to be a summary and a
-listing of all the extensions to the standard.
+bc(1) follows the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), which is a
+much more thorough resource for the language this bc(1) accepts. This section is
+meant to be a summary and a listing of all the extensions to the standard.
In the sections below, **E** means expression, **S** means statement, and **I**
means identifier.
@@ -648,9 +683,10 @@ The operators will be described in more detail below.
**assignment** operators, which means that **a=b\>c** is interpreted as
**(a=b)\>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**.
+ 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 **non-portable extension**.
**&&**
@@ -883,7 +919,9 @@ command-line flags are given.
## Standard Library
-The [standard][1] defines the following functions for the math library:
+The standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) defines the
+following functions for the math library:
**s(x)**
@@ -929,10 +967,11 @@ The [standard][1] defines the following functions for the math library:
## Transcendental Functions
-All transcendental functions can return slightly inaccurate results (up to 1
-[ULP][4]). This is unavoidable, and [this article][5] explains why it is
-impossible and unnecessary to calculate exact results for the transcendental
-functions.
+All transcendental functions can return slightly inaccurate results, up to 1 ULP
+(https://en.wikipedia.org/wiki/Unit_in_the_last_place). This is unavoidable, and
+the article at https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT explains
+why it is impossible and unnecessary to calculate exact results for the
+transcendental functions.
Because of the possible inaccuracy, I recommend that users call those functions
with the precision (**scale**) set to at least 1 higher than is necessary. If
@@ -1154,8 +1193,8 @@ bc(1) recognizes the following environment variables:
: If any expressions or expression files are given on the command-line with
**-e**, **-\-expression**, **-f**, or **-\-file**, then if this environment
variable exists and contains an integer, a non-zero value makes bc(1) exit
- after executing the expressions and expression files, and a non-zero value
- makes bc(1) not exit.
+ after executing the expressions and expression files, and a zero value makes
+ bc(1) not exit.
This environment variable overrides the default, which can be queried with
the **-h** or **-\-help** options.
@@ -1233,10 +1272,12 @@ checking, and its normal behavior can be forced by using the **-i** flag or
# INTERACTIVE MODE
-Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
-Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
-turn it on in other situations.
+Per the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), bc(1) has
+an interactive mode and a non-interactive mode. Interactive mode is turned on
+automatically when both **stdin** and **stdout** are hooked to a terminal, but
+the **-i** flag and **-\-interactive** option can turn it on in other
+situations.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
section), and in normal execution, flushes **stdout** as soon as execution is
@@ -1262,8 +1303,10 @@ setting is used. The default setting can be queried with the **-h** or
**-\-help** options.
TTY mode is different from interactive mode because interactive mode is required
-in the [bc(1) specification][1], and interactive mode requires only **stdin**
-and **stdout** to be connected to a terminal.
+in the bc(1) standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), and
+interactive mode requires only **stdin** and **stdout** to be connected to a
+terminal.
## Prompt
@@ -1318,9 +1361,10 @@ dc(1)
# STANDARDS
-bc(1) is compliant with the [IEEE Std 1003.1-2017 (“POSIX.1-2017”)][1]
-specification. The flags **-efghiqsvVw**, all long options, and the extensions
-noted above are extensions to that specification.
+bc(1) is compliant with the IEEE Std 1003.1-2017 (“POSIX.1-2017”) specification
+at https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html . The
+flags **-efghiqsvVw**, all long options, and the extensions noted above are
+extensions to that specification.
Note that the specification explicitly says that bc(1) only accepts numbers that
use a period (**.**) as a radix point, regardless of the value of
@@ -1333,10 +1377,3 @@ None are known. Report bugs at https://git.yzena.com/gavin/bc.
# AUTHORS
Gavin D. Howard <gavin@yzena.com> and contributors.
-
-[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html
-[2]: https://www.gnu.org/software/bc/
-[3]: https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero
-[4]: https://en.wikipedia.org/wiki/Unit_in_the_last_place
-[5]: https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT
-[6]: https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero
diff --git a/manuals/bc/EN.1 b/manuals/bc/EN.1
index c4704807fac6..1f1e60aad093 100644
--- a/manuals/bc/EN.1
+++ b/manuals/bc/EN.1
@@ -25,7 +25,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "June 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "June 2022" "Gavin D. Howard" "General Commands Manual"
+.nh
+.ad l
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
@@ -43,8 +45,8 @@ bc - arbitrary-precision decimal arithmetic language and calculator
.PP
bc(1) is an interactive processor for a language first standardized in
1991 by POSIX.
-(The current standard is
-here (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).)
+(The current standard is at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .)
The language provides unlimited precision decimal arithmetic and is
somewhat C-like, but there are differences.
Such differences will be noted in this document.
@@ -256,26 +258,32 @@ multiple times.
Keywords are \f[I]not\f[R] redefined when parsing the builtin math
library (see the \f[B]LIBRARY\f[R] section).
.PP
-It is a fatal error to redefine keywords mandated by the POSIX standard.
+It is a fatal error to redefine keywords mandated by the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
It is a fatal error to attempt to redefine words that this bc(1) does
not reserve as keywords.
.RE
.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
-bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
+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.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given
+unless the \f[B]BC_BANNER\f[R] environment variable is set and contains
+a non-zero integer or if this bc(1) was built with the header displayed
+by default.
+If \f[I]any\f[R] of that is the case, then this option \f[I]does\f[R]
+prevent bc(1) from printing the header.
.RS
.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
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-and error if any extensions are used.
+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
.PP
This is a \f[B]non-portable extension\f[R].
@@ -351,13 +359,46 @@ exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
+.TP
+\f[B]-I\f[R] \f[I]ibase\f[R], \f[B]--ibase\f[R]=\f[I]ibase\f[R]
+Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
+assuming that \f[I]ibase\f[R] is in base 10.
+It is a fatal error if \f[I]ibase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-O\f[R] \f[I]obase\f[R], \f[B]--obase\f[R]=\f[I]obase\f[R]
+Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
+assuming that \f[I]obase\f[R] is in base 10.
+It is a fatal error if \f[I]obase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-S\f[R] \f[I]scale\f[R], \f[B]--scale\f[R]=\f[I]scale\f[R]
+Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
+assuming that \f[I]scale\f[R] is in base 10.
+It is a fatal error if \f[I]scale\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
.PP
If no files or expressions are given by the \f[B]-f\f[R],
\f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then
-bc(1) read from \f[B]stdin\f[R].
+bc(1) reads from \f[B]stdin\f[R].
.PP
However, there are a few caveats to this.
.PP
@@ -404,8 +445,8 @@ redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
.PP
The syntax for bc(1) programs is mostly C-like, with some differences.
-This bc(1) follows the POSIX
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+This bc(1) follows the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
which is a much more thorough resource for the language this bc(1)
accepts.
This section is meant to be a summary and a listing of all the
@@ -812,8 +853,8 @@ 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].
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
+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].
@@ -1102,8 +1143,8 @@ All of the functions below are available when the \f[B]-l\f[R] or
\f[B]--mathlib\f[R] command-line flags are given.
.SS Standard Library
.PP
-The
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
+The standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
.TP
\f[B]s(x)\f[R]
@@ -1156,11 +1197,11 @@ Functions\f[R] subsection below).
.RE
.SS Transcendental Functions
.PP
-All transcendental functions can return slightly inaccurate results (up
-to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place)).
-This is unavoidable, and this
-article (https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT) explains
-why it is impossible and unnecessary to calculate exact results for the
+All transcendental functions can return slightly inaccurate results, up
+to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place).
+This is unavoidable, and the article at
+https://people.eecs.berkeley.edu/\[ti]wkahan/LOG10HAF.TXT explains why
+it is impossible and unnecessary to calculate exact results for the
transcendental functions.
.PP
Because of the possible inaccuracy, I recommend that users call those
@@ -1406,8 +1447,7 @@ If any expressions or expression files are given on the command-line
with \f[B]-e\f[R], \f[B]--expression\f[R], \f[B]-f\f[R], or
\f[B]--file\f[R], then if this environment variable exists and contains
an integer, a non-zero value makes bc(1) exit after executing the
-expressions and expression files, and a non-zero value makes bc(1) not
-exit.
+expressions and expression files, and a zero value makes bc(1) not exit.
.RS
.PP
This environment variable overrides the default, which can be queried
@@ -1492,8 +1532,8 @@ checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
-Per the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+Per the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
@@ -1526,8 +1566,8 @@ The default setting can be queried with the \f[B]-h\f[R] or
\f[B]--help\f[R] options.
.PP
TTY mode is different from interactive mode because interactive mode is
-required in the bc(1)
-specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+required in the bc(1) standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
to be connected to a terminal.
.SS Command-Line History
@@ -1618,8 +1658,8 @@ dc(1)
.SH STANDARDS
.PP
bc(1) is compliant with the IEEE Std 1003.1-2017
-(\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-specification.
+(\[lq]POSIX.1-2017\[rq]) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
The flags \f[B]-efghiqsvVw\f[R], all long options, and the extensions
noted above are extensions to that specification.
.PP
diff --git a/manuals/bc/EN.1.md b/manuals/bc/EN.1.md
index 13ad5f8b570a..3ebd10f8ecb5 100644
--- a/manuals/bc/EN.1.md
+++ b/manuals/bc/EN.1.md
@@ -39,9 +39,10 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# DESCRIPTION
bc(1) is an interactive processor for a language first standardized in 1991 by
-POSIX. (The current standard is [here][1].) The language provides unlimited
-precision decimal arithmetic and is somewhat C-like, but there are differences.
-Such differences will be noted in this document.
+POSIX. (The current standard is at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .) The
+language provides unlimited precision decimal arithmetic and is somewhat C-like,
+but there are differences. Such differences will be noted in this document.
After parsing and handling options, this bc(1) reads any files given on the
command line and executes them before reading from **stdin**.
@@ -203,23 +204,29 @@ The following are the options that bc(1) accepts.
Keywords are *not* redefined when parsing the builtin math library (see the
**LIBRARY** section).
- It is a fatal error to redefine keywords mandated by the POSIX standard. It
- is a fatal error to attempt to redefine words that this bc(1) does not
- reserve as keywords.
+ It is a fatal error to redefine keywords mandated by the POSIX standard
+ (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html). It is
+ a fatal error to attempt to redefine words that this bc(1) does not reserve
+ as keywords.
**-q**, **-\-quiet**
-: This option is for compatibility with the [GNU bc(1)][2]; 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 **-v**, **-V**, or
- **-\-version** options are given.
+: 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 **-v**, **-V**, or **-\-version** options are given
+ unless the **BC_BANNER** environment variable is set and contains a non-zero
+ integer or if this bc(1) was built with the header displayed by default. If
+ *any* of that is the case, then this option *does* prevent bc(1) from
+ printing the header.
This is a **non-portable extension**.
**-s**, **-\-standard**
-: Process exactly the language defined by the [standard][1] and error if any
- extensions are used.
+: Process exactly the language defined by the standard
+ (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) and
+ error if any extensions are used.
This is a **non-portable extension**.
@@ -279,12 +286,39 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
+**-I** *ibase*, **-\-ibase**=*ibase*
+
+: Sets the builtin variable **ibase** to the value *ibase* assuming that
+ *ibase* is in base 10. It is a fatal error if *ibase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-O** *obase*, **-\-obase**=*obase*
+
+: Sets the builtin variable **obase** to the value *obase* assuming that
+ *obase* is in base 10. It is a fatal error if *obase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-S** *scale*, **-\-scale**=*scale*
+
+: Sets the builtin variable **scale** to the value *scale* assuming that
+ *scale* is in base 10. It is a fatal error if *scale* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
All long options are **non-portable extensions**.
# STDIN
If no files or expressions are given by the **-f**, **-\-file**, **-e**, or
-**-\-expression** options, then bc(1) read from **stdin**.
+**-\-expression** options, then bc(1) reads from **stdin**.
However, there are a few caveats to this.
@@ -330,9 +364,10 @@ it is recommended that those scripts be changed to redirect **stderr** to
# SYNTAX
The syntax for bc(1) programs is mostly C-like, with some differences. This
-bc(1) follows the [POSIX standard][1], which is a much more thorough resource
-for the language this bc(1) accepts. This section is meant to be a summary and a
-listing of all the extensions to the standard.
+bc(1) follows the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), which is a
+much more thorough resource for the language this bc(1) accepts. This section is
+meant to be a summary and a listing of all the extensions to the standard.
In the sections below, **E** means expression, **S** means statement, and **I**
means identifier.
@@ -648,9 +683,10 @@ The operators will be described in more detail below.
**assignment** operators, which means that **a=b\>c** is interpreted as
**(a=b)\>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**.
+ 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 **non-portable extension**.
**&&**
@@ -883,7 +919,9 @@ command-line flags are given.
## Standard Library
-The [standard][1] defines the following functions for the math library:
+The standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) defines the
+following functions for the math library:
**s(x)**
@@ -929,10 +967,11 @@ The [standard][1] defines the following functions for the math library:
## Transcendental Functions
-All transcendental functions can return slightly inaccurate results (up to 1
-[ULP][4]). This is unavoidable, and [this article][5] explains why it is
-impossible and unnecessary to calculate exact results for the transcendental
-functions.
+All transcendental functions can return slightly inaccurate results, up to 1 ULP
+(https://en.wikipedia.org/wiki/Unit_in_the_last_place). This is unavoidable, and
+the article at https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT explains
+why it is impossible and unnecessary to calculate exact results for the
+transcendental functions.
Because of the possible inaccuracy, I recommend that users call those functions
with the precision (**scale**) set to at least 1 higher than is necessary. If
@@ -1154,8 +1193,8 @@ bc(1) recognizes the following environment variables:
: If any expressions or expression files are given on the command-line with
**-e**, **-\-expression**, **-f**, or **-\-file**, then if this environment
variable exists and contains an integer, a non-zero value makes bc(1) exit
- after executing the expressions and expression files, and a non-zero value
- makes bc(1) not exit.
+ after executing the expressions and expression files, and a zero value makes
+ bc(1) not exit.
This environment variable overrides the default, which can be queried with
the **-h** or **-\-help** options.
@@ -1233,10 +1272,12 @@ checking, and its normal behavior can be forced by using the **-i** flag or
# INTERACTIVE MODE
-Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
-Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
-turn it on in other situations.
+Per the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), bc(1) has
+an interactive mode and a non-interactive mode. Interactive mode is turned on
+automatically when both **stdin** and **stdout** are hooked to a terminal, but
+the **-i** flag and **-\-interactive** option can turn it on in other
+situations.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
section), and in normal execution, flushes **stdout** as soon as execution is
@@ -1262,8 +1303,10 @@ setting is used. The default setting can be queried with the **-h** or
**-\-help** options.
TTY mode is different from interactive mode because interactive mode is required
-in the [bc(1) specification][1], and interactive mode requires only **stdin**
-and **stdout** to be connected to a terminal.
+in the bc(1) standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), and
+interactive mode requires only **stdin** and **stdout** to be connected to a
+terminal.
## Command-Line History
@@ -1344,9 +1387,10 @@ dc(1)
# STANDARDS
-bc(1) is compliant with the [IEEE Std 1003.1-2017 (“POSIX.1-2017”)][1]
-specification. The flags **-efghiqsvVw**, all long options, and the extensions
-noted above are extensions to that specification.
+bc(1) is compliant with the IEEE Std 1003.1-2017 (“POSIX.1-2017”) specification
+at https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html . The
+flags **-efghiqsvVw**, all long options, and the extensions noted above are
+extensions to that specification.
Note that the specification explicitly says that bc(1) only accepts numbers that
use a period (**.**) as a radix point, regardless of the value of
@@ -1359,10 +1403,3 @@ None are known. Report bugs at https://git.yzena.com/gavin/bc.
# AUTHORS
Gavin D. Howard <gavin@yzena.com> and contributors.
-
-[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html
-[2]: https://www.gnu.org/software/bc/
-[3]: https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero
-[4]: https://en.wikipedia.org/wiki/Unit_in_the_last_place
-[5]: https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT
-[6]: https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero
diff --git a/manuals/bc/H.1 b/manuals/bc/H.1
index f6d555943367..b3e3880b0723 100644
--- a/manuals/bc/H.1
+++ b/manuals/bc/H.1
@@ -25,7 +25,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "June 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "June 2022" "Gavin D. Howard" "General Commands Manual"
+.nh
+.ad l
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
@@ -38,13 +40,17 @@ bc - arbitrary-precision decimal arithmetic language and calculator
[\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[I]file\f[R]\&...] [\f[B]-I\f[R] \f[I]ibase\f[R]]
+[\f[B]--ibase\f[R]=\f[I]ibase\f[R]] [\f[B]-O\f[R] \f[I]obase\f[R]]
+[\f[B]--obase\f[R]=\f[I]obase\f[R]] [\f[B]-S\f[R] \f[I]scale\f[R]]
+[\f[B]--scale\f[R]=\f[I]scale\f[R]] [\f[B]-E\f[R] \f[I]seed\f[R]]
+[\f[B]--seed\f[R]=\f[I]seed\f[R]]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
1991 by POSIX.
-(The current standard is
-here (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).)
+(The current standard is at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .)
The language provides unlimited precision decimal arithmetic and is
somewhat C-like, but there are differences.
Such differences will be noted in this document.
@@ -287,26 +293,32 @@ multiple times.
Keywords are \f[I]not\f[R] redefined when parsing the builtin math
library (see the \f[B]LIBRARY\f[R] section).
.PP
-It is a fatal error to redefine keywords mandated by the POSIX standard.
+It is a fatal error to redefine keywords mandated by the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
It is a fatal error to attempt to redefine words that this bc(1) does
not reserve as keywords.
.RE
.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
-bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
+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.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given
+unless the \f[B]BC_BANNER\f[R] environment variable is set and contains
+a non-zero integer or if this bc(1) was built with the header displayed
+by default.
+If \f[I]any\f[R] of that is the case, then this option \f[I]does\f[R]
+prevent bc(1) from printing the header.
.RS
.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
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-and error if any extensions are used.
+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
.PP
This is a \f[B]non-portable extension\f[R].
@@ -382,13 +394,57 @@ exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
+.TP
+\f[B]-I\f[R] \f[I]ibase\f[R], \f[B]--ibase\f[R]=\f[I]ibase\f[R]
+Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
+assuming that \f[I]ibase\f[R] is in base 10.
+It is a fatal error if \f[I]ibase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-O\f[R] \f[I]obase\f[R], \f[B]--obase\f[R]=\f[I]obase\f[R]
+Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
+assuming that \f[I]obase\f[R] is in base 10.
+It is a fatal error if \f[I]obase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-S\f[R] \f[I]scale\f[R], \f[B]--scale\f[R]=\f[I]scale\f[R]
+Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
+assuming that \f[I]scale\f[R] is in base 10.
+It is a fatal error if \f[I]scale\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-E\f[R] \f[I]seed\f[R], \f[B]--seed\f[R]=\f[I]seed\f[R]
+Sets the builtin variable \f[B]seed\f[R] to the value \f[I]seed\f[R]
+assuming that \f[I]seed\f[R] is in base 10.
+It is a fatal error if \f[I]seed\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
.PP
If no files or expressions are given by the \f[B]-f\f[R],
\f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then
-bc(1) read from \f[B]stdin\f[R].
+bc(1) reads from \f[B]stdin\f[R].
.PP
However, there are a few caveats to this.
.PP
@@ -435,8 +491,8 @@ redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
.PP
The syntax for bc(1) programs is mostly C-like, with some differences.
-This bc(1) follows the POSIX
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+This bc(1) follows the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
which is a much more thorough resource for the language this bc(1)
accepts.
This section is meant to be a summary and a listing of all the
@@ -1020,8 +1076,8 @@ 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].
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
+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].
@@ -1328,8 +1384,8 @@ when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
are given.
.SS Standard Library
.PP
-The
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
+The standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
.TP
\f[B]s(x)\f[R]
@@ -1385,7 +1441,8 @@ Functions\f[R] subsection below).
The extended library is \f[I]not\f[R] loaded when the
\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R]
options are given since they are not part of the library defined by the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
+standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
The extended library is a \f[B]non-portable extension\f[R].
.TP
@@ -1404,13 +1461,13 @@ Functions\f[R] subsection below).
.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
-the rounding mode round half away from
-\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
+the rounding mode round half away from \f[B]0\f[R]
+(https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
.TP
\f[B]ceil(x, p)\f[R]
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).
+the rounding mode round away from \f[B]0\f[R]
+(https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero).
.TP
\f[B]f(x)\f[R]
Returns the factorial of the truncated absolute value of \f[B]x\f[R].
@@ -2275,11 +2332,11 @@ subsection of the \f[B]FUNCTIONS\f[R] section).
.RE
.SS Transcendental Functions
.PP
-All transcendental functions can return slightly inaccurate results (up
-to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place)).
-This is unavoidable, and this
-article (https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT) explains
-why it is impossible and unnecessary to calculate exact results for the
+All transcendental functions can return slightly inaccurate results, up
+to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place).
+This is unavoidable, and the article at
+https://people.eecs.berkeley.edu/\[ti]wkahan/LOG10HAF.TXT explains why
+it is impossible and unnecessary to calculate exact results for the
transcendental functions.
.PP
Because of the possible inaccuracy, I recommend that users call those
@@ -2558,8 +2615,7 @@ If any expressions or expression files are given on the command-line
with \f[B]-e\f[R], \f[B]--expression\f[R], \f[B]-f\f[R], or
\f[B]--file\f[R], then if this environment variable exists and contains
an integer, a non-zero value makes bc(1) exit after executing the
-expressions and expression files, and a non-zero value makes bc(1) not
-exit.
+expressions and expression files, and a zero value makes bc(1) not exit.
.RS
.PP
This environment variable overrides the default, which can be queried
@@ -2646,8 +2702,8 @@ checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
-Per the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+Per the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
@@ -2680,8 +2736,8 @@ The default setting can be queried with the \f[B]-h\f[R] or
\f[B]--help\f[R] options.
.PP
TTY mode is different from interactive mode because interactive mode is
-required in the bc(1)
-specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+required in the bc(1) standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
to be connected to a terminal.
.SS Prompt
@@ -2747,8 +2803,8 @@ dc(1)
.SH STANDARDS
.PP
bc(1) is compliant with the IEEE Std 1003.1-2017
-(\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-specification.
+(\[lq]POSIX.1-2017\[rq]) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
The flags \f[B]-efghiqsvVw\f[R], all long options, and the extensions
noted above are extensions to that specification.
.PP
diff --git a/manuals/bc/H.1.md b/manuals/bc/H.1.md
index 47b17f1188e4..f494e5632967 100644
--- a/manuals/bc/H.1.md
+++ b/manuals/bc/H.1.md
@@ -34,14 +34,15 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**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*...]
+**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*...] [**-I** *ibase*] [**-\-ibase**=*ibase*] [**-O** *obase*] [**-\-obase**=*obase*] [**-S** *scale*] [**-\-scale**=*scale*] [**-E** *seed*] [**-\-seed**=*seed*]
# DESCRIPTION
bc(1) is an interactive processor for a language first standardized in 1991 by
-POSIX. (The current standard is [here][1].) The language provides unlimited
-precision decimal arithmetic and is somewhat C-like, but there are differences.
-Such differences will be noted in this document.
+POSIX. (The current standard is at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .) The
+language provides unlimited precision decimal arithmetic and is somewhat C-like,
+but there are differences. Such differences will be noted in this document.
After parsing and handling options, this bc(1) reads any files given on the
command line and executes them before reading from **stdin**.
@@ -223,23 +224,29 @@ The following are the options that bc(1) accepts.
Keywords are *not* redefined when parsing the builtin math library (see the
**LIBRARY** section).
- It is a fatal error to redefine keywords mandated by the POSIX standard. It
- is a fatal error to attempt to redefine words that this bc(1) does not
- reserve as keywords.
+ It is a fatal error to redefine keywords mandated by the POSIX standard
+ (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html). It is
+ a fatal error to attempt to redefine words that this bc(1) does not reserve
+ as keywords.
**-q**, **-\-quiet**
-: This option is for compatibility with the [GNU bc(1)][2]; 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 **-v**, **-V**, or
- **-\-version** options are given.
+: 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 **-v**, **-V**, or **-\-version** options are given
+ unless the **BC_BANNER** environment variable is set and contains a non-zero
+ integer or if this bc(1) was built with the header displayed by default. If
+ *any* of that is the case, then this option *does* prevent bc(1) from
+ printing the header.
This is a **non-portable extension**.
**-s**, **-\-standard**
-: Process exactly the language defined by the [standard][1] and error if any
- extensions are used.
+: Process exactly the language defined by the standard
+ (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) and
+ error if any extensions are used.
This is a **non-portable extension**.
@@ -299,12 +306,48 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
+**-I** *ibase*, **-\-ibase**=*ibase*
+
+: Sets the builtin variable **ibase** to the value *ibase* assuming that
+ *ibase* is in base 10. It is a fatal error if *ibase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-O** *obase*, **-\-obase**=*obase*
+
+: Sets the builtin variable **obase** to the value *obase* assuming that
+ *obase* is in base 10. It is a fatal error if *obase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-S** *scale*, **-\-scale**=*scale*
+
+: Sets the builtin variable **scale** to the value *scale* assuming that
+ *scale* is in base 10. It is a fatal error if *scale* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-E** *seed*, **-\-seed**=*seed*
+
+: Sets the builtin variable **seed** to the value *seed* assuming that *seed*
+ is in base 10. It is a fatal error if *seed* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
All long options are **non-portable extensions**.
# STDIN
If no files or expressions are given by the **-f**, **-\-file**, **-e**, or
-**-\-expression** options, then bc(1) read from **stdin**.
+**-\-expression** options, then bc(1) reads from **stdin**.
However, there are a few caveats to this.
@@ -350,9 +393,10 @@ it is recommended that those scripts be changed to redirect **stderr** to
# SYNTAX
The syntax for bc(1) programs is mostly C-like, with some differences. This
-bc(1) follows the [POSIX standard][1], which is a much more thorough resource
-for the language this bc(1) accepts. This section is meant to be a summary and a
-listing of all the extensions to the standard.
+bc(1) follows the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), which is a
+much more thorough resource for the language this bc(1) accepts. This section is
+meant to be a summary and a listing of all the extensions to the standard.
In the sections below, **E** means expression, **S** means statement, and **I**
means identifier.
@@ -805,9 +849,10 @@ The operators will be described in more detail below.
**assignment** operators, which means that **a=b\>c** is interpreted as
**(a=b)\>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**.
+ 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 **non-portable extension**.
**&&**
@@ -1054,7 +1099,9 @@ equivalents are given.
## Standard Library
-The [standard][1] defines the following functions for the math library:
+The standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) defines the
+following functions for the math library:
**s(x)**
@@ -1102,7 +1149,8 @@ The [standard][1] defines the following functions for the math library:
The extended library is *not* loaded when the **-s**/**-\-standard** or
**-w**/**-\-warn** options are given since they are not part of the library
-defined by the [standard][1].
+defined by the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
The extended library is a **non-portable extension**.
@@ -1119,12 +1167,14 @@ The extended library is a **non-portable extension**.
**r(x, p)**
: Returns **x** rounded to **p** decimal places according to the rounding mode
- [round half away from **0**][3].
+ round half away from **0**
+ (https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
**ceil(x, p)**
: Returns **x** rounded to **p** decimal places according to the rounding mode
- [round away from **0**][6].
+ round away from **0**
+ (https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero).
**f(x)**
@@ -1888,10 +1938,11 @@ The extended library is a **non-portable extension**.
## Transcendental Functions
-All transcendental functions can return slightly inaccurate results (up to 1
-[ULP][4]). This is unavoidable, and [this article][5] explains why it is
-impossible and unnecessary to calculate exact results for the transcendental
-functions.
+All transcendental functions can return slightly inaccurate results, up to 1 ULP
+(https://en.wikipedia.org/wiki/Unit_in_the_last_place). This is unavoidable, and
+the article at https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT explains
+why it is impossible and unnecessary to calculate exact results for the
+transcendental functions.
Because of the possible inaccuracy, I recommend that users call those functions
with the precision (**scale**) set to at least 1 higher than is necessary. If
@@ -2134,8 +2185,8 @@ bc(1) recognizes the following environment variables:
: If any expressions or expression files are given on the command-line with
**-e**, **-\-expression**, **-f**, or **-\-file**, then if this environment
variable exists and contains an integer, a non-zero value makes bc(1) exit
- after executing the expressions and expression files, and a non-zero value
- makes bc(1) not exit.
+ after executing the expressions and expression files, and a zero value makes
+ bc(1) not exit.
This environment variable overrides the default, which can be queried with
the **-h** or **-\-help** options.
@@ -2215,10 +2266,12 @@ checking, and its normal behavior can be forced by using the **-i** flag or
# INTERACTIVE MODE
-Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
-Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
-turn it on in other situations.
+Per the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), bc(1) has
+an interactive mode and a non-interactive mode. Interactive mode is turned on
+automatically when both **stdin** and **stdout** are hooked to a terminal, but
+the **-i** flag and **-\-interactive** option can turn it on in other
+situations.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
section), and in normal execution, flushes **stdout** as soon as execution is
@@ -2244,8 +2297,10 @@ setting is used. The default setting can be queried with the **-h** or
**-\-help** options.
TTY mode is different from interactive mode because interactive mode is required
-in the [bc(1) specification][1], and interactive mode requires only **stdin**
-and **stdout** to be connected to a terminal.
+in the bc(1) standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), and
+interactive mode requires only **stdin** and **stdout** to be connected to a
+terminal.
## Prompt
@@ -2305,9 +2360,10 @@ dc(1)
# STANDARDS
-bc(1) is compliant with the [IEEE Std 1003.1-2017 (“POSIX.1-2017”)][1]
-specification. The flags **-efghiqsvVw**, all long options, and the extensions
-noted above are extensions to that specification.
+bc(1) is compliant with the IEEE Std 1003.1-2017 (“POSIX.1-2017”) specification
+at https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html . The
+flags **-efghiqsvVw**, all long options, and the extensions noted above are
+extensions to that specification.
Note that the specification explicitly says that bc(1) only accepts numbers that
use a period (**.**) as a radix point, regardless of the value of
@@ -2323,10 +2379,3 @@ None are known. Report bugs at https://git.yzena.com/gavin/bc.
# AUTHORS
Gavin D. Howard <gavin@yzena.com> and contributors.
-
-[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html
-[2]: https://www.gnu.org/software/bc/
-[3]: https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero
-[4]: https://en.wikipedia.org/wiki/Unit_in_the_last_place
-[5]: https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT
-[6]: https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero
diff --git a/manuals/bc/HN.1 b/manuals/bc/HN.1
index 0687cb263b6e..6235a3b9931c 100644
--- a/manuals/bc/HN.1
+++ b/manuals/bc/HN.1
@@ -25,7 +25,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "June 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "June 2022" "Gavin D. Howard" "General Commands Manual"
+.nh
+.ad l
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
@@ -38,13 +40,17 @@ bc - arbitrary-precision decimal arithmetic language and calculator
[\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[I]file\f[R]\&...] [\f[B]-I\f[R] \f[I]ibase\f[R]]
+[\f[B]--ibase\f[R]=\f[I]ibase\f[R]] [\f[B]-O\f[R] \f[I]obase\f[R]]
+[\f[B]--obase\f[R]=\f[I]obase\f[R]] [\f[B]-S\f[R] \f[I]scale\f[R]]
+[\f[B]--scale\f[R]=\f[I]scale\f[R]] [\f[B]-E\f[R] \f[I]seed\f[R]]
+[\f[B]--seed\f[R]=\f[I]seed\f[R]]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
1991 by POSIX.
-(The current standard is
-here (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).)
+(The current standard is at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .)
The language provides unlimited precision decimal arithmetic and is
somewhat C-like, but there are differences.
Such differences will be noted in this document.
@@ -287,26 +293,32 @@ multiple times.
Keywords are \f[I]not\f[R] redefined when parsing the builtin math
library (see the \f[B]LIBRARY\f[R] section).
.PP
-It is a fatal error to redefine keywords mandated by the POSIX standard.
+It is a fatal error to redefine keywords mandated by the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
It is a fatal error to attempt to redefine words that this bc(1) does
not reserve as keywords.
.RE
.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
-bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
+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.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given
+unless the \f[B]BC_BANNER\f[R] environment variable is set and contains
+a non-zero integer or if this bc(1) was built with the header displayed
+by default.
+If \f[I]any\f[R] of that is the case, then this option \f[I]does\f[R]
+prevent bc(1) from printing the header.
.RS
.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
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-and error if any extensions are used.
+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
.PP
This is a \f[B]non-portable extension\f[R].
@@ -382,13 +394,57 @@ exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
+.TP
+\f[B]-I\f[R] \f[I]ibase\f[R], \f[B]--ibase\f[R]=\f[I]ibase\f[R]
+Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
+assuming that \f[I]ibase\f[R] is in base 10.
+It is a fatal error if \f[I]ibase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-O\f[R] \f[I]obase\f[R], \f[B]--obase\f[R]=\f[I]obase\f[R]
+Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
+assuming that \f[I]obase\f[R] is in base 10.
+It is a fatal error if \f[I]obase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-S\f[R] \f[I]scale\f[R], \f[B]--scale\f[R]=\f[I]scale\f[R]
+Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
+assuming that \f[I]scale\f[R] is in base 10.
+It is a fatal error if \f[I]scale\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-E\f[R] \f[I]seed\f[R], \f[B]--seed\f[R]=\f[I]seed\f[R]
+Sets the builtin variable \f[B]seed\f[R] to the value \f[I]seed\f[R]
+assuming that \f[I]seed\f[R] is in base 10.
+It is a fatal error if \f[I]seed\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
.PP
If no files or expressions are given by the \f[B]-f\f[R],
\f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then
-bc(1) read from \f[B]stdin\f[R].
+bc(1) reads from \f[B]stdin\f[R].
.PP
However, there are a few caveats to this.
.PP
@@ -435,8 +491,8 @@ redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
.PP
The syntax for bc(1) programs is mostly C-like, with some differences.
-This bc(1) follows the POSIX
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+This bc(1) follows the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
which is a much more thorough resource for the language this bc(1)
accepts.
This section is meant to be a summary and a listing of all the
@@ -1020,8 +1076,8 @@ 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].
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
+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].
@@ -1328,8 +1384,8 @@ when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
are given.
.SS Standard Library
.PP
-The
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
+The standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
.TP
\f[B]s(x)\f[R]
@@ -1385,7 +1441,8 @@ Functions\f[R] subsection below).
The extended library is \f[I]not\f[R] loaded when the
\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R]
options are given since they are not part of the library defined by the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
+standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
The extended library is a \f[B]non-portable extension\f[R].
.TP
@@ -1404,13 +1461,13 @@ Functions\f[R] subsection below).
.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
-the rounding mode round half away from
-\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
+the rounding mode round half away from \f[B]0\f[R]
+(https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
.TP
\f[B]ceil(x, p)\f[R]
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).
+the rounding mode round away from \f[B]0\f[R]
+(https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero).
.TP
\f[B]f(x)\f[R]
Returns the factorial of the truncated absolute value of \f[B]x\f[R].
@@ -2275,11 +2332,11 @@ subsection of the \f[B]FUNCTIONS\f[R] section).
.RE
.SS Transcendental Functions
.PP
-All transcendental functions can return slightly inaccurate results (up
-to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place)).
-This is unavoidable, and this
-article (https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT) explains
-why it is impossible and unnecessary to calculate exact results for the
+All transcendental functions can return slightly inaccurate results, up
+to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place).
+This is unavoidable, and the article at
+https://people.eecs.berkeley.edu/\[ti]wkahan/LOG10HAF.TXT explains why
+it is impossible and unnecessary to calculate exact results for the
transcendental functions.
.PP
Because of the possible inaccuracy, I recommend that users call those
@@ -2558,8 +2615,7 @@ If any expressions or expression files are given on the command-line
with \f[B]-e\f[R], \f[B]--expression\f[R], \f[B]-f\f[R], or
\f[B]--file\f[R], then if this environment variable exists and contains
an integer, a non-zero value makes bc(1) exit after executing the
-expressions and expression files, and a non-zero value makes bc(1) not
-exit.
+expressions and expression files, and a zero value makes bc(1) not exit.
.RS
.PP
This environment variable overrides the default, which can be queried
@@ -2646,8 +2702,8 @@ checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
-Per the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+Per the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
@@ -2680,8 +2736,8 @@ The default setting can be queried with the \f[B]-h\f[R] or
\f[B]--help\f[R] options.
.PP
TTY mode is different from interactive mode because interactive mode is
-required in the bc(1)
-specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+required in the bc(1) standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
to be connected to a terminal.
.SS Prompt
@@ -2743,8 +2799,8 @@ dc(1)
.SH STANDARDS
.PP
bc(1) is compliant with the IEEE Std 1003.1-2017
-(\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-specification.
+(\[lq]POSIX.1-2017\[rq]) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
The flags \f[B]-efghiqsvVw\f[R], all long options, and the extensions
noted above are extensions to that specification.
.PP
diff --git a/manuals/bc/HN.1.md b/manuals/bc/HN.1.md
index 12ed1c9c5e74..13f085a5cca7 100644
--- a/manuals/bc/HN.1.md
+++ b/manuals/bc/HN.1.md
@@ -34,14 +34,15 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**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*...]
+**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*...] [**-I** *ibase*] [**-\-ibase**=*ibase*] [**-O** *obase*] [**-\-obase**=*obase*] [**-S** *scale*] [**-\-scale**=*scale*] [**-E** *seed*] [**-\-seed**=*seed*]
# DESCRIPTION
bc(1) is an interactive processor for a language first standardized in 1991 by
-POSIX. (The current standard is [here][1].) The language provides unlimited
-precision decimal arithmetic and is somewhat C-like, but there are differences.
-Such differences will be noted in this document.
+POSIX. (The current standard is at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .) The
+language provides unlimited precision decimal arithmetic and is somewhat C-like,
+but there are differences. Such differences will be noted in this document.
After parsing and handling options, this bc(1) reads any files given on the
command line and executes them before reading from **stdin**.
@@ -223,23 +224,29 @@ The following are the options that bc(1) accepts.
Keywords are *not* redefined when parsing the builtin math library (see the
**LIBRARY** section).
- It is a fatal error to redefine keywords mandated by the POSIX standard. It
- is a fatal error to attempt to redefine words that this bc(1) does not
- reserve as keywords.
+ It is a fatal error to redefine keywords mandated by the POSIX standard
+ (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html). It is
+ a fatal error to attempt to redefine words that this bc(1) does not reserve
+ as keywords.
**-q**, **-\-quiet**
-: This option is for compatibility with the [GNU bc(1)][2]; 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 **-v**, **-V**, or
- **-\-version** options are given.
+: 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 **-v**, **-V**, or **-\-version** options are given
+ unless the **BC_BANNER** environment variable is set and contains a non-zero
+ integer or if this bc(1) was built with the header displayed by default. If
+ *any* of that is the case, then this option *does* prevent bc(1) from
+ printing the header.
This is a **non-portable extension**.
**-s**, **-\-standard**
-: Process exactly the language defined by the [standard][1] and error if any
- extensions are used.
+: Process exactly the language defined by the standard
+ (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) and
+ error if any extensions are used.
This is a **non-portable extension**.
@@ -299,12 +306,48 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
+**-I** *ibase*, **-\-ibase**=*ibase*
+
+: Sets the builtin variable **ibase** to the value *ibase* assuming that
+ *ibase* is in base 10. It is a fatal error if *ibase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-O** *obase*, **-\-obase**=*obase*
+
+: Sets the builtin variable **obase** to the value *obase* assuming that
+ *obase* is in base 10. It is a fatal error if *obase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-S** *scale*, **-\-scale**=*scale*
+
+: Sets the builtin variable **scale** to the value *scale* assuming that
+ *scale* is in base 10. It is a fatal error if *scale* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-E** *seed*, **-\-seed**=*seed*
+
+: Sets the builtin variable **seed** to the value *seed* assuming that *seed*
+ is in base 10. It is a fatal error if *seed* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
All long options are **non-portable extensions**.
# STDIN
If no files or expressions are given by the **-f**, **-\-file**, **-e**, or
-**-\-expression** options, then bc(1) read from **stdin**.
+**-\-expression** options, then bc(1) reads from **stdin**.
However, there are a few caveats to this.
@@ -350,9 +393,10 @@ it is recommended that those scripts be changed to redirect **stderr** to
# SYNTAX
The syntax for bc(1) programs is mostly C-like, with some differences. This
-bc(1) follows the [POSIX standard][1], which is a much more thorough resource
-for the language this bc(1) accepts. This section is meant to be a summary and a
-listing of all the extensions to the standard.
+bc(1) follows the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), which is a
+much more thorough resource for the language this bc(1) accepts. This section is
+meant to be a summary and a listing of all the extensions to the standard.
In the sections below, **E** means expression, **S** means statement, and **I**
means identifier.
@@ -805,9 +849,10 @@ The operators will be described in more detail below.
**assignment** operators, which means that **a=b\>c** is interpreted as
**(a=b)\>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**.
+ 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 **non-portable extension**.
**&&**
@@ -1054,7 +1099,9 @@ equivalents are given.
## Standard Library
-The [standard][1] defines the following functions for the math library:
+The standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) defines the
+following functions for the math library:
**s(x)**
@@ -1102,7 +1149,8 @@ The [standard][1] defines the following functions for the math library:
The extended library is *not* loaded when the **-s**/**-\-standard** or
**-w**/**-\-warn** options are given since they are not part of the library
-defined by the [standard][1].
+defined by the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
The extended library is a **non-portable extension**.
@@ -1119,12 +1167,14 @@ The extended library is a **non-portable extension**.
**r(x, p)**
: Returns **x** rounded to **p** decimal places according to the rounding mode
- [round half away from **0**][3].
+ round half away from **0**
+ (https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
**ceil(x, p)**
: Returns **x** rounded to **p** decimal places according to the rounding mode
- [round away from **0**][6].
+ round away from **0**
+ (https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero).
**f(x)**
@@ -1888,10 +1938,11 @@ The extended library is a **non-portable extension**.
## Transcendental Functions
-All transcendental functions can return slightly inaccurate results (up to 1
-[ULP][4]). This is unavoidable, and [this article][5] explains why it is
-impossible and unnecessary to calculate exact results for the transcendental
-functions.
+All transcendental functions can return slightly inaccurate results, up to 1 ULP
+(https://en.wikipedia.org/wiki/Unit_in_the_last_place). This is unavoidable, and
+the article at https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT explains
+why it is impossible and unnecessary to calculate exact results for the
+transcendental functions.
Because of the possible inaccuracy, I recommend that users call those functions
with the precision (**scale**) set to at least 1 higher than is necessary. If
@@ -2134,8 +2185,8 @@ bc(1) recognizes the following environment variables:
: If any expressions or expression files are given on the command-line with
**-e**, **-\-expression**, **-f**, or **-\-file**, then if this environment
variable exists and contains an integer, a non-zero value makes bc(1) exit
- after executing the expressions and expression files, and a non-zero value
- makes bc(1) not exit.
+ after executing the expressions and expression files, and a zero value makes
+ bc(1) not exit.
This environment variable overrides the default, which can be queried with
the **-h** or **-\-help** options.
@@ -2215,10 +2266,12 @@ checking, and its normal behavior can be forced by using the **-i** flag or
# INTERACTIVE MODE
-Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
-Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
-turn it on in other situations.
+Per the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), bc(1) has
+an interactive mode and a non-interactive mode. Interactive mode is turned on
+automatically when both **stdin** and **stdout** are hooked to a terminal, but
+the **-i** flag and **-\-interactive** option can turn it on in other
+situations.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
section), and in normal execution, flushes **stdout** as soon as execution is
@@ -2244,8 +2297,10 @@ setting is used. The default setting can be queried with the **-h** or
**-\-help** options.
TTY mode is different from interactive mode because interactive mode is required
-in the [bc(1) specification][1], and interactive mode requires only **stdin**
-and **stdout** to be connected to a terminal.
+in the bc(1) standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), and
+interactive mode requires only **stdin** and **stdout** to be connected to a
+terminal.
## Prompt
@@ -2300,9 +2355,10 @@ dc(1)
# STANDARDS
-bc(1) is compliant with the [IEEE Std 1003.1-2017 (“POSIX.1-2017”)][1]
-specification. The flags **-efghiqsvVw**, all long options, and the extensions
-noted above are extensions to that specification.
+bc(1) is compliant with the IEEE Std 1003.1-2017 (“POSIX.1-2017”) specification
+at https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html . The
+flags **-efghiqsvVw**, all long options, and the extensions noted above are
+extensions to that specification.
Note that the specification explicitly says that bc(1) only accepts numbers that
use a period (**.**) as a radix point, regardless of the value of
@@ -2315,10 +2371,3 @@ None are known. Report bugs at https://git.yzena.com/gavin/bc.
# AUTHORS
Gavin D. Howard <gavin@yzena.com> and contributors.
-
-[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html
-[2]: https://www.gnu.org/software/bc/
-[3]: https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero
-[4]: https://en.wikipedia.org/wiki/Unit_in_the_last_place
-[5]: https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT
-[6]: https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero
diff --git a/manuals/bc/N.1 b/manuals/bc/N.1
index 40dbad9bb2f2..def2aee98bbc 100644
--- a/manuals/bc/N.1
+++ b/manuals/bc/N.1
@@ -25,7 +25,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BC" "1" "June 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "BC" "1" "June 2022" "Gavin D. Howard" "General Commands Manual"
+.nh
+.ad l
.SH NAME
.PP
bc - arbitrary-precision decimal arithmetic language and calculator
@@ -38,13 +40,17 @@ bc - arbitrary-precision decimal arithmetic language and calculator
[\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[I]file\f[R]\&...] [\f[B]-I\f[R] \f[I]ibase\f[R]]
+[\f[B]--ibase\f[R]=\f[I]ibase\f[R]] [\f[B]-O\f[R] \f[I]obase\f[R]]
+[\f[B]--obase\f[R]=\f[I]obase\f[R]] [\f[B]-S\f[R] \f[I]scale\f[R]]
+[\f[B]--scale\f[R]=\f[I]scale\f[R]] [\f[B]-E\f[R] \f[I]seed\f[R]]
+[\f[B]--seed\f[R]=\f[I]seed\f[R]]
.SH DESCRIPTION
.PP
bc(1) is an interactive processor for a language first standardized in
1991 by POSIX.
-(The current standard is
-here (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).)
+(The current standard is at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .)
The language provides unlimited precision decimal arithmetic and is
somewhat C-like, but there are differences.
Such differences will be noted in this document.
@@ -287,26 +293,32 @@ multiple times.
Keywords are \f[I]not\f[R] redefined when parsing the builtin math
library (see the \f[B]LIBRARY\f[R] section).
.PP
-It is a fatal error to redefine keywords mandated by the POSIX standard.
+It is a fatal error to redefine keywords mandated by the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
It is a fatal error to attempt to redefine words that this bc(1) does
not reserve as keywords.
.RE
.TP
\f[B]-q\f[R], \f[B]--quiet\f[R]
-This option is for compatibility with the GNU
-bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
+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.
+\f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given
+unless the \f[B]BC_BANNER\f[R] environment variable is set and contains
+a non-zero integer or if this bc(1) was built with the header displayed
+by default.
+If \f[I]any\f[R] of that is the case, then this option \f[I]does\f[R]
+prevent bc(1) from printing the header.
.RS
.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
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-and error if any extensions are used.
+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
.PP
This is a \f[B]non-portable extension\f[R].
@@ -382,13 +394,57 @@ exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
+.TP
+\f[B]-I\f[R] \f[I]ibase\f[R], \f[B]--ibase\f[R]=\f[I]ibase\f[R]
+Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
+assuming that \f[I]ibase\f[R] is in base 10.
+It is a fatal error if \f[I]ibase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-O\f[R] \f[I]obase\f[R], \f[B]--obase\f[R]=\f[I]obase\f[R]
+Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
+assuming that \f[I]obase\f[R] is in base 10.
+It is a fatal error if \f[I]obase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-S\f[R] \f[I]scale\f[R], \f[B]--scale\f[R]=\f[I]scale\f[R]
+Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
+assuming that \f[I]scale\f[R] is in base 10.
+It is a fatal error if \f[I]scale\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-E\f[R] \f[I]seed\f[R], \f[B]--seed\f[R]=\f[I]seed\f[R]
+Sets the builtin variable \f[B]seed\f[R] to the value \f[I]seed\f[R]
+assuming that \f[I]seed\f[R] is in base 10.
+It is a fatal error if \f[I]seed\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
.PP
If no files or expressions are given by the \f[B]-f\f[R],
\f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then
-bc(1) read from \f[B]stdin\f[R].
+bc(1) reads from \f[B]stdin\f[R].
.PP
However, there are a few caveats to this.
.PP
@@ -435,8 +491,8 @@ redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
.SH SYNTAX
.PP
The syntax for bc(1) programs is mostly C-like, with some differences.
-This bc(1) follows the POSIX
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+This bc(1) follows the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
which is a much more thorough resource for the language this bc(1)
accepts.
This section is meant to be a summary and a listing of all the
@@ -1020,8 +1076,8 @@ 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].
.PP
-Also, unlike the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
+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].
@@ -1328,8 +1384,8 @@ when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
are given.
.SS Standard Library
.PP
-The
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
+The standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
defines the following functions for the math library:
.TP
\f[B]s(x)\f[R]
@@ -1385,7 +1441,8 @@ Functions\f[R] subsection below).
The extended library is \f[I]not\f[R] loaded when the
\f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R]
options are given since they are not part of the library defined by the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
+standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
.PP
The extended library is a \f[B]non-portable extension\f[R].
.TP
@@ -1404,13 +1461,13 @@ Functions\f[R] subsection below).
.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
-the rounding mode round half away from
-\f[B]0\f[R] (https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
+the rounding mode round half away from \f[B]0\f[R]
+(https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
.TP
\f[B]ceil(x, p)\f[R]
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).
+the rounding mode round away from \f[B]0\f[R]
+(https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero).
.TP
\f[B]f(x)\f[R]
Returns the factorial of the truncated absolute value of \f[B]x\f[R].
@@ -2275,11 +2332,11 @@ subsection of the \f[B]FUNCTIONS\f[R] section).
.RE
.SS Transcendental Functions
.PP
-All transcendental functions can return slightly inaccurate results (up
-to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place)).
-This is unavoidable, and this
-article (https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT) explains
-why it is impossible and unnecessary to calculate exact results for the
+All transcendental functions can return slightly inaccurate results, up
+to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place).
+This is unavoidable, and the article at
+https://people.eecs.berkeley.edu/\[ti]wkahan/LOG10HAF.TXT explains why
+it is impossible and unnecessary to calculate exact results for the
transcendental functions.
.PP
Because of the possible inaccuracy, I recommend that users call those
@@ -2558,8 +2615,7 @@ If any expressions or expression files are given on the command-line
with \f[B]-e\f[R], \f[B]--expression\f[R], \f[B]-f\f[R], or
\f[B]--file\f[R], then if this environment variable exists and contains
an integer, a non-zero value makes bc(1) exit after executing the
-expressions and expression files, and a non-zero value makes bc(1) not
-exit.
+expressions and expression files, and a zero value makes bc(1) not exit.
.RS
.PP
This environment variable overrides the default, which can be queried
@@ -2646,8 +2702,8 @@ checking, and its normal behavior can be forced by using the
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
.SH INTERACTIVE MODE
.PP
-Per the
-standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+Per the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
bc(1) has an interactive mode and a non-interactive mode.
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
@@ -2680,8 +2736,8 @@ The default setting can be queried with the \f[B]-h\f[R] or
\f[B]--help\f[R] options.
.PP
TTY mode is different from interactive mode because interactive mode is
-required in the bc(1)
-specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
+required in the bc(1) standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
to be connected to a terminal.
.SS Command-Line History
@@ -2772,8 +2828,8 @@ dc(1)
.SH STANDARDS
.PP
bc(1) is compliant with the IEEE Std 1003.1-2017
-(\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-specification.
+(\[lq]POSIX.1-2017\[rq]) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
The flags \f[B]-efghiqsvVw\f[R], all long options, and the extensions
noted above are extensions to that specification.
.PP
diff --git a/manuals/bc/N.1.md b/manuals/bc/N.1.md
index 92c239c0b12b..27cc68c8d39a 100644
--- a/manuals/bc/N.1.md
+++ b/manuals/bc/N.1.md
@@ -34,14 +34,15 @@ bc - arbitrary-precision decimal arithmetic language and calculator
# SYNOPSIS
-**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*...]
+**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*...] [**-I** *ibase*] [**-\-ibase**=*ibase*] [**-O** *obase*] [**-\-obase**=*obase*] [**-S** *scale*] [**-\-scale**=*scale*] [**-E** *seed*] [**-\-seed**=*seed*]
# DESCRIPTION
bc(1) is an interactive processor for a language first standardized in 1991 by
-POSIX. (The current standard is [here][1].) The language provides unlimited
-precision decimal arithmetic and is somewhat C-like, but there are differences.
-Such differences will be noted in this document.
+POSIX. (The current standard is at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .) The
+language provides unlimited precision decimal arithmetic and is somewhat C-like,
+but there are differences. Such differences will be noted in this document.
After parsing and handling options, this bc(1) reads any files given on the
command line and executes them before reading from **stdin**.
@@ -223,23 +224,29 @@ The following are the options that bc(1) accepts.
Keywords are *not* redefined when parsing the builtin math library (see the
**LIBRARY** section).
- It is a fatal error to redefine keywords mandated by the POSIX standard. It
- is a fatal error to attempt to redefine words that this bc(1) does not
- reserve as keywords.
+ It is a fatal error to redefine keywords mandated by the POSIX standard
+ (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html). It is
+ a fatal error to attempt to redefine words that this bc(1) does not reserve
+ as keywords.
**-q**, **-\-quiet**
-: This option is for compatibility with the [GNU bc(1)][2]; 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 **-v**, **-V**, or
- **-\-version** options are given.
+: 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 **-v**, **-V**, or **-\-version** options are given
+ unless the **BC_BANNER** environment variable is set and contains a non-zero
+ integer or if this bc(1) was built with the header displayed by default. If
+ *any* of that is the case, then this option *does* prevent bc(1) from
+ printing the header.
This is a **non-portable extension**.
**-s**, **-\-standard**
-: Process exactly the language defined by the [standard][1] and error if any
- extensions are used.
+: Process exactly the language defined by the standard
+ (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) and
+ error if any extensions are used.
This is a **non-portable extension**.
@@ -299,12 +306,48 @@ The following are the options that bc(1) accepts.
This is a **non-portable extension**.
+**-I** *ibase*, **-\-ibase**=*ibase*
+
+: Sets the builtin variable **ibase** to the value *ibase* assuming that
+ *ibase* is in base 10. It is a fatal error if *ibase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-O** *obase*, **-\-obase**=*obase*
+
+: Sets the builtin variable **obase** to the value *obase* assuming that
+ *obase* is in base 10. It is a fatal error if *obase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-S** *scale*, **-\-scale**=*scale*
+
+: Sets the builtin variable **scale** to the value *scale* assuming that
+ *scale* is in base 10. It is a fatal error if *scale* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-E** *seed*, **-\-seed**=*seed*
+
+: Sets the builtin variable **seed** to the value *seed* assuming that *seed*
+ is in base 10. It is a fatal error if *seed* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
All long options are **non-portable extensions**.
# STDIN
If no files or expressions are given by the **-f**, **-\-file**, **-e**, or
-**-\-expression** options, then bc(1) read from **stdin**.
+**-\-expression** options, then bc(1) reads from **stdin**.
However, there are a few caveats to this.
@@ -350,9 +393,10 @@ it is recommended that those scripts be changed to redirect **stderr** to
# SYNTAX
The syntax for bc(1) programs is mostly C-like, with some differences. This
-bc(1) follows the [POSIX standard][1], which is a much more thorough resource
-for the language this bc(1) accepts. This section is meant to be a summary and a
-listing of all the extensions to the standard.
+bc(1) follows the POSIX standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), which is a
+much more thorough resource for the language this bc(1) accepts. This section is
+meant to be a summary and a listing of all the extensions to the standard.
In the sections below, **E** means expression, **S** means statement, and **I**
means identifier.
@@ -805,9 +849,10 @@ The operators will be described in more detail below.
**assignment** operators, which means that **a=b\>c** is interpreted as
**(a=b)\>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**.
+ 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 **non-portable extension**.
**&&**
@@ -1054,7 +1099,9 @@ equivalents are given.
## Standard Library
-The [standard][1] defines the following functions for the math library:
+The standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) defines the
+following functions for the math library:
**s(x)**
@@ -1102,7 +1149,8 @@ The [standard][1] defines the following functions for the math library:
The extended library is *not* loaded when the **-s**/**-\-standard** or
**-w**/**-\-warn** options are given since they are not part of the library
-defined by the [standard][1].
+defined by the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html).
The extended library is a **non-portable extension**.
@@ -1119,12 +1167,14 @@ The extended library is a **non-portable extension**.
**r(x, p)**
: Returns **x** rounded to **p** decimal places according to the rounding mode
- [round half away from **0**][3].
+ round half away from **0**
+ (https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
**ceil(x, p)**
: Returns **x** rounded to **p** decimal places according to the rounding mode
- [round away from **0**][6].
+ round away from **0**
+ (https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero).
**f(x)**
@@ -1888,10 +1938,11 @@ The extended library is a **non-portable extension**.
## Transcendental Functions
-All transcendental functions can return slightly inaccurate results (up to 1
-[ULP][4]). This is unavoidable, and [this article][5] explains why it is
-impossible and unnecessary to calculate exact results for the transcendental
-functions.
+All transcendental functions can return slightly inaccurate results, up to 1 ULP
+(https://en.wikipedia.org/wiki/Unit_in_the_last_place). This is unavoidable, and
+the article at https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT explains
+why it is impossible and unnecessary to calculate exact results for the
+transcendental functions.
Because of the possible inaccuracy, I recommend that users call those functions
with the precision (**scale**) set to at least 1 higher than is necessary. If
@@ -2134,8 +2185,8 @@ bc(1) recognizes the following environment variables:
: If any expressions or expression files are given on the command-line with
**-e**, **-\-expression**, **-f**, or **-\-file**, then if this environment
variable exists and contains an integer, a non-zero value makes bc(1) exit
- after executing the expressions and expression files, and a non-zero value
- makes bc(1) not exit.
+ after executing the expressions and expression files, and a zero value makes
+ bc(1) not exit.
This environment variable overrides the default, which can be queried with
the **-h** or **-\-help** options.
@@ -2215,10 +2266,12 @@ checking, and its normal behavior can be forced by using the **-i** flag or
# INTERACTIVE MODE
-Per the [standard][1], bc(1) has an interactive mode and a non-interactive mode.
-Interactive mode is turned on automatically when both **stdin** and **stdout**
-are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
-turn it on in other situations.
+Per the standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), bc(1) has
+an interactive mode and a non-interactive mode. Interactive mode is turned on
+automatically when both **stdin** and **stdout** are hooked to a terminal, but
+the **-i** flag and **-\-interactive** option can turn it on in other
+situations.
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
section), and in normal execution, flushes **stdout** as soon as execution is
@@ -2244,8 +2297,10 @@ setting is used. The default setting can be queried with the **-h** or
**-\-help** options.
TTY mode is different from interactive mode because interactive mode is required
-in the [bc(1) specification][1], and interactive mode requires only **stdin**
-and **stdout** to be connected to a terminal.
+in the bc(1) standard
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html), and
+interactive mode requires only **stdin** and **stdout** to be connected to a
+terminal.
## Command-Line History
@@ -2326,9 +2381,10 @@ dc(1)
# STANDARDS
-bc(1) is compliant with the [IEEE Std 1003.1-2017 (“POSIX.1-2017”)][1]
-specification. The flags **-efghiqsvVw**, all long options, and the extensions
-noted above are extensions to that specification.
+bc(1) is compliant with the IEEE Std 1003.1-2017 (“POSIX.1-2017”) specification
+at https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html . The
+flags **-efghiqsvVw**, all long options, and the extensions noted above are
+extensions to that specification.
Note that the specification explicitly says that bc(1) only accepts numbers that
use a period (**.**) as a radix point, regardless of the value of
@@ -2341,10 +2397,3 @@ None are known. Report bugs at https://git.yzena.com/gavin/bc.
# AUTHORS
Gavin D. Howard <gavin@yzena.com> and contributors.
-
-[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html
-[2]: https://www.gnu.org/software/bc/
-[3]: https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero
-[4]: https://en.wikipedia.org/wiki/Unit_in_the_last_place
-[5]: https://people.eecs.berkeley.edu/~wkahan/LOG10HAF.TXT
-[6]: https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero
diff --git a/manuals/bcl.3 b/manuals/bcl.3
index 9370417dcfef..c0678722db0c 100644
--- a/manuals/bcl.3
+++ b/manuals/bcl.3
@@ -25,7 +25,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "BCL" "3" "June 2021" "Gavin D. Howard" "Libraries Manual"
+.TH "BCL" "3" "June 2022" "Gavin D. Howard" "Libraries Manual"
+.nh
+.ad l
.SH NAME
.PP
bcl - library of arbitrary precision decimal arithmetic
@@ -228,9 +230,9 @@ generator in bcl(3).
.SH DESCRIPTION
.PP
bcl(3) is a library that implements arbitrary-precision decimal math, as
-standardized by
-POSIX (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-in bc(1).
+standardized by 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.
@@ -1376,9 +1378,9 @@ bc(1) and dc(1)
.SH STANDARDS
.PP
bcl(3) is compliant with the arithmetic defined in the IEEE Std
-1003.1-2017
-(\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-specification for bc(1).
+1003.1-2017 (\[lq]POSIX.1-2017\[rq]) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for
+bc(1).
.PP
Note that the specification explicitly says that bc(1) only accepts
numbers that use a period (\f[B].\f[R]) as a radix point, regardless of
diff --git a/manuals/bcl.3.md b/manuals/bcl.3.md
index fa630fc79f1a..1f694413f7d6 100644
--- a/manuals/bcl.3.md
+++ b/manuals/bcl.3.md
@@ -215,7 +215,8 @@ generator in bcl(3).
# DESCRIPTION
bcl(3) is a library that implements arbitrary-precision decimal math, as
-[standardized by POSIX][1] in bc(1).
+standardized by POSIX
+(https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html) in bc(1).
bcl(3) is async-signal-safe if **bcl_handleSignal(**_void_**)** is used
properly. (See the **SIGNAL HANDLING** section.)
@@ -1184,8 +1185,9 @@ bc(1) and dc(1)
# STANDARDS
-bcl(3) is compliant with the arithmetic defined in the
-[IEEE Std 1003.1-2017 (“POSIX.1-2017”)][1] specification for bc(1).
+bcl(3) is compliant with the arithmetic defined in the IEEE Std 1003.1-2017
+(“POSIX.1-2017”) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for bc(1).
Note that the specification explicitly says that bc(1) only accepts numbers that
use a period (**.**) as a radix point, regardless of the value of
@@ -1198,5 +1200,3 @@ None are known. Report bugs at https://git.yzena.com/gavin/bc.
# AUTHORS
Gavin D. Howard <gavin@yzena.com> and contributors.
-
-[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html
diff --git a/manuals/build.md b/manuals/build.md
index aa0ed78e2d72..af0b7c15e0c3 100644
--- a/manuals/build.md
+++ b/manuals/build.md
@@ -46,7 +46,7 @@ However, if you wish to build it yourself, this `bc` can be built using Visual
Studio or MSBuild.
Unfortunately, only one build configuration (besides Debug or Release) is
-supported: extra math enabled, history and NLS (locale support) disabled, with
+supported: extra math and history enabled, NLS (locale support) disabled, with
both calculators built. The default [settings][11] are `BC_BANNER=1`,
`{BC,DC}_SIGINT_RESET=0`, `{BC,DC}_TTY_MODE=1`, `{BC,DC}_PROMPT=1`.
@@ -424,15 +424,46 @@ to `configure.sh`, as follows:
Both commands are equivalent.
-History is automatically disabled when building for Windows or on another
-platform that does not support the terminal handling that is required.
-
***WARNING***: Of all of the code in the `bc`, this is the only code that is not
completely portable. If the `bc` does not work on your platform, your first step
should be to retry with history disabled.
This option affects the [build type][7].
+##### Editline
+
+History support can be provided by editline, in order to implement `vi`-like
+keybindings and other features.
+
+To enable editline support pass either the `-e` flag or the `--enable-editline`
+option to `configure.sh`, as follows:
+
+```
+./configure.sh -e
+./configure.sh --enable-editline
+```
+
+Both commands are equivalent.
+
+This is ignored if history is disabled.
+
+##### Readline
+
+History support can be provided by readline, in order to implement `vi`-like
+keybindings and other features.
+
+To enable readline support pass either the `-r` flag or the `--enable-readline`
+option to `configure.sh`, as follows:
+
+```
+./configure.sh -r
+./configure.sh --enable-readline
+```
+
+Both commands are equivalent.
+
+This is ignored if history is disabled.
+
#### NLS (Locale Support)
To disable locale support (use only English), pass either the `-N` flag or the
diff --git a/manuals/dc/A.1 b/manuals/dc/A.1
index 3dff3b16d080..cc1ad0e7bb75 100644
--- a/manuals/dc/A.1
+++ b/manuals/dc/A.1
@@ -25,7 +25,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "June 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "June 2022" "Gavin D. Howard" "General Commands Manual"
+.nh
+.ad l
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
@@ -37,7 +39,11 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
[\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[I]file\f[R]\&...] [\f[B]-I\f[R] \f[I]ibase\f[R]]
+[\f[B]--ibase\f[R]=\f[I]ibase\f[R]] [\f[B]-O\f[R] \f[I]obase\f[R]]
+[\f[B]--obase\f[R]=\f[I]obase\f[R]] [\f[B]-S\f[R] \f[I]scale\f[R]]
+[\f[B]--scale\f[R]=\f[I]scale\f[R]] [\f[B]-E\f[R] \f[I]seed\f[R]]
+[\f[B]--seed\f[R]=\f[I]seed\f[R]]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -129,7 +135,7 @@ This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
-Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
+Makes dc(1) print all numbers greater than \f[B]-1\f[R] and less than
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
.RS
.PP
@@ -182,13 +188,57 @@ exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
+.TP
+\f[B]-I\f[R] \f[I]ibase\f[R], \f[B]--ibase\f[R]=\f[I]ibase\f[R]
+Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
+assuming that \f[I]ibase\f[R] is in base 10.
+It is a fatal error if \f[I]ibase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-O\f[R] \f[I]obase\f[R], \f[B]--obase\f[R]=\f[I]obase\f[R]
+Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
+assuming that \f[I]obase\f[R] is in base 10.
+It is a fatal error if \f[I]obase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-S\f[R] \f[I]scale\f[R], \f[B]--scale\f[R]=\f[I]scale\f[R]
+Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
+assuming that \f[I]scale\f[R] is in base 10.
+It is a fatal error if \f[I]scale\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-E\f[R] \f[I]seed\f[R], \f[B]--seed\f[R]=\f[I]seed\f[R]
+Sets the builtin variable \f[B]seed\f[R] to the value \f[I]seed\f[R]
+assuming that \f[I]seed\f[R] is in base 10.
+It is a fatal error if \f[I]seed\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
.PP
If no files are given on the command-line and no files or expressions
are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or
-\f[B]--expression\f[R] options, then dc(1) read from \f[B]stdin\f[R].
+\f[B]--expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
.PP
However, there is a caveat to this.
.PP
@@ -1346,8 +1396,7 @@ If any expressions or expression files are given on the command-line
with \f[B]-e\f[R], \f[B]--expression\f[R], \f[B]-f\f[R], or
\f[B]--file\f[R], then if this environment variable exists and contains
an integer, a non-zero value makes dc(1) exit after executing the
-expressions and expression files, and a non-zero value makes dc(1) not
-exit.
+expressions and expression files, and a zero value makes dc(1) not exit.
.RS
.PP
This environment variable overrides the default, which can be queried
@@ -1456,10 +1505,10 @@ The default setting can be queried with the \f[B]-h\f[R] or
\f[B]--help\f[R] options.
.PP
TTY mode is different from interactive mode because interactive mode is
-required in the bc(1)
-specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
-and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
-to be connected to a terminal.
+required in the bc(1) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html , and
+interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R] to
+be connected to a terminal.
.SS Command-Line History
.PP
Command-line history is only enabled if TTY mode is, i.e., that
@@ -1548,10 +1597,10 @@ locales and thus, supports \f[B]LC_MESSAGES\f[R].
bc(1)
.SH STANDARDS
.PP
-The dc(1) utility operators are compliant with the operators in the
-bc(1) IEEE Std 1003.1-2017
-(\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-specification.
+The dc(1) utility operators are compliant with the operators in the IEEE
+Std 1003.1-2017 (\[lq]POSIX.1-2017\[rq]) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for
+bc(1).
.SH BUGS
.PP
None are known.
diff --git a/manuals/dc/A.1.md b/manuals/dc/A.1.md
index 618543d7f397..f678c5f5a869 100644
--- a/manuals/dc/A.1.md
+++ b/manuals/dc/A.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-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*...] [**-I** *ibase*] [**-\-ibase**=*ibase*] [**-O** *obase*] [**-\-obase**=*obase*] [**-S** *scale*] [**-\-scale**=*scale*] [**-E** *seed*] [**-\-seed**=*seed*]
# DESCRIPTION
@@ -116,7 +116,7 @@ The following are the options that dc(1) accepts.
**-z**, **-\-leading-zeroes**
-: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
+: Makes dc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
@@ -157,13 +157,49 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
+**-I** *ibase*, **-\-ibase**=*ibase*
+
+: Sets the builtin variable **ibase** to the value *ibase* assuming that
+ *ibase* is in base 10. It is a fatal error if *ibase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-O** *obase*, **-\-obase**=*obase*
+
+: Sets the builtin variable **obase** to the value *obase* assuming that
+ *obase* is in base 10. It is a fatal error if *obase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-S** *scale*, **-\-scale**=*scale*
+
+: Sets the builtin variable **scale** to the value *scale* assuming that
+ *scale* is in base 10. It is a fatal error if *scale* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-E** *seed*, **-\-seed**=*seed*
+
+: Sets the builtin variable **seed** to the value *seed* assuming that *seed*
+ is in base 10. It is a fatal error if *seed* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
All long options are **non-portable extensions**.
# STDIN
If no files are given on the command-line and no files or expressions are given
by the **-f**, **-\-file**, **-e**, or **-\-expression** options, then dc(1)
-read from **stdin**.
+reads from **stdin**.
However, there is a caveat to this.
@@ -1195,8 +1231,8 @@ dc(1) recognizes the following environment variables:
: If any expressions or expression files are given on the command-line with
**-e**, **-\-expression**, **-f**, or **-\-file**, then if this environment
variable exists and contains an integer, a non-zero value makes dc(1) exit
- after executing the expressions and expression files, and a non-zero value
- makes dc(1) not exit.
+ after executing the expressions and expression files, and a zero value makes
+ dc(1) not exit.
This environment variable overrides the default, which can be queried with
the **-h** or **-\-help** options.
@@ -1297,8 +1333,10 @@ setting is used. The default setting can be queried with the **-h** or
**-\-help** options.
TTY mode is different from interactive mode because interactive mode is required
-in the [bc(1) specification][1], and interactive mode requires only **stdin**
-and **stdout** to be connected to a terminal.
+in the bc(1) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html , and
+interactive mode requires only **stdin** and **stdout** to be connected to a
+terminal.
## Command-Line History
@@ -1381,8 +1419,9 @@ bc(1)
# STANDARDS
-The dc(1) utility operators are compliant with the operators in the bc(1)
-[IEEE Std 1003.1-2017 (“POSIX.1-2017”)][1] specification.
+The dc(1) utility operators are compliant with the operators in the IEEE Std
+1003.1-2017 (“POSIX.1-2017”) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for bc(1).
# BUGS
@@ -1391,5 +1430,3 @@ None are known. Report bugs at https://git.yzena.com/gavin/bc.
# AUTHOR
Gavin D. Howard <gavin@yzena.com> and contributors.
-
-[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html
diff --git a/manuals/dc/E.1 b/manuals/dc/E.1
index a677bcea0c0c..7f90beac6b1c 100644
--- a/manuals/dc/E.1
+++ b/manuals/dc/E.1
@@ -25,7 +25,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "June 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "June 2022" "Gavin D. Howard" "General Commands Manual"
+.nh
+.ad l
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
@@ -129,7 +131,7 @@ This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
-Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
+Makes dc(1) print all numbers greater than \f[B]-1\f[R] and less than
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
.RS
.PP
@@ -182,13 +184,46 @@ exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
+.TP
+\f[B]-I\f[R] \f[I]ibase\f[R], \f[B]--ibase\f[R]=\f[I]ibase\f[R]
+Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
+assuming that \f[I]ibase\f[R] is in base 10.
+It is a fatal error if \f[I]ibase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-O\f[R] \f[I]obase\f[R], \f[B]--obase\f[R]=\f[I]obase\f[R]
+Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
+assuming that \f[I]obase\f[R] is in base 10.
+It is a fatal error if \f[I]obase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-S\f[R] \f[I]scale\f[R], \f[B]--scale\f[R]=\f[I]scale\f[R]
+Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
+assuming that \f[I]scale\f[R] is in base 10.
+It is a fatal error if \f[I]scale\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
.PP
If no files are given on the command-line and no files or expressions
are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or
-\f[B]--expression\f[R] options, then dc(1) read from \f[B]stdin\f[R].
+\f[B]--expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
.PP
However, there is a caveat to this.
.PP
@@ -1141,8 +1176,7 @@ If any expressions or expression files are given on the command-line
with \f[B]-e\f[R], \f[B]--expression\f[R], \f[B]-f\f[R], or
\f[B]--file\f[R], then if this environment variable exists and contains
an integer, a non-zero value makes dc(1) exit after executing the
-expressions and expression files, and a non-zero value makes dc(1) not
-exit.
+expressions and expression files, and a zero value makes dc(1) not exit.
.RS
.PP
This environment variable overrides the default, which can be queried
@@ -1249,10 +1283,10 @@ The default setting can be queried with the \f[B]-h\f[R] or
\f[B]--help\f[R] options.
.PP
TTY mode is different from interactive mode because interactive mode is
-required in the bc(1)
-specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
-and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
-to be connected to a terminal.
+required in the bc(1) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html , and
+interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R] to
+be connected to a terminal.
.SS Command-Line History
.PP
Command-line history is only enabled if TTY mode is, i.e., that
@@ -1341,10 +1375,10 @@ locales and thus, supports \f[B]LC_MESSAGES\f[R].
bc(1)
.SH STANDARDS
.PP
-The dc(1) utility operators are compliant with the operators in the
-bc(1) IEEE Std 1003.1-2017
-(\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-specification.
+The dc(1) utility operators are compliant with the operators in the IEEE
+Std 1003.1-2017 (\[lq]POSIX.1-2017\[rq]) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for
+bc(1).
.SH BUGS
.PP
None are known.
diff --git a/manuals/dc/E.1.md b/manuals/dc/E.1.md
index a138fdb32158..f854cbba874b 100644
--- a/manuals/dc/E.1.md
+++ b/manuals/dc/E.1.md
@@ -116,7 +116,7 @@ The following are the options that dc(1) accepts.
**-z**, **-\-leading-zeroes**
-: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
+: Makes dc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
@@ -157,13 +157,40 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
+**-I** *ibase*, **-\-ibase**=*ibase*
+
+: Sets the builtin variable **ibase** to the value *ibase* assuming that
+ *ibase* is in base 10. It is a fatal error if *ibase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-O** *obase*, **-\-obase**=*obase*
+
+: Sets the builtin variable **obase** to the value *obase* assuming that
+ *obase* is in base 10. It is a fatal error if *obase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-S** *scale*, **-\-scale**=*scale*
+
+: Sets the builtin variable **scale** to the value *scale* assuming that
+ *scale* is in base 10. It is a fatal error if *scale* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
All long options are **non-portable extensions**.
# STDIN
If no files are given on the command-line and no files or expressions are given
by the **-f**, **-\-file**, **-e**, or **-\-expression** options, then dc(1)
-read from **stdin**.
+reads from **stdin**.
However, there is a caveat to this.
@@ -1030,8 +1057,8 @@ dc(1) recognizes the following environment variables:
: If any expressions or expression files are given on the command-line with
**-e**, **-\-expression**, **-f**, or **-\-file**, then if this environment
variable exists and contains an integer, a non-zero value makes dc(1) exit
- after executing the expressions and expression files, and a non-zero value
- makes dc(1) not exit.
+ after executing the expressions and expression files, and a zero value makes
+ dc(1) not exit.
This environment variable overrides the default, which can be queried with
the **-h** or **-\-help** options.
@@ -1130,8 +1157,10 @@ setting is used. The default setting can be queried with the **-h** or
**-\-help** options.
TTY mode is different from interactive mode because interactive mode is required
-in the [bc(1) specification][1], and interactive mode requires only **stdin**
-and **stdout** to be connected to a terminal.
+in the bc(1) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html , and
+interactive mode requires only **stdin** and **stdout** to be connected to a
+terminal.
## Command-Line History
@@ -1214,8 +1243,9 @@ bc(1)
# STANDARDS
-The dc(1) utility operators are compliant with the operators in the bc(1)
-[IEEE Std 1003.1-2017 (“POSIX.1-2017”)][1] specification.
+The dc(1) utility operators are compliant with the operators in the IEEE Std
+1003.1-2017 (“POSIX.1-2017”) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for bc(1).
# BUGS
@@ -1224,5 +1254,3 @@ None are known. Report bugs at https://git.yzena.com/gavin/bc.
# AUTHOR
Gavin D. Howard <gavin@yzena.com> and contributors.
-
-[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html
diff --git a/manuals/dc/EH.1 b/manuals/dc/EH.1
index 97c05ca44094..96cb156e789f 100644
--- a/manuals/dc/EH.1
+++ b/manuals/dc/EH.1
@@ -25,7 +25,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "June 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "June 2022" "Gavin D. Howard" "General Commands Manual"
+.nh
+.ad l
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
@@ -129,7 +131,7 @@ This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
-Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
+Makes dc(1) print all numbers greater than \f[B]-1\f[R] and less than
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
.RS
.PP
@@ -182,13 +184,46 @@ exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
+.TP
+\f[B]-I\f[R] \f[I]ibase\f[R], \f[B]--ibase\f[R]=\f[I]ibase\f[R]
+Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
+assuming that \f[I]ibase\f[R] is in base 10.
+It is a fatal error if \f[I]ibase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-O\f[R] \f[I]obase\f[R], \f[B]--obase\f[R]=\f[I]obase\f[R]
+Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
+assuming that \f[I]obase\f[R] is in base 10.
+It is a fatal error if \f[I]obase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-S\f[R] \f[I]scale\f[R], \f[B]--scale\f[R]=\f[I]scale\f[R]
+Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
+assuming that \f[I]scale\f[R] is in base 10.
+It is a fatal error if \f[I]scale\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
.PP
If no files are given on the command-line and no files or expressions
are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or
-\f[B]--expression\f[R] options, then dc(1) read from \f[B]stdin\f[R].
+\f[B]--expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
.PP
However, there is a caveat to this.
.PP
@@ -1141,8 +1176,7 @@ If any expressions or expression files are given on the command-line
with \f[B]-e\f[R], \f[B]--expression\f[R], \f[B]-f\f[R], or
\f[B]--file\f[R], then if this environment variable exists and contains
an integer, a non-zero value makes dc(1) exit after executing the
-expressions and expression files, and a non-zero value makes dc(1) not
-exit.
+expressions and expression files, and a zero value makes dc(1) not exit.
.RS
.PP
This environment variable overrides the default, which can be queried
@@ -1249,10 +1283,10 @@ The default setting can be queried with the \f[B]-h\f[R] or
\f[B]--help\f[R] options.
.PP
TTY mode is different from interactive mode because interactive mode is
-required in the bc(1)
-specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
-and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
-to be connected to a terminal.
+required in the bc(1) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html , and
+interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R] to
+be connected to a terminal.
.SS Prompt
.PP
If TTY mode is available, then a prompt can be enabled.
@@ -1315,10 +1349,10 @@ locales and thus, supports \f[B]LC_MESSAGES\f[R].
bc(1)
.SH STANDARDS
.PP
-The dc(1) utility operators are compliant with the operators in the
-bc(1) IEEE Std 1003.1-2017
-(\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-specification.
+The dc(1) utility operators are compliant with the operators in the IEEE
+Std 1003.1-2017 (\[lq]POSIX.1-2017\[rq]) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for
+bc(1).
.SH BUGS
.PP
None are known.
diff --git a/manuals/dc/EH.1.md b/manuals/dc/EH.1.md
index 459f8ac12e7e..50850226ddbe 100644
--- a/manuals/dc/EH.1.md
+++ b/manuals/dc/EH.1.md
@@ -116,7 +116,7 @@ The following are the options that dc(1) accepts.
**-z**, **-\-leading-zeroes**
-: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
+: Makes dc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
@@ -157,13 +157,40 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
+**-I** *ibase*, **-\-ibase**=*ibase*
+
+: Sets the builtin variable **ibase** to the value *ibase* assuming that
+ *ibase* is in base 10. It is a fatal error if *ibase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-O** *obase*, **-\-obase**=*obase*
+
+: Sets the builtin variable **obase** to the value *obase* assuming that
+ *obase* is in base 10. It is a fatal error if *obase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-S** *scale*, **-\-scale**=*scale*
+
+: Sets the builtin variable **scale** to the value *scale* assuming that
+ *scale* is in base 10. It is a fatal error if *scale* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
All long options are **non-portable extensions**.
# STDIN
If no files are given on the command-line and no files or expressions are given
by the **-f**, **-\-file**, **-e**, or **-\-expression** options, then dc(1)
-read from **stdin**.
+reads from **stdin**.
However, there is a caveat to this.
@@ -1030,8 +1057,8 @@ dc(1) recognizes the following environment variables:
: If any expressions or expression files are given on the command-line with
**-e**, **-\-expression**, **-f**, or **-\-file**, then if this environment
variable exists and contains an integer, a non-zero value makes dc(1) exit
- after executing the expressions and expression files, and a non-zero value
- makes dc(1) not exit.
+ after executing the expressions and expression files, and a zero value makes
+ dc(1) not exit.
This environment variable overrides the default, which can be queried with
the **-h** or **-\-help** options.
@@ -1130,8 +1157,10 @@ setting is used. The default setting can be queried with the **-h** or
**-\-help** options.
TTY mode is different from interactive mode because interactive mode is required
-in the [bc(1) specification][1], and interactive mode requires only **stdin**
-and **stdout** to be connected to a terminal.
+in the bc(1) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html , and
+interactive mode requires only **stdin** and **stdout** to be connected to a
+terminal.
## Prompt
@@ -1191,8 +1220,9 @@ bc(1)
# STANDARDS
-The dc(1) utility operators are compliant with the operators in the bc(1)
-[IEEE Std 1003.1-2017 (“POSIX.1-2017”)][1] specification.
+The dc(1) utility operators are compliant with the operators in the IEEE Std
+1003.1-2017 (“POSIX.1-2017”) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for bc(1).
# BUGS
@@ -1201,5 +1231,3 @@ None are known. Report bugs at https://git.yzena.com/gavin/bc.
# AUTHOR
Gavin D. Howard <gavin@yzena.com> and contributors.
-
-[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html
diff --git a/manuals/dc/EHN.1 b/manuals/dc/EHN.1
index 223bd9f08dfa..31e60102b971 100644
--- a/manuals/dc/EHN.1
+++ b/manuals/dc/EHN.1
@@ -25,7 +25,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "June 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "June 2022" "Gavin D. Howard" "General Commands Manual"
+.nh
+.ad l
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
@@ -129,7 +131,7 @@ This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
-Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
+Makes dc(1) print all numbers greater than \f[B]-1\f[R] and less than
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
.RS
.PP
@@ -182,13 +184,46 @@ exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
+.TP
+\f[B]-I\f[R] \f[I]ibase\f[R], \f[B]--ibase\f[R]=\f[I]ibase\f[R]
+Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
+assuming that \f[I]ibase\f[R] is in base 10.
+It is a fatal error if \f[I]ibase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-O\f[R] \f[I]obase\f[R], \f[B]--obase\f[R]=\f[I]obase\f[R]
+Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
+assuming that \f[I]obase\f[R] is in base 10.
+It is a fatal error if \f[I]obase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-S\f[R] \f[I]scale\f[R], \f[B]--scale\f[R]=\f[I]scale\f[R]
+Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
+assuming that \f[I]scale\f[R] is in base 10.
+It is a fatal error if \f[I]scale\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
.PP
If no files are given on the command-line and no files or expressions
are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or
-\f[B]--expression\f[R] options, then dc(1) read from \f[B]stdin\f[R].
+\f[B]--expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
.PP
However, there is a caveat to this.
.PP
@@ -1141,8 +1176,7 @@ If any expressions or expression files are given on the command-line
with \f[B]-e\f[R], \f[B]--expression\f[R], \f[B]-f\f[R], or
\f[B]--file\f[R], then if this environment variable exists and contains
an integer, a non-zero value makes dc(1) exit after executing the
-expressions and expression files, and a non-zero value makes dc(1) not
-exit.
+expressions and expression files, and a zero value makes dc(1) not exit.
.RS
.PP
This environment variable overrides the default, which can be queried
@@ -1249,10 +1283,10 @@ The default setting can be queried with the \f[B]-h\f[R] or
\f[B]--help\f[R] options.
.PP
TTY mode is different from interactive mode because interactive mode is
-required in the bc(1)
-specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
-and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
-to be connected to a terminal.
+required in the bc(1) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html , and
+interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R] to
+be connected to a terminal.
.SS Prompt
.PP
If TTY mode is available, then a prompt can be enabled.
@@ -1311,10 +1345,10 @@ exit, and it uses the default handler for all other signals.
bc(1)
.SH STANDARDS
.PP
-The dc(1) utility operators are compliant with the operators in the
-bc(1) IEEE Std 1003.1-2017
-(\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-specification.
+The dc(1) utility operators are compliant with the operators in the IEEE
+Std 1003.1-2017 (\[lq]POSIX.1-2017\[rq]) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for
+bc(1).
.SH BUGS
.PP
None are known.
diff --git a/manuals/dc/EHN.1.md b/manuals/dc/EHN.1.md
index 56ac39ed599e..e3b42d4453f6 100644
--- a/manuals/dc/EHN.1.md
+++ b/manuals/dc/EHN.1.md
@@ -116,7 +116,7 @@ The following are the options that dc(1) accepts.
**-z**, **-\-leading-zeroes**
-: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
+: Makes dc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
@@ -157,13 +157,40 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
+**-I** *ibase*, **-\-ibase**=*ibase*
+
+: Sets the builtin variable **ibase** to the value *ibase* assuming that
+ *ibase* is in base 10. It is a fatal error if *ibase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-O** *obase*, **-\-obase**=*obase*
+
+: Sets the builtin variable **obase** to the value *obase* assuming that
+ *obase* is in base 10. It is a fatal error if *obase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-S** *scale*, **-\-scale**=*scale*
+
+: Sets the builtin variable **scale** to the value *scale* assuming that
+ *scale* is in base 10. It is a fatal error if *scale* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
All long options are **non-portable extensions**.
# STDIN
If no files are given on the command-line and no files or expressions are given
by the **-f**, **-\-file**, **-e**, or **-\-expression** options, then dc(1)
-read from **stdin**.
+reads from **stdin**.
However, there is a caveat to this.
@@ -1030,8 +1057,8 @@ dc(1) recognizes the following environment variables:
: If any expressions or expression files are given on the command-line with
**-e**, **-\-expression**, **-f**, or **-\-file**, then if this environment
variable exists and contains an integer, a non-zero value makes dc(1) exit
- after executing the expressions and expression files, and a non-zero value
- makes dc(1) not exit.
+ after executing the expressions and expression files, and a zero value makes
+ dc(1) not exit.
This environment variable overrides the default, which can be queried with
the **-h** or **-\-help** options.
@@ -1130,8 +1157,10 @@ setting is used. The default setting can be queried with the **-h** or
**-\-help** options.
TTY mode is different from interactive mode because interactive mode is required
-in the [bc(1) specification][1], and interactive mode requires only **stdin**
-and **stdout** to be connected to a terminal.
+in the bc(1) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html , and
+interactive mode requires only **stdin** and **stdout** to be connected to a
+terminal.
## Prompt
@@ -1186,8 +1215,9 @@ bc(1)
# STANDARDS
-The dc(1) utility operators are compliant with the operators in the bc(1)
-[IEEE Std 1003.1-2017 (“POSIX.1-2017”)][1] specification.
+The dc(1) utility operators are compliant with the operators in the IEEE Std
+1003.1-2017 (“POSIX.1-2017”) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for bc(1).
# BUGS
@@ -1196,5 +1226,3 @@ None are known. Report bugs at https://git.yzena.com/gavin/bc.
# AUTHOR
Gavin D. Howard <gavin@yzena.com> and contributors.
-
-[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html
diff --git a/manuals/dc/EN.1 b/manuals/dc/EN.1
index 8c2d14f57840..d941c130e847 100644
--- a/manuals/dc/EN.1
+++ b/manuals/dc/EN.1
@@ -25,7 +25,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "June 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "June 2022" "Gavin D. Howard" "General Commands Manual"
+.nh
+.ad l
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
@@ -129,7 +131,7 @@ This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
-Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
+Makes dc(1) print all numbers greater than \f[B]-1\f[R] and less than
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
.RS
.PP
@@ -182,13 +184,46 @@ exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
+.TP
+\f[B]-I\f[R] \f[I]ibase\f[R], \f[B]--ibase\f[R]=\f[I]ibase\f[R]
+Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
+assuming that \f[I]ibase\f[R] is in base 10.
+It is a fatal error if \f[I]ibase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-O\f[R] \f[I]obase\f[R], \f[B]--obase\f[R]=\f[I]obase\f[R]
+Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
+assuming that \f[I]obase\f[R] is in base 10.
+It is a fatal error if \f[I]obase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-S\f[R] \f[I]scale\f[R], \f[B]--scale\f[R]=\f[I]scale\f[R]
+Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
+assuming that \f[I]scale\f[R] is in base 10.
+It is a fatal error if \f[I]scale\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
.PP
If no files are given on the command-line and no files or expressions
are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or
-\f[B]--expression\f[R] options, then dc(1) read from \f[B]stdin\f[R].
+\f[B]--expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
.PP
However, there is a caveat to this.
.PP
@@ -1141,8 +1176,7 @@ If any expressions or expression files are given on the command-line
with \f[B]-e\f[R], \f[B]--expression\f[R], \f[B]-f\f[R], or
\f[B]--file\f[R], then if this environment variable exists and contains
an integer, a non-zero value makes dc(1) exit after executing the
-expressions and expression files, and a non-zero value makes dc(1) not
-exit.
+expressions and expression files, and a zero value makes dc(1) not exit.
.RS
.PP
This environment variable overrides the default, which can be queried
@@ -1249,10 +1283,10 @@ The default setting can be queried with the \f[B]-h\f[R] or
\f[B]--help\f[R] options.
.PP
TTY mode is different from interactive mode because interactive mode is
-required in the bc(1)
-specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
-and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
-to be connected to a terminal.
+required in the bc(1) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html , and
+interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R] to
+be connected to a terminal.
.SS Command-Line History
.PP
Command-line history is only enabled if TTY mode is, i.e., that
@@ -1337,10 +1371,10 @@ section).
bc(1)
.SH STANDARDS
.PP
-The dc(1) utility operators are compliant with the operators in the
-bc(1) IEEE Std 1003.1-2017
-(\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-specification.
+The dc(1) utility operators are compliant with the operators in the IEEE
+Std 1003.1-2017 (\[lq]POSIX.1-2017\[rq]) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for
+bc(1).
.SH BUGS
.PP
None are known.
diff --git a/manuals/dc/EN.1.md b/manuals/dc/EN.1.md
index 03836923c00e..fa02ccf4b43f 100644
--- a/manuals/dc/EN.1.md
+++ b/manuals/dc/EN.1.md
@@ -116,7 +116,7 @@ The following are the options that dc(1) accepts.
**-z**, **-\-leading-zeroes**
-: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
+: Makes dc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
@@ -157,13 +157,40 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
+**-I** *ibase*, **-\-ibase**=*ibase*
+
+: Sets the builtin variable **ibase** to the value *ibase* assuming that
+ *ibase* is in base 10. It is a fatal error if *ibase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-O** *obase*, **-\-obase**=*obase*
+
+: Sets the builtin variable **obase** to the value *obase* assuming that
+ *obase* is in base 10. It is a fatal error if *obase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-S** *scale*, **-\-scale**=*scale*
+
+: Sets the builtin variable **scale** to the value *scale* assuming that
+ *scale* is in base 10. It is a fatal error if *scale* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
All long options are **non-portable extensions**.
# STDIN
If no files are given on the command-line and no files or expressions are given
by the **-f**, **-\-file**, **-e**, or **-\-expression** options, then dc(1)
-read from **stdin**.
+reads from **stdin**.
However, there is a caveat to this.
@@ -1030,8 +1057,8 @@ dc(1) recognizes the following environment variables:
: If any expressions or expression files are given on the command-line with
**-e**, **-\-expression**, **-f**, or **-\-file**, then if this environment
variable exists and contains an integer, a non-zero value makes dc(1) exit
- after executing the expressions and expression files, and a non-zero value
- makes dc(1) not exit.
+ after executing the expressions and expression files, and a zero value makes
+ dc(1) not exit.
This environment variable overrides the default, which can be queried with
the **-h** or **-\-help** options.
@@ -1130,8 +1157,10 @@ setting is used. The default setting can be queried with the **-h** or
**-\-help** options.
TTY mode is different from interactive mode because interactive mode is required
-in the [bc(1) specification][1], and interactive mode requires only **stdin**
-and **stdout** to be connected to a terminal.
+in the bc(1) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html , and
+interactive mode requires only **stdin** and **stdout** to be connected to a
+terminal.
## Command-Line History
@@ -1209,8 +1238,9 @@ bc(1)
# STANDARDS
-The dc(1) utility operators are compliant with the operators in the bc(1)
-[IEEE Std 1003.1-2017 (“POSIX.1-2017”)][1] specification.
+The dc(1) utility operators are compliant with the operators in the IEEE Std
+1003.1-2017 (“POSIX.1-2017”) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for bc(1).
# BUGS
@@ -1219,5 +1249,3 @@ None are known. Report bugs at https://git.yzena.com/gavin/bc.
# AUTHOR
Gavin D. Howard <gavin@yzena.com> and contributors.
-
-[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html
diff --git a/manuals/dc/H.1 b/manuals/dc/H.1
index f27358fb7f12..58703e03be34 100644
--- a/manuals/dc/H.1
+++ b/manuals/dc/H.1
@@ -25,7 +25,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "June 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "June 2022" "Gavin D. Howard" "General Commands Manual"
+.nh
+.ad l
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
@@ -37,7 +39,11 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
[\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[I]file\f[R]\&...] [\f[B]-I\f[R] \f[I]ibase\f[R]]
+[\f[B]--ibase\f[R]=\f[I]ibase\f[R]] [\f[B]-O\f[R] \f[I]obase\f[R]]
+[\f[B]--obase\f[R]=\f[I]obase\f[R]] [\f[B]-S\f[R] \f[I]scale\f[R]]
+[\f[B]--scale\f[R]=\f[I]scale\f[R]] [\f[B]-E\f[R] \f[I]seed\f[R]]
+[\f[B]--seed\f[R]=\f[I]seed\f[R]]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -129,7 +135,7 @@ This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
-Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
+Makes dc(1) print all numbers greater than \f[B]-1\f[R] and less than
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
.RS
.PP
@@ -182,13 +188,57 @@ exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
+.TP
+\f[B]-I\f[R] \f[I]ibase\f[R], \f[B]--ibase\f[R]=\f[I]ibase\f[R]
+Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
+assuming that \f[I]ibase\f[R] is in base 10.
+It is a fatal error if \f[I]ibase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-O\f[R] \f[I]obase\f[R], \f[B]--obase\f[R]=\f[I]obase\f[R]
+Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
+assuming that \f[I]obase\f[R] is in base 10.
+It is a fatal error if \f[I]obase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-S\f[R] \f[I]scale\f[R], \f[B]--scale\f[R]=\f[I]scale\f[R]
+Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
+assuming that \f[I]scale\f[R] is in base 10.
+It is a fatal error if \f[I]scale\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-E\f[R] \f[I]seed\f[R], \f[B]--seed\f[R]=\f[I]seed\f[R]
+Sets the builtin variable \f[B]seed\f[R] to the value \f[I]seed\f[R]
+assuming that \f[I]seed\f[R] is in base 10.
+It is a fatal error if \f[I]seed\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
.PP
If no files are given on the command-line and no files or expressions
are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or
-\f[B]--expression\f[R] options, then dc(1) read from \f[B]stdin\f[R].
+\f[B]--expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
.PP
However, there is a caveat to this.
.PP
@@ -1346,8 +1396,7 @@ If any expressions or expression files are given on the command-line
with \f[B]-e\f[R], \f[B]--expression\f[R], \f[B]-f\f[R], or
\f[B]--file\f[R], then if this environment variable exists and contains
an integer, a non-zero value makes dc(1) exit after executing the
-expressions and expression files, and a non-zero value makes dc(1) not
-exit.
+expressions and expression files, and a zero value makes dc(1) not exit.
.RS
.PP
This environment variable overrides the default, which can be queried
@@ -1456,10 +1505,10 @@ The default setting can be queried with the \f[B]-h\f[R] or
\f[B]--help\f[R] options.
.PP
TTY mode is different from interactive mode because interactive mode is
-required in the bc(1)
-specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
-and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
-to be connected to a terminal.
+required in the bc(1) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html , and
+interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R] to
+be connected to a terminal.
.SS Prompt
.PP
If TTY mode is available, then a prompt can be enabled.
@@ -1522,10 +1571,10 @@ locales and thus, supports \f[B]LC_MESSAGES\f[R].
bc(1)
.SH STANDARDS
.PP
-The dc(1) utility operators are compliant with the operators in the
-bc(1) IEEE Std 1003.1-2017
-(\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-specification.
+The dc(1) utility operators are compliant with the operators in the IEEE
+Std 1003.1-2017 (\[lq]POSIX.1-2017\[rq]) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for
+bc(1).
.SH BUGS
.PP
None are known.
diff --git a/manuals/dc/H.1.md b/manuals/dc/H.1.md
index c97cc8b58eef..50111044d265 100644
--- a/manuals/dc/H.1.md
+++ b/manuals/dc/H.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-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*...] [**-I** *ibase*] [**-\-ibase**=*ibase*] [**-O** *obase*] [**-\-obase**=*obase*] [**-S** *scale*] [**-\-scale**=*scale*] [**-E** *seed*] [**-\-seed**=*seed*]
# DESCRIPTION
@@ -116,7 +116,7 @@ The following are the options that dc(1) accepts.
**-z**, **-\-leading-zeroes**
-: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
+: Makes dc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
@@ -157,13 +157,49 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
+**-I** *ibase*, **-\-ibase**=*ibase*
+
+: Sets the builtin variable **ibase** to the value *ibase* assuming that
+ *ibase* is in base 10. It is a fatal error if *ibase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-O** *obase*, **-\-obase**=*obase*
+
+: Sets the builtin variable **obase** to the value *obase* assuming that
+ *obase* is in base 10. It is a fatal error if *obase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-S** *scale*, **-\-scale**=*scale*
+
+: Sets the builtin variable **scale** to the value *scale* assuming that
+ *scale* is in base 10. It is a fatal error if *scale* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-E** *seed*, **-\-seed**=*seed*
+
+: Sets the builtin variable **seed** to the value *seed* assuming that *seed*
+ is in base 10. It is a fatal error if *seed* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
All long options are **non-portable extensions**.
# STDIN
If no files are given on the command-line and no files or expressions are given
by the **-f**, **-\-file**, **-e**, or **-\-expression** options, then dc(1)
-read from **stdin**.
+reads from **stdin**.
However, there is a caveat to this.
@@ -1195,8 +1231,8 @@ dc(1) recognizes the following environment variables:
: If any expressions or expression files are given on the command-line with
**-e**, **-\-expression**, **-f**, or **-\-file**, then if this environment
variable exists and contains an integer, a non-zero value makes dc(1) exit
- after executing the expressions and expression files, and a non-zero value
- makes dc(1) not exit.
+ after executing the expressions and expression files, and a zero value makes
+ dc(1) not exit.
This environment variable overrides the default, which can be queried with
the **-h** or **-\-help** options.
@@ -1297,8 +1333,10 @@ setting is used. The default setting can be queried with the **-h** or
**-\-help** options.
TTY mode is different from interactive mode because interactive mode is required
-in the [bc(1) specification][1], and interactive mode requires only **stdin**
-and **stdout** to be connected to a terminal.
+in the bc(1) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html , and
+interactive mode requires only **stdin** and **stdout** to be connected to a
+terminal.
## Prompt
@@ -1358,8 +1396,9 @@ bc(1)
# STANDARDS
-The dc(1) utility operators are compliant with the operators in the bc(1)
-[IEEE Std 1003.1-2017 (“POSIX.1-2017”)][1] specification.
+The dc(1) utility operators are compliant with the operators in the IEEE Std
+1003.1-2017 (“POSIX.1-2017”) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for bc(1).
# BUGS
@@ -1368,5 +1407,3 @@ None are known. Report bugs at https://git.yzena.com/gavin/bc.
# AUTHOR
Gavin D. Howard <gavin@yzena.com> and contributors.
-
-[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html
diff --git a/manuals/dc/HN.1 b/manuals/dc/HN.1
index 13a39ef26540..d67e2325817e 100644
--- a/manuals/dc/HN.1
+++ b/manuals/dc/HN.1
@@ -25,7 +25,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "June 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "June 2022" "Gavin D. Howard" "General Commands Manual"
+.nh
+.ad l
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
@@ -37,7 +39,11 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
[\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[I]file\f[R]\&...] [\f[B]-I\f[R] \f[I]ibase\f[R]]
+[\f[B]--ibase\f[R]=\f[I]ibase\f[R]] [\f[B]-O\f[R] \f[I]obase\f[R]]
+[\f[B]--obase\f[R]=\f[I]obase\f[R]] [\f[B]-S\f[R] \f[I]scale\f[R]]
+[\f[B]--scale\f[R]=\f[I]scale\f[R]] [\f[B]-E\f[R] \f[I]seed\f[R]]
+[\f[B]--seed\f[R]=\f[I]seed\f[R]]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -129,7 +135,7 @@ This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
-Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
+Makes dc(1) print all numbers greater than \f[B]-1\f[R] and less than
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
.RS
.PP
@@ -182,13 +188,57 @@ exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
+.TP
+\f[B]-I\f[R] \f[I]ibase\f[R], \f[B]--ibase\f[R]=\f[I]ibase\f[R]
+Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
+assuming that \f[I]ibase\f[R] is in base 10.
+It is a fatal error if \f[I]ibase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-O\f[R] \f[I]obase\f[R], \f[B]--obase\f[R]=\f[I]obase\f[R]
+Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
+assuming that \f[I]obase\f[R] is in base 10.
+It is a fatal error if \f[I]obase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-S\f[R] \f[I]scale\f[R], \f[B]--scale\f[R]=\f[I]scale\f[R]
+Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
+assuming that \f[I]scale\f[R] is in base 10.
+It is a fatal error if \f[I]scale\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-E\f[R] \f[I]seed\f[R], \f[B]--seed\f[R]=\f[I]seed\f[R]
+Sets the builtin variable \f[B]seed\f[R] to the value \f[I]seed\f[R]
+assuming that \f[I]seed\f[R] is in base 10.
+It is a fatal error if \f[I]seed\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
.PP
If no files are given on the command-line and no files or expressions
are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or
-\f[B]--expression\f[R] options, then dc(1) read from \f[B]stdin\f[R].
+\f[B]--expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
.PP
However, there is a caveat to this.
.PP
@@ -1346,8 +1396,7 @@ If any expressions or expression files are given on the command-line
with \f[B]-e\f[R], \f[B]--expression\f[R], \f[B]-f\f[R], or
\f[B]--file\f[R], then if this environment variable exists and contains
an integer, a non-zero value makes dc(1) exit after executing the
-expressions and expression files, and a non-zero value makes dc(1) not
-exit.
+expressions and expression files, and a zero value makes dc(1) not exit.
.RS
.PP
This environment variable overrides the default, which can be queried
@@ -1456,10 +1505,10 @@ The default setting can be queried with the \f[B]-h\f[R] or
\f[B]--help\f[R] options.
.PP
TTY mode is different from interactive mode because interactive mode is
-required in the bc(1)
-specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
-and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
-to be connected to a terminal.
+required in the bc(1) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html , and
+interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R] to
+be connected to a terminal.
.SS Prompt
.PP
If TTY mode is available, then a prompt can be enabled.
@@ -1518,10 +1567,10 @@ exit, and it uses the default handler for all other signals.
bc(1)
.SH STANDARDS
.PP
-The dc(1) utility operators are compliant with the operators in the
-bc(1) IEEE Std 1003.1-2017
-(\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-specification.
+The dc(1) utility operators are compliant with the operators in the IEEE
+Std 1003.1-2017 (\[lq]POSIX.1-2017\[rq]) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for
+bc(1).
.SH BUGS
.PP
None are known.
diff --git a/manuals/dc/HN.1.md b/manuals/dc/HN.1.md
index 47c2a0330ae9..79292243304c 100644
--- a/manuals/dc/HN.1.md
+++ b/manuals/dc/HN.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-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*...] [**-I** *ibase*] [**-\-ibase**=*ibase*] [**-O** *obase*] [**-\-obase**=*obase*] [**-S** *scale*] [**-\-scale**=*scale*] [**-E** *seed*] [**-\-seed**=*seed*]
# DESCRIPTION
@@ -116,7 +116,7 @@ The following are the options that dc(1) accepts.
**-z**, **-\-leading-zeroes**
-: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
+: Makes dc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
@@ -157,13 +157,49 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
+**-I** *ibase*, **-\-ibase**=*ibase*
+
+: Sets the builtin variable **ibase** to the value *ibase* assuming that
+ *ibase* is in base 10. It is a fatal error if *ibase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-O** *obase*, **-\-obase**=*obase*
+
+: Sets the builtin variable **obase** to the value *obase* assuming that
+ *obase* is in base 10. It is a fatal error if *obase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-S** *scale*, **-\-scale**=*scale*
+
+: Sets the builtin variable **scale** to the value *scale* assuming that
+ *scale* is in base 10. It is a fatal error if *scale* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-E** *seed*, **-\-seed**=*seed*
+
+: Sets the builtin variable **seed** to the value *seed* assuming that *seed*
+ is in base 10. It is a fatal error if *seed* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
All long options are **non-portable extensions**.
# STDIN
If no files are given on the command-line and no files or expressions are given
by the **-f**, **-\-file**, **-e**, or **-\-expression** options, then dc(1)
-read from **stdin**.
+reads from **stdin**.
However, there is a caveat to this.
@@ -1195,8 +1231,8 @@ dc(1) recognizes the following environment variables:
: If any expressions or expression files are given on the command-line with
**-e**, **-\-expression**, **-f**, or **-\-file**, then if this environment
variable exists and contains an integer, a non-zero value makes dc(1) exit
- after executing the expressions and expression files, and a non-zero value
- makes dc(1) not exit.
+ after executing the expressions and expression files, and a zero value makes
+ dc(1) not exit.
This environment variable overrides the default, which can be queried with
the **-h** or **-\-help** options.
@@ -1297,8 +1333,10 @@ setting is used. The default setting can be queried with the **-h** or
**-\-help** options.
TTY mode is different from interactive mode because interactive mode is required
-in the [bc(1) specification][1], and interactive mode requires only **stdin**
-and **stdout** to be connected to a terminal.
+in the bc(1) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html , and
+interactive mode requires only **stdin** and **stdout** to be connected to a
+terminal.
## Prompt
@@ -1353,8 +1391,9 @@ bc(1)
# STANDARDS
-The dc(1) utility operators are compliant with the operators in the bc(1)
-[IEEE Std 1003.1-2017 (“POSIX.1-2017”)][1] specification.
+The dc(1) utility operators are compliant with the operators in the IEEE Std
+1003.1-2017 (“POSIX.1-2017”) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for bc(1).
# BUGS
@@ -1363,5 +1402,3 @@ None are known. Report bugs at https://git.yzena.com/gavin/bc.
# AUTHOR
Gavin D. Howard <gavin@yzena.com> and contributors.
-
-[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html
diff --git a/manuals/dc/N.1 b/manuals/dc/N.1
index 16f89b7ee2a1..39782bf95e5e 100644
--- a/manuals/dc/N.1
+++ b/manuals/dc/N.1
@@ -25,7 +25,9 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.TH "DC" "1" "June 2021" "Gavin D. Howard" "General Commands Manual"
+.TH "DC" "1" "June 2022" "Gavin D. Howard" "General Commands Manual"
+.nh
+.ad l
.SH Name
.PP
dc - arbitrary-precision decimal reverse-Polish notation calculator
@@ -37,7 +39,11 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
[\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[I]file\f[R]\&...] [\f[B]-I\f[R] \f[I]ibase\f[R]]
+[\f[B]--ibase\f[R]=\f[I]ibase\f[R]] [\f[B]-O\f[R] \f[I]obase\f[R]]
+[\f[B]--obase\f[R]=\f[I]obase\f[R]] [\f[B]-S\f[R] \f[I]scale\f[R]]
+[\f[B]--scale\f[R]=\f[I]scale\f[R]] [\f[B]-E\f[R] \f[I]seed\f[R]]
+[\f[B]--seed\f[R]=\f[I]seed\f[R]]
.SH DESCRIPTION
.PP
dc(1) is an arbitrary-precision calculator.
@@ -129,7 +135,7 @@ This is a \f[B]non-portable extension\f[R].
.RE
.TP
\f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
-Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
+Makes dc(1) print all numbers greater than \f[B]-1\f[R] and less than
\f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
.RS
.PP
@@ -182,13 +188,57 @@ exit.
.PP
This is a \f[B]non-portable extension\f[R].
.RE
+.TP
+\f[B]-I\f[R] \f[I]ibase\f[R], \f[B]--ibase\f[R]=\f[I]ibase\f[R]
+Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
+assuming that \f[I]ibase\f[R] is in base 10.
+It is a fatal error if \f[I]ibase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-O\f[R] \f[I]obase\f[R], \f[B]--obase\f[R]=\f[I]obase\f[R]
+Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
+assuming that \f[I]obase\f[R] is in base 10.
+It is a fatal error if \f[I]obase\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-S\f[R] \f[I]scale\f[R], \f[B]--scale\f[R]=\f[I]scale\f[R]
+Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
+assuming that \f[I]scale\f[R] is in base 10.
+It is a fatal error if \f[I]scale\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
+.TP
+\f[B]-E\f[R] \f[I]seed\f[R], \f[B]--seed\f[R]=\f[I]seed\f[R]
+Sets the builtin variable \f[B]seed\f[R] to the value \f[I]seed\f[R]
+assuming that \f[I]seed\f[R] is in base 10.
+It is a fatal error if \f[I]seed\f[R] is not a valid number.
+.RS
+.PP
+If multiple instances of this option are given, the last is used.
+.PP
+This is a \f[B]non-portable extension\f[R].
+.RE
.PP
All long options are \f[B]non-portable extensions\f[R].
.SH STDIN
.PP
If no files are given on the command-line and no files or expressions
are given by the \f[B]-f\f[R], \f[B]--file\f[R], \f[B]-e\f[R], or
-\f[B]--expression\f[R] options, then dc(1) read from \f[B]stdin\f[R].
+\f[B]--expression\f[R] options, then dc(1) reads from \f[B]stdin\f[R].
.PP
However, there is a caveat to this.
.PP
@@ -1346,8 +1396,7 @@ If any expressions or expression files are given on the command-line
with \f[B]-e\f[R], \f[B]--expression\f[R], \f[B]-f\f[R], or
\f[B]--file\f[R], then if this environment variable exists and contains
an integer, a non-zero value makes dc(1) exit after executing the
-expressions and expression files, and a non-zero value makes dc(1) not
-exit.
+expressions and expression files, and a zero value makes dc(1) not exit.
.RS
.PP
This environment variable overrides the default, which can be queried
@@ -1456,10 +1505,10 @@ The default setting can be queried with the \f[B]-h\f[R] or
\f[B]--help\f[R] options.
.PP
TTY mode is different from interactive mode because interactive mode is
-required in the bc(1)
-specification (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
-and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
-to be connected to a terminal.
+required in the bc(1) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html , and
+interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R] to
+be connected to a terminal.
.SS Command-Line History
.PP
Command-line history is only enabled if TTY mode is, i.e., that
@@ -1544,10 +1593,10 @@ section).
bc(1)
.SH STANDARDS
.PP
-The dc(1) utility operators are compliant with the operators in the
-bc(1) IEEE Std 1003.1-2017
-(\[lq]POSIX.1-2017\[rq]) (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
-specification.
+The dc(1) utility operators are compliant with the operators in the IEEE
+Std 1003.1-2017 (\[lq]POSIX.1-2017\[rq]) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for
+bc(1).
.SH BUGS
.PP
None are known.
diff --git a/manuals/dc/N.1.md b/manuals/dc/N.1.md
index a14c922b4dbc..25c13b7c2fd4 100644
--- a/manuals/dc/N.1.md
+++ b/manuals/dc/N.1.md
@@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
# SYNOPSIS
-**dc** [**-hiPRvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-no-read-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*...] [**-I** *ibase*] [**-\-ibase**=*ibase*] [**-O** *obase*] [**-\-obase**=*obase*] [**-S** *scale*] [**-\-scale**=*scale*] [**-E** *seed*] [**-\-seed**=*seed*]
# DESCRIPTION
@@ -116,7 +116,7 @@ The following are the options that dc(1) accepts.
**-z**, **-\-leading-zeroes**
-: Makes bc(1) print all numbers greater than **-1** and less than **1**, and
+: Makes dc(1) print all numbers greater than **-1** and less than **1**, and
not equal to **0**, with a leading zero.
This can be set for individual numbers with the **plz(x)**, plznl(x)**,
@@ -157,13 +157,49 @@ The following are the options that dc(1) accepts.
This is a **non-portable extension**.
+**-I** *ibase*, **-\-ibase**=*ibase*
+
+: Sets the builtin variable **ibase** to the value *ibase* assuming that
+ *ibase* is in base 10. It is a fatal error if *ibase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-O** *obase*, **-\-obase**=*obase*
+
+: Sets the builtin variable **obase** to the value *obase* assuming that
+ *obase* is in base 10. It is a fatal error if *obase* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-S** *scale*, **-\-scale**=*scale*
+
+: Sets the builtin variable **scale** to the value *scale* assuming that
+ *scale* is in base 10. It is a fatal error if *scale* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
+**-E** *seed*, **-\-seed**=*seed*
+
+: Sets the builtin variable **seed** to the value *seed* assuming that *seed*
+ is in base 10. It is a fatal error if *seed* is not a valid number.
+
+ If multiple instances of this option are given, the last is used.
+
+ This is a **non-portable extension**.
+
All long options are **non-portable extensions**.
# STDIN
If no files are given on the command-line and no files or expressions are given
by the **-f**, **-\-file**, **-e**, or **-\-expression** options, then dc(1)
-read from **stdin**.
+reads from **stdin**.
However, there is a caveat to this.
@@ -1195,8 +1231,8 @@ dc(1) recognizes the following environment variables:
: If any expressions or expression files are given on the command-line with
**-e**, **-\-expression**, **-f**, or **-\-file**, then if this environment
variable exists and contains an integer, a non-zero value makes dc(1) exit
- after executing the expressions and expression files, and a non-zero value
- makes dc(1) not exit.
+ after executing the expressions and expression files, and a zero value makes
+ dc(1) not exit.
This environment variable overrides the default, which can be queried with
the **-h** or **-\-help** options.
@@ -1297,8 +1333,10 @@ setting is used. The default setting can be queried with the **-h** or
**-\-help** options.
TTY mode is different from interactive mode because interactive mode is required
-in the [bc(1) specification][1], and interactive mode requires only **stdin**
-and **stdout** to be connected to a terminal.
+in the bc(1) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html , and
+interactive mode requires only **stdin** and **stdout** to be connected to a
+terminal.
## Command-Line History
@@ -1376,8 +1414,9 @@ bc(1)
# STANDARDS
-The dc(1) utility operators are compliant with the operators in the bc(1)
-[IEEE Std 1003.1-2017 (“POSIX.1-2017”)][1] specification.
+The dc(1) utility operators are compliant with the operators in the IEEE Std
+1003.1-2017 (“POSIX.1-2017”) specification at
+https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html for bc(1).
# BUGS
@@ -1386,5 +1425,3 @@ None are known. Report bugs at https://git.yzena.com/gavin/bc.
# AUTHOR
Gavin D. Howard <gavin@yzena.com> and contributors.
-
-[1]: https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html