bc: Vendor import new version 3.3.3
This commit is contained in:
parent
88832d59de
commit
028616d0dd
@ -29,7 +29,7 @@
|
|||||||
#
|
#
|
||||||
.POSIX:
|
.POSIX:
|
||||||
|
|
||||||
VERSION = 3.3.0
|
VERSION = 3.3.3
|
||||||
|
|
||||||
SRC = %%SRC%%
|
SRC = %%SRC%%
|
||||||
OBJ = %%OBJ%%
|
OBJ = %%OBJ%%
|
||||||
|
@ -1,5 +1,31 @@
|
|||||||
# News
|
# News
|
||||||
|
|
||||||
|
## 3.3.3
|
||||||
|
|
||||||
|
This is a production release with one tweak and fixes for manuals.
|
||||||
|
|
||||||
|
The tweak is that `length(0)` returns `1` instead of `0`. In `3.3.1`, I changed
|
||||||
|
it so `length(0.x)`, where `x` could be any number of digits, returned the
|
||||||
|
`scale`, but `length(0)` still returned `0` because I believe that `0` has `0`
|
||||||
|
significant digits.
|
||||||
|
|
||||||
|
After request of FreeBSD and considering the arguments of a mathematician,
|
||||||
|
compatibility with other `bc`'s, and the expectations of users, I decided to
|
||||||
|
make the change.
|
||||||
|
|
||||||
|
The fixes for manuals fixed a bug where `--` was rendered as `-`.
|
||||||
|
|
||||||
|
## 3.3.2
|
||||||
|
|
||||||
|
This is a production release that fixes a divide-by-zero bug in `root()` in the
|
||||||
|
[extended math library][16]. All previous versions with `root()` have the bug.
|
||||||
|
|
||||||
|
## 3.3.1
|
||||||
|
|
||||||
|
This is a production release that fixes a bug.
|
||||||
|
|
||||||
|
The bug was in the reporting of number length when the value was 0.
|
||||||
|
|
||||||
## 3.3.0
|
## 3.3.0
|
||||||
|
|
||||||
This is a production release that changes one behavior and fixes documentation
|
This is a production release that changes one behavior and fixes documentation
|
||||||
|
@ -110,7 +110,7 @@ define root(x,n){
|
|||||||
if(n<0)sqrt(n)
|
if(n<0)sqrt(n)
|
||||||
n=n$
|
n=n$
|
||||||
if(n==0)x/n
|
if(n==0)x/n
|
||||||
if(n==1)return x
|
if(x==0||n==1)return x
|
||||||
if(n==2)return sqrt(x)
|
if(n==2)return sqrt(x)
|
||||||
s=scale
|
s=scale
|
||||||
scale=0
|
scale=0
|
||||||
|
@ -121,20 +121,20 @@ def run(cmd, env=None):
|
|||||||
|
|
||||||
p = run([ "make", "clean" ])
|
p = run([ "make", "clean" ])
|
||||||
|
|
||||||
print("Testing \"make -j4\"")
|
print("Testing \"make -j12\"")
|
||||||
|
|
||||||
if p.returncode != 0:
|
if p.returncode != 0:
|
||||||
print("make returned an error ({}); exiting...".format(p.returncode))
|
print("make returned an error ({}); exiting...".format(p.returncode))
|
||||||
sys.exit(p.returncode)
|
sys.exit(p.returncode)
|
||||||
|
|
||||||
p = run([ "make", "-j4" ])
|
p = run([ "make", "-j12" ])
|
||||||
|
|
||||||
if p.returncode == 0:
|
if p.returncode == 0:
|
||||||
makecmd = [ "make", "-j4" ]
|
makecmd = [ "make", "-j12" ]
|
||||||
print("Using \"make -j4\"")
|
print("Using \"make -j12\"")
|
||||||
else:
|
else:
|
||||||
makecmd = [ "make" ]
|
makecmd = [ "make" ]
|
||||||
print("Not using \"make -j4\"")
|
print("Not using \"make -j12\"")
|
||||||
|
|
||||||
if test_num != 0:
|
if test_num != 0:
|
||||||
mx2 = test_num
|
mx2 = test_num
|
||||||
|
@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
|
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
[*file*...]
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -61,7 +60,7 @@ especially) the GNU bc(1).
|
|||||||
|
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
|
|
||||||
**-g**, **--global-stacks**
|
**-g**, **-\-global-stacks**
|
||||||
|
|
||||||
{{ A H N P HN HP NP HNP }}
|
{{ A H N P HN HP NP HNP }}
|
||||||
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
||||||
@ -152,17 +151,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **--mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
{{ A H N P HN HP NP HNP }}
|
{{ A H N P HN HP NP HNP }}
|
||||||
@ -178,7 +177,7 @@ The following are the options that bc(1) accepts.
|
|||||||
To learn what is in the library, see the **LIBRARY** section.
|
To learn what is in the library, see the **LIBRARY** section.
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
{{ A E H N EH EN HN EHN }}
|
{{ A E H N EH EN HN EHN }}
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
@ -193,36 +192,36 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-q**, **--quiet**
|
**-q**, **-\-quiet**
|
||||||
|
|
||||||
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
|
: 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
|
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
|
prints the copyright header if one or more of the **-v**, **-V**, or
|
||||||
**--version** options are given.
|
**-\-version** options are given.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-s**, **--standard**
|
**-s**, **-\-standard**
|
||||||
|
|
||||||
: Process exactly the language defined by the [standard][1] and error if any
|
: Process exactly the language defined by the [standard][1] and error if any
|
||||||
extensions are used.
|
extensions are used.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-w**, **--warn**
|
**-w**, **-\-warn**
|
||||||
|
|
||||||
: Like **-s** and **--standard**, except that warnings (and not errors) are
|
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
|
||||||
printed for non-standard extensions and execution continues normally.
|
printed for non-standard extensions and execution continues normally.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -232,14 +231,14 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, bc(1) will give a fatal error and exit.
|
or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -248,8 +247,8 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -304,8 +303,8 @@ Identifiers with more than one character (letter) are a
|
|||||||
|
|
||||||
**ibase** is a global variable determining how to interpret constant numbers. It
|
**ibase** is a global variable determining how to interpret constant numbers. It
|
||||||
is the "input" base, or the number base used for interpreting input numbers.
|
is the "input" base, or the number base used for interpreting input numbers.
|
||||||
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
|
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
|
||||||
(**--warn**) flags were not given on the command line, the max allowable value
|
(**-\-warn**) flags were not given on the command line, the max allowable value
|
||||||
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
||||||
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
||||||
bc(1) programs with the **maxibase()** built-in function.
|
bc(1) programs with the **maxibase()** built-in function.
|
||||||
@ -512,7 +511,7 @@ The following arithmetic and logical operators can be used. They are listed in
|
|||||||
order of decreasing precedence. Operators in the same group have the same
|
order of decreasing precedence. Operators in the same group have the same
|
||||||
precedence.
|
precedence.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: Type: Prefix and Postfix
|
: Type: Prefix and Postfix
|
||||||
|
|
||||||
@ -617,7 +616,7 @@ precedence.
|
|||||||
|
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: The prefix and postfix **increment** and **decrement** operators behave
|
: The prefix and postfix **increment** and **decrement** operators behave
|
||||||
exactly like they would in C. They require a named expression (see the
|
exactly like they would in C. They require a named expression (see the
|
||||||
@ -962,12 +961,12 @@ This is a **non-portable extension**.
|
|||||||
{{ A H N P HN HP NP HNP }}
|
{{ A H N P HN HP NP HNP }}
|
||||||
All of the functions below, including the functions in the extended math
|
All of the functions below, including the functions in the extended math
|
||||||
library (see the *Extended Library* subsection below), are available when the
|
library (see the *Extended Library* subsection below), are available when the
|
||||||
**-l** or **--mathlib** command-line flags are given, except that the extended
|
**-l** or **-\-mathlib** command-line flags are given, except that the extended
|
||||||
math library is not available when the **-s** option, the **-w** option, or
|
math library is not available when the **-s** option, the **-w** option, or
|
||||||
equivalents are given.
|
equivalents are given.
|
||||||
{{ end }}
|
{{ end }}
|
||||||
{{ E EH EN EP EHN EHP ENP EHNP }}
|
{{ E EH EN EP EHN EHP ENP EHNP }}
|
||||||
All of the functions below are available when the **-l** or **--mathlib**
|
All of the functions below are available when the **-l** or **-\-mathlib**
|
||||||
command-line flags are given.
|
command-line flags are given.
|
||||||
{{ end }}
|
{{ end }}
|
||||||
|
|
||||||
@ -1020,8 +1019,8 @@ The [standard][1] defines the following functions for the math library:
|
|||||||
{{ A H N P HN HP NP HNP }}
|
{{ A H N P HN HP NP HNP }}
|
||||||
## Extended Library
|
## Extended Library
|
||||||
|
|
||||||
The extended library is *not* loaded when the **-s**/**--standard** or
|
The extended library is *not* loaded when the **-s**/**-\-standard** or
|
||||||
**-w**/**--warn** options are given since they are not part of the library
|
**-w**/**-\-warn** options are given since they are not part of the library
|
||||||
defined by the [standard][1].
|
defined by the [standard][1].
|
||||||
|
|
||||||
The extended library is a **non-portable extension**.
|
The extended library is a **non-portable extension**.
|
||||||
@ -1705,17 +1704,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Per the [standard][1], bc(1) has an interactive mode and a non-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**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,19 +25,18 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
bc - arbitrary-precision decimal arithmetic language and calculator
|
bc - arbitrary-precision decimal arithmetic language and calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
|
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
|
||||||
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
|
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
|
||||||
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
|
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -60,7 +59,7 @@ implementations.
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
|
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
|
||||||
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
|
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
|
||||||
\f[B]seed\f[R] into stacks.
|
\f[B]seed\f[R] into stacks.
|
||||||
.RS
|
.RS
|
||||||
@ -152,10 +151,10 @@ is ignored.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -163,7 +162,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library and the extended math library before
|
and loads the included math library and the extended math library before
|
||||||
running any code, including any expressions or files specified on the
|
running any code, including any expressions or files specified on the
|
||||||
@ -173,7 +172,7 @@ command line.
|
|||||||
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
|
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
||||||
@ -185,18 +184,18 @@ Most of those users would want to put this option in
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
|
\f[B]-q\f[R], \f[B]--quiet\f[R]
|
||||||
This option is for compatibility with the GNU
|
This option is for compatibility with the GNU
|
||||||
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
||||||
Without this option, GNU bc(1) prints a copyright header.
|
Without this option, GNU bc(1) prints a copyright header.
|
||||||
This bc(1) only prints the copyright header if one or more of the
|
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]\[en]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.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
|
\f[B]-s\f[R], \f[B]--standard\f[R]
|
||||||
Process exactly the language defined by the
|
Process exactly the language defined by the
|
||||||
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
||||||
and error if any extensions are used.
|
and error if any extensions are used.
|
||||||
@ -205,15 +204,15 @@ and error if any extensions are used.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
|
\f[B]-w\f[R], \f[B]--warn\f[R]
|
||||||
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
|
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
|
||||||
not errors) are printed for non-standard extensions and execution
|
not errors) are printed for non-standard extensions and execution
|
||||||
continues normally.
|
continues normally.
|
||||||
.RS
|
.RS
|
||||||
@ -221,7 +220,7 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -234,17 +233,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]BC_ENV_ARGS\f[R].
|
\f[B]BC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -255,9 +254,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -322,8 +321,8 @@ constant numbers.
|
|||||||
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
||||||
input numbers.
|
input numbers.
|
||||||
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
||||||
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
|
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
|
||||||
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
|
(\f[B]--warn\f[R]) flags were not given on the command line, the max
|
||||||
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
||||||
Otherwise, it is \f[B]16\f[R].
|
Otherwise, it is \f[B]16\f[R].
|
||||||
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
||||||
@ -582,7 +581,7 @@ The following arithmetic and logical operators can be used.
|
|||||||
They are listed in order of decreasing precedence.
|
They are listed in order of decreasing precedence.
|
||||||
Operators in the same group have the same precedence.
|
Operators in the same group have the same precedence.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
Type: Prefix and Postfix
|
Type: Prefix and Postfix
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
@ -692,7 +691,7 @@ Description: \f[B]boolean or\f[R]
|
|||||||
.PP
|
.PP
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
||||||
operators behave exactly like they would in C.
|
operators behave exactly like they would in C.
|
||||||
They require a named expression (see the \f[I]Named Expressions\f[R]
|
They require a named expression (see the \f[I]Named Expressions\f[R]
|
||||||
@ -1138,7 +1137,7 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.PP
|
.PP
|
||||||
All of the functions below, including the functions in the extended math
|
All of the functions below, including the functions in the extended math
|
||||||
library (see the \f[I]Extended Library\f[R] subsection below), are
|
library (see the \f[I]Extended Library\f[R] subsection below), are
|
||||||
available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line
|
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
|
||||||
flags are given, except that the extended math library is not available
|
flags are given, except that the extended math library is not available
|
||||||
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
|
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
|
||||||
are given.
|
are given.
|
||||||
@ -1199,7 +1198,7 @@ Functions\f[R] subsection below).
|
|||||||
.SS Extended Library
|
.SS Extended Library
|
||||||
.PP
|
.PP
|
||||||
The extended library is \f[I]not\f[R] loaded when the
|
The extended library is \f[I]not\f[R] loaded when the
|
||||||
\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
|
\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
|
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
|
.PP
|
||||||
@ -1957,11 +1956,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Per the
|
Per the
|
||||||
@ -1969,7 +1968,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
|
|||||||
bc(1) has an interactive mode and a non-interactive mode.
|
bc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the
|
In interactive mode, bc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
|
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
[*file*...]
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -55,7 +54,7 @@ other implementations.
|
|||||||
|
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
|
|
||||||
**-g**, **--global-stacks**
|
**-g**, **-\-global-stacks**
|
||||||
|
|
||||||
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
||||||
|
|
||||||
@ -123,17 +122,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **--mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
math library and the extended math library before running any code,
|
math library and the extended math library before running any code,
|
||||||
@ -141,7 +140,7 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
To learn what is in the libraries, see the **LIBRARY** section.
|
To learn what is in the libraries, see the **LIBRARY** section.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
See the **TTY MODE** section) This is mostly for those users that do not
|
See the **TTY MODE** section) This is mostly for those users that do not
|
||||||
@ -151,36 +150,36 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-q**, **--quiet**
|
**-q**, **-\-quiet**
|
||||||
|
|
||||||
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
|
: 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
|
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
|
prints the copyright header if one or more of the **-v**, **-V**, or
|
||||||
**--version** options are given.
|
**-\-version** options are given.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-s**, **--standard**
|
**-s**, **-\-standard**
|
||||||
|
|
||||||
: Process exactly the language defined by the [standard][1] and error if any
|
: Process exactly the language defined by the [standard][1] and error if any
|
||||||
extensions are used.
|
extensions are used.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-w**, **--warn**
|
**-w**, **-\-warn**
|
||||||
|
|
||||||
: Like **-s** and **--standard**, except that warnings (and not errors) are
|
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
|
||||||
printed for non-standard extensions and execution continues normally.
|
printed for non-standard extensions and execution continues normally.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -190,14 +189,14 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, bc(1) will give a fatal error and exit.
|
or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -206,8 +205,8 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -262,8 +261,8 @@ Identifiers with more than one character (letter) are a
|
|||||||
|
|
||||||
**ibase** is a global variable determining how to interpret constant numbers. It
|
**ibase** is a global variable determining how to interpret constant numbers. It
|
||||||
is the "input" base, or the number base used for interpreting input numbers.
|
is the "input" base, or the number base used for interpreting input numbers.
|
||||||
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
|
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
|
||||||
(**--warn**) flags were not given on the command line, the max allowable value
|
(**-\-warn**) flags were not given on the command line, the max allowable value
|
||||||
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
||||||
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
||||||
bc(1) programs with the **maxibase()** built-in function.
|
bc(1) programs with the **maxibase()** built-in function.
|
||||||
@ -453,7 +452,7 @@ The following arithmetic and logical operators can be used. They are listed in
|
|||||||
order of decreasing precedence. Operators in the same group have the same
|
order of decreasing precedence. Operators in the same group have the same
|
||||||
precedence.
|
precedence.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: Type: Prefix and Postfix
|
: Type: Prefix and Postfix
|
||||||
|
|
||||||
@ -551,7 +550,7 @@ precedence.
|
|||||||
|
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: The prefix and postfix **increment** and **decrement** operators behave
|
: The prefix and postfix **increment** and **decrement** operators behave
|
||||||
exactly like they would in C. They require a named expression (see the
|
exactly like they would in C. They require a named expression (see the
|
||||||
@ -882,7 +881,7 @@ This is a **non-portable extension**.
|
|||||||
|
|
||||||
All of the functions below, including the functions in the extended math
|
All of the functions below, including the functions in the extended math
|
||||||
library (see the *Extended Library* subsection below), are available when the
|
library (see the *Extended Library* subsection below), are available when the
|
||||||
**-l** or **--mathlib** command-line flags are given, except that the extended
|
**-l** or **-\-mathlib** command-line flags are given, except that the extended
|
||||||
math library is not available when the **-s** option, the **-w** option, or
|
math library is not available when the **-s** option, the **-w** option, or
|
||||||
equivalents are given.
|
equivalents are given.
|
||||||
|
|
||||||
@ -934,8 +933,8 @@ The [standard][1] defines the following functions for the math library:
|
|||||||
|
|
||||||
## Extended Library
|
## Extended Library
|
||||||
|
|
||||||
The extended library is *not* loaded when the **-s**/**--standard** or
|
The extended library is *not* loaded when the **-s**/**-\-standard** or
|
||||||
**-w**/**--warn** options are given since they are not part of the library
|
**-w**/**-\-warn** options are given since they are not part of the library
|
||||||
defined by the [standard][1].
|
defined by the [standard][1].
|
||||||
|
|
||||||
The extended library is a **non-portable extension**.
|
The extended library is a **non-portable extension**.
|
||||||
@ -1603,17 +1602,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Per the [standard][1], bc(1) has an interactive mode and a non-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**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,19 +25,18 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
bc - arbitrary-precision decimal arithmetic language and calculator
|
bc - arbitrary-precision decimal arithmetic language and calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
|
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
|
||||||
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
|
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
|
||||||
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
|
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -58,7 +57,7 @@ This bc(1) is a drop-in replacement for \f[I]any\f[R] bc(1), including
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
.PP
|
.PP
|
||||||
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
|
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
|
||||||
.IP
|
.IP
|
||||||
.nf
|
.nf
|
||||||
\f[C]
|
\f[C]
|
||||||
@ -115,10 +114,10 @@ This is a **non-portable extension**.
|
|||||||
\f[R]
|
\f[R]
|
||||||
.fi
|
.fi
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -126,7 +125,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library before running any code, including
|
and loads the included math library before running any code, including
|
||||||
any expressions or files specified on the command line.
|
any expressions or files specified on the command line.
|
||||||
@ -135,7 +134,7 @@ any expressions or files specified on the command line.
|
|||||||
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
|
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
||||||
@ -147,18 +146,18 @@ Most of those users would want to put this option in
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
|
\f[B]-q\f[R], \f[B]--quiet\f[R]
|
||||||
This option is for compatibility with the GNU
|
This option is for compatibility with the GNU
|
||||||
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
||||||
Without this option, GNU bc(1) prints a copyright header.
|
Without this option, GNU bc(1) prints a copyright header.
|
||||||
This bc(1) only prints the copyright header if one or more of the
|
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]\[en]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.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
|
\f[B]-s\f[R], \f[B]--standard\f[R]
|
||||||
Process exactly the language defined by the
|
Process exactly the language defined by the
|
||||||
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
||||||
and error if any extensions are used.
|
and error if any extensions are used.
|
||||||
@ -167,15 +166,15 @@ and error if any extensions are used.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
|
\f[B]-w\f[R], \f[B]--warn\f[R]
|
||||||
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
|
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
|
||||||
not errors) are printed for non-standard extensions and execution
|
not errors) are printed for non-standard extensions and execution
|
||||||
continues normally.
|
continues normally.
|
||||||
.RS
|
.RS
|
||||||
@ -183,7 +182,7 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -196,17 +195,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]BC_ENV_ARGS\f[R].
|
\f[B]BC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -217,9 +216,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -284,8 +283,8 @@ constant numbers.
|
|||||||
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
||||||
input numbers.
|
input numbers.
|
||||||
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
||||||
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
|
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
|
||||||
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
|
(\f[B]--warn\f[R]) flags were not given on the command line, the max
|
||||||
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
||||||
Otherwise, it is \f[B]16\f[R].
|
Otherwise, it is \f[B]16\f[R].
|
||||||
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
||||||
@ -445,7 +444,7 @@ The following arithmetic and logical operators can be used.
|
|||||||
They are listed in order of decreasing precedence.
|
They are listed in order of decreasing precedence.
|
||||||
Operators in the same group have the same precedence.
|
Operators in the same group have the same precedence.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
Type: Prefix and Postfix
|
Type: Prefix and Postfix
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
@ -528,7 +527,7 @@ Description: \f[B]boolean or\f[R]
|
|||||||
.PP
|
.PP
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
||||||
operators behave exactly like they would in C.
|
operators behave exactly like they would in C.
|
||||||
They require a named expression (see the \f[I]Named Expressions\f[R]
|
They require a named expression (see the \f[I]Named Expressions\f[R]
|
||||||
@ -908,7 +907,7 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.SH LIBRARY
|
.SH LIBRARY
|
||||||
.PP
|
.PP
|
||||||
All of the functions below are available when the \f[B]-l\f[R] or
|
All of the functions below are available when the \f[B]-l\f[R] or
|
||||||
\f[B]\[en]mathlib\f[R] command-line flags are given.
|
\f[B]--mathlib\f[R] command-line flags are given.
|
||||||
.SS Standard Library
|
.SS Standard Library
|
||||||
.PP
|
.PP
|
||||||
The
|
The
|
||||||
@ -1213,11 +1212,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Per the
|
Per the
|
||||||
@ -1225,7 +1224,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
|
|||||||
bc(1) has an interactive mode and a non-interactive mode.
|
bc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the
|
In interactive mode, bc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
|
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
[*file*...]
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -54,7 +53,7 @@ especially) the GNU bc(1).
|
|||||||
|
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
|
|
||||||
**-g**, **--global-stacks**
|
**-g**, **-\-global-stacks**
|
||||||
|
|
||||||
Turns the globals **ibase**, **obase**, and **scale** into stacks.
|
Turns the globals **ibase**, **obase**, and **scale** into stacks.
|
||||||
|
|
||||||
@ -107,17 +106,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **--mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
math library before running any code, including any expressions or files
|
math library before running any code, including any expressions or files
|
||||||
@ -125,7 +124,7 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
To learn what is in the library, see the **LIBRARY** section.
|
To learn what is in the library, see the **LIBRARY** section.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
See the **TTY MODE** section) This is mostly for those users that do not
|
See the **TTY MODE** section) This is mostly for those users that do not
|
||||||
@ -135,36 +134,36 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-q**, **--quiet**
|
**-q**, **-\-quiet**
|
||||||
|
|
||||||
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
|
: 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
|
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
|
prints the copyright header if one or more of the **-v**, **-V**, or
|
||||||
**--version** options are given.
|
**-\-version** options are given.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-s**, **--standard**
|
**-s**, **-\-standard**
|
||||||
|
|
||||||
: Process exactly the language defined by the [standard][1] and error if any
|
: Process exactly the language defined by the [standard][1] and error if any
|
||||||
extensions are used.
|
extensions are used.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-w**, **--warn**
|
**-w**, **-\-warn**
|
||||||
|
|
||||||
: Like **-s** and **--standard**, except that warnings (and not errors) are
|
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
|
||||||
printed for non-standard extensions and execution continues normally.
|
printed for non-standard extensions and execution continues normally.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -174,14 +173,14 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, bc(1) will give a fatal error and exit.
|
or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -190,8 +189,8 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -246,8 +245,8 @@ Identifiers with more than one character (letter) are a
|
|||||||
|
|
||||||
**ibase** is a global variable determining how to interpret constant numbers. It
|
**ibase** is a global variable determining how to interpret constant numbers. It
|
||||||
is the "input" base, or the number base used for interpreting input numbers.
|
is the "input" base, or the number base used for interpreting input numbers.
|
||||||
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
|
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
|
||||||
(**--warn**) flags were not given on the command line, the max allowable value
|
(**-\-warn**) flags were not given on the command line, the max allowable value
|
||||||
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
||||||
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
||||||
bc(1) programs with the **maxibase()** built-in function.
|
bc(1) programs with the **maxibase()** built-in function.
|
||||||
@ -366,7 +365,7 @@ The following arithmetic and logical operators can be used. They are listed in
|
|||||||
order of decreasing precedence. Operators in the same group have the same
|
order of decreasing precedence. Operators in the same group have the same
|
||||||
precedence.
|
precedence.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: Type: Prefix and Postfix
|
: Type: Prefix and Postfix
|
||||||
|
|
||||||
@ -440,7 +439,7 @@ precedence.
|
|||||||
|
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: The prefix and postfix **increment** and **decrement** operators behave
|
: The prefix and postfix **increment** and **decrement** operators behave
|
||||||
exactly like they would in C. They require a named expression (see the
|
exactly like they would in C. They require a named expression (see the
|
||||||
@ -716,7 +715,7 @@ This is a **non-portable extension**.
|
|||||||
|
|
||||||
# LIBRARY
|
# LIBRARY
|
||||||
|
|
||||||
All of the functions below are available when the **-l** or **--mathlib**
|
All of the functions below are available when the **-l** or **-\-mathlib**
|
||||||
command-line flags are given.
|
command-line flags are given.
|
||||||
|
|
||||||
## Standard Library
|
## Standard Library
|
||||||
@ -992,17 +991,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Per the [standard][1], bc(1) has an interactive mode and a non-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**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,19 +25,18 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
bc - arbitrary-precision decimal arithmetic language and calculator
|
bc - arbitrary-precision decimal arithmetic language and calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
|
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
|
||||||
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
|
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
|
||||||
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
|
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
.PP
|
.PP
|
||||||
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
|
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
|
||||||
.IP
|
.IP
|
||||||
.nf
|
.nf
|
||||||
\f[C]
|
\f[C]
|
||||||
@ -112,10 +111,10 @@ This is a **non-portable extension**.
|
|||||||
\f[R]
|
\f[R]
|
||||||
.fi
|
.fi
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -123,7 +122,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library before running any code, including
|
and loads the included math library before running any code, including
|
||||||
any expressions or files specified on the command line.
|
any expressions or files specified on the command line.
|
||||||
@ -132,7 +131,7 @@ any expressions or files specified on the command line.
|
|||||||
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
|
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
||||||
@ -144,18 +143,18 @@ Most of those users would want to put this option in
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
|
\f[B]-q\f[R], \f[B]--quiet\f[R]
|
||||||
This option is for compatibility with the GNU
|
This option is for compatibility with the GNU
|
||||||
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
||||||
Without this option, GNU bc(1) prints a copyright header.
|
Without this option, GNU bc(1) prints a copyright header.
|
||||||
This bc(1) only prints the copyright header if one or more of the
|
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]\[en]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.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
|
\f[B]-s\f[R], \f[B]--standard\f[R]
|
||||||
Process exactly the language defined by the
|
Process exactly the language defined by the
|
||||||
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
||||||
and error if any extensions are used.
|
and error if any extensions are used.
|
||||||
@ -164,15 +163,15 @@ and error if any extensions are used.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
|
\f[B]-w\f[R], \f[B]--warn\f[R]
|
||||||
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
|
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
|
||||||
not errors) are printed for non-standard extensions and execution
|
not errors) are printed for non-standard extensions and execution
|
||||||
continues normally.
|
continues normally.
|
||||||
.RS
|
.RS
|
||||||
@ -180,7 +179,7 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -193,17 +192,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]BC_ENV_ARGS\f[R].
|
\f[B]BC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -214,9 +213,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -281,8 +280,8 @@ constant numbers.
|
|||||||
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
||||||
input numbers.
|
input numbers.
|
||||||
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
||||||
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
|
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
|
||||||
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
|
(\f[B]--warn\f[R]) flags were not given on the command line, the max
|
||||||
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
||||||
Otherwise, it is \f[B]16\f[R].
|
Otherwise, it is \f[B]16\f[R].
|
||||||
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
||||||
@ -442,7 +441,7 @@ The following arithmetic and logical operators can be used.
|
|||||||
They are listed in order of decreasing precedence.
|
They are listed in order of decreasing precedence.
|
||||||
Operators in the same group have the same precedence.
|
Operators in the same group have the same precedence.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
Type: Prefix and Postfix
|
Type: Prefix and Postfix
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
@ -525,7 +524,7 @@ Description: \f[B]boolean or\f[R]
|
|||||||
.PP
|
.PP
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
||||||
operators behave exactly like they would in C.
|
operators behave exactly like they would in C.
|
||||||
They require a named expression (see the \f[I]Named Expressions\f[R]
|
They require a named expression (see the \f[I]Named Expressions\f[R]
|
||||||
@ -905,7 +904,7 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.SH LIBRARY
|
.SH LIBRARY
|
||||||
.PP
|
.PP
|
||||||
All of the functions below are available when the \f[B]-l\f[R] or
|
All of the functions below are available when the \f[B]-l\f[R] or
|
||||||
\f[B]\[en]mathlib\f[R] command-line flags are given.
|
\f[B]--mathlib\f[R] command-line flags are given.
|
||||||
.SS Standard Library
|
.SS Standard Library
|
||||||
.PP
|
.PP
|
||||||
The
|
The
|
||||||
@ -1210,11 +1209,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Per the
|
Per the
|
||||||
@ -1222,7 +1221,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
|
|||||||
bc(1) has an interactive mode and a non-interactive mode.
|
bc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the
|
In interactive mode, bc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
|
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
[*file*...]
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
|
|||||||
|
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
|
|
||||||
**-g**, **--global-stacks**
|
**-g**, **-\-global-stacks**
|
||||||
|
|
||||||
Turns the globals **ibase**, **obase**, and **scale** into stacks.
|
Turns the globals **ibase**, **obase**, and **scale** into stacks.
|
||||||
|
|
||||||
@ -104,17 +103,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **--mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
math library before running any code, including any expressions or files
|
math library before running any code, including any expressions or files
|
||||||
@ -122,7 +121,7 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
To learn what is in the library, see the **LIBRARY** section.
|
To learn what is in the library, see the **LIBRARY** section.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
See the **TTY MODE** section) This is mostly for those users that do not
|
See the **TTY MODE** section) This is mostly for those users that do not
|
||||||
@ -132,36 +131,36 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-q**, **--quiet**
|
**-q**, **-\-quiet**
|
||||||
|
|
||||||
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
|
: 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
|
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
|
prints the copyright header if one or more of the **-v**, **-V**, or
|
||||||
**--version** options are given.
|
**-\-version** options are given.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-s**, **--standard**
|
**-s**, **-\-standard**
|
||||||
|
|
||||||
: Process exactly the language defined by the [standard][1] and error if any
|
: Process exactly the language defined by the [standard][1] and error if any
|
||||||
extensions are used.
|
extensions are used.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-w**, **--warn**
|
**-w**, **-\-warn**
|
||||||
|
|
||||||
: Like **-s** and **--standard**, except that warnings (and not errors) are
|
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
|
||||||
printed for non-standard extensions and execution continues normally.
|
printed for non-standard extensions and execution continues normally.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -171,14 +170,14 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, bc(1) will give a fatal error and exit.
|
or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -187,8 +186,8 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -243,8 +242,8 @@ Identifiers with more than one character (letter) are a
|
|||||||
|
|
||||||
**ibase** is a global variable determining how to interpret constant numbers. It
|
**ibase** is a global variable determining how to interpret constant numbers. It
|
||||||
is the "input" base, or the number base used for interpreting input numbers.
|
is the "input" base, or the number base used for interpreting input numbers.
|
||||||
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
|
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
|
||||||
(**--warn**) flags were not given on the command line, the max allowable value
|
(**-\-warn**) flags were not given on the command line, the max allowable value
|
||||||
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
||||||
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
||||||
bc(1) programs with the **maxibase()** built-in function.
|
bc(1) programs with the **maxibase()** built-in function.
|
||||||
@ -363,7 +362,7 @@ The following arithmetic and logical operators can be used. They are listed in
|
|||||||
order of decreasing precedence. Operators in the same group have the same
|
order of decreasing precedence. Operators in the same group have the same
|
||||||
precedence.
|
precedence.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: Type: Prefix and Postfix
|
: Type: Prefix and Postfix
|
||||||
|
|
||||||
@ -437,7 +436,7 @@ precedence.
|
|||||||
|
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: The prefix and postfix **increment** and **decrement** operators behave
|
: The prefix and postfix **increment** and **decrement** operators behave
|
||||||
exactly like they would in C. They require a named expression (see the
|
exactly like they would in C. They require a named expression (see the
|
||||||
@ -713,7 +712,7 @@ This is a **non-portable extension**.
|
|||||||
|
|
||||||
# LIBRARY
|
# LIBRARY
|
||||||
|
|
||||||
All of the functions below are available when the **-l** or **--mathlib**
|
All of the functions below are available when the **-l** or **-\-mathlib**
|
||||||
command-line flags are given.
|
command-line flags are given.
|
||||||
|
|
||||||
## Standard Library
|
## Standard Library
|
||||||
@ -989,17 +988,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Per the [standard][1], bc(1) has an interactive mode and a non-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**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,19 +25,18 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
bc - arbitrary-precision decimal arithmetic language and calculator
|
bc - arbitrary-precision decimal arithmetic language and calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
|
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
|
||||||
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
|
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
|
||||||
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
|
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
.PP
|
.PP
|
||||||
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
|
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
|
||||||
.IP
|
.IP
|
||||||
.nf
|
.nf
|
||||||
\f[C]
|
\f[C]
|
||||||
@ -112,10 +111,10 @@ This is a **non-portable extension**.
|
|||||||
\f[R]
|
\f[R]
|
||||||
.fi
|
.fi
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -123,7 +122,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library before running any code, including
|
and loads the included math library before running any code, including
|
||||||
any expressions or files specified on the command line.
|
any expressions or files specified on the command line.
|
||||||
@ -132,7 +131,7 @@ any expressions or files specified on the command line.
|
|||||||
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
|
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
||||||
@ -144,18 +143,18 @@ Most of those users would want to put this option in
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
|
\f[B]-q\f[R], \f[B]--quiet\f[R]
|
||||||
This option is for compatibility with the GNU
|
This option is for compatibility with the GNU
|
||||||
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
||||||
Without this option, GNU bc(1) prints a copyright header.
|
Without this option, GNU bc(1) prints a copyright header.
|
||||||
This bc(1) only prints the copyright header if one or more of the
|
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]\[en]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.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
|
\f[B]-s\f[R], \f[B]--standard\f[R]
|
||||||
Process exactly the language defined by the
|
Process exactly the language defined by the
|
||||||
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
||||||
and error if any extensions are used.
|
and error if any extensions are used.
|
||||||
@ -164,15 +163,15 @@ and error if any extensions are used.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
|
\f[B]-w\f[R], \f[B]--warn\f[R]
|
||||||
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
|
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
|
||||||
not errors) are printed for non-standard extensions and execution
|
not errors) are printed for non-standard extensions and execution
|
||||||
continues normally.
|
continues normally.
|
||||||
.RS
|
.RS
|
||||||
@ -180,7 +179,7 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -193,17 +192,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]BC_ENV_ARGS\f[R].
|
\f[B]BC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -214,9 +213,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -281,8 +280,8 @@ constant numbers.
|
|||||||
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
||||||
input numbers.
|
input numbers.
|
||||||
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
||||||
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
|
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
|
||||||
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
|
(\f[B]--warn\f[R]) flags were not given on the command line, the max
|
||||||
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
||||||
Otherwise, it is \f[B]16\f[R].
|
Otherwise, it is \f[B]16\f[R].
|
||||||
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
||||||
@ -442,7 +441,7 @@ The following arithmetic and logical operators can be used.
|
|||||||
They are listed in order of decreasing precedence.
|
They are listed in order of decreasing precedence.
|
||||||
Operators in the same group have the same precedence.
|
Operators in the same group have the same precedence.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
Type: Prefix and Postfix
|
Type: Prefix and Postfix
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
@ -525,7 +524,7 @@ Description: \f[B]boolean or\f[R]
|
|||||||
.PP
|
.PP
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
||||||
operators behave exactly like they would in C.
|
operators behave exactly like they would in C.
|
||||||
They require a named expression (see the \f[I]Named Expressions\f[R]
|
They require a named expression (see the \f[I]Named Expressions\f[R]
|
||||||
@ -905,7 +904,7 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.SH LIBRARY
|
.SH LIBRARY
|
||||||
.PP
|
.PP
|
||||||
All of the functions below are available when the \f[B]-l\f[R] or
|
All of the functions below are available when the \f[B]-l\f[R] or
|
||||||
\f[B]\[en]mathlib\f[R] command-line flags are given.
|
\f[B]--mathlib\f[R] command-line flags are given.
|
||||||
.SS Standard Library
|
.SS Standard Library
|
||||||
.PP
|
.PP
|
||||||
The
|
The
|
||||||
@ -1210,11 +1209,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Per the
|
Per the
|
||||||
@ -1222,7 +1221,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
|
|||||||
bc(1) has an interactive mode and a non-interactive mode.
|
bc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the
|
In interactive mode, bc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
|
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
[*file*...]
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
|
|||||||
|
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
|
|
||||||
**-g**, **--global-stacks**
|
**-g**, **-\-global-stacks**
|
||||||
|
|
||||||
Turns the globals **ibase**, **obase**, and **scale** into stacks.
|
Turns the globals **ibase**, **obase**, and **scale** into stacks.
|
||||||
|
|
||||||
@ -104,17 +103,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **--mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
math library before running any code, including any expressions or files
|
math library before running any code, including any expressions or files
|
||||||
@ -122,7 +121,7 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
To learn what is in the library, see the **LIBRARY** section.
|
To learn what is in the library, see the **LIBRARY** section.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
See the **TTY MODE** section) This is mostly for those users that do not
|
See the **TTY MODE** section) This is mostly for those users that do not
|
||||||
@ -132,36 +131,36 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-q**, **--quiet**
|
**-q**, **-\-quiet**
|
||||||
|
|
||||||
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
|
: 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
|
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
|
prints the copyright header if one or more of the **-v**, **-V**, or
|
||||||
**--version** options are given.
|
**-\-version** options are given.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-s**, **--standard**
|
**-s**, **-\-standard**
|
||||||
|
|
||||||
: Process exactly the language defined by the [standard][1] and error if any
|
: Process exactly the language defined by the [standard][1] and error if any
|
||||||
extensions are used.
|
extensions are used.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-w**, **--warn**
|
**-w**, **-\-warn**
|
||||||
|
|
||||||
: Like **-s** and **--standard**, except that warnings (and not errors) are
|
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
|
||||||
printed for non-standard extensions and execution continues normally.
|
printed for non-standard extensions and execution continues normally.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -171,14 +170,14 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, bc(1) will give a fatal error and exit.
|
or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -187,8 +186,8 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -243,8 +242,8 @@ Identifiers with more than one character (letter) are a
|
|||||||
|
|
||||||
**ibase** is a global variable determining how to interpret constant numbers. It
|
**ibase** is a global variable determining how to interpret constant numbers. It
|
||||||
is the "input" base, or the number base used for interpreting input numbers.
|
is the "input" base, or the number base used for interpreting input numbers.
|
||||||
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
|
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
|
||||||
(**--warn**) flags were not given on the command line, the max allowable value
|
(**-\-warn**) flags were not given on the command line, the max allowable value
|
||||||
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
||||||
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
||||||
bc(1) programs with the **maxibase()** built-in function.
|
bc(1) programs with the **maxibase()** built-in function.
|
||||||
@ -363,7 +362,7 @@ The following arithmetic and logical operators can be used. They are listed in
|
|||||||
order of decreasing precedence. Operators in the same group have the same
|
order of decreasing precedence. Operators in the same group have the same
|
||||||
precedence.
|
precedence.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: Type: Prefix and Postfix
|
: Type: Prefix and Postfix
|
||||||
|
|
||||||
@ -437,7 +436,7 @@ precedence.
|
|||||||
|
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: The prefix and postfix **increment** and **decrement** operators behave
|
: The prefix and postfix **increment** and **decrement** operators behave
|
||||||
exactly like they would in C. They require a named expression (see the
|
exactly like they would in C. They require a named expression (see the
|
||||||
@ -713,7 +712,7 @@ This is a **non-portable extension**.
|
|||||||
|
|
||||||
# LIBRARY
|
# LIBRARY
|
||||||
|
|
||||||
All of the functions below are available when the **-l** or **--mathlib**
|
All of the functions below are available when the **-l** or **-\-mathlib**
|
||||||
command-line flags are given.
|
command-line flags are given.
|
||||||
|
|
||||||
## Standard Library
|
## Standard Library
|
||||||
@ -989,17 +988,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Per the [standard][1], bc(1) has an interactive mode and a non-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**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,19 +25,18 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
bc - arbitrary-precision decimal arithmetic language and calculator
|
bc - arbitrary-precision decimal arithmetic language and calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
|
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
|
||||||
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
|
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
|
||||||
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
|
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
.PP
|
.PP
|
||||||
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
|
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
|
||||||
.IP
|
.IP
|
||||||
.nf
|
.nf
|
||||||
\f[C]
|
\f[C]
|
||||||
@ -112,10 +111,10 @@ This is a **non-portable extension**.
|
|||||||
\f[R]
|
\f[R]
|
||||||
.fi
|
.fi
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -123,7 +122,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library before running any code, including
|
and loads the included math library before running any code, including
|
||||||
any expressions or files specified on the command line.
|
any expressions or files specified on the command line.
|
||||||
@ -132,25 +131,25 @@ any expressions or files specified on the command line.
|
|||||||
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
|
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
This option is a no-op.
|
This option is a no-op.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
|
\f[B]-q\f[R], \f[B]--quiet\f[R]
|
||||||
This option is for compatibility with the GNU
|
This option is for compatibility with the GNU
|
||||||
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
||||||
Without this option, GNU bc(1) prints a copyright header.
|
Without this option, GNU bc(1) prints a copyright header.
|
||||||
This bc(1) only prints the copyright header if one or more of the
|
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]\[en]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.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
|
\f[B]-s\f[R], \f[B]--standard\f[R]
|
||||||
Process exactly the language defined by the
|
Process exactly the language defined by the
|
||||||
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
||||||
and error if any extensions are used.
|
and error if any extensions are used.
|
||||||
@ -159,15 +158,15 @@ and error if any extensions are used.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
|
\f[B]-w\f[R], \f[B]--warn\f[R]
|
||||||
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
|
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
|
||||||
not errors) are printed for non-standard extensions and execution
|
not errors) are printed for non-standard extensions and execution
|
||||||
continues normally.
|
continues normally.
|
||||||
.RS
|
.RS
|
||||||
@ -175,7 +174,7 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -188,17 +187,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]BC_ENV_ARGS\f[R].
|
\f[B]BC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -209,9 +208,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -276,8 +275,8 @@ constant numbers.
|
|||||||
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
||||||
input numbers.
|
input numbers.
|
||||||
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
||||||
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
|
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
|
||||||
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
|
(\f[B]--warn\f[R]) flags were not given on the command line, the max
|
||||||
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
||||||
Otherwise, it is \f[B]16\f[R].
|
Otherwise, it is \f[B]16\f[R].
|
||||||
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
||||||
@ -437,7 +436,7 @@ The following arithmetic and logical operators can be used.
|
|||||||
They are listed in order of decreasing precedence.
|
They are listed in order of decreasing precedence.
|
||||||
Operators in the same group have the same precedence.
|
Operators in the same group have the same precedence.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
Type: Prefix and Postfix
|
Type: Prefix and Postfix
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
@ -520,7 +519,7 @@ Description: \f[B]boolean or\f[R]
|
|||||||
.PP
|
.PP
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
||||||
operators behave exactly like they would in C.
|
operators behave exactly like they would in C.
|
||||||
They require a named expression (see the \f[I]Named Expressions\f[R]
|
They require a named expression (see the \f[I]Named Expressions\f[R]
|
||||||
@ -900,7 +899,7 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.SH LIBRARY
|
.SH LIBRARY
|
||||||
.PP
|
.PP
|
||||||
All of the functions below are available when the \f[B]-l\f[R] or
|
All of the functions below are available when the \f[B]-l\f[R] or
|
||||||
\f[B]\[en]mathlib\f[R] command-line flags are given.
|
\f[B]--mathlib\f[R] command-line flags are given.
|
||||||
.SS Standard Library
|
.SS Standard Library
|
||||||
.PP
|
.PP
|
||||||
The
|
The
|
||||||
@ -1205,11 +1204,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Per the
|
Per the
|
||||||
@ -1217,7 +1216,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
|
|||||||
bc(1) has an interactive mode and a non-interactive mode.
|
bc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the
|
In interactive mode, bc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
|
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
[*file*...]
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
|
|||||||
|
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
|
|
||||||
**-g**, **--global-stacks**
|
**-g**, **-\-global-stacks**
|
||||||
|
|
||||||
Turns the globals **ibase**, **obase**, and **scale** into stacks.
|
Turns the globals **ibase**, **obase**, and **scale** into stacks.
|
||||||
|
|
||||||
@ -104,17 +103,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **--mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
math library before running any code, including any expressions or files
|
math library before running any code, including any expressions or files
|
||||||
@ -122,42 +121,42 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
To learn what is in the library, see the **LIBRARY** section.
|
To learn what is in the library, see the **LIBRARY** section.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: This option is a no-op.
|
: This option is a no-op.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-q**, **--quiet**
|
**-q**, **-\-quiet**
|
||||||
|
|
||||||
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
|
: 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
|
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
|
prints the copyright header if one or more of the **-v**, **-V**, or
|
||||||
**--version** options are given.
|
**-\-version** options are given.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-s**, **--standard**
|
**-s**, **-\-standard**
|
||||||
|
|
||||||
: Process exactly the language defined by the [standard][1] and error if any
|
: Process exactly the language defined by the [standard][1] and error if any
|
||||||
extensions are used.
|
extensions are used.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-w**, **--warn**
|
**-w**, **-\-warn**
|
||||||
|
|
||||||
: Like **-s** and **--standard**, except that warnings (and not errors) are
|
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
|
||||||
printed for non-standard extensions and execution continues normally.
|
printed for non-standard extensions and execution continues normally.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -167,14 +166,14 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, bc(1) will give a fatal error and exit.
|
or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -183,8 +182,8 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -239,8 +238,8 @@ Identifiers with more than one character (letter) are a
|
|||||||
|
|
||||||
**ibase** is a global variable determining how to interpret constant numbers. It
|
**ibase** is a global variable determining how to interpret constant numbers. It
|
||||||
is the "input" base, or the number base used for interpreting input numbers.
|
is the "input" base, or the number base used for interpreting input numbers.
|
||||||
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
|
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
|
||||||
(**--warn**) flags were not given on the command line, the max allowable value
|
(**-\-warn**) flags were not given on the command line, the max allowable value
|
||||||
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
||||||
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
||||||
bc(1) programs with the **maxibase()** built-in function.
|
bc(1) programs with the **maxibase()** built-in function.
|
||||||
@ -359,7 +358,7 @@ The following arithmetic and logical operators can be used. They are listed in
|
|||||||
order of decreasing precedence. Operators in the same group have the same
|
order of decreasing precedence. Operators in the same group have the same
|
||||||
precedence.
|
precedence.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: Type: Prefix and Postfix
|
: Type: Prefix and Postfix
|
||||||
|
|
||||||
@ -433,7 +432,7 @@ precedence.
|
|||||||
|
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: The prefix and postfix **increment** and **decrement** operators behave
|
: The prefix and postfix **increment** and **decrement** operators behave
|
||||||
exactly like they would in C. They require a named expression (see the
|
exactly like they would in C. They require a named expression (see the
|
||||||
@ -709,7 +708,7 @@ This is a **non-portable extension**.
|
|||||||
|
|
||||||
# LIBRARY
|
# LIBRARY
|
||||||
|
|
||||||
All of the functions below are available when the **-l** or **--mathlib**
|
All of the functions below are available when the **-l** or **-\-mathlib**
|
||||||
command-line flags are given.
|
command-line flags are given.
|
||||||
|
|
||||||
## Standard Library
|
## Standard Library
|
||||||
@ -985,17 +984,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Per the [standard][1], bc(1) has an interactive mode and a non-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**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,19 +25,18 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
bc - arbitrary-precision decimal arithmetic language and calculator
|
bc - arbitrary-precision decimal arithmetic language and calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
|
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
|
||||||
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
|
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
|
||||||
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
|
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
.PP
|
.PP
|
||||||
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
|
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
|
||||||
.IP
|
.IP
|
||||||
.nf
|
.nf
|
||||||
\f[C]
|
\f[C]
|
||||||
@ -112,10 +111,10 @@ This is a **non-portable extension**.
|
|||||||
\f[R]
|
\f[R]
|
||||||
.fi
|
.fi
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -123,7 +122,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library before running any code, including
|
and loads the included math library before running any code, including
|
||||||
any expressions or files specified on the command line.
|
any expressions or files specified on the command line.
|
||||||
@ -132,25 +131,25 @@ any expressions or files specified on the command line.
|
|||||||
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
|
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
This option is a no-op.
|
This option is a no-op.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
|
\f[B]-q\f[R], \f[B]--quiet\f[R]
|
||||||
This option is for compatibility with the GNU
|
This option is for compatibility with the GNU
|
||||||
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
||||||
Without this option, GNU bc(1) prints a copyright header.
|
Without this option, GNU bc(1) prints a copyright header.
|
||||||
This bc(1) only prints the copyright header if one or more of the
|
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]\[en]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.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
|
\f[B]-s\f[R], \f[B]--standard\f[R]
|
||||||
Process exactly the language defined by the
|
Process exactly the language defined by the
|
||||||
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
||||||
and error if any extensions are used.
|
and error if any extensions are used.
|
||||||
@ -159,15 +158,15 @@ and error if any extensions are used.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
|
\f[B]-w\f[R], \f[B]--warn\f[R]
|
||||||
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
|
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
|
||||||
not errors) are printed for non-standard extensions and execution
|
not errors) are printed for non-standard extensions and execution
|
||||||
continues normally.
|
continues normally.
|
||||||
.RS
|
.RS
|
||||||
@ -175,7 +174,7 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -188,17 +187,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]BC_ENV_ARGS\f[R].
|
\f[B]BC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -209,9 +208,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -276,8 +275,8 @@ constant numbers.
|
|||||||
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
||||||
input numbers.
|
input numbers.
|
||||||
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
||||||
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
|
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
|
||||||
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
|
(\f[B]--warn\f[R]) flags were not given on the command line, the max
|
||||||
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
||||||
Otherwise, it is \f[B]16\f[R].
|
Otherwise, it is \f[B]16\f[R].
|
||||||
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
||||||
@ -437,7 +436,7 @@ The following arithmetic and logical operators can be used.
|
|||||||
They are listed in order of decreasing precedence.
|
They are listed in order of decreasing precedence.
|
||||||
Operators in the same group have the same precedence.
|
Operators in the same group have the same precedence.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
Type: Prefix and Postfix
|
Type: Prefix and Postfix
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
@ -520,7 +519,7 @@ Description: \f[B]boolean or\f[R]
|
|||||||
.PP
|
.PP
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
||||||
operators behave exactly like they would in C.
|
operators behave exactly like they would in C.
|
||||||
They require a named expression (see the \f[I]Named Expressions\f[R]
|
They require a named expression (see the \f[I]Named Expressions\f[R]
|
||||||
@ -900,7 +899,7 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.SH LIBRARY
|
.SH LIBRARY
|
||||||
.PP
|
.PP
|
||||||
All of the functions below are available when the \f[B]-l\f[R] or
|
All of the functions below are available when the \f[B]-l\f[R] or
|
||||||
\f[B]\[en]mathlib\f[R] command-line flags are given.
|
\f[B]--mathlib\f[R] command-line flags are given.
|
||||||
.SS Standard Library
|
.SS Standard Library
|
||||||
.PP
|
.PP
|
||||||
The
|
The
|
||||||
@ -1205,11 +1204,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Per the
|
Per the
|
||||||
@ -1217,7 +1216,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
|
|||||||
bc(1) has an interactive mode and a non-interactive mode.
|
bc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the
|
In interactive mode, bc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
|
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
[*file*...]
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
|
|||||||
|
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
|
|
||||||
**-g**, **--global-stacks**
|
**-g**, **-\-global-stacks**
|
||||||
|
|
||||||
Turns the globals **ibase**, **obase**, and **scale** into stacks.
|
Turns the globals **ibase**, **obase**, and **scale** into stacks.
|
||||||
|
|
||||||
@ -104,17 +103,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **--mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
math library before running any code, including any expressions or files
|
math library before running any code, including any expressions or files
|
||||||
@ -122,42 +121,42 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
To learn what is in the library, see the **LIBRARY** section.
|
To learn what is in the library, see the **LIBRARY** section.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: This option is a no-op.
|
: This option is a no-op.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-q**, **--quiet**
|
**-q**, **-\-quiet**
|
||||||
|
|
||||||
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
|
: 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
|
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
|
prints the copyright header if one or more of the **-v**, **-V**, or
|
||||||
**--version** options are given.
|
**-\-version** options are given.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-s**, **--standard**
|
**-s**, **-\-standard**
|
||||||
|
|
||||||
: Process exactly the language defined by the [standard][1] and error if any
|
: Process exactly the language defined by the [standard][1] and error if any
|
||||||
extensions are used.
|
extensions are used.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-w**, **--warn**
|
**-w**, **-\-warn**
|
||||||
|
|
||||||
: Like **-s** and **--standard**, except that warnings (and not errors) are
|
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
|
||||||
printed for non-standard extensions and execution continues normally.
|
printed for non-standard extensions and execution continues normally.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -167,14 +166,14 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, bc(1) will give a fatal error and exit.
|
or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -183,8 +182,8 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -239,8 +238,8 @@ Identifiers with more than one character (letter) are a
|
|||||||
|
|
||||||
**ibase** is a global variable determining how to interpret constant numbers. It
|
**ibase** is a global variable determining how to interpret constant numbers. It
|
||||||
is the "input" base, or the number base used for interpreting input numbers.
|
is the "input" base, or the number base used for interpreting input numbers.
|
||||||
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
|
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
|
||||||
(**--warn**) flags were not given on the command line, the max allowable value
|
(**-\-warn**) flags were not given on the command line, the max allowable value
|
||||||
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
||||||
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
||||||
bc(1) programs with the **maxibase()** built-in function.
|
bc(1) programs with the **maxibase()** built-in function.
|
||||||
@ -359,7 +358,7 @@ The following arithmetic and logical operators can be used. They are listed in
|
|||||||
order of decreasing precedence. Operators in the same group have the same
|
order of decreasing precedence. Operators in the same group have the same
|
||||||
precedence.
|
precedence.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: Type: Prefix and Postfix
|
: Type: Prefix and Postfix
|
||||||
|
|
||||||
@ -433,7 +432,7 @@ precedence.
|
|||||||
|
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: The prefix and postfix **increment** and **decrement** operators behave
|
: The prefix and postfix **increment** and **decrement** operators behave
|
||||||
exactly like they would in C. They require a named expression (see the
|
exactly like they would in C. They require a named expression (see the
|
||||||
@ -709,7 +708,7 @@ This is a **non-portable extension**.
|
|||||||
|
|
||||||
# LIBRARY
|
# LIBRARY
|
||||||
|
|
||||||
All of the functions below are available when the **-l** or **--mathlib**
|
All of the functions below are available when the **-l** or **-\-mathlib**
|
||||||
command-line flags are given.
|
command-line flags are given.
|
||||||
|
|
||||||
## Standard Library
|
## Standard Library
|
||||||
@ -985,17 +984,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Per the [standard][1], bc(1) has an interactive mode and a non-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**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,19 +25,18 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
bc - arbitrary-precision decimal arithmetic language and calculator
|
bc - arbitrary-precision decimal arithmetic language and calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
|
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
|
||||||
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
|
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
|
||||||
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
|
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -58,7 +57,7 @@ This bc(1) is a drop-in replacement for \f[I]any\f[R] bc(1), including
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
.PP
|
.PP
|
||||||
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
|
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
|
||||||
.IP
|
.IP
|
||||||
.nf
|
.nf
|
||||||
\f[C]
|
\f[C]
|
||||||
@ -115,10 +114,10 @@ This is a **non-portable extension**.
|
|||||||
\f[R]
|
\f[R]
|
||||||
.fi
|
.fi
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -126,7 +125,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library before running any code, including
|
and loads the included math library before running any code, including
|
||||||
any expressions or files specified on the command line.
|
any expressions or files specified on the command line.
|
||||||
@ -135,7 +134,7 @@ any expressions or files specified on the command line.
|
|||||||
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
|
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
||||||
@ -147,18 +146,18 @@ Most of those users would want to put this option in
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
|
\f[B]-q\f[R], \f[B]--quiet\f[R]
|
||||||
This option is for compatibility with the GNU
|
This option is for compatibility with the GNU
|
||||||
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
||||||
Without this option, GNU bc(1) prints a copyright header.
|
Without this option, GNU bc(1) prints a copyright header.
|
||||||
This bc(1) only prints the copyright header if one or more of the
|
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]\[en]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.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
|
\f[B]-s\f[R], \f[B]--standard\f[R]
|
||||||
Process exactly the language defined by the
|
Process exactly the language defined by the
|
||||||
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
||||||
and error if any extensions are used.
|
and error if any extensions are used.
|
||||||
@ -167,15 +166,15 @@ and error if any extensions are used.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
|
\f[B]-w\f[R], \f[B]--warn\f[R]
|
||||||
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
|
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
|
||||||
not errors) are printed for non-standard extensions and execution
|
not errors) are printed for non-standard extensions and execution
|
||||||
continues normally.
|
continues normally.
|
||||||
.RS
|
.RS
|
||||||
@ -183,7 +182,7 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -196,17 +195,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]BC_ENV_ARGS\f[R].
|
\f[B]BC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -217,9 +216,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -284,8 +283,8 @@ constant numbers.
|
|||||||
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
||||||
input numbers.
|
input numbers.
|
||||||
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
||||||
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
|
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
|
||||||
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
|
(\f[B]--warn\f[R]) flags were not given on the command line, the max
|
||||||
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
||||||
Otherwise, it is \f[B]16\f[R].
|
Otherwise, it is \f[B]16\f[R].
|
||||||
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
||||||
@ -445,7 +444,7 @@ The following arithmetic and logical operators can be used.
|
|||||||
They are listed in order of decreasing precedence.
|
They are listed in order of decreasing precedence.
|
||||||
Operators in the same group have the same precedence.
|
Operators in the same group have the same precedence.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
Type: Prefix and Postfix
|
Type: Prefix and Postfix
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
@ -528,7 +527,7 @@ Description: \f[B]boolean or\f[R]
|
|||||||
.PP
|
.PP
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
||||||
operators behave exactly like they would in C.
|
operators behave exactly like they would in C.
|
||||||
They require a named expression (see the \f[I]Named Expressions\f[R]
|
They require a named expression (see the \f[I]Named Expressions\f[R]
|
||||||
@ -908,7 +907,7 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.SH LIBRARY
|
.SH LIBRARY
|
||||||
.PP
|
.PP
|
||||||
All of the functions below are available when the \f[B]-l\f[R] or
|
All of the functions below are available when the \f[B]-l\f[R] or
|
||||||
\f[B]\[en]mathlib\f[R] command-line flags are given.
|
\f[B]--mathlib\f[R] command-line flags are given.
|
||||||
.SS Standard Library
|
.SS Standard Library
|
||||||
.PP
|
.PP
|
||||||
The
|
The
|
||||||
@ -1213,11 +1212,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Per the
|
Per the
|
||||||
@ -1225,7 +1224,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
|
|||||||
bc(1) has an interactive mode and a non-interactive mode.
|
bc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the
|
In interactive mode, bc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
|
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
[*file*...]
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -54,7 +53,7 @@ especially) the GNU bc(1).
|
|||||||
|
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
|
|
||||||
**-g**, **--global-stacks**
|
**-g**, **-\-global-stacks**
|
||||||
|
|
||||||
Turns the globals **ibase**, **obase**, and **scale** into stacks.
|
Turns the globals **ibase**, **obase**, and **scale** into stacks.
|
||||||
|
|
||||||
@ -107,17 +106,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **--mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
math library before running any code, including any expressions or files
|
math library before running any code, including any expressions or files
|
||||||
@ -125,7 +124,7 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
To learn what is in the library, see the **LIBRARY** section.
|
To learn what is in the library, see the **LIBRARY** section.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
See the **TTY MODE** section) This is mostly for those users that do not
|
See the **TTY MODE** section) This is mostly for those users that do not
|
||||||
@ -135,36 +134,36 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-q**, **--quiet**
|
**-q**, **-\-quiet**
|
||||||
|
|
||||||
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
|
: 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
|
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
|
prints the copyright header if one or more of the **-v**, **-V**, or
|
||||||
**--version** options are given.
|
**-\-version** options are given.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-s**, **--standard**
|
**-s**, **-\-standard**
|
||||||
|
|
||||||
: Process exactly the language defined by the [standard][1] and error if any
|
: Process exactly the language defined by the [standard][1] and error if any
|
||||||
extensions are used.
|
extensions are used.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-w**, **--warn**
|
**-w**, **-\-warn**
|
||||||
|
|
||||||
: Like **-s** and **--standard**, except that warnings (and not errors) are
|
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
|
||||||
printed for non-standard extensions and execution continues normally.
|
printed for non-standard extensions and execution continues normally.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -174,14 +173,14 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, bc(1) will give a fatal error and exit.
|
or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -190,8 +189,8 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -246,8 +245,8 @@ Identifiers with more than one character (letter) are a
|
|||||||
|
|
||||||
**ibase** is a global variable determining how to interpret constant numbers. It
|
**ibase** is a global variable determining how to interpret constant numbers. It
|
||||||
is the "input" base, or the number base used for interpreting input numbers.
|
is the "input" base, or the number base used for interpreting input numbers.
|
||||||
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
|
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
|
||||||
(**--warn**) flags were not given on the command line, the max allowable value
|
(**-\-warn**) flags were not given on the command line, the max allowable value
|
||||||
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
||||||
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
||||||
bc(1) programs with the **maxibase()** built-in function.
|
bc(1) programs with the **maxibase()** built-in function.
|
||||||
@ -366,7 +365,7 @@ The following arithmetic and logical operators can be used. They are listed in
|
|||||||
order of decreasing precedence. Operators in the same group have the same
|
order of decreasing precedence. Operators in the same group have the same
|
||||||
precedence.
|
precedence.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: Type: Prefix and Postfix
|
: Type: Prefix and Postfix
|
||||||
|
|
||||||
@ -440,7 +439,7 @@ precedence.
|
|||||||
|
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: The prefix and postfix **increment** and **decrement** operators behave
|
: The prefix and postfix **increment** and **decrement** operators behave
|
||||||
exactly like they would in C. They require a named expression (see the
|
exactly like they would in C. They require a named expression (see the
|
||||||
@ -716,7 +715,7 @@ This is a **non-portable extension**.
|
|||||||
|
|
||||||
# LIBRARY
|
# LIBRARY
|
||||||
|
|
||||||
All of the functions below are available when the **-l** or **--mathlib**
|
All of the functions below are available when the **-l** or **-\-mathlib**
|
||||||
command-line flags are given.
|
command-line flags are given.
|
||||||
|
|
||||||
## Standard Library
|
## Standard Library
|
||||||
@ -992,17 +991,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Per the [standard][1], bc(1) has an interactive mode and a non-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**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,19 +25,18 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
bc - arbitrary-precision decimal arithmetic language and calculator
|
bc - arbitrary-precision decimal arithmetic language and calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
|
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
|
||||||
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
|
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
|
||||||
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
|
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -58,7 +57,7 @@ This bc(1) is a drop-in replacement for \f[I]any\f[R] bc(1), including
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
.PP
|
.PP
|
||||||
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
|
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
|
||||||
.IP
|
.IP
|
||||||
.nf
|
.nf
|
||||||
\f[C]
|
\f[C]
|
||||||
@ -115,10 +114,10 @@ This is a **non-portable extension**.
|
|||||||
\f[R]
|
\f[R]
|
||||||
.fi
|
.fi
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -126,7 +125,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library before running any code, including
|
and loads the included math library before running any code, including
|
||||||
any expressions or files specified on the command line.
|
any expressions or files specified on the command line.
|
||||||
@ -135,25 +134,25 @@ any expressions or files specified on the command line.
|
|||||||
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
|
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
This option is a no-op.
|
This option is a no-op.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
|
\f[B]-q\f[R], \f[B]--quiet\f[R]
|
||||||
This option is for compatibility with the GNU
|
This option is for compatibility with the GNU
|
||||||
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
||||||
Without this option, GNU bc(1) prints a copyright header.
|
Without this option, GNU bc(1) prints a copyright header.
|
||||||
This bc(1) only prints the copyright header if one or more of the
|
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]\[en]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.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
|
\f[B]-s\f[R], \f[B]--standard\f[R]
|
||||||
Process exactly the language defined by the
|
Process exactly the language defined by the
|
||||||
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
||||||
and error if any extensions are used.
|
and error if any extensions are used.
|
||||||
@ -162,15 +161,15 @@ and error if any extensions are used.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
|
\f[B]-w\f[R], \f[B]--warn\f[R]
|
||||||
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
|
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
|
||||||
not errors) are printed for non-standard extensions and execution
|
not errors) are printed for non-standard extensions and execution
|
||||||
continues normally.
|
continues normally.
|
||||||
.RS
|
.RS
|
||||||
@ -178,7 +177,7 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -191,17 +190,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]BC_ENV_ARGS\f[R].
|
\f[B]BC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -212,9 +211,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -279,8 +278,8 @@ constant numbers.
|
|||||||
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
||||||
input numbers.
|
input numbers.
|
||||||
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
||||||
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
|
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
|
||||||
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
|
(\f[B]--warn\f[R]) flags were not given on the command line, the max
|
||||||
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
||||||
Otherwise, it is \f[B]16\f[R].
|
Otherwise, it is \f[B]16\f[R].
|
||||||
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
||||||
@ -440,7 +439,7 @@ The following arithmetic and logical operators can be used.
|
|||||||
They are listed in order of decreasing precedence.
|
They are listed in order of decreasing precedence.
|
||||||
Operators in the same group have the same precedence.
|
Operators in the same group have the same precedence.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
Type: Prefix and Postfix
|
Type: Prefix and Postfix
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
@ -523,7 +522,7 @@ Description: \f[B]boolean or\f[R]
|
|||||||
.PP
|
.PP
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
||||||
operators behave exactly like they would in C.
|
operators behave exactly like they would in C.
|
||||||
They require a named expression (see the \f[I]Named Expressions\f[R]
|
They require a named expression (see the \f[I]Named Expressions\f[R]
|
||||||
@ -903,7 +902,7 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.SH LIBRARY
|
.SH LIBRARY
|
||||||
.PP
|
.PP
|
||||||
All of the functions below are available when the \f[B]-l\f[R] or
|
All of the functions below are available when the \f[B]-l\f[R] or
|
||||||
\f[B]\[en]mathlib\f[R] command-line flags are given.
|
\f[B]--mathlib\f[R] command-line flags are given.
|
||||||
.SS Standard Library
|
.SS Standard Library
|
||||||
.PP
|
.PP
|
||||||
The
|
The
|
||||||
@ -1208,11 +1207,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Per the
|
Per the
|
||||||
@ -1220,7 +1219,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
|
|||||||
bc(1) has an interactive mode and a non-interactive mode.
|
bc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the
|
In interactive mode, bc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
|
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
[*file*...]
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -54,7 +53,7 @@ especially) the GNU bc(1).
|
|||||||
|
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
|
|
||||||
**-g**, **--global-stacks**
|
**-g**, **-\-global-stacks**
|
||||||
|
|
||||||
Turns the globals **ibase**, **obase**, and **scale** into stacks.
|
Turns the globals **ibase**, **obase**, and **scale** into stacks.
|
||||||
|
|
||||||
@ -107,17 +106,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **--mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
math library before running any code, including any expressions or files
|
math library before running any code, including any expressions or files
|
||||||
@ -125,42 +124,42 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
To learn what is in the library, see the **LIBRARY** section.
|
To learn what is in the library, see the **LIBRARY** section.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: This option is a no-op.
|
: This option is a no-op.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-q**, **--quiet**
|
**-q**, **-\-quiet**
|
||||||
|
|
||||||
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
|
: 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
|
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
|
prints the copyright header if one or more of the **-v**, **-V**, or
|
||||||
**--version** options are given.
|
**-\-version** options are given.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-s**, **--standard**
|
**-s**, **-\-standard**
|
||||||
|
|
||||||
: Process exactly the language defined by the [standard][1] and error if any
|
: Process exactly the language defined by the [standard][1] and error if any
|
||||||
extensions are used.
|
extensions are used.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-w**, **--warn**
|
**-w**, **-\-warn**
|
||||||
|
|
||||||
: Like **-s** and **--standard**, except that warnings (and not errors) are
|
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
|
||||||
printed for non-standard extensions and execution continues normally.
|
printed for non-standard extensions and execution continues normally.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -170,14 +169,14 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, bc(1) will give a fatal error and exit.
|
or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -186,8 +185,8 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -242,8 +241,8 @@ Identifiers with more than one character (letter) are a
|
|||||||
|
|
||||||
**ibase** is a global variable determining how to interpret constant numbers. It
|
**ibase** is a global variable determining how to interpret constant numbers. It
|
||||||
is the "input" base, or the number base used for interpreting input numbers.
|
is the "input" base, or the number base used for interpreting input numbers.
|
||||||
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
|
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
|
||||||
(**--warn**) flags were not given on the command line, the max allowable value
|
(**-\-warn**) flags were not given on the command line, the max allowable value
|
||||||
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
||||||
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
||||||
bc(1) programs with the **maxibase()** built-in function.
|
bc(1) programs with the **maxibase()** built-in function.
|
||||||
@ -362,7 +361,7 @@ The following arithmetic and logical operators can be used. They are listed in
|
|||||||
order of decreasing precedence. Operators in the same group have the same
|
order of decreasing precedence. Operators in the same group have the same
|
||||||
precedence.
|
precedence.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: Type: Prefix and Postfix
|
: Type: Prefix and Postfix
|
||||||
|
|
||||||
@ -436,7 +435,7 @@ precedence.
|
|||||||
|
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: The prefix and postfix **increment** and **decrement** operators behave
|
: The prefix and postfix **increment** and **decrement** operators behave
|
||||||
exactly like they would in C. They require a named expression (see the
|
exactly like they would in C. They require a named expression (see the
|
||||||
@ -712,7 +711,7 @@ This is a **non-portable extension**.
|
|||||||
|
|
||||||
# LIBRARY
|
# LIBRARY
|
||||||
|
|
||||||
All of the functions below are available when the **-l** or **--mathlib**
|
All of the functions below are available when the **-l** or **-\-mathlib**
|
||||||
command-line flags are given.
|
command-line flags are given.
|
||||||
|
|
||||||
## Standard Library
|
## Standard Library
|
||||||
@ -988,17 +987,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Per the [standard][1], bc(1) has an interactive mode and a non-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**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,19 +25,18 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
bc - arbitrary-precision decimal arithmetic language and calculator
|
bc - arbitrary-precision decimal arithmetic language and calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
|
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
|
||||||
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
|
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
|
||||||
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
|
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -58,7 +57,7 @@ This bc(1) is a drop-in replacement for \f[I]any\f[R] bc(1), including
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
.PP
|
.PP
|
||||||
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
|
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
|
||||||
.IP
|
.IP
|
||||||
.nf
|
.nf
|
||||||
\f[C]
|
\f[C]
|
||||||
@ -115,10 +114,10 @@ This is a **non-portable extension**.
|
|||||||
\f[R]
|
\f[R]
|
||||||
.fi
|
.fi
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -126,7 +125,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library before running any code, including
|
and loads the included math library before running any code, including
|
||||||
any expressions or files specified on the command line.
|
any expressions or files specified on the command line.
|
||||||
@ -135,25 +134,25 @@ any expressions or files specified on the command line.
|
|||||||
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
|
To learn what is in the library, see the \f[B]LIBRARY\f[R] section.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
This option is a no-op.
|
This option is a no-op.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
|
\f[B]-q\f[R], \f[B]--quiet\f[R]
|
||||||
This option is for compatibility with the GNU
|
This option is for compatibility with the GNU
|
||||||
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
||||||
Without this option, GNU bc(1) prints a copyright header.
|
Without this option, GNU bc(1) prints a copyright header.
|
||||||
This bc(1) only prints the copyright header if one or more of the
|
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]\[en]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.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
|
\f[B]-s\f[R], \f[B]--standard\f[R]
|
||||||
Process exactly the language defined by the
|
Process exactly the language defined by the
|
||||||
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
||||||
and error if any extensions are used.
|
and error if any extensions are used.
|
||||||
@ -162,15 +161,15 @@ and error if any extensions are used.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
|
\f[B]-w\f[R], \f[B]--warn\f[R]
|
||||||
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
|
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
|
||||||
not errors) are printed for non-standard extensions and execution
|
not errors) are printed for non-standard extensions and execution
|
||||||
continues normally.
|
continues normally.
|
||||||
.RS
|
.RS
|
||||||
@ -178,7 +177,7 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -191,17 +190,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]BC_ENV_ARGS\f[R].
|
\f[B]BC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -212,9 +211,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -279,8 +278,8 @@ constant numbers.
|
|||||||
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
||||||
input numbers.
|
input numbers.
|
||||||
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
||||||
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
|
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
|
||||||
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
|
(\f[B]--warn\f[R]) flags were not given on the command line, the max
|
||||||
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
||||||
Otherwise, it is \f[B]16\f[R].
|
Otherwise, it is \f[B]16\f[R].
|
||||||
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
||||||
@ -440,7 +439,7 @@ The following arithmetic and logical operators can be used.
|
|||||||
They are listed in order of decreasing precedence.
|
They are listed in order of decreasing precedence.
|
||||||
Operators in the same group have the same precedence.
|
Operators in the same group have the same precedence.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
Type: Prefix and Postfix
|
Type: Prefix and Postfix
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
@ -523,7 +522,7 @@ Description: \f[B]boolean or\f[R]
|
|||||||
.PP
|
.PP
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
||||||
operators behave exactly like they would in C.
|
operators behave exactly like they would in C.
|
||||||
They require a named expression (see the \f[I]Named Expressions\f[R]
|
They require a named expression (see the \f[I]Named Expressions\f[R]
|
||||||
@ -903,7 +902,7 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.SH LIBRARY
|
.SH LIBRARY
|
||||||
.PP
|
.PP
|
||||||
All of the functions below are available when the \f[B]-l\f[R] or
|
All of the functions below are available when the \f[B]-l\f[R] or
|
||||||
\f[B]\[en]mathlib\f[R] command-line flags are given.
|
\f[B]--mathlib\f[R] command-line flags are given.
|
||||||
.SS Standard Library
|
.SS Standard Library
|
||||||
.PP
|
.PP
|
||||||
The
|
The
|
||||||
@ -1208,11 +1207,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Per the
|
Per the
|
||||||
@ -1220,7 +1219,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
|
|||||||
bc(1) has an interactive mode and a non-interactive mode.
|
bc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the
|
In interactive mode, bc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
|
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
[*file*...]
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -54,7 +53,7 @@ especially) the GNU bc(1).
|
|||||||
|
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
|
|
||||||
**-g**, **--global-stacks**
|
**-g**, **-\-global-stacks**
|
||||||
|
|
||||||
Turns the globals **ibase**, **obase**, and **scale** into stacks.
|
Turns the globals **ibase**, **obase**, and **scale** into stacks.
|
||||||
|
|
||||||
@ -107,17 +106,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **--mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
math library before running any code, including any expressions or files
|
math library before running any code, including any expressions or files
|
||||||
@ -125,42 +124,42 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
To learn what is in the library, see the **LIBRARY** section.
|
To learn what is in the library, see the **LIBRARY** section.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: This option is a no-op.
|
: This option is a no-op.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-q**, **--quiet**
|
**-q**, **-\-quiet**
|
||||||
|
|
||||||
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
|
: 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
|
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
|
prints the copyright header if one or more of the **-v**, **-V**, or
|
||||||
**--version** options are given.
|
**-\-version** options are given.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-s**, **--standard**
|
**-s**, **-\-standard**
|
||||||
|
|
||||||
: Process exactly the language defined by the [standard][1] and error if any
|
: Process exactly the language defined by the [standard][1] and error if any
|
||||||
extensions are used.
|
extensions are used.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-w**, **--warn**
|
**-w**, **-\-warn**
|
||||||
|
|
||||||
: Like **-s** and **--standard**, except that warnings (and not errors) are
|
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
|
||||||
printed for non-standard extensions and execution continues normally.
|
printed for non-standard extensions and execution continues normally.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -170,14 +169,14 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, bc(1) will give a fatal error and exit.
|
or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -186,8 +185,8 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -242,8 +241,8 @@ Identifiers with more than one character (letter) are a
|
|||||||
|
|
||||||
**ibase** is a global variable determining how to interpret constant numbers. It
|
**ibase** is a global variable determining how to interpret constant numbers. It
|
||||||
is the "input" base, or the number base used for interpreting input numbers.
|
is the "input" base, or the number base used for interpreting input numbers.
|
||||||
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
|
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
|
||||||
(**--warn**) flags were not given on the command line, the max allowable value
|
(**-\-warn**) flags were not given on the command line, the max allowable value
|
||||||
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
||||||
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
||||||
bc(1) programs with the **maxibase()** built-in function.
|
bc(1) programs with the **maxibase()** built-in function.
|
||||||
@ -362,7 +361,7 @@ The following arithmetic and logical operators can be used. They are listed in
|
|||||||
order of decreasing precedence. Operators in the same group have the same
|
order of decreasing precedence. Operators in the same group have the same
|
||||||
precedence.
|
precedence.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: Type: Prefix and Postfix
|
: Type: Prefix and Postfix
|
||||||
|
|
||||||
@ -436,7 +435,7 @@ precedence.
|
|||||||
|
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: The prefix and postfix **increment** and **decrement** operators behave
|
: The prefix and postfix **increment** and **decrement** operators behave
|
||||||
exactly like they would in C. They require a named expression (see the
|
exactly like they would in C. They require a named expression (see the
|
||||||
@ -712,7 +711,7 @@ This is a **non-portable extension**.
|
|||||||
|
|
||||||
# LIBRARY
|
# LIBRARY
|
||||||
|
|
||||||
All of the functions below are available when the **-l** or **--mathlib**
|
All of the functions below are available when the **-l** or **-\-mathlib**
|
||||||
command-line flags are given.
|
command-line flags are given.
|
||||||
|
|
||||||
## Standard Library
|
## Standard Library
|
||||||
@ -988,17 +987,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Per the [standard][1], bc(1) has an interactive mode and a non-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**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,19 +25,18 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
bc - arbitrary-precision decimal arithmetic language and calculator
|
bc - arbitrary-precision decimal arithmetic language and calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
|
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
|
||||||
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
|
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
|
||||||
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
|
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
|
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
|
||||||
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
|
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
|
||||||
\f[B]seed\f[R] into stacks.
|
\f[B]seed\f[R] into stacks.
|
||||||
.RS
|
.RS
|
||||||
@ -147,10 +146,10 @@ is ignored.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -158,7 +157,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library and the extended math library before
|
and loads the included math library and the extended math library before
|
||||||
running any code, including any expressions or files specified on the
|
running any code, including any expressions or files specified on the
|
||||||
@ -168,7 +167,7 @@ command line.
|
|||||||
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
|
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
||||||
@ -180,18 +179,18 @@ Most of those users would want to put this option in
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
|
\f[B]-q\f[R], \f[B]--quiet\f[R]
|
||||||
This option is for compatibility with the GNU
|
This option is for compatibility with the GNU
|
||||||
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
||||||
Without this option, GNU bc(1) prints a copyright header.
|
Without this option, GNU bc(1) prints a copyright header.
|
||||||
This bc(1) only prints the copyright header if one or more of the
|
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]\[en]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.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
|
\f[B]-s\f[R], \f[B]--standard\f[R]
|
||||||
Process exactly the language defined by the
|
Process exactly the language defined by the
|
||||||
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
||||||
and error if any extensions are used.
|
and error if any extensions are used.
|
||||||
@ -200,15 +199,15 @@ and error if any extensions are used.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
|
\f[B]-w\f[R], \f[B]--warn\f[R]
|
||||||
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
|
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
|
||||||
not errors) are printed for non-standard extensions and execution
|
not errors) are printed for non-standard extensions and execution
|
||||||
continues normally.
|
continues normally.
|
||||||
.RS
|
.RS
|
||||||
@ -216,7 +215,7 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -229,17 +228,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]BC_ENV_ARGS\f[R].
|
\f[B]BC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -250,9 +249,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -317,8 +316,8 @@ constant numbers.
|
|||||||
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
||||||
input numbers.
|
input numbers.
|
||||||
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
||||||
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
|
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
|
||||||
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
|
(\f[B]--warn\f[R]) flags were not given on the command line, the max
|
||||||
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
||||||
Otherwise, it is \f[B]16\f[R].
|
Otherwise, it is \f[B]16\f[R].
|
||||||
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
||||||
@ -577,7 +576,7 @@ The following arithmetic and logical operators can be used.
|
|||||||
They are listed in order of decreasing precedence.
|
They are listed in order of decreasing precedence.
|
||||||
Operators in the same group have the same precedence.
|
Operators in the same group have the same precedence.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
Type: Prefix and Postfix
|
Type: Prefix and Postfix
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
@ -687,7 +686,7 @@ Description: \f[B]boolean or\f[R]
|
|||||||
.PP
|
.PP
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
||||||
operators behave exactly like they would in C.
|
operators behave exactly like they would in C.
|
||||||
They require a named expression (see the \f[I]Named Expressions\f[R]
|
They require a named expression (see the \f[I]Named Expressions\f[R]
|
||||||
@ -1133,7 +1132,7 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.PP
|
.PP
|
||||||
All of the functions below, including the functions in the extended math
|
All of the functions below, including the functions in the extended math
|
||||||
library (see the \f[I]Extended Library\f[R] subsection below), are
|
library (see the \f[I]Extended Library\f[R] subsection below), are
|
||||||
available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line
|
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
|
||||||
flags are given, except that the extended math library is not available
|
flags are given, except that the extended math library is not available
|
||||||
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
|
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
|
||||||
are given.
|
are given.
|
||||||
@ -1194,7 +1193,7 @@ Functions\f[R] subsection below).
|
|||||||
.SS Extended Library
|
.SS Extended Library
|
||||||
.PP
|
.PP
|
||||||
The extended library is \f[I]not\f[R] loaded when the
|
The extended library is \f[I]not\f[R] loaded when the
|
||||||
\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
|
\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
|
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
|
.PP
|
||||||
@ -1952,11 +1951,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Per the
|
Per the
|
||||||
@ -1964,7 +1963,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
|
|||||||
bc(1) has an interactive mode and a non-interactive mode.
|
bc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the
|
In interactive mode, bc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
|
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
[*file*...]
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
|
|||||||
|
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
|
|
||||||
**-g**, **--global-stacks**
|
**-g**, **-\-global-stacks**
|
||||||
|
|
||||||
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
||||||
|
|
||||||
@ -119,17 +118,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **--mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
math library and the extended math library before running any code,
|
math library and the extended math library before running any code,
|
||||||
@ -137,7 +136,7 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
To learn what is in the libraries, see the **LIBRARY** section.
|
To learn what is in the libraries, see the **LIBRARY** section.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
See the **TTY MODE** section) This is mostly for those users that do not
|
See the **TTY MODE** section) This is mostly for those users that do not
|
||||||
@ -147,36 +146,36 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-q**, **--quiet**
|
**-q**, **-\-quiet**
|
||||||
|
|
||||||
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
|
: 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
|
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
|
prints the copyright header if one or more of the **-v**, **-V**, or
|
||||||
**--version** options are given.
|
**-\-version** options are given.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-s**, **--standard**
|
**-s**, **-\-standard**
|
||||||
|
|
||||||
: Process exactly the language defined by the [standard][1] and error if any
|
: Process exactly the language defined by the [standard][1] and error if any
|
||||||
extensions are used.
|
extensions are used.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-w**, **--warn**
|
**-w**, **-\-warn**
|
||||||
|
|
||||||
: Like **-s** and **--standard**, except that warnings (and not errors) are
|
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
|
||||||
printed for non-standard extensions and execution continues normally.
|
printed for non-standard extensions and execution continues normally.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -186,14 +185,14 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, bc(1) will give a fatal error and exit.
|
or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -202,8 +201,8 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -258,8 +257,8 @@ Identifiers with more than one character (letter) are a
|
|||||||
|
|
||||||
**ibase** is a global variable determining how to interpret constant numbers. It
|
**ibase** is a global variable determining how to interpret constant numbers. It
|
||||||
is the "input" base, or the number base used for interpreting input numbers.
|
is the "input" base, or the number base used for interpreting input numbers.
|
||||||
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
|
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
|
||||||
(**--warn**) flags were not given on the command line, the max allowable value
|
(**-\-warn**) flags were not given on the command line, the max allowable value
|
||||||
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
||||||
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
||||||
bc(1) programs with the **maxibase()** built-in function.
|
bc(1) programs with the **maxibase()** built-in function.
|
||||||
@ -449,7 +448,7 @@ The following arithmetic and logical operators can be used. They are listed in
|
|||||||
order of decreasing precedence. Operators in the same group have the same
|
order of decreasing precedence. Operators in the same group have the same
|
||||||
precedence.
|
precedence.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: Type: Prefix and Postfix
|
: Type: Prefix and Postfix
|
||||||
|
|
||||||
@ -547,7 +546,7 @@ precedence.
|
|||||||
|
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: The prefix and postfix **increment** and **decrement** operators behave
|
: The prefix and postfix **increment** and **decrement** operators behave
|
||||||
exactly like they would in C. They require a named expression (see the
|
exactly like they would in C. They require a named expression (see the
|
||||||
@ -878,7 +877,7 @@ This is a **non-portable extension**.
|
|||||||
|
|
||||||
All of the functions below, including the functions in the extended math
|
All of the functions below, including the functions in the extended math
|
||||||
library (see the *Extended Library* subsection below), are available when the
|
library (see the *Extended Library* subsection below), are available when the
|
||||||
**-l** or **--mathlib** command-line flags are given, except that the extended
|
**-l** or **-\-mathlib** command-line flags are given, except that the extended
|
||||||
math library is not available when the **-s** option, the **-w** option, or
|
math library is not available when the **-s** option, the **-w** option, or
|
||||||
equivalents are given.
|
equivalents are given.
|
||||||
|
|
||||||
@ -930,8 +929,8 @@ The [standard][1] defines the following functions for the math library:
|
|||||||
|
|
||||||
## Extended Library
|
## Extended Library
|
||||||
|
|
||||||
The extended library is *not* loaded when the **-s**/**--standard** or
|
The extended library is *not* loaded when the **-s**/**-\-standard** or
|
||||||
**-w**/**--warn** options are given since they are not part of the library
|
**-w**/**-\-warn** options are given since they are not part of the library
|
||||||
defined by the [standard][1].
|
defined by the [standard][1].
|
||||||
|
|
||||||
The extended library is a **non-portable extension**.
|
The extended library is a **non-portable extension**.
|
||||||
@ -1599,17 +1598,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Per the [standard][1], bc(1) has an interactive mode and a non-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**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,19 +25,18 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
bc - arbitrary-precision decimal arithmetic language and calculator
|
bc - arbitrary-precision decimal arithmetic language and calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
|
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
|
||||||
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
|
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
|
||||||
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
|
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
|
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
|
||||||
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
|
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
|
||||||
\f[B]seed\f[R] into stacks.
|
\f[B]seed\f[R] into stacks.
|
||||||
.RS
|
.RS
|
||||||
@ -147,10 +146,10 @@ is ignored.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -158,7 +157,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library and the extended math library before
|
and loads the included math library and the extended math library before
|
||||||
running any code, including any expressions or files specified on the
|
running any code, including any expressions or files specified on the
|
||||||
@ -168,7 +167,7 @@ command line.
|
|||||||
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
|
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
||||||
@ -180,18 +179,18 @@ Most of those users would want to put this option in
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
|
\f[B]-q\f[R], \f[B]--quiet\f[R]
|
||||||
This option is for compatibility with the GNU
|
This option is for compatibility with the GNU
|
||||||
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
||||||
Without this option, GNU bc(1) prints a copyright header.
|
Without this option, GNU bc(1) prints a copyright header.
|
||||||
This bc(1) only prints the copyright header if one or more of the
|
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]\[en]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.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
|
\f[B]-s\f[R], \f[B]--standard\f[R]
|
||||||
Process exactly the language defined by the
|
Process exactly the language defined by the
|
||||||
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
||||||
and error if any extensions are used.
|
and error if any extensions are used.
|
||||||
@ -200,15 +199,15 @@ and error if any extensions are used.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
|
\f[B]-w\f[R], \f[B]--warn\f[R]
|
||||||
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
|
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
|
||||||
not errors) are printed for non-standard extensions and execution
|
not errors) are printed for non-standard extensions and execution
|
||||||
continues normally.
|
continues normally.
|
||||||
.RS
|
.RS
|
||||||
@ -216,7 +215,7 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -229,17 +228,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]BC_ENV_ARGS\f[R].
|
\f[B]BC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -250,9 +249,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -317,8 +316,8 @@ constant numbers.
|
|||||||
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
||||||
input numbers.
|
input numbers.
|
||||||
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
||||||
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
|
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
|
||||||
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
|
(\f[B]--warn\f[R]) flags were not given on the command line, the max
|
||||||
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
||||||
Otherwise, it is \f[B]16\f[R].
|
Otherwise, it is \f[B]16\f[R].
|
||||||
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
||||||
@ -577,7 +576,7 @@ The following arithmetic and logical operators can be used.
|
|||||||
They are listed in order of decreasing precedence.
|
They are listed in order of decreasing precedence.
|
||||||
Operators in the same group have the same precedence.
|
Operators in the same group have the same precedence.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
Type: Prefix and Postfix
|
Type: Prefix and Postfix
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
@ -687,7 +686,7 @@ Description: \f[B]boolean or\f[R]
|
|||||||
.PP
|
.PP
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
||||||
operators behave exactly like they would in C.
|
operators behave exactly like they would in C.
|
||||||
They require a named expression (see the \f[I]Named Expressions\f[R]
|
They require a named expression (see the \f[I]Named Expressions\f[R]
|
||||||
@ -1133,7 +1132,7 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.PP
|
.PP
|
||||||
All of the functions below, including the functions in the extended math
|
All of the functions below, including the functions in the extended math
|
||||||
library (see the \f[I]Extended Library\f[R] subsection below), are
|
library (see the \f[I]Extended Library\f[R] subsection below), are
|
||||||
available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line
|
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
|
||||||
flags are given, except that the extended math library is not available
|
flags are given, except that the extended math library is not available
|
||||||
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
|
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
|
||||||
are given.
|
are given.
|
||||||
@ -1194,7 +1193,7 @@ Functions\f[R] subsection below).
|
|||||||
.SS Extended Library
|
.SS Extended Library
|
||||||
.PP
|
.PP
|
||||||
The extended library is \f[I]not\f[R] loaded when the
|
The extended library is \f[I]not\f[R] loaded when the
|
||||||
\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
|
\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
|
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
|
.PP
|
||||||
@ -1952,11 +1951,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Per the
|
Per the
|
||||||
@ -1964,7 +1963,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
|
|||||||
bc(1) has an interactive mode and a non-interactive mode.
|
bc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the
|
In interactive mode, bc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
|
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
[*file*...]
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
|
|||||||
|
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
|
|
||||||
**-g**, **--global-stacks**
|
**-g**, **-\-global-stacks**
|
||||||
|
|
||||||
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
||||||
|
|
||||||
@ -119,17 +118,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **--mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
math library and the extended math library before running any code,
|
math library and the extended math library before running any code,
|
||||||
@ -137,7 +136,7 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
To learn what is in the libraries, see the **LIBRARY** section.
|
To learn what is in the libraries, see the **LIBRARY** section.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
See the **TTY MODE** section) This is mostly for those users that do not
|
See the **TTY MODE** section) This is mostly for those users that do not
|
||||||
@ -147,36 +146,36 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-q**, **--quiet**
|
**-q**, **-\-quiet**
|
||||||
|
|
||||||
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
|
: 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
|
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
|
prints the copyright header if one or more of the **-v**, **-V**, or
|
||||||
**--version** options are given.
|
**-\-version** options are given.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-s**, **--standard**
|
**-s**, **-\-standard**
|
||||||
|
|
||||||
: Process exactly the language defined by the [standard][1] and error if any
|
: Process exactly the language defined by the [standard][1] and error if any
|
||||||
extensions are used.
|
extensions are used.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-w**, **--warn**
|
**-w**, **-\-warn**
|
||||||
|
|
||||||
: Like **-s** and **--standard**, except that warnings (and not errors) are
|
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
|
||||||
printed for non-standard extensions and execution continues normally.
|
printed for non-standard extensions and execution continues normally.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -186,14 +185,14 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, bc(1) will give a fatal error and exit.
|
or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -202,8 +201,8 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -258,8 +257,8 @@ Identifiers with more than one character (letter) are a
|
|||||||
|
|
||||||
**ibase** is a global variable determining how to interpret constant numbers. It
|
**ibase** is a global variable determining how to interpret constant numbers. It
|
||||||
is the "input" base, or the number base used for interpreting input numbers.
|
is the "input" base, or the number base used for interpreting input numbers.
|
||||||
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
|
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
|
||||||
(**--warn**) flags were not given on the command line, the max allowable value
|
(**-\-warn**) flags were not given on the command line, the max allowable value
|
||||||
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
||||||
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
||||||
bc(1) programs with the **maxibase()** built-in function.
|
bc(1) programs with the **maxibase()** built-in function.
|
||||||
@ -449,7 +448,7 @@ The following arithmetic and logical operators can be used. They are listed in
|
|||||||
order of decreasing precedence. Operators in the same group have the same
|
order of decreasing precedence. Operators in the same group have the same
|
||||||
precedence.
|
precedence.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: Type: Prefix and Postfix
|
: Type: Prefix and Postfix
|
||||||
|
|
||||||
@ -547,7 +546,7 @@ precedence.
|
|||||||
|
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: The prefix and postfix **increment** and **decrement** operators behave
|
: The prefix and postfix **increment** and **decrement** operators behave
|
||||||
exactly like they would in C. They require a named expression (see the
|
exactly like they would in C. They require a named expression (see the
|
||||||
@ -878,7 +877,7 @@ This is a **non-portable extension**.
|
|||||||
|
|
||||||
All of the functions below, including the functions in the extended math
|
All of the functions below, including the functions in the extended math
|
||||||
library (see the *Extended Library* subsection below), are available when the
|
library (see the *Extended Library* subsection below), are available when the
|
||||||
**-l** or **--mathlib** command-line flags are given, except that the extended
|
**-l** or **-\-mathlib** command-line flags are given, except that the extended
|
||||||
math library is not available when the **-s** option, the **-w** option, or
|
math library is not available when the **-s** option, the **-w** option, or
|
||||||
equivalents are given.
|
equivalents are given.
|
||||||
|
|
||||||
@ -930,8 +929,8 @@ The [standard][1] defines the following functions for the math library:
|
|||||||
|
|
||||||
## Extended Library
|
## Extended Library
|
||||||
|
|
||||||
The extended library is *not* loaded when the **-s**/**--standard** or
|
The extended library is *not* loaded when the **-s**/**-\-standard** or
|
||||||
**-w**/**--warn** options are given since they are not part of the library
|
**-w**/**-\-warn** options are given since they are not part of the library
|
||||||
defined by the [standard][1].
|
defined by the [standard][1].
|
||||||
|
|
||||||
The extended library is a **non-portable extension**.
|
The extended library is a **non-portable extension**.
|
||||||
@ -1599,17 +1598,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Per the [standard][1], bc(1) has an interactive mode and a non-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**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,19 +25,18 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
bc - arbitrary-precision decimal arithmetic language and calculator
|
bc - arbitrary-precision decimal arithmetic language and calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
|
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
|
||||||
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
|
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
|
||||||
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
|
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
|
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
|
||||||
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
|
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
|
||||||
\f[B]seed\f[R] into stacks.
|
\f[B]seed\f[R] into stacks.
|
||||||
.RS
|
.RS
|
||||||
@ -147,10 +146,10 @@ is ignored.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -158,7 +157,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library and the extended math library before
|
and loads the included math library and the extended math library before
|
||||||
running any code, including any expressions or files specified on the
|
running any code, including any expressions or files specified on the
|
||||||
@ -168,25 +167,25 @@ command line.
|
|||||||
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
|
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
This option is a no-op.
|
This option is a no-op.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
|
\f[B]-q\f[R], \f[B]--quiet\f[R]
|
||||||
This option is for compatibility with the GNU
|
This option is for compatibility with the GNU
|
||||||
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
||||||
Without this option, GNU bc(1) prints a copyright header.
|
Without this option, GNU bc(1) prints a copyright header.
|
||||||
This bc(1) only prints the copyright header if one or more of the
|
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]\[en]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.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
|
\f[B]-s\f[R], \f[B]--standard\f[R]
|
||||||
Process exactly the language defined by the
|
Process exactly the language defined by the
|
||||||
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
||||||
and error if any extensions are used.
|
and error if any extensions are used.
|
||||||
@ -195,15 +194,15 @@ and error if any extensions are used.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
|
\f[B]-w\f[R], \f[B]--warn\f[R]
|
||||||
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
|
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
|
||||||
not errors) are printed for non-standard extensions and execution
|
not errors) are printed for non-standard extensions and execution
|
||||||
continues normally.
|
continues normally.
|
||||||
.RS
|
.RS
|
||||||
@ -211,7 +210,7 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -224,17 +223,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]BC_ENV_ARGS\f[R].
|
\f[B]BC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -245,9 +244,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -312,8 +311,8 @@ constant numbers.
|
|||||||
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
||||||
input numbers.
|
input numbers.
|
||||||
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
||||||
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
|
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
|
||||||
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
|
(\f[B]--warn\f[R]) flags were not given on the command line, the max
|
||||||
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
||||||
Otherwise, it is \f[B]16\f[R].
|
Otherwise, it is \f[B]16\f[R].
|
||||||
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
||||||
@ -572,7 +571,7 @@ The following arithmetic and logical operators can be used.
|
|||||||
They are listed in order of decreasing precedence.
|
They are listed in order of decreasing precedence.
|
||||||
Operators in the same group have the same precedence.
|
Operators in the same group have the same precedence.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
Type: Prefix and Postfix
|
Type: Prefix and Postfix
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
@ -682,7 +681,7 @@ Description: \f[B]boolean or\f[R]
|
|||||||
.PP
|
.PP
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
||||||
operators behave exactly like they would in C.
|
operators behave exactly like they would in C.
|
||||||
They require a named expression (see the \f[I]Named Expressions\f[R]
|
They require a named expression (see the \f[I]Named Expressions\f[R]
|
||||||
@ -1128,7 +1127,7 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.PP
|
.PP
|
||||||
All of the functions below, including the functions in the extended math
|
All of the functions below, including the functions in the extended math
|
||||||
library (see the \f[I]Extended Library\f[R] subsection below), are
|
library (see the \f[I]Extended Library\f[R] subsection below), are
|
||||||
available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line
|
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
|
||||||
flags are given, except that the extended math library is not available
|
flags are given, except that the extended math library is not available
|
||||||
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
|
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
|
||||||
are given.
|
are given.
|
||||||
@ -1189,7 +1188,7 @@ Functions\f[R] subsection below).
|
|||||||
.SS Extended Library
|
.SS Extended Library
|
||||||
.PP
|
.PP
|
||||||
The extended library is \f[I]not\f[R] loaded when the
|
The extended library is \f[I]not\f[R] loaded when the
|
||||||
\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
|
\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
|
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
|
.PP
|
||||||
@ -1947,11 +1946,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Per the
|
Per the
|
||||||
@ -1959,7 +1958,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
|
|||||||
bc(1) has an interactive mode and a non-interactive mode.
|
bc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the
|
In interactive mode, bc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
|
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
[*file*...]
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
|
|||||||
|
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
|
|
||||||
**-g**, **--global-stacks**
|
**-g**, **-\-global-stacks**
|
||||||
|
|
||||||
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
||||||
|
|
||||||
@ -119,17 +118,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **--mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
math library and the extended math library before running any code,
|
math library and the extended math library before running any code,
|
||||||
@ -137,42 +136,42 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
To learn what is in the libraries, see the **LIBRARY** section.
|
To learn what is in the libraries, see the **LIBRARY** section.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: This option is a no-op.
|
: This option is a no-op.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-q**, **--quiet**
|
**-q**, **-\-quiet**
|
||||||
|
|
||||||
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
|
: 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
|
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
|
prints the copyright header if one or more of the **-v**, **-V**, or
|
||||||
**--version** options are given.
|
**-\-version** options are given.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-s**, **--standard**
|
**-s**, **-\-standard**
|
||||||
|
|
||||||
: Process exactly the language defined by the [standard][1] and error if any
|
: Process exactly the language defined by the [standard][1] and error if any
|
||||||
extensions are used.
|
extensions are used.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-w**, **--warn**
|
**-w**, **-\-warn**
|
||||||
|
|
||||||
: Like **-s** and **--standard**, except that warnings (and not errors) are
|
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
|
||||||
printed for non-standard extensions and execution continues normally.
|
printed for non-standard extensions and execution continues normally.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -182,14 +181,14 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, bc(1) will give a fatal error and exit.
|
or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -198,8 +197,8 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -254,8 +253,8 @@ Identifiers with more than one character (letter) are a
|
|||||||
|
|
||||||
**ibase** is a global variable determining how to interpret constant numbers. It
|
**ibase** is a global variable determining how to interpret constant numbers. It
|
||||||
is the "input" base, or the number base used for interpreting input numbers.
|
is the "input" base, or the number base used for interpreting input numbers.
|
||||||
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
|
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
|
||||||
(**--warn**) flags were not given on the command line, the max allowable value
|
(**-\-warn**) flags were not given on the command line, the max allowable value
|
||||||
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
||||||
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
||||||
bc(1) programs with the **maxibase()** built-in function.
|
bc(1) programs with the **maxibase()** built-in function.
|
||||||
@ -445,7 +444,7 @@ The following arithmetic and logical operators can be used. They are listed in
|
|||||||
order of decreasing precedence. Operators in the same group have the same
|
order of decreasing precedence. Operators in the same group have the same
|
||||||
precedence.
|
precedence.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: Type: Prefix and Postfix
|
: Type: Prefix and Postfix
|
||||||
|
|
||||||
@ -543,7 +542,7 @@ precedence.
|
|||||||
|
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: The prefix and postfix **increment** and **decrement** operators behave
|
: The prefix and postfix **increment** and **decrement** operators behave
|
||||||
exactly like they would in C. They require a named expression (see the
|
exactly like they would in C. They require a named expression (see the
|
||||||
@ -874,7 +873,7 @@ This is a **non-portable extension**.
|
|||||||
|
|
||||||
All of the functions below, including the functions in the extended math
|
All of the functions below, including the functions in the extended math
|
||||||
library (see the *Extended Library* subsection below), are available when the
|
library (see the *Extended Library* subsection below), are available when the
|
||||||
**-l** or **--mathlib** command-line flags are given, except that the extended
|
**-l** or **-\-mathlib** command-line flags are given, except that the extended
|
||||||
math library is not available when the **-s** option, the **-w** option, or
|
math library is not available when the **-s** option, the **-w** option, or
|
||||||
equivalents are given.
|
equivalents are given.
|
||||||
|
|
||||||
@ -926,8 +925,8 @@ The [standard][1] defines the following functions for the math library:
|
|||||||
|
|
||||||
## Extended Library
|
## Extended Library
|
||||||
|
|
||||||
The extended library is *not* loaded when the **-s**/**--standard** or
|
The extended library is *not* loaded when the **-s**/**-\-standard** or
|
||||||
**-w**/**--warn** options are given since they are not part of the library
|
**-w**/**-\-warn** options are given since they are not part of the library
|
||||||
defined by the [standard][1].
|
defined by the [standard][1].
|
||||||
|
|
||||||
The extended library is a **non-portable extension**.
|
The extended library is a **non-portable extension**.
|
||||||
@ -1595,17 +1594,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Per the [standard][1], bc(1) has an interactive mode and a non-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**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,19 +25,18 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
bc - arbitrary-precision decimal arithmetic language and calculator
|
bc - arbitrary-precision decimal arithmetic language and calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
|
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
|
||||||
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
|
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
|
||||||
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
|
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -55,7 +54,7 @@ the command line and executes them before reading from \f[B]stdin\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
|
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
|
||||||
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
|
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
|
||||||
\f[B]seed\f[R] into stacks.
|
\f[B]seed\f[R] into stacks.
|
||||||
.RS
|
.RS
|
||||||
@ -147,10 +146,10 @@ is ignored.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -158,7 +157,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library and the extended math library before
|
and loads the included math library and the extended math library before
|
||||||
running any code, including any expressions or files specified on the
|
running any code, including any expressions or files specified on the
|
||||||
@ -168,25 +167,25 @@ command line.
|
|||||||
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
|
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
This option is a no-op.
|
This option is a no-op.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
|
\f[B]-q\f[R], \f[B]--quiet\f[R]
|
||||||
This option is for compatibility with the GNU
|
This option is for compatibility with the GNU
|
||||||
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
||||||
Without this option, GNU bc(1) prints a copyright header.
|
Without this option, GNU bc(1) prints a copyright header.
|
||||||
This bc(1) only prints the copyright header if one or more of the
|
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]\[en]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.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
|
\f[B]-s\f[R], \f[B]--standard\f[R]
|
||||||
Process exactly the language defined by the
|
Process exactly the language defined by the
|
||||||
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
||||||
and error if any extensions are used.
|
and error if any extensions are used.
|
||||||
@ -195,15 +194,15 @@ and error if any extensions are used.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
|
\f[B]-w\f[R], \f[B]--warn\f[R]
|
||||||
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
|
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
|
||||||
not errors) are printed for non-standard extensions and execution
|
not errors) are printed for non-standard extensions and execution
|
||||||
continues normally.
|
continues normally.
|
||||||
.RS
|
.RS
|
||||||
@ -211,7 +210,7 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -224,17 +223,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]BC_ENV_ARGS\f[R].
|
\f[B]BC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -245,9 +244,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -312,8 +311,8 @@ constant numbers.
|
|||||||
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
||||||
input numbers.
|
input numbers.
|
||||||
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
||||||
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
|
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
|
||||||
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
|
(\f[B]--warn\f[R]) flags were not given on the command line, the max
|
||||||
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
||||||
Otherwise, it is \f[B]16\f[R].
|
Otherwise, it is \f[B]16\f[R].
|
||||||
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
||||||
@ -572,7 +571,7 @@ The following arithmetic and logical operators can be used.
|
|||||||
They are listed in order of decreasing precedence.
|
They are listed in order of decreasing precedence.
|
||||||
Operators in the same group have the same precedence.
|
Operators in the same group have the same precedence.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
Type: Prefix and Postfix
|
Type: Prefix and Postfix
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
@ -682,7 +681,7 @@ Description: \f[B]boolean or\f[R]
|
|||||||
.PP
|
.PP
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
||||||
operators behave exactly like they would in C.
|
operators behave exactly like they would in C.
|
||||||
They require a named expression (see the \f[I]Named Expressions\f[R]
|
They require a named expression (see the \f[I]Named Expressions\f[R]
|
||||||
@ -1128,7 +1127,7 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.PP
|
.PP
|
||||||
All of the functions below, including the functions in the extended math
|
All of the functions below, including the functions in the extended math
|
||||||
library (see the \f[I]Extended Library\f[R] subsection below), are
|
library (see the \f[I]Extended Library\f[R] subsection below), are
|
||||||
available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line
|
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
|
||||||
flags are given, except that the extended math library is not available
|
flags are given, except that the extended math library is not available
|
||||||
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
|
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
|
||||||
are given.
|
are given.
|
||||||
@ -1189,7 +1188,7 @@ Functions\f[R] subsection below).
|
|||||||
.SS Extended Library
|
.SS Extended Library
|
||||||
.PP
|
.PP
|
||||||
The extended library is \f[I]not\f[R] loaded when the
|
The extended library is \f[I]not\f[R] loaded when the
|
||||||
\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
|
\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
|
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
|
.PP
|
||||||
@ -1947,11 +1946,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Per the
|
Per the
|
||||||
@ -1959,7 +1958,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
|
|||||||
bc(1) has an interactive mode and a non-interactive mode.
|
bc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the
|
In interactive mode, bc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
|
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
[*file*...]
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -51,7 +50,7 @@ command line and executes them before reading from **stdin**.
|
|||||||
|
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
|
|
||||||
**-g**, **--global-stacks**
|
**-g**, **-\-global-stacks**
|
||||||
|
|
||||||
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
||||||
|
|
||||||
@ -119,17 +118,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **--mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
math library and the extended math library before running any code,
|
math library and the extended math library before running any code,
|
||||||
@ -137,42 +136,42 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
To learn what is in the libraries, see the **LIBRARY** section.
|
To learn what is in the libraries, see the **LIBRARY** section.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: This option is a no-op.
|
: This option is a no-op.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-q**, **--quiet**
|
**-q**, **-\-quiet**
|
||||||
|
|
||||||
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
|
: 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
|
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
|
prints the copyright header if one or more of the **-v**, **-V**, or
|
||||||
**--version** options are given.
|
**-\-version** options are given.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-s**, **--standard**
|
**-s**, **-\-standard**
|
||||||
|
|
||||||
: Process exactly the language defined by the [standard][1] and error if any
|
: Process exactly the language defined by the [standard][1] and error if any
|
||||||
extensions are used.
|
extensions are used.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-w**, **--warn**
|
**-w**, **-\-warn**
|
||||||
|
|
||||||
: Like **-s** and **--standard**, except that warnings (and not errors) are
|
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
|
||||||
printed for non-standard extensions and execution continues normally.
|
printed for non-standard extensions and execution continues normally.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -182,14 +181,14 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, bc(1) will give a fatal error and exit.
|
or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -198,8 +197,8 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -254,8 +253,8 @@ Identifiers with more than one character (letter) are a
|
|||||||
|
|
||||||
**ibase** is a global variable determining how to interpret constant numbers. It
|
**ibase** is a global variable determining how to interpret constant numbers. It
|
||||||
is the "input" base, or the number base used for interpreting input numbers.
|
is the "input" base, or the number base used for interpreting input numbers.
|
||||||
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
|
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
|
||||||
(**--warn**) flags were not given on the command line, the max allowable value
|
(**-\-warn**) flags were not given on the command line, the max allowable value
|
||||||
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
||||||
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
||||||
bc(1) programs with the **maxibase()** built-in function.
|
bc(1) programs with the **maxibase()** built-in function.
|
||||||
@ -445,7 +444,7 @@ The following arithmetic and logical operators can be used. They are listed in
|
|||||||
order of decreasing precedence. Operators in the same group have the same
|
order of decreasing precedence. Operators in the same group have the same
|
||||||
precedence.
|
precedence.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: Type: Prefix and Postfix
|
: Type: Prefix and Postfix
|
||||||
|
|
||||||
@ -543,7 +542,7 @@ precedence.
|
|||||||
|
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: The prefix and postfix **increment** and **decrement** operators behave
|
: The prefix and postfix **increment** and **decrement** operators behave
|
||||||
exactly like they would in C. They require a named expression (see the
|
exactly like they would in C. They require a named expression (see the
|
||||||
@ -874,7 +873,7 @@ This is a **non-portable extension**.
|
|||||||
|
|
||||||
All of the functions below, including the functions in the extended math
|
All of the functions below, including the functions in the extended math
|
||||||
library (see the *Extended Library* subsection below), are available when the
|
library (see the *Extended Library* subsection below), are available when the
|
||||||
**-l** or **--mathlib** command-line flags are given, except that the extended
|
**-l** or **-\-mathlib** command-line flags are given, except that the extended
|
||||||
math library is not available when the **-s** option, the **-w** option, or
|
math library is not available when the **-s** option, the **-w** option, or
|
||||||
equivalents are given.
|
equivalents are given.
|
||||||
|
|
||||||
@ -926,8 +925,8 @@ The [standard][1] defines the following functions for the math library:
|
|||||||
|
|
||||||
## Extended Library
|
## Extended Library
|
||||||
|
|
||||||
The extended library is *not* loaded when the **-s**/**--standard** or
|
The extended library is *not* loaded when the **-s**/**-\-standard** or
|
||||||
**-w**/**--warn** options are given since they are not part of the library
|
**-w**/**-\-warn** options are given since they are not part of the library
|
||||||
defined by the [standard][1].
|
defined by the [standard][1].
|
||||||
|
|
||||||
The extended library is a **non-portable extension**.
|
The extended library is a **non-portable extension**.
|
||||||
@ -1595,17 +1594,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Per the [standard][1], bc(1) has an interactive mode and a non-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**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,19 +25,18 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
bc - arbitrary-precision decimal arithmetic language and calculator
|
bc - arbitrary-precision decimal arithmetic language and calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
|
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
|
||||||
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
|
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
|
||||||
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
|
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -60,7 +59,7 @@ implementations.
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
|
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
|
||||||
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
|
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
|
||||||
\f[B]seed\f[R] into stacks.
|
\f[B]seed\f[R] into stacks.
|
||||||
.RS
|
.RS
|
||||||
@ -152,10 +151,10 @@ is ignored.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -163,7 +162,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library and the extended math library before
|
and loads the included math library and the extended math library before
|
||||||
running any code, including any expressions or files specified on the
|
running any code, including any expressions or files specified on the
|
||||||
@ -173,7 +172,7 @@ command line.
|
|||||||
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
|
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
||||||
@ -185,18 +184,18 @@ Most of those users would want to put this option in
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
|
\f[B]-q\f[R], \f[B]--quiet\f[R]
|
||||||
This option is for compatibility with the GNU
|
This option is for compatibility with the GNU
|
||||||
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
||||||
Without this option, GNU bc(1) prints a copyright header.
|
Without this option, GNU bc(1) prints a copyright header.
|
||||||
This bc(1) only prints the copyright header if one or more of the
|
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]\[en]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.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
|
\f[B]-s\f[R], \f[B]--standard\f[R]
|
||||||
Process exactly the language defined by the
|
Process exactly the language defined by the
|
||||||
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
||||||
and error if any extensions are used.
|
and error if any extensions are used.
|
||||||
@ -205,15 +204,15 @@ and error if any extensions are used.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
|
\f[B]-w\f[R], \f[B]--warn\f[R]
|
||||||
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
|
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
|
||||||
not errors) are printed for non-standard extensions and execution
|
not errors) are printed for non-standard extensions and execution
|
||||||
continues normally.
|
continues normally.
|
||||||
.RS
|
.RS
|
||||||
@ -221,7 +220,7 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -234,17 +233,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]BC_ENV_ARGS\f[R].
|
\f[B]BC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -255,9 +254,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -322,8 +321,8 @@ constant numbers.
|
|||||||
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
||||||
input numbers.
|
input numbers.
|
||||||
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
||||||
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
|
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
|
||||||
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
|
(\f[B]--warn\f[R]) flags were not given on the command line, the max
|
||||||
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
||||||
Otherwise, it is \f[B]16\f[R].
|
Otherwise, it is \f[B]16\f[R].
|
||||||
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
||||||
@ -582,7 +581,7 @@ The following arithmetic and logical operators can be used.
|
|||||||
They are listed in order of decreasing precedence.
|
They are listed in order of decreasing precedence.
|
||||||
Operators in the same group have the same precedence.
|
Operators in the same group have the same precedence.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
Type: Prefix and Postfix
|
Type: Prefix and Postfix
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
@ -692,7 +691,7 @@ Description: \f[B]boolean or\f[R]
|
|||||||
.PP
|
.PP
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
||||||
operators behave exactly like they would in C.
|
operators behave exactly like they would in C.
|
||||||
They require a named expression (see the \f[I]Named Expressions\f[R]
|
They require a named expression (see the \f[I]Named Expressions\f[R]
|
||||||
@ -1138,7 +1137,7 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.PP
|
.PP
|
||||||
All of the functions below, including the functions in the extended math
|
All of the functions below, including the functions in the extended math
|
||||||
library (see the \f[I]Extended Library\f[R] subsection below), are
|
library (see the \f[I]Extended Library\f[R] subsection below), are
|
||||||
available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line
|
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
|
||||||
flags are given, except that the extended math library is not available
|
flags are given, except that the extended math library is not available
|
||||||
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
|
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
|
||||||
are given.
|
are given.
|
||||||
@ -1199,7 +1198,7 @@ Functions\f[R] subsection below).
|
|||||||
.SS Extended Library
|
.SS Extended Library
|
||||||
.PP
|
.PP
|
||||||
The extended library is \f[I]not\f[R] loaded when the
|
The extended library is \f[I]not\f[R] loaded when the
|
||||||
\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
|
\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
|
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
|
.PP
|
||||||
@ -1957,11 +1956,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Per the
|
Per the
|
||||||
@ -1969,7 +1968,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
|
|||||||
bc(1) has an interactive mode and a non-interactive mode.
|
bc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the
|
In interactive mode, bc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
|
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
[*file*...]
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -55,7 +54,7 @@ other implementations.
|
|||||||
|
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
|
|
||||||
**-g**, **--global-stacks**
|
**-g**, **-\-global-stacks**
|
||||||
|
|
||||||
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
||||||
|
|
||||||
@ -123,17 +122,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **--mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
math library and the extended math library before running any code,
|
math library and the extended math library before running any code,
|
||||||
@ -141,7 +140,7 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
To learn what is in the libraries, see the **LIBRARY** section.
|
To learn what is in the libraries, see the **LIBRARY** section.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
See the **TTY MODE** section) This is mostly for those users that do not
|
See the **TTY MODE** section) This is mostly for those users that do not
|
||||||
@ -151,36 +150,36 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-q**, **--quiet**
|
**-q**, **-\-quiet**
|
||||||
|
|
||||||
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
|
: 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
|
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
|
prints the copyright header if one or more of the **-v**, **-V**, or
|
||||||
**--version** options are given.
|
**-\-version** options are given.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-s**, **--standard**
|
**-s**, **-\-standard**
|
||||||
|
|
||||||
: Process exactly the language defined by the [standard][1] and error if any
|
: Process exactly the language defined by the [standard][1] and error if any
|
||||||
extensions are used.
|
extensions are used.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-w**, **--warn**
|
**-w**, **-\-warn**
|
||||||
|
|
||||||
: Like **-s** and **--standard**, except that warnings (and not errors) are
|
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
|
||||||
printed for non-standard extensions and execution continues normally.
|
printed for non-standard extensions and execution continues normally.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -190,14 +189,14 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, bc(1) will give a fatal error and exit.
|
or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -206,8 +205,8 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -262,8 +261,8 @@ Identifiers with more than one character (letter) are a
|
|||||||
|
|
||||||
**ibase** is a global variable determining how to interpret constant numbers. It
|
**ibase** is a global variable determining how to interpret constant numbers. It
|
||||||
is the "input" base, or the number base used for interpreting input numbers.
|
is the "input" base, or the number base used for interpreting input numbers.
|
||||||
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
|
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
|
||||||
(**--warn**) flags were not given on the command line, the max allowable value
|
(**-\-warn**) flags were not given on the command line, the max allowable value
|
||||||
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
||||||
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
||||||
bc(1) programs with the **maxibase()** built-in function.
|
bc(1) programs with the **maxibase()** built-in function.
|
||||||
@ -453,7 +452,7 @@ The following arithmetic and logical operators can be used. They are listed in
|
|||||||
order of decreasing precedence. Operators in the same group have the same
|
order of decreasing precedence. Operators in the same group have the same
|
||||||
precedence.
|
precedence.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: Type: Prefix and Postfix
|
: Type: Prefix and Postfix
|
||||||
|
|
||||||
@ -551,7 +550,7 @@ precedence.
|
|||||||
|
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: The prefix and postfix **increment** and **decrement** operators behave
|
: The prefix and postfix **increment** and **decrement** operators behave
|
||||||
exactly like they would in C. They require a named expression (see the
|
exactly like they would in C. They require a named expression (see the
|
||||||
@ -882,7 +881,7 @@ This is a **non-portable extension**.
|
|||||||
|
|
||||||
All of the functions below, including the functions in the extended math
|
All of the functions below, including the functions in the extended math
|
||||||
library (see the *Extended Library* subsection below), are available when the
|
library (see the *Extended Library* subsection below), are available when the
|
||||||
**-l** or **--mathlib** command-line flags are given, except that the extended
|
**-l** or **-\-mathlib** command-line flags are given, except that the extended
|
||||||
math library is not available when the **-s** option, the **-w** option, or
|
math library is not available when the **-s** option, the **-w** option, or
|
||||||
equivalents are given.
|
equivalents are given.
|
||||||
|
|
||||||
@ -934,8 +933,8 @@ The [standard][1] defines the following functions for the math library:
|
|||||||
|
|
||||||
## Extended Library
|
## Extended Library
|
||||||
|
|
||||||
The extended library is *not* loaded when the **-s**/**--standard** or
|
The extended library is *not* loaded when the **-s**/**-\-standard** or
|
||||||
**-w**/**--warn** options are given since they are not part of the library
|
**-w**/**-\-warn** options are given since they are not part of the library
|
||||||
defined by the [standard][1].
|
defined by the [standard][1].
|
||||||
|
|
||||||
The extended library is a **non-portable extension**.
|
The extended library is a **non-portable extension**.
|
||||||
@ -1603,17 +1602,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Per the [standard][1], bc(1) has an interactive mode and a non-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**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,19 +25,18 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
bc - arbitrary-precision decimal arithmetic language and calculator
|
bc - arbitrary-precision decimal arithmetic language and calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
|
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
|
||||||
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
|
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
|
||||||
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
|
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -60,7 +59,7 @@ implementations.
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
|
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
|
||||||
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
|
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
|
||||||
\f[B]seed\f[R] into stacks.
|
\f[B]seed\f[R] into stacks.
|
||||||
.RS
|
.RS
|
||||||
@ -152,10 +151,10 @@ is ignored.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -163,7 +162,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library and the extended math library before
|
and loads the included math library and the extended math library before
|
||||||
running any code, including any expressions or files specified on the
|
running any code, including any expressions or files specified on the
|
||||||
@ -173,25 +172,25 @@ command line.
|
|||||||
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
|
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
This option is a no-op.
|
This option is a no-op.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
|
\f[B]-q\f[R], \f[B]--quiet\f[R]
|
||||||
This option is for compatibility with the GNU
|
This option is for compatibility with the GNU
|
||||||
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
||||||
Without this option, GNU bc(1) prints a copyright header.
|
Without this option, GNU bc(1) prints a copyright header.
|
||||||
This bc(1) only prints the copyright header if one or more of the
|
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]\[en]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.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
|
\f[B]-s\f[R], \f[B]--standard\f[R]
|
||||||
Process exactly the language defined by the
|
Process exactly the language defined by the
|
||||||
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
||||||
and error if any extensions are used.
|
and error if any extensions are used.
|
||||||
@ -200,15 +199,15 @@ and error if any extensions are used.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
|
\f[B]-w\f[R], \f[B]--warn\f[R]
|
||||||
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
|
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
|
||||||
not errors) are printed for non-standard extensions and execution
|
not errors) are printed for non-standard extensions and execution
|
||||||
continues normally.
|
continues normally.
|
||||||
.RS
|
.RS
|
||||||
@ -216,7 +215,7 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -229,17 +228,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]BC_ENV_ARGS\f[R].
|
\f[B]BC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -250,9 +249,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -317,8 +316,8 @@ constant numbers.
|
|||||||
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
||||||
input numbers.
|
input numbers.
|
||||||
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
||||||
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
|
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
|
||||||
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
|
(\f[B]--warn\f[R]) flags were not given on the command line, the max
|
||||||
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
||||||
Otherwise, it is \f[B]16\f[R].
|
Otherwise, it is \f[B]16\f[R].
|
||||||
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
||||||
@ -577,7 +576,7 @@ The following arithmetic and logical operators can be used.
|
|||||||
They are listed in order of decreasing precedence.
|
They are listed in order of decreasing precedence.
|
||||||
Operators in the same group have the same precedence.
|
Operators in the same group have the same precedence.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
Type: Prefix and Postfix
|
Type: Prefix and Postfix
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
@ -687,7 +686,7 @@ Description: \f[B]boolean or\f[R]
|
|||||||
.PP
|
.PP
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
||||||
operators behave exactly like they would in C.
|
operators behave exactly like they would in C.
|
||||||
They require a named expression (see the \f[I]Named Expressions\f[R]
|
They require a named expression (see the \f[I]Named Expressions\f[R]
|
||||||
@ -1133,7 +1132,7 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.PP
|
.PP
|
||||||
All of the functions below, including the functions in the extended math
|
All of the functions below, including the functions in the extended math
|
||||||
library (see the \f[I]Extended Library\f[R] subsection below), are
|
library (see the \f[I]Extended Library\f[R] subsection below), are
|
||||||
available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line
|
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
|
||||||
flags are given, except that the extended math library is not available
|
flags are given, except that the extended math library is not available
|
||||||
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
|
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
|
||||||
are given.
|
are given.
|
||||||
@ -1194,7 +1193,7 @@ Functions\f[R] subsection below).
|
|||||||
.SS Extended Library
|
.SS Extended Library
|
||||||
.PP
|
.PP
|
||||||
The extended library is \f[I]not\f[R] loaded when the
|
The extended library is \f[I]not\f[R] loaded when the
|
||||||
\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
|
\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
|
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
|
.PP
|
||||||
@ -1952,11 +1951,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Per the
|
Per the
|
||||||
@ -1964,7 +1963,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
|
|||||||
bc(1) has an interactive mode and a non-interactive mode.
|
bc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the
|
In interactive mode, bc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
|
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
[*file*...]
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -55,7 +54,7 @@ other implementations.
|
|||||||
|
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
|
|
||||||
**-g**, **--global-stacks**
|
**-g**, **-\-global-stacks**
|
||||||
|
|
||||||
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
||||||
|
|
||||||
@ -123,17 +122,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **--mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
math library and the extended math library before running any code,
|
math library and the extended math library before running any code,
|
||||||
@ -141,42 +140,42 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
To learn what is in the libraries, see the **LIBRARY** section.
|
To learn what is in the libraries, see the **LIBRARY** section.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: This option is a no-op.
|
: This option is a no-op.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-q**, **--quiet**
|
**-q**, **-\-quiet**
|
||||||
|
|
||||||
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
|
: 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
|
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
|
prints the copyright header if one or more of the **-v**, **-V**, or
|
||||||
**--version** options are given.
|
**-\-version** options are given.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-s**, **--standard**
|
**-s**, **-\-standard**
|
||||||
|
|
||||||
: Process exactly the language defined by the [standard][1] and error if any
|
: Process exactly the language defined by the [standard][1] and error if any
|
||||||
extensions are used.
|
extensions are used.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-w**, **--warn**
|
**-w**, **-\-warn**
|
||||||
|
|
||||||
: Like **-s** and **--standard**, except that warnings (and not errors) are
|
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
|
||||||
printed for non-standard extensions and execution continues normally.
|
printed for non-standard extensions and execution continues normally.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -186,14 +185,14 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, bc(1) will give a fatal error and exit.
|
or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -202,8 +201,8 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -258,8 +257,8 @@ Identifiers with more than one character (letter) are a
|
|||||||
|
|
||||||
**ibase** is a global variable determining how to interpret constant numbers. It
|
**ibase** is a global variable determining how to interpret constant numbers. It
|
||||||
is the "input" base, or the number base used for interpreting input numbers.
|
is the "input" base, or the number base used for interpreting input numbers.
|
||||||
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
|
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
|
||||||
(**--warn**) flags were not given on the command line, the max allowable value
|
(**-\-warn**) flags were not given on the command line, the max allowable value
|
||||||
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
||||||
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
||||||
bc(1) programs with the **maxibase()** built-in function.
|
bc(1) programs with the **maxibase()** built-in function.
|
||||||
@ -449,7 +448,7 @@ The following arithmetic and logical operators can be used. They are listed in
|
|||||||
order of decreasing precedence. Operators in the same group have the same
|
order of decreasing precedence. Operators in the same group have the same
|
||||||
precedence.
|
precedence.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: Type: Prefix and Postfix
|
: Type: Prefix and Postfix
|
||||||
|
|
||||||
@ -547,7 +546,7 @@ precedence.
|
|||||||
|
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: The prefix and postfix **increment** and **decrement** operators behave
|
: The prefix and postfix **increment** and **decrement** operators behave
|
||||||
exactly like they would in C. They require a named expression (see the
|
exactly like they would in C. They require a named expression (see the
|
||||||
@ -878,7 +877,7 @@ This is a **non-portable extension**.
|
|||||||
|
|
||||||
All of the functions below, including the functions in the extended math
|
All of the functions below, including the functions in the extended math
|
||||||
library (see the *Extended Library* subsection below), are available when the
|
library (see the *Extended Library* subsection below), are available when the
|
||||||
**-l** or **--mathlib** command-line flags are given, except that the extended
|
**-l** or **-\-mathlib** command-line flags are given, except that the extended
|
||||||
math library is not available when the **-s** option, the **-w** option, or
|
math library is not available when the **-s** option, the **-w** option, or
|
||||||
equivalents are given.
|
equivalents are given.
|
||||||
|
|
||||||
@ -930,8 +929,8 @@ The [standard][1] defines the following functions for the math library:
|
|||||||
|
|
||||||
## Extended Library
|
## Extended Library
|
||||||
|
|
||||||
The extended library is *not* loaded when the **-s**/**--standard** or
|
The extended library is *not* loaded when the **-s**/**-\-standard** or
|
||||||
**-w**/**--warn** options are given since they are not part of the library
|
**-w**/**-\-warn** options are given since they are not part of the library
|
||||||
defined by the [standard][1].
|
defined by the [standard][1].
|
||||||
|
|
||||||
The extended library is a **non-portable extension**.
|
The extended library is a **non-portable extension**.
|
||||||
@ -1599,17 +1598,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Per the [standard][1], bc(1) has an interactive mode and a non-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**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,19 +25,18 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
bc - arbitrary-precision decimal arithmetic language and calculator
|
bc - arbitrary-precision decimal arithmetic language and calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]\[en]global-stacks\f[R]]
|
\f[B]bc\f[R] [\f[B]-ghilPqsvVw\f[R]] [\f[B]--global-stacks\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
|
||||||
[\f[B]\[en]mathlib\f[R]] [\f[B]\[en]no-prompt\f[R]]
|
[\f[B]--no-prompt\f[R]] [\f[B]--quiet\f[R]] [\f[B]--standard\f[R]]
|
||||||
[\f[B]\[en]quiet\f[R]] [\f[B]\[en]standard\f[R]] [\f[B]\[en]warn\f[R]]
|
[\f[B]--warn\f[R]] [\f[B]--version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]\[en]version\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -60,7 +59,7 @@ implementations.
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-g\f[R], \f[B]\[en]global-stacks\f[R]
|
\f[B]-g\f[R], \f[B]--global-stacks\f[R]
|
||||||
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
|
Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
|
||||||
\f[B]seed\f[R] into stacks.
|
\f[B]seed\f[R] into stacks.
|
||||||
.RS
|
.RS
|
||||||
@ -152,10 +151,10 @@ is ignored.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -163,7 +162,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-l\f[R], \f[B]\[en]mathlib\f[R]
|
\f[B]-l\f[R], \f[B]--mathlib\f[R]
|
||||||
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
|
||||||
and loads the included math library and the extended math library before
|
and loads the included math library and the extended math library before
|
||||||
running any code, including any expressions or files specified on the
|
running any code, including any expressions or files specified on the
|
||||||
@ -173,25 +172,25 @@ command line.
|
|||||||
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
|
To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
This option is a no-op.
|
This option is a no-op.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-q\f[R], \f[B]\[en]quiet\f[R]
|
\f[B]-q\f[R], \f[B]--quiet\f[R]
|
||||||
This option is for compatibility with the GNU
|
This option is for compatibility with the GNU
|
||||||
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
bc(1) (https://www.gnu.org/software/bc/); it is a no-op.
|
||||||
Without this option, GNU bc(1) prints a copyright header.
|
Without this option, GNU bc(1) prints a copyright header.
|
||||||
This bc(1) only prints the copyright header if one or more of the
|
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]\[en]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.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-s\f[R], \f[B]\[en]standard\f[R]
|
\f[B]-s\f[R], \f[B]--standard\f[R]
|
||||||
Process exactly the language defined by the
|
Process exactly the language defined by the
|
||||||
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html)
|
||||||
and error if any extensions are used.
|
and error if any extensions are used.
|
||||||
@ -200,15 +199,15 @@ and error if any extensions are used.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-w\f[R], \f[B]\[en]warn\f[R]
|
\f[B]-w\f[R], \f[B]--warn\f[R]
|
||||||
Like \f[B]-s\f[R] and \f[B]\[en]standard\f[R], except that warnings (and
|
Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
|
||||||
not errors) are printed for non-standard extensions and execution
|
not errors) are printed for non-standard extensions and execution
|
||||||
continues normally.
|
continues normally.
|
||||||
.RS
|
.RS
|
||||||
@ -216,7 +215,7 @@ continues normally.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -229,17 +228,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]BC_ENV_ARGS\f[R].
|
\f[B]BC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -250,9 +249,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, bc(1) will exit, unless
|
then after processing all expressions and files, bc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -317,8 +316,8 @@ constant numbers.
|
|||||||
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
It is the \[lq]input\[rq] base, or the number base used for interpreting
|
||||||
input numbers.
|
input numbers.
|
||||||
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
\f[B]ibase\f[R] is initially \f[B]10\f[R].
|
||||||
If the \f[B]-s\f[R] (\f[B]\[en]standard\f[R]) and \f[B]-w\f[R]
|
If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
|
||||||
(\f[B]\[en]warn\f[R]) flags were not given on the command line, the max
|
(\f[B]--warn\f[R]) flags were not given on the command line, the max
|
||||||
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
|
||||||
Otherwise, it is \f[B]16\f[R].
|
Otherwise, it is \f[B]16\f[R].
|
||||||
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
|
||||||
@ -577,7 +576,7 @@ The following arithmetic and logical operators can be used.
|
|||||||
They are listed in order of decreasing precedence.
|
They are listed in order of decreasing precedence.
|
||||||
Operators in the same group have the same precedence.
|
Operators in the same group have the same precedence.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
Type: Prefix and Postfix
|
Type: Prefix and Postfix
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
@ -687,7 +686,7 @@ Description: \f[B]boolean or\f[R]
|
|||||||
.PP
|
.PP
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
.TP
|
.TP
|
||||||
\f[B]++\f[R] \f[B]\[en]\f[R]
|
\f[B]++\f[R] \f[B]--\f[R]
|
||||||
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
|
||||||
operators behave exactly like they would in C.
|
operators behave exactly like they would in C.
|
||||||
They require a named expression (see the \f[I]Named Expressions\f[R]
|
They require a named expression (see the \f[I]Named Expressions\f[R]
|
||||||
@ -1133,7 +1132,7 @@ This is a \f[B]non-portable extension\f[R].
|
|||||||
.PP
|
.PP
|
||||||
All of the functions below, including the functions in the extended math
|
All of the functions below, including the functions in the extended math
|
||||||
library (see the \f[I]Extended Library\f[R] subsection below), are
|
library (see the \f[I]Extended Library\f[R] subsection below), are
|
||||||
available when the \f[B]-l\f[R] or \f[B]\[en]mathlib\f[R] command-line
|
available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
|
||||||
flags are given, except that the extended math library is not available
|
flags are given, except that the extended math library is not available
|
||||||
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
|
when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
|
||||||
are given.
|
are given.
|
||||||
@ -1194,7 +1193,7 @@ Functions\f[R] subsection below).
|
|||||||
.SS Extended Library
|
.SS Extended Library
|
||||||
.PP
|
.PP
|
||||||
The extended library is \f[I]not\f[R] loaded when the
|
The extended library is \f[I]not\f[R] loaded when the
|
||||||
\f[B]-s\f[R]/\f[B]\[en]standard\f[R] or \f[B]-w\f[R]/\f[B]\[en]warn\f[R]
|
\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
|
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
|
.PP
|
||||||
@ -1952,11 +1951,11 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Per the
|
Per the
|
||||||
@ -1964,7 +1963,7 @@ standard (https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html),
|
|||||||
bc(1) has an interactive mode and a non-interactive mode.
|
bc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the
|
In interactive mode, bc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,8 +34,7 @@ bc - arbitrary-precision decimal arithmetic language and calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**bc** [**-ghilPqsvVw**] [**--global-stacks**] [**--help**] [**--interactive**] [**--mathlib**] [**--no-prompt**] [**--quiet**] [**--standard**] [**--warn**] [**--version**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...]
|
**bc** [**-ghilPqsvVw**] [**-\-global-stacks**] [**-\-help**] [**-\-interactive**] [**-\-mathlib**] [**-\-no-prompt**] [**-\-quiet**] [**-\-standard**] [**-\-warn**] [**-\-version**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
[*file*...]
|
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -55,7 +54,7 @@ other implementations.
|
|||||||
|
|
||||||
The following are the options that bc(1) accepts.
|
The following are the options that bc(1) accepts.
|
||||||
|
|
||||||
**-g**, **--global-stacks**
|
**-g**, **-\-global-stacks**
|
||||||
|
|
||||||
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
: Turns the globals **ibase**, **obase**, **scale**, and **seed** into stacks.
|
||||||
|
|
||||||
@ -123,17 +122,17 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-l**, **--mathlib**
|
**-l**, **-\-mathlib**
|
||||||
|
|
||||||
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
: Sets **scale** (see the **SYNTAX** section) to **20** and loads the included
|
||||||
math library and the extended math library before running any code,
|
math library and the extended math library before running any code,
|
||||||
@ -141,42 +140,42 @@ The following are the options that bc(1) accepts.
|
|||||||
|
|
||||||
To learn what is in the libraries, see the **LIBRARY** section.
|
To learn what is in the libraries, see the **LIBRARY** section.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: This option is a no-op.
|
: This option is a no-op.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-q**, **--quiet**
|
**-q**, **-\-quiet**
|
||||||
|
|
||||||
: This option is for compatibility with the [GNU bc(1)][2]; it is a no-op.
|
: 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
|
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
|
prints the copyright header if one or more of the **-v**, **-V**, or
|
||||||
**--version** options are given.
|
**-\-version** options are given.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-s**, **--standard**
|
**-s**, **-\-standard**
|
||||||
|
|
||||||
: Process exactly the language defined by the [standard][1] and error if any
|
: Process exactly the language defined by the [standard][1] and error if any
|
||||||
extensions are used.
|
extensions are used.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-w**, **--warn**
|
**-w**, **-\-warn**
|
||||||
|
|
||||||
: Like **-s** and **--standard**, except that warnings (and not errors) are
|
: Like **-s** and **-\-standard**, except that warnings (and not errors) are
|
||||||
printed for non-standard extensions and execution continues normally.
|
printed for non-standard extensions and execution continues normally.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -186,14 +185,14 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **BC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, bc(1) will give a fatal error and exit.
|
or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -202,8 +201,8 @@ The following are the options that bc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **BC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, bc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, bc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -258,8 +257,8 @@ Identifiers with more than one character (letter) are a
|
|||||||
|
|
||||||
**ibase** is a global variable determining how to interpret constant numbers. It
|
**ibase** is a global variable determining how to interpret constant numbers. It
|
||||||
is the "input" base, or the number base used for interpreting input numbers.
|
is the "input" base, or the number base used for interpreting input numbers.
|
||||||
**ibase** is initially **10**. If the **-s** (**--standard**) and **-w**
|
**ibase** is initially **10**. If the **-s** (**-\-standard**) and **-w**
|
||||||
(**--warn**) flags were not given on the command line, the max allowable value
|
(**-\-warn**) flags were not given on the command line, the max allowable value
|
||||||
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
for **ibase** is **36**. Otherwise, it is **16**. The min allowable value for
|
||||||
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
**ibase** is **2**. The max allowable value for **ibase** can be queried in
|
||||||
bc(1) programs with the **maxibase()** built-in function.
|
bc(1) programs with the **maxibase()** built-in function.
|
||||||
@ -449,7 +448,7 @@ The following arithmetic and logical operators can be used. They are listed in
|
|||||||
order of decreasing precedence. Operators in the same group have the same
|
order of decreasing precedence. Operators in the same group have the same
|
||||||
precedence.
|
precedence.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: Type: Prefix and Postfix
|
: Type: Prefix and Postfix
|
||||||
|
|
||||||
@ -547,7 +546,7 @@ precedence.
|
|||||||
|
|
||||||
The operators will be described in more detail below.
|
The operators will be described in more detail below.
|
||||||
|
|
||||||
**++** **--**
|
**++** **-\-**
|
||||||
|
|
||||||
: The prefix and postfix **increment** and **decrement** operators behave
|
: The prefix and postfix **increment** and **decrement** operators behave
|
||||||
exactly like they would in C. They require a named expression (see the
|
exactly like they would in C. They require a named expression (see the
|
||||||
@ -878,7 +877,7 @@ This is a **non-portable extension**.
|
|||||||
|
|
||||||
All of the functions below, including the functions in the extended math
|
All of the functions below, including the functions in the extended math
|
||||||
library (see the *Extended Library* subsection below), are available when the
|
library (see the *Extended Library* subsection below), are available when the
|
||||||
**-l** or **--mathlib** command-line flags are given, except that the extended
|
**-l** or **-\-mathlib** command-line flags are given, except that the extended
|
||||||
math library is not available when the **-s** option, the **-w** option, or
|
math library is not available when the **-s** option, the **-w** option, or
|
||||||
equivalents are given.
|
equivalents are given.
|
||||||
|
|
||||||
@ -930,8 +929,8 @@ The [standard][1] defines the following functions for the math library:
|
|||||||
|
|
||||||
## Extended Library
|
## Extended Library
|
||||||
|
|
||||||
The extended library is *not* loaded when the **-s**/**--standard** or
|
The extended library is *not* loaded when the **-s**/**-\-standard** or
|
||||||
**-w**/**--warn** options are given since they are not part of the library
|
**-w**/**-\-warn** options are given since they are not part of the library
|
||||||
defined by the [standard][1].
|
defined by the [standard][1].
|
||||||
|
|
||||||
The extended library is a **non-portable extension**.
|
The extended library is a **non-portable extension**.
|
||||||
@ -1599,17 +1598,17 @@ The other statuses will only be returned when bc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since bc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow bc(1) to be used in shell scripting with error
|
These exit statuses allow bc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Per the [standard][1], bc(1) has an interactive mode and a non-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**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, bc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "BCL" "3" "February 2021" "Gavin D. Howard" "Libraries Manual"
|
.TH "BCL" "3" "March 2021" "Gavin D. Howard" "Libraries Manual"
|
||||||
.SH NAME
|
.SH NAME
|
||||||
.PP
|
.PP
|
||||||
bcl - library of arbitrary precision decimal arithmetic
|
bcl - library of arbitrary precision decimal arithmetic
|
||||||
|
@ -426,7 +426,7 @@ All procedures in this section require a valid current context.
|
|||||||
bcl(3) will encode an error in the return value, if there was one. The error
|
bcl(3) will encode an error in the return value, if there was one. The error
|
||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
**void bcl_num_free(BclNumber** *n***)**
|
**void bcl_num_free(BclNumber** *n***)**
|
||||||
@ -487,7 +487,7 @@ subsection below.
|
|||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_NUM**
|
* **BCL_ERROR_INVALID_NUM**
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_PARSE_INVALID_STR**
|
* **BCL_ERROR_PARSE_INVALID_STR**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
@ -524,7 +524,7 @@ subsection below.
|
|||||||
bcl(3) will encode an error in the return value, if there was one. The error
|
bcl(3) will encode an error in the return value, if there was one. The error
|
||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
## Math
|
## Math
|
||||||
@ -551,7 +551,7 @@ All procedures in this section can return the following errors:
|
|||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_NUM**
|
* **BCL_ERROR_INVALID_NUM**
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
**BclNumber bcl_sub(BclNumber** *a***, BclNumber** *b***)**
|
**BclNumber bcl_sub(BclNumber** *a***, BclNumber** *b***)**
|
||||||
@ -568,7 +568,7 @@ All procedures in this section can return the following errors:
|
|||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_NUM**
|
* **BCL_ERROR_INVALID_NUM**
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
**BclNumber bcl_mul(BclNumber** *a***, BclNumber** *b***)**
|
**BclNumber bcl_mul(BclNumber** *a***, BclNumber** *b***)**
|
||||||
@ -587,7 +587,7 @@ All procedures in this section can return the following errors:
|
|||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_NUM**
|
* **BCL_ERROR_INVALID_NUM**
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
**BclNumber bcl_div(BclNumber** *a***, BclNumber** *b***)**
|
**BclNumber bcl_div(BclNumber** *a***, BclNumber** *b***)**
|
||||||
@ -606,8 +606,8 @@ All procedures in this section can return the following errors:
|
|||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_NUM**
|
* **BCL_ERROR_INVALID_NUM**
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
|
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
**BclNumber bcl_mod(BclNumber** *a***, BclNumber** *b***)**
|
**BclNumber bcl_mod(BclNumber** *a***, BclNumber** *b***)**
|
||||||
@ -626,8 +626,8 @@ All procedures in this section can return the following errors:
|
|||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_NUM**
|
* **BCL_ERROR_INVALID_NUM**
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
|
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
**BclNumber bcl_pow(BclNumber** *a***, BclNumber** *b***)**
|
**BclNumber bcl_pow(BclNumber** *a***, BclNumber** *b***)**
|
||||||
@ -649,10 +649,10 @@ All procedures in this section can return the following errors:
|
|||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_NUM**
|
* **BCL_ERROR_INVALID_NUM**
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_MATH_NON_INTEGER**
|
* **BCL_ERROR_MATH_NON_INTEGER**
|
||||||
* **BCL_ERROR_MATH_OVERFLOW**
|
* **BCL_ERROR_MATH_OVERFLOW**
|
||||||
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
|
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
**BclNumber bcl_lshift(BclNumber** *a***, BclNumber** *b***)**
|
**BclNumber bcl_lshift(BclNumber** *a***, BclNumber** *b***)**
|
||||||
@ -671,8 +671,8 @@ All procedures in this section can return the following errors:
|
|||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_NUM**
|
* **BCL_ERROR_INVALID_NUM**
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_MATH_NON_INTEGER**
|
* **BCL_ERROR_MATH_NON_INTEGER**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
**BclNumber bcl_rshift(BclNumber** *a***, BclNumber** *b***)**
|
**BclNumber bcl_rshift(BclNumber** *a***, BclNumber** *b***)**
|
||||||
@ -691,8 +691,8 @@ All procedures in this section can return the following errors:
|
|||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_NUM**
|
* **BCL_ERROR_INVALID_NUM**
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_MATH_NON_INTEGER**
|
* **BCL_ERROR_MATH_NON_INTEGER**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
**BclNumber bcl_sqrt(BclNumber** *a***)**
|
**BclNumber bcl_sqrt(BclNumber** *a***)**
|
||||||
@ -709,8 +709,8 @@ All procedures in this section can return the following errors:
|
|||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_NUM**
|
* **BCL_ERROR_INVALID_NUM**
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_MATH_NEGATIVE**
|
* **BCL_ERROR_MATH_NEGATIVE**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
**BclError bcl_divmod(BclNumber** *a***, BclNumber** *b***, BclNumber \****c***, BclNumber \****d***)**
|
**BclError bcl_divmod(BclNumber** *a***, BclNumber** *b***, BclNumber \****c***, BclNumber \****d***)**
|
||||||
@ -719,7 +719,7 @@ All procedures in this section can return the following errors:
|
|||||||
into the space pointed to by *c*, and puts the modulus in a new number which
|
into the space pointed to by *c*, and puts the modulus in a new number which
|
||||||
is put into the space pointed to by *d*.
|
is put into the space pointed to by *d*.
|
||||||
|
|
||||||
*b* cannot be **0**.
|
*b* cannot be **0**.
|
||||||
|
|
||||||
*a* and *b* are consumed; they cannot be used after the call. See the
|
*a* and *b* are consumed; they cannot be used after the call. See the
|
||||||
**Consumption and Propagation** subsection below.
|
**Consumption and Propagation** subsection below.
|
||||||
@ -731,8 +731,8 @@ All procedures in this section can return the following errors:
|
|||||||
function can return:
|
function can return:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_NUM**
|
* **BCL_ERROR_INVALID_NUM**
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
|
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
**BclNumber bcl_modexp(BclNumber** *a***, BclNumber** *b***, BclNumber** *c***)**
|
**BclNumber bcl_modexp(BclNumber** *a***, BclNumber** *b***, BclNumber** *c***)**
|
||||||
@ -751,10 +751,10 @@ All procedures in this section can return the following errors:
|
|||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_NUM**
|
* **BCL_ERROR_INVALID_NUM**
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_MATH_NEGATIVE**
|
* **BCL_ERROR_MATH_NEGATIVE**
|
||||||
* **BCL_ERROR_MATH_NON_INTEGER**
|
* **BCL_ERROR_MATH_NON_INTEGER**
|
||||||
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
|
* **BCL_ERROR_MATH_DIVIDE_BY_ZERO**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
## Miscellaneous
|
## Miscellaneous
|
||||||
@ -791,7 +791,7 @@ All procedures in this section can return the following errors:
|
|||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_NUM**
|
* **BCL_ERROR_INVALID_NUM**
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
## Pseudo-Random Number Generator
|
## Pseudo-Random Number Generator
|
||||||
@ -852,9 +852,9 @@ procedures require a valid current context.
|
|||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_NUM**
|
* **BCL_ERROR_INVALID_NUM**
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_MATH_NEGATIVE**
|
* **BCL_ERROR_MATH_NEGATIVE**
|
||||||
* **BCL_ERROR_MATH_NON_INTEGER**
|
* **BCL_ERROR_MATH_NON_INTEGER**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
**BclNumber bcl_frand(size_t** *places***)**
|
**BclNumber bcl_frand(size_t** *places***)**
|
||||||
@ -868,7 +868,7 @@ procedures require a valid current context.
|
|||||||
bcl(3) will encode an error in the return value, if there was one. The error
|
bcl(3) will encode an error in the return value, if there was one. The error
|
||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
**BclNumber bcl_ifrand(BclNumber** *a***, size_t** *places***)**
|
**BclNumber bcl_ifrand(BclNumber** *a***, size_t** *places***)**
|
||||||
@ -887,9 +887,9 @@ procedures require a valid current context.
|
|||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_NUM**
|
* **BCL_ERROR_INVALID_NUM**
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_MATH_NEGATIVE**
|
* **BCL_ERROR_MATH_NEGATIVE**
|
||||||
* **BCL_ERROR_MATH_NON_INTEGER**
|
* **BCL_ERROR_MATH_NON_INTEGER**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
**BclError bcl_rand_seedWithNum(BclNumber** *n***)**
|
**BclError bcl_rand_seedWithNum(BclNumber** *n***)**
|
||||||
@ -904,7 +904,7 @@ procedures require a valid current context.
|
|||||||
function can return:
|
function can return:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_NUM**
|
* **BCL_ERROR_INVALID_NUM**
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
|
|
||||||
Note that if **bcl_rand_seed2num(***void***)** or
|
Note that if **bcl_rand_seed2num(***void***)** or
|
||||||
**bcl_rand_seed2num_err(BclNumber)** are called right after this function,
|
**bcl_rand_seed2num_err(BclNumber)** are called right after this function,
|
||||||
@ -917,7 +917,7 @@ procedures require a valid current context.
|
|||||||
If there was no error, **BCL_ERROR_NONE** is returned. Otherwise, this
|
If there was no error, **BCL_ERROR_NONE** is returned. Otherwise, this
|
||||||
function can return:
|
function can return:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
|
|
||||||
**void bcl_rand_reseed(***void***)**
|
**void bcl_rand_reseed(***void***)**
|
||||||
|
|
||||||
@ -935,7 +935,7 @@ procedures require a valid current context.
|
|||||||
bcl(3) will encode an error in the return value, if there was one. The error
|
bcl(3) will encode an error in the return value, if there was one. The error
|
||||||
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
can be queried with **bcl_err(BclNumber)**. Possible errors include:
|
||||||
|
|
||||||
* **BCL_ERROR_INVALID_CONTEXT**
|
* **BCL_ERROR_INVALID_CONTEXT**
|
||||||
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
* **BCL_ERROR_FATAL_ALLOC_ERR**
|
||||||
|
|
||||||
**BclRandInt bcl_rand_int(***void***)**
|
**BclRandInt bcl_rand_int(***void***)**
|
||||||
|
@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
|
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
|
|||||||
pop arguments off of the stack and push the results.
|
pop arguments off of the stack and push the results.
|
||||||
|
|
||||||
If no files are given on the command-line as extra arguments (i.e., not as
|
If no files are given on the command-line as extra arguments (i.e., not as
|
||||||
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
||||||
those files are processed, and dc(1) will then exit.
|
those files are processed, and dc(1) will then exit.
|
||||||
|
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where **-e** (**--expression**) and **-f** (**--file**)
|
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
|
||||||
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
||||||
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
||||||
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
||||||
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
|
|||||||
|
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
{{ A E H N EH EN HN EHN }}
|
{{ A E H N EH EN HN EHN }}
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
@ -92,14 +92,14 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-x** **--extended-register**
|
**-x** **-\-extended-register**
|
||||||
|
|
||||||
: Enables extended register mode. See the *Extended Register Mode* subsection
|
: Enables extended register mode. See the *Extended Register Mode* subsection
|
||||||
of the **REGISTERS** section for more information.
|
of the **REGISTERS** section for more information.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -109,14 +109,14 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, dc(1) will give a fatal error and exit.
|
or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -125,8 +125,8 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -947,7 +947,7 @@ follows any command that needs a register name. The only exception is a newline
|
|||||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
||||||
amounts of registers, if extended register mode is enabled.
|
amounts of registers, if extended register mode is enabled.
|
||||||
|
|
||||||
If extended register mode is enabled (**-x** or **--extended-register**
|
If extended register mode is enabled (**-x** or **-\-extended-register**
|
||||||
command-line arguments are given), then normal single character registers are
|
command-line arguments are given), then normal single character registers are
|
||||||
used *unless* the character immediately following a command that needs a
|
used *unless* the character immediately following a command that needs a
|
||||||
register name is a space (according to **isspace()**) and not a newline
|
register name is a space (according to **isspace()**) and not a newline
|
||||||
@ -1168,17 +1168,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,18 +25,17 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH Name
|
.SH Name
|
||||||
.PP
|
.PP
|
||||||
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
|
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
|
||||||
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
|
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
|
|||||||
results.
|
results.
|
||||||
.PP
|
.PP
|
||||||
If no files are given on the command-line as extra arguments (i.e., not
|
If no files are given on the command-line as extra arguments (i.e., not
|
||||||
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
|
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
|
||||||
\f[B]stdin\f[R].
|
\f[B]stdin\f[R].
|
||||||
Otherwise, those files are processed, and dc(1) will then exit.
|
Otherwise, those files are processed, and dc(1) will then exit.
|
||||||
.PP
|
.PP
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
|
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
|
||||||
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
|
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
|
||||||
and exit.
|
and exit.
|
||||||
The reason for this is that this dc(1) allows users to set arguments in
|
The reason for this is that this dc(1) allows users to set arguments in
|
||||||
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
||||||
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -86,7 +85,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
||||||
@ -98,7 +97,7 @@ Most of those users would want to put this option in
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
|
\f[B]-x\f[R] \f[B]--extended-register\f[R]
|
||||||
Enables extended register mode.
|
Enables extended register mode.
|
||||||
See the \f[I]Extended Register Mode\f[R] subsection of the
|
See the \f[I]Extended Register Mode\f[R] subsection of the
|
||||||
\f[B]REGISTERS\f[R] section for more information.
|
\f[B]REGISTERS\f[R] section for more information.
|
||||||
@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -120,17 +119,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]DC_ENV_ARGS\f[R].
|
\f[B]DC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -141,9 +140,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -1037,7 +1036,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
|
|||||||
unlimited amounts of registers, if extended register mode is enabled.
|
unlimited amounts of registers, if extended register mode is enabled.
|
||||||
.PP
|
.PP
|
||||||
If extended register mode is enabled (\f[B]-x\f[R] or
|
If extended register mode is enabled (\f[B]-x\f[R] or
|
||||||
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
|
\f[B]--extended-register\f[R] command-line arguments are given), then
|
||||||
normal single character registers are used \f[I]unless\f[R] the
|
normal single character registers are used \f[I]unless\f[R] the
|
||||||
character immediately following a command that needs a register name is
|
character immediately following a command that needs a register name is
|
||||||
a space (according to \f[B]isspace()\f[R]) and not a newline
|
a space (according to \f[B]isspace()\f[R]) and not a newline
|
||||||
@ -1260,17 +1259,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the
|
In interactive mode, dc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
|
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
|
|||||||
pop arguments off of the stack and push the results.
|
pop arguments off of the stack and push the results.
|
||||||
|
|
||||||
If no files are given on the command-line as extra arguments (i.e., not as
|
If no files are given on the command-line as extra arguments (i.e., not as
|
||||||
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
||||||
those files are processed, and dc(1) will then exit.
|
those files are processed, and dc(1) will then exit.
|
||||||
|
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where **-e** (**--expression**) and **-f** (**--file**)
|
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
|
||||||
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
||||||
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
||||||
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
||||||
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
|
|||||||
|
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
See the **TTY MODE** section) This is mostly for those users that do not
|
See the **TTY MODE** section) This is mostly for those users that do not
|
||||||
@ -87,14 +87,14 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-x** **--extended-register**
|
**-x** **-\-extended-register**
|
||||||
|
|
||||||
: Enables extended register mode. See the *Extended Register Mode* subsection
|
: Enables extended register mode. See the *Extended Register Mode* subsection
|
||||||
of the **REGISTERS** section for more information.
|
of the **REGISTERS** section for more information.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -104,14 +104,14 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, dc(1) will give a fatal error and exit.
|
or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -120,8 +120,8 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -909,7 +909,7 @@ follows any command that needs a register name. The only exception is a newline
|
|||||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
||||||
amounts of registers, if extended register mode is enabled.
|
amounts of registers, if extended register mode is enabled.
|
||||||
|
|
||||||
If extended register mode is enabled (**-x** or **--extended-register**
|
If extended register mode is enabled (**-x** or **-\-extended-register**
|
||||||
command-line arguments are given), then normal single character registers are
|
command-line arguments are given), then normal single character registers are
|
||||||
used *unless* the character immediately following a command that needs a
|
used *unless* the character immediately following a command that needs a
|
||||||
register name is a space (according to **isspace()**) and not a newline
|
register name is a space (according to **isspace()**) and not a newline
|
||||||
@ -1118,17 +1118,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,18 +25,17 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH Name
|
.SH Name
|
||||||
.PP
|
.PP
|
||||||
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
|
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
|
||||||
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
|
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
|
|||||||
results.
|
results.
|
||||||
.PP
|
.PP
|
||||||
If no files are given on the command-line as extra arguments (i.e., not
|
If no files are given on the command-line as extra arguments (i.e., not
|
||||||
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
|
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
|
||||||
\f[B]stdin\f[R].
|
\f[B]stdin\f[R].
|
||||||
Otherwise, those files are processed, and dc(1) will then exit.
|
Otherwise, those files are processed, and dc(1) will then exit.
|
||||||
.PP
|
.PP
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
|
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
|
||||||
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
|
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
|
||||||
and exit.
|
and exit.
|
||||||
The reason for this is that this dc(1) allows users to set arguments in
|
The reason for this is that this dc(1) allows users to set arguments in
|
||||||
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
||||||
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -86,7 +85,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
||||||
@ -98,7 +97,7 @@ Most of those users would want to put this option in
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
|
\f[B]-x\f[R] \f[B]--extended-register\f[R]
|
||||||
Enables extended register mode.
|
Enables extended register mode.
|
||||||
See the \f[I]Extended Register Mode\f[R] subsection of the
|
See the \f[I]Extended Register Mode\f[R] subsection of the
|
||||||
\f[B]REGISTERS\f[R] section for more information.
|
\f[B]REGISTERS\f[R] section for more information.
|
||||||
@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -120,17 +119,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]DC_ENV_ARGS\f[R].
|
\f[B]DC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -141,9 +140,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -837,7 +836,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
|
|||||||
unlimited amounts of registers, if extended register mode is enabled.
|
unlimited amounts of registers, if extended register mode is enabled.
|
||||||
.PP
|
.PP
|
||||||
If extended register mode is enabled (\f[B]-x\f[R] or
|
If extended register mode is enabled (\f[B]-x\f[R] or
|
||||||
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
|
\f[B]--extended-register\f[R] command-line arguments are given), then
|
||||||
normal single character registers are used \f[I]unless\f[R] the
|
normal single character registers are used \f[I]unless\f[R] the
|
||||||
character immediately following a command that needs a register name is
|
character immediately following a command that needs a register name is
|
||||||
a space (according to \f[B]isspace()\f[R]) and not a newline
|
a space (according to \f[B]isspace()\f[R]) and not a newline
|
||||||
@ -1052,17 +1051,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the
|
In interactive mode, dc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
|
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
|
|||||||
pop arguments off of the stack and push the results.
|
pop arguments off of the stack and push the results.
|
||||||
|
|
||||||
If no files are given on the command-line as extra arguments (i.e., not as
|
If no files are given on the command-line as extra arguments (i.e., not as
|
||||||
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
||||||
those files are processed, and dc(1) will then exit.
|
those files are processed, and dc(1) will then exit.
|
||||||
|
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where **-e** (**--expression**) and **-f** (**--file**)
|
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
|
||||||
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
||||||
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
||||||
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
||||||
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
|
|||||||
|
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
See the **TTY MODE** section) This is mostly for those users that do not
|
See the **TTY MODE** section) This is mostly for those users that do not
|
||||||
@ -87,14 +87,14 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-x** **--extended-register**
|
**-x** **-\-extended-register**
|
||||||
|
|
||||||
: Enables extended register mode. See the *Extended Register Mode* subsection
|
: Enables extended register mode. See the *Extended Register Mode* subsection
|
||||||
of the **REGISTERS** section for more information.
|
of the **REGISTERS** section for more information.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -104,14 +104,14 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, dc(1) will give a fatal error and exit.
|
or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -120,8 +120,8 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -749,7 +749,7 @@ follows any command that needs a register name. The only exception is a newline
|
|||||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
||||||
amounts of registers, if extended register mode is enabled.
|
amounts of registers, if extended register mode is enabled.
|
||||||
|
|
||||||
If extended register mode is enabled (**-x** or **--extended-register**
|
If extended register mode is enabled (**-x** or **-\-extended-register**
|
||||||
command-line arguments are given), then normal single character registers are
|
command-line arguments are given), then normal single character registers are
|
||||||
used *unless* the character immediately following a command that needs a
|
used *unless* the character immediately following a command that needs a
|
||||||
register name is a space (according to **isspace()**) and not a newline
|
register name is a space (according to **isspace()**) and not a newline
|
||||||
@ -951,17 +951,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,18 +25,17 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH Name
|
.SH Name
|
||||||
.PP
|
.PP
|
||||||
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
|
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
|
||||||
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
|
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
|
|||||||
results.
|
results.
|
||||||
.PP
|
.PP
|
||||||
If no files are given on the command-line as extra arguments (i.e., not
|
If no files are given on the command-line as extra arguments (i.e., not
|
||||||
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
|
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
|
||||||
\f[B]stdin\f[R].
|
\f[B]stdin\f[R].
|
||||||
Otherwise, those files are processed, and dc(1) will then exit.
|
Otherwise, those files are processed, and dc(1) will then exit.
|
||||||
.PP
|
.PP
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
|
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
|
||||||
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
|
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
|
||||||
and exit.
|
and exit.
|
||||||
The reason for this is that this dc(1) allows users to set arguments in
|
The reason for this is that this dc(1) allows users to set arguments in
|
||||||
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
||||||
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -86,7 +85,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
||||||
@ -98,7 +97,7 @@ Most of those users would want to put this option in
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
|
\f[B]-x\f[R] \f[B]--extended-register\f[R]
|
||||||
Enables extended register mode.
|
Enables extended register mode.
|
||||||
See the \f[I]Extended Register Mode\f[R] subsection of the
|
See the \f[I]Extended Register Mode\f[R] subsection of the
|
||||||
\f[B]REGISTERS\f[R] section for more information.
|
\f[B]REGISTERS\f[R] section for more information.
|
||||||
@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -120,17 +119,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]DC_ENV_ARGS\f[R].
|
\f[B]DC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -141,9 +140,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -837,7 +836,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
|
|||||||
unlimited amounts of registers, if extended register mode is enabled.
|
unlimited amounts of registers, if extended register mode is enabled.
|
||||||
.PP
|
.PP
|
||||||
If extended register mode is enabled (\f[B]-x\f[R] or
|
If extended register mode is enabled (\f[B]-x\f[R] or
|
||||||
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
|
\f[B]--extended-register\f[R] command-line arguments are given), then
|
||||||
normal single character registers are used \f[I]unless\f[R] the
|
normal single character registers are used \f[I]unless\f[R] the
|
||||||
character immediately following a command that needs a register name is
|
character immediately following a command that needs a register name is
|
||||||
a space (according to \f[B]isspace()\f[R]) and not a newline
|
a space (according to \f[B]isspace()\f[R]) and not a newline
|
||||||
@ -1052,17 +1051,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the
|
In interactive mode, dc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
|
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
|
|||||||
pop arguments off of the stack and push the results.
|
pop arguments off of the stack and push the results.
|
||||||
|
|
||||||
If no files are given on the command-line as extra arguments (i.e., not as
|
If no files are given on the command-line as extra arguments (i.e., not as
|
||||||
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
||||||
those files are processed, and dc(1) will then exit.
|
those files are processed, and dc(1) will then exit.
|
||||||
|
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where **-e** (**--expression**) and **-f** (**--file**)
|
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
|
||||||
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
||||||
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
||||||
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
||||||
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
|
|||||||
|
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
See the **TTY MODE** section) This is mostly for those users that do not
|
See the **TTY MODE** section) This is mostly for those users that do not
|
||||||
@ -87,14 +87,14 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-x** **--extended-register**
|
**-x** **-\-extended-register**
|
||||||
|
|
||||||
: Enables extended register mode. See the *Extended Register Mode* subsection
|
: Enables extended register mode. See the *Extended Register Mode* subsection
|
||||||
of the **REGISTERS** section for more information.
|
of the **REGISTERS** section for more information.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -104,14 +104,14 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, dc(1) will give a fatal error and exit.
|
or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -120,8 +120,8 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -749,7 +749,7 @@ follows any command that needs a register name. The only exception is a newline
|
|||||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
||||||
amounts of registers, if extended register mode is enabled.
|
amounts of registers, if extended register mode is enabled.
|
||||||
|
|
||||||
If extended register mode is enabled (**-x** or **--extended-register**
|
If extended register mode is enabled (**-x** or **-\-extended-register**
|
||||||
command-line arguments are given), then normal single character registers are
|
command-line arguments are given), then normal single character registers are
|
||||||
used *unless* the character immediately following a command that needs a
|
used *unless* the character immediately following a command that needs a
|
||||||
register name is a space (according to **isspace()**) and not a newline
|
register name is a space (according to **isspace()**) and not a newline
|
||||||
@ -951,17 +951,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,18 +25,17 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH Name
|
.SH Name
|
||||||
.PP
|
.PP
|
||||||
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
|
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
|
||||||
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
|
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
|
|||||||
results.
|
results.
|
||||||
.PP
|
.PP
|
||||||
If no files are given on the command-line as extra arguments (i.e., not
|
If no files are given on the command-line as extra arguments (i.e., not
|
||||||
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
|
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
|
||||||
\f[B]stdin\f[R].
|
\f[B]stdin\f[R].
|
||||||
Otherwise, those files are processed, and dc(1) will then exit.
|
Otherwise, those files are processed, and dc(1) will then exit.
|
||||||
.PP
|
.PP
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
|
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
|
||||||
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
|
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
|
||||||
and exit.
|
and exit.
|
||||||
The reason for this is that this dc(1) allows users to set arguments in
|
The reason for this is that this dc(1) allows users to set arguments in
|
||||||
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
||||||
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -86,7 +85,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
||||||
@ -98,7 +97,7 @@ Most of those users would want to put this option in
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
|
\f[B]-x\f[R] \f[B]--extended-register\f[R]
|
||||||
Enables extended register mode.
|
Enables extended register mode.
|
||||||
See the \f[I]Extended Register Mode\f[R] subsection of the
|
See the \f[I]Extended Register Mode\f[R] subsection of the
|
||||||
\f[B]REGISTERS\f[R] section for more information.
|
\f[B]REGISTERS\f[R] section for more information.
|
||||||
@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -120,17 +119,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]DC_ENV_ARGS\f[R].
|
\f[B]DC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -141,9 +140,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -837,7 +836,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
|
|||||||
unlimited amounts of registers, if extended register mode is enabled.
|
unlimited amounts of registers, if extended register mode is enabled.
|
||||||
.PP
|
.PP
|
||||||
If extended register mode is enabled (\f[B]-x\f[R] or
|
If extended register mode is enabled (\f[B]-x\f[R] or
|
||||||
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
|
\f[B]--extended-register\f[R] command-line arguments are given), then
|
||||||
normal single character registers are used \f[I]unless\f[R] the
|
normal single character registers are used \f[I]unless\f[R] the
|
||||||
character immediately following a command that needs a register name is
|
character immediately following a command that needs a register name is
|
||||||
a space (according to \f[B]isspace()\f[R]) and not a newline
|
a space (according to \f[B]isspace()\f[R]) and not a newline
|
||||||
@ -1052,17 +1051,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the
|
In interactive mode, dc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
|
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
|
|||||||
pop arguments off of the stack and push the results.
|
pop arguments off of the stack and push the results.
|
||||||
|
|
||||||
If no files are given on the command-line as extra arguments (i.e., not as
|
If no files are given on the command-line as extra arguments (i.e., not as
|
||||||
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
||||||
those files are processed, and dc(1) will then exit.
|
those files are processed, and dc(1) will then exit.
|
||||||
|
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where **-e** (**--expression**) and **-f** (**--file**)
|
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
|
||||||
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
||||||
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
||||||
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
||||||
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
|
|||||||
|
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
See the **TTY MODE** section) This is mostly for those users that do not
|
See the **TTY MODE** section) This is mostly for those users that do not
|
||||||
@ -87,14 +87,14 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-x** **--extended-register**
|
**-x** **-\-extended-register**
|
||||||
|
|
||||||
: Enables extended register mode. See the *Extended Register Mode* subsection
|
: Enables extended register mode. See the *Extended Register Mode* subsection
|
||||||
of the **REGISTERS** section for more information.
|
of the **REGISTERS** section for more information.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -104,14 +104,14 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, dc(1) will give a fatal error and exit.
|
or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -120,8 +120,8 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -749,7 +749,7 @@ follows any command that needs a register name. The only exception is a newline
|
|||||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
||||||
amounts of registers, if extended register mode is enabled.
|
amounts of registers, if extended register mode is enabled.
|
||||||
|
|
||||||
If extended register mode is enabled (**-x** or **--extended-register**
|
If extended register mode is enabled (**-x** or **-\-extended-register**
|
||||||
command-line arguments are given), then normal single character registers are
|
command-line arguments are given), then normal single character registers are
|
||||||
used *unless* the character immediately following a command that needs a
|
used *unless* the character immediately following a command that needs a
|
||||||
register name is a space (according to **isspace()**) and not a newline
|
register name is a space (according to **isspace()**) and not a newline
|
||||||
@ -951,17 +951,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,18 +25,17 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH Name
|
.SH Name
|
||||||
.PP
|
.PP
|
||||||
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
|
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
|
||||||
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
|
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
|
|||||||
results.
|
results.
|
||||||
.PP
|
.PP
|
||||||
If no files are given on the command-line as extra arguments (i.e., not
|
If no files are given on the command-line as extra arguments (i.e., not
|
||||||
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
|
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
|
||||||
\f[B]stdin\f[R].
|
\f[B]stdin\f[R].
|
||||||
Otherwise, those files are processed, and dc(1) will then exit.
|
Otherwise, those files are processed, and dc(1) will then exit.
|
||||||
.PP
|
.PP
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
|
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
|
||||||
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
|
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
|
||||||
and exit.
|
and exit.
|
||||||
The reason for this is that this dc(1) allows users to set arguments in
|
The reason for this is that this dc(1) allows users to set arguments in
|
||||||
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
||||||
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -86,14 +85,14 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
This option is a no-op.
|
This option is a no-op.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
|
\f[B]-x\f[R] \f[B]--extended-register\f[R]
|
||||||
Enables extended register mode.
|
Enables extended register mode.
|
||||||
See the \f[I]Extended Register Mode\f[R] subsection of the
|
See the \f[I]Extended Register Mode\f[R] subsection of the
|
||||||
\f[B]REGISTERS\f[R] section for more information.
|
\f[B]REGISTERS\f[R] section for more information.
|
||||||
@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -115,17 +114,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]DC_ENV_ARGS\f[R].
|
\f[B]DC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -136,9 +135,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -832,7 +831,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
|
|||||||
unlimited amounts of registers, if extended register mode is enabled.
|
unlimited amounts of registers, if extended register mode is enabled.
|
||||||
.PP
|
.PP
|
||||||
If extended register mode is enabled (\f[B]-x\f[R] or
|
If extended register mode is enabled (\f[B]-x\f[R] or
|
||||||
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
|
\f[B]--extended-register\f[R] command-line arguments are given), then
|
||||||
normal single character registers are used \f[I]unless\f[R] the
|
normal single character registers are used \f[I]unless\f[R] the
|
||||||
character immediately following a command that needs a register name is
|
character immediately following a command that needs a register name is
|
||||||
a space (according to \f[B]isspace()\f[R]) and not a newline
|
a space (according to \f[B]isspace()\f[R]) and not a newline
|
||||||
@ -1047,17 +1046,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the
|
In interactive mode, dc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
|
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
|
|||||||
pop arguments off of the stack and push the results.
|
pop arguments off of the stack and push the results.
|
||||||
|
|
||||||
If no files are given on the command-line as extra arguments (i.e., not as
|
If no files are given on the command-line as extra arguments (i.e., not as
|
||||||
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
||||||
those files are processed, and dc(1) will then exit.
|
those files are processed, and dc(1) will then exit.
|
||||||
|
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where **-e** (**--expression**) and **-f** (**--file**)
|
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
|
||||||
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
||||||
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
||||||
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
||||||
@ -64,34 +64,34 @@ as the last command-line argument or define the environment variable
|
|||||||
|
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: This option is a no-op.
|
: This option is a no-op.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-x** **--extended-register**
|
**-x** **-\-extended-register**
|
||||||
|
|
||||||
: Enables extended register mode. See the *Extended Register Mode* subsection
|
: Enables extended register mode. See the *Extended Register Mode* subsection
|
||||||
of the **REGISTERS** section for more information.
|
of the **REGISTERS** section for more information.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -101,14 +101,14 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, dc(1) will give a fatal error and exit.
|
or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -117,8 +117,8 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -746,7 +746,7 @@ follows any command that needs a register name. The only exception is a newline
|
|||||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
||||||
amounts of registers, if extended register mode is enabled.
|
amounts of registers, if extended register mode is enabled.
|
||||||
|
|
||||||
If extended register mode is enabled (**-x** or **--extended-register**
|
If extended register mode is enabled (**-x** or **-\-extended-register**
|
||||||
command-line arguments are given), then normal single character registers are
|
command-line arguments are given), then normal single character registers are
|
||||||
used *unless* the character immediately following a command that needs a
|
used *unless* the character immediately following a command that needs a
|
||||||
register name is a space (according to **isspace()**) and not a newline
|
register name is a space (according to **isspace()**) and not a newline
|
||||||
@ -948,17 +948,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,18 +25,17 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH Name
|
.SH Name
|
||||||
.PP
|
.PP
|
||||||
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
|
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
|
||||||
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
|
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
|
|||||||
results.
|
results.
|
||||||
.PP
|
.PP
|
||||||
If no files are given on the command-line as extra arguments (i.e., not
|
If no files are given on the command-line as extra arguments (i.e., not
|
||||||
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
|
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
|
||||||
\f[B]stdin\f[R].
|
\f[B]stdin\f[R].
|
||||||
Otherwise, those files are processed, and dc(1) will then exit.
|
Otherwise, those files are processed, and dc(1) will then exit.
|
||||||
.PP
|
.PP
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
|
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
|
||||||
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
|
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
|
||||||
and exit.
|
and exit.
|
||||||
The reason for this is that this dc(1) allows users to set arguments in
|
The reason for this is that this dc(1) allows users to set arguments in
|
||||||
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
||||||
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -86,14 +85,14 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
This option is a no-op.
|
This option is a no-op.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
|
\f[B]-x\f[R] \f[B]--extended-register\f[R]
|
||||||
Enables extended register mode.
|
Enables extended register mode.
|
||||||
See the \f[I]Extended Register Mode\f[R] subsection of the
|
See the \f[I]Extended Register Mode\f[R] subsection of the
|
||||||
\f[B]REGISTERS\f[R] section for more information.
|
\f[B]REGISTERS\f[R] section for more information.
|
||||||
@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -115,17 +114,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]DC_ENV_ARGS\f[R].
|
\f[B]DC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -136,9 +135,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -832,7 +831,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
|
|||||||
unlimited amounts of registers, if extended register mode is enabled.
|
unlimited amounts of registers, if extended register mode is enabled.
|
||||||
.PP
|
.PP
|
||||||
If extended register mode is enabled (\f[B]-x\f[R] or
|
If extended register mode is enabled (\f[B]-x\f[R] or
|
||||||
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
|
\f[B]--extended-register\f[R] command-line arguments are given), then
|
||||||
normal single character registers are used \f[I]unless\f[R] the
|
normal single character registers are used \f[I]unless\f[R] the
|
||||||
character immediately following a command that needs a register name is
|
character immediately following a command that needs a register name is
|
||||||
a space (according to \f[B]isspace()\f[R]) and not a newline
|
a space (according to \f[B]isspace()\f[R]) and not a newline
|
||||||
@ -1047,17 +1046,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the
|
In interactive mode, dc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
|
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
|
|||||||
pop arguments off of the stack and push the results.
|
pop arguments off of the stack and push the results.
|
||||||
|
|
||||||
If no files are given on the command-line as extra arguments (i.e., not as
|
If no files are given on the command-line as extra arguments (i.e., not as
|
||||||
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
||||||
those files are processed, and dc(1) will then exit.
|
those files are processed, and dc(1) will then exit.
|
||||||
|
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where **-e** (**--expression**) and **-f** (**--file**)
|
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
|
||||||
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
||||||
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
||||||
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
||||||
@ -64,34 +64,34 @@ as the last command-line argument or define the environment variable
|
|||||||
|
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: This option is a no-op.
|
: This option is a no-op.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-x** **--extended-register**
|
**-x** **-\-extended-register**
|
||||||
|
|
||||||
: Enables extended register mode. See the *Extended Register Mode* subsection
|
: Enables extended register mode. See the *Extended Register Mode* subsection
|
||||||
of the **REGISTERS** section for more information.
|
of the **REGISTERS** section for more information.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -101,14 +101,14 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, dc(1) will give a fatal error and exit.
|
or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -117,8 +117,8 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -746,7 +746,7 @@ follows any command that needs a register name. The only exception is a newline
|
|||||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
||||||
amounts of registers, if extended register mode is enabled.
|
amounts of registers, if extended register mode is enabled.
|
||||||
|
|
||||||
If extended register mode is enabled (**-x** or **--extended-register**
|
If extended register mode is enabled (**-x** or **-\-extended-register**
|
||||||
command-line arguments are given), then normal single character registers are
|
command-line arguments are given), then normal single character registers are
|
||||||
used *unless* the character immediately following a command that needs a
|
used *unless* the character immediately following a command that needs a
|
||||||
register name is a space (according to **isspace()**) and not a newline
|
register name is a space (according to **isspace()**) and not a newline
|
||||||
@ -948,17 +948,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,18 +25,17 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH Name
|
.SH Name
|
||||||
.PP
|
.PP
|
||||||
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
|
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
|
||||||
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
|
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
|
|||||||
results.
|
results.
|
||||||
.PP
|
.PP
|
||||||
If no files are given on the command-line as extra arguments (i.e., not
|
If no files are given on the command-line as extra arguments (i.e., not
|
||||||
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
|
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
|
||||||
\f[B]stdin\f[R].
|
\f[B]stdin\f[R].
|
||||||
Otherwise, those files are processed, and dc(1) will then exit.
|
Otherwise, those files are processed, and dc(1) will then exit.
|
||||||
.PP
|
.PP
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
|
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
|
||||||
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
|
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
|
||||||
and exit.
|
and exit.
|
||||||
The reason for this is that this dc(1) allows users to set arguments in
|
The reason for this is that this dc(1) allows users to set arguments in
|
||||||
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
||||||
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -86,7 +85,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
||||||
@ -98,7 +97,7 @@ Most of those users would want to put this option in
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
|
\f[B]-x\f[R] \f[B]--extended-register\f[R]
|
||||||
Enables extended register mode.
|
Enables extended register mode.
|
||||||
See the \f[I]Extended Register Mode\f[R] subsection of the
|
See the \f[I]Extended Register Mode\f[R] subsection of the
|
||||||
\f[B]REGISTERS\f[R] section for more information.
|
\f[B]REGISTERS\f[R] section for more information.
|
||||||
@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -120,17 +119,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]DC_ENV_ARGS\f[R].
|
\f[B]DC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -141,9 +140,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -837,7 +836,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
|
|||||||
unlimited amounts of registers, if extended register mode is enabled.
|
unlimited amounts of registers, if extended register mode is enabled.
|
||||||
.PP
|
.PP
|
||||||
If extended register mode is enabled (\f[B]-x\f[R] or
|
If extended register mode is enabled (\f[B]-x\f[R] or
|
||||||
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
|
\f[B]--extended-register\f[R] command-line arguments are given), then
|
||||||
normal single character registers are used \f[I]unless\f[R] the
|
normal single character registers are used \f[I]unless\f[R] the
|
||||||
character immediately following a command that needs a register name is
|
character immediately following a command that needs a register name is
|
||||||
a space (according to \f[B]isspace()\f[R]) and not a newline
|
a space (according to \f[B]isspace()\f[R]) and not a newline
|
||||||
@ -1052,17 +1051,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the
|
In interactive mode, dc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
|
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
|
|||||||
pop arguments off of the stack and push the results.
|
pop arguments off of the stack and push the results.
|
||||||
|
|
||||||
If no files are given on the command-line as extra arguments (i.e., not as
|
If no files are given on the command-line as extra arguments (i.e., not as
|
||||||
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
||||||
those files are processed, and dc(1) will then exit.
|
those files are processed, and dc(1) will then exit.
|
||||||
|
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where **-e** (**--expression**) and **-f** (**--file**)
|
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
|
||||||
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
||||||
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
||||||
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
||||||
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
|
|||||||
|
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
See the **TTY MODE** section) This is mostly for those users that do not
|
See the **TTY MODE** section) This is mostly for those users that do not
|
||||||
@ -87,14 +87,14 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-x** **--extended-register**
|
**-x** **-\-extended-register**
|
||||||
|
|
||||||
: Enables extended register mode. See the *Extended Register Mode* subsection
|
: Enables extended register mode. See the *Extended Register Mode* subsection
|
||||||
of the **REGISTERS** section for more information.
|
of the **REGISTERS** section for more information.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -104,14 +104,14 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, dc(1) will give a fatal error and exit.
|
or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -120,8 +120,8 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -749,7 +749,7 @@ follows any command that needs a register name. The only exception is a newline
|
|||||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
||||||
amounts of registers, if extended register mode is enabled.
|
amounts of registers, if extended register mode is enabled.
|
||||||
|
|
||||||
If extended register mode is enabled (**-x** or **--extended-register**
|
If extended register mode is enabled (**-x** or **-\-extended-register**
|
||||||
command-line arguments are given), then normal single character registers are
|
command-line arguments are given), then normal single character registers are
|
||||||
used *unless* the character immediately following a command that needs a
|
used *unless* the character immediately following a command that needs a
|
||||||
register name is a space (according to **isspace()**) and not a newline
|
register name is a space (according to **isspace()**) and not a newline
|
||||||
@ -951,17 +951,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,18 +25,17 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH Name
|
.SH Name
|
||||||
.PP
|
.PP
|
||||||
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
|
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
|
||||||
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
|
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
|
|||||||
results.
|
results.
|
||||||
.PP
|
.PP
|
||||||
If no files are given on the command-line as extra arguments (i.e., not
|
If no files are given on the command-line as extra arguments (i.e., not
|
||||||
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
|
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
|
||||||
\f[B]stdin\f[R].
|
\f[B]stdin\f[R].
|
||||||
Otherwise, those files are processed, and dc(1) will then exit.
|
Otherwise, those files are processed, and dc(1) will then exit.
|
||||||
.PP
|
.PP
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
|
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
|
||||||
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
|
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
|
||||||
and exit.
|
and exit.
|
||||||
The reason for this is that this dc(1) allows users to set arguments in
|
The reason for this is that this dc(1) allows users to set arguments in
|
||||||
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
||||||
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -86,14 +85,14 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
This option is a no-op.
|
This option is a no-op.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
|
\f[B]-x\f[R] \f[B]--extended-register\f[R]
|
||||||
Enables extended register mode.
|
Enables extended register mode.
|
||||||
See the \f[I]Extended Register Mode\f[R] subsection of the
|
See the \f[I]Extended Register Mode\f[R] subsection of the
|
||||||
\f[B]REGISTERS\f[R] section for more information.
|
\f[B]REGISTERS\f[R] section for more information.
|
||||||
@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -115,17 +114,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]DC_ENV_ARGS\f[R].
|
\f[B]DC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -136,9 +135,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -832,7 +831,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
|
|||||||
unlimited amounts of registers, if extended register mode is enabled.
|
unlimited amounts of registers, if extended register mode is enabled.
|
||||||
.PP
|
.PP
|
||||||
If extended register mode is enabled (\f[B]-x\f[R] or
|
If extended register mode is enabled (\f[B]-x\f[R] or
|
||||||
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
|
\f[B]--extended-register\f[R] command-line arguments are given), then
|
||||||
normal single character registers are used \f[I]unless\f[R] the
|
normal single character registers are used \f[I]unless\f[R] the
|
||||||
character immediately following a command that needs a register name is
|
character immediately following a command that needs a register name is
|
||||||
a space (according to \f[B]isspace()\f[R]) and not a newline
|
a space (according to \f[B]isspace()\f[R]) and not a newline
|
||||||
@ -1047,17 +1046,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the
|
In interactive mode, dc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
|
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
|
|||||||
pop arguments off of the stack and push the results.
|
pop arguments off of the stack and push the results.
|
||||||
|
|
||||||
If no files are given on the command-line as extra arguments (i.e., not as
|
If no files are given on the command-line as extra arguments (i.e., not as
|
||||||
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
||||||
those files are processed, and dc(1) will then exit.
|
those files are processed, and dc(1) will then exit.
|
||||||
|
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where **-e** (**--expression**) and **-f** (**--file**)
|
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
|
||||||
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
||||||
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
||||||
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
||||||
@ -64,34 +64,34 @@ as the last command-line argument or define the environment variable
|
|||||||
|
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: This option is a no-op.
|
: This option is a no-op.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-x** **--extended-register**
|
**-x** **-\-extended-register**
|
||||||
|
|
||||||
: Enables extended register mode. See the *Extended Register Mode* subsection
|
: Enables extended register mode. See the *Extended Register Mode* subsection
|
||||||
of the **REGISTERS** section for more information.
|
of the **REGISTERS** section for more information.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -101,14 +101,14 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, dc(1) will give a fatal error and exit.
|
or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -117,8 +117,8 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -746,7 +746,7 @@ follows any command that needs a register name. The only exception is a newline
|
|||||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
||||||
amounts of registers, if extended register mode is enabled.
|
amounts of registers, if extended register mode is enabled.
|
||||||
|
|
||||||
If extended register mode is enabled (**-x** or **--extended-register**
|
If extended register mode is enabled (**-x** or **-\-extended-register**
|
||||||
command-line arguments are given), then normal single character registers are
|
command-line arguments are given), then normal single character registers are
|
||||||
used *unless* the character immediately following a command that needs a
|
used *unless* the character immediately following a command that needs a
|
||||||
register name is a space (according to **isspace()**) and not a newline
|
register name is a space (according to **isspace()**) and not a newline
|
||||||
@ -948,17 +948,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,18 +25,17 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH Name
|
.SH Name
|
||||||
.PP
|
.PP
|
||||||
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
|
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
|
||||||
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
|
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
|
|||||||
results.
|
results.
|
||||||
.PP
|
.PP
|
||||||
If no files are given on the command-line as extra arguments (i.e., not
|
If no files are given on the command-line as extra arguments (i.e., not
|
||||||
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
|
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
|
||||||
\f[B]stdin\f[R].
|
\f[B]stdin\f[R].
|
||||||
Otherwise, those files are processed, and dc(1) will then exit.
|
Otherwise, those files are processed, and dc(1) will then exit.
|
||||||
.PP
|
.PP
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
|
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
|
||||||
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
|
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
|
||||||
and exit.
|
and exit.
|
||||||
The reason for this is that this dc(1) allows users to set arguments in
|
The reason for this is that this dc(1) allows users to set arguments in
|
||||||
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
||||||
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -86,14 +85,14 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
This option is a no-op.
|
This option is a no-op.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
|
\f[B]-x\f[R] \f[B]--extended-register\f[R]
|
||||||
Enables extended register mode.
|
Enables extended register mode.
|
||||||
See the \f[I]Extended Register Mode\f[R] subsection of the
|
See the \f[I]Extended Register Mode\f[R] subsection of the
|
||||||
\f[B]REGISTERS\f[R] section for more information.
|
\f[B]REGISTERS\f[R] section for more information.
|
||||||
@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -115,17 +114,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]DC_ENV_ARGS\f[R].
|
\f[B]DC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -136,9 +135,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -832,7 +831,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
|
|||||||
unlimited amounts of registers, if extended register mode is enabled.
|
unlimited amounts of registers, if extended register mode is enabled.
|
||||||
.PP
|
.PP
|
||||||
If extended register mode is enabled (\f[B]-x\f[R] or
|
If extended register mode is enabled (\f[B]-x\f[R] or
|
||||||
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
|
\f[B]--extended-register\f[R] command-line arguments are given), then
|
||||||
normal single character registers are used \f[I]unless\f[R] the
|
normal single character registers are used \f[I]unless\f[R] the
|
||||||
character immediately following a command that needs a register name is
|
character immediately following a command that needs a register name is
|
||||||
a space (according to \f[B]isspace()\f[R]) and not a newline
|
a space (according to \f[B]isspace()\f[R]) and not a newline
|
||||||
@ -1047,17 +1046,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the
|
In interactive mode, dc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
|
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
|
|||||||
pop arguments off of the stack and push the results.
|
pop arguments off of the stack and push the results.
|
||||||
|
|
||||||
If no files are given on the command-line as extra arguments (i.e., not as
|
If no files are given on the command-line as extra arguments (i.e., not as
|
||||||
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
||||||
those files are processed, and dc(1) will then exit.
|
those files are processed, and dc(1) will then exit.
|
||||||
|
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where **-e** (**--expression**) and **-f** (**--file**)
|
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
|
||||||
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
||||||
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
||||||
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
||||||
@ -64,34 +64,34 @@ as the last command-line argument or define the environment variable
|
|||||||
|
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: This option is a no-op.
|
: This option is a no-op.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-x** **--extended-register**
|
**-x** **-\-extended-register**
|
||||||
|
|
||||||
: Enables extended register mode. See the *Extended Register Mode* subsection
|
: Enables extended register mode. See the *Extended Register Mode* subsection
|
||||||
of the **REGISTERS** section for more information.
|
of the **REGISTERS** section for more information.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -101,14 +101,14 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, dc(1) will give a fatal error and exit.
|
or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -117,8 +117,8 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -746,7 +746,7 @@ follows any command that needs a register name. The only exception is a newline
|
|||||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
||||||
amounts of registers, if extended register mode is enabled.
|
amounts of registers, if extended register mode is enabled.
|
||||||
|
|
||||||
If extended register mode is enabled (**-x** or **--extended-register**
|
If extended register mode is enabled (**-x** or **-\-extended-register**
|
||||||
command-line arguments are given), then normal single character registers are
|
command-line arguments are given), then normal single character registers are
|
||||||
used *unless* the character immediately following a command that needs a
|
used *unless* the character immediately following a command that needs a
|
||||||
register name is a space (according to **isspace()**) and not a newline
|
register name is a space (according to **isspace()**) and not a newline
|
||||||
@ -948,17 +948,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,18 +25,17 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH Name
|
.SH Name
|
||||||
.PP
|
.PP
|
||||||
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
|
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
|
||||||
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
|
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
|
|||||||
results.
|
results.
|
||||||
.PP
|
.PP
|
||||||
If no files are given on the command-line as extra arguments (i.e., not
|
If no files are given on the command-line as extra arguments (i.e., not
|
||||||
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
|
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
|
||||||
\f[B]stdin\f[R].
|
\f[B]stdin\f[R].
|
||||||
Otherwise, those files are processed, and dc(1) will then exit.
|
Otherwise, those files are processed, and dc(1) will then exit.
|
||||||
.PP
|
.PP
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
|
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
|
||||||
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
|
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
|
||||||
and exit.
|
and exit.
|
||||||
The reason for this is that this dc(1) allows users to set arguments in
|
The reason for this is that this dc(1) allows users to set arguments in
|
||||||
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
||||||
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -86,7 +85,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
||||||
@ -98,7 +97,7 @@ Most of those users would want to put this option in
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
|
\f[B]-x\f[R] \f[B]--extended-register\f[R]
|
||||||
Enables extended register mode.
|
Enables extended register mode.
|
||||||
See the \f[I]Extended Register Mode\f[R] subsection of the
|
See the \f[I]Extended Register Mode\f[R] subsection of the
|
||||||
\f[B]REGISTERS\f[R] section for more information.
|
\f[B]REGISTERS\f[R] section for more information.
|
||||||
@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -120,17 +119,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]DC_ENV_ARGS\f[R].
|
\f[B]DC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -141,9 +140,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -1037,7 +1036,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
|
|||||||
unlimited amounts of registers, if extended register mode is enabled.
|
unlimited amounts of registers, if extended register mode is enabled.
|
||||||
.PP
|
.PP
|
||||||
If extended register mode is enabled (\f[B]-x\f[R] or
|
If extended register mode is enabled (\f[B]-x\f[R] or
|
||||||
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
|
\f[B]--extended-register\f[R] command-line arguments are given), then
|
||||||
normal single character registers are used \f[I]unless\f[R] the
|
normal single character registers are used \f[I]unless\f[R] the
|
||||||
character immediately following a command that needs a register name is
|
character immediately following a command that needs a register name is
|
||||||
a space (according to \f[B]isspace()\f[R]) and not a newline
|
a space (according to \f[B]isspace()\f[R]) and not a newline
|
||||||
@ -1260,17 +1259,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the
|
In interactive mode, dc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
|
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
|
|||||||
pop arguments off of the stack and push the results.
|
pop arguments off of the stack and push the results.
|
||||||
|
|
||||||
If no files are given on the command-line as extra arguments (i.e., not as
|
If no files are given on the command-line as extra arguments (i.e., not as
|
||||||
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
||||||
those files are processed, and dc(1) will then exit.
|
those files are processed, and dc(1) will then exit.
|
||||||
|
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where **-e** (**--expression**) and **-f** (**--file**)
|
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
|
||||||
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
||||||
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
||||||
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
||||||
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
|
|||||||
|
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
See the **TTY MODE** section) This is mostly for those users that do not
|
See the **TTY MODE** section) This is mostly for those users that do not
|
||||||
@ -87,14 +87,14 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-x** **--extended-register**
|
**-x** **-\-extended-register**
|
||||||
|
|
||||||
: Enables extended register mode. See the *Extended Register Mode* subsection
|
: Enables extended register mode. See the *Extended Register Mode* subsection
|
||||||
of the **REGISTERS** section for more information.
|
of the **REGISTERS** section for more information.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -104,14 +104,14 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, dc(1) will give a fatal error and exit.
|
or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -120,8 +120,8 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -909,7 +909,7 @@ follows any command that needs a register name. The only exception is a newline
|
|||||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
||||||
amounts of registers, if extended register mode is enabled.
|
amounts of registers, if extended register mode is enabled.
|
||||||
|
|
||||||
If extended register mode is enabled (**-x** or **--extended-register**
|
If extended register mode is enabled (**-x** or **-\-extended-register**
|
||||||
command-line arguments are given), then normal single character registers are
|
command-line arguments are given), then normal single character registers are
|
||||||
used *unless* the character immediately following a command that needs a
|
used *unless* the character immediately following a command that needs a
|
||||||
register name is a space (according to **isspace()**) and not a newline
|
register name is a space (according to **isspace()**) and not a newline
|
||||||
@ -1118,17 +1118,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,18 +25,17 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH Name
|
.SH Name
|
||||||
.PP
|
.PP
|
||||||
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
|
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
|
||||||
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
|
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
|
|||||||
results.
|
results.
|
||||||
.PP
|
.PP
|
||||||
If no files are given on the command-line as extra arguments (i.e., not
|
If no files are given on the command-line as extra arguments (i.e., not
|
||||||
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
|
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
|
||||||
\f[B]stdin\f[R].
|
\f[B]stdin\f[R].
|
||||||
Otherwise, those files are processed, and dc(1) will then exit.
|
Otherwise, those files are processed, and dc(1) will then exit.
|
||||||
.PP
|
.PP
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
|
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
|
||||||
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
|
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
|
||||||
and exit.
|
and exit.
|
||||||
The reason for this is that this dc(1) allows users to set arguments in
|
The reason for this is that this dc(1) allows users to set arguments in
|
||||||
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
||||||
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -86,7 +85,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
||||||
@ -98,7 +97,7 @@ Most of those users would want to put this option in
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
|
\f[B]-x\f[R] \f[B]--extended-register\f[R]
|
||||||
Enables extended register mode.
|
Enables extended register mode.
|
||||||
See the \f[I]Extended Register Mode\f[R] subsection of the
|
See the \f[I]Extended Register Mode\f[R] subsection of the
|
||||||
\f[B]REGISTERS\f[R] section for more information.
|
\f[B]REGISTERS\f[R] section for more information.
|
||||||
@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -120,17 +119,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]DC_ENV_ARGS\f[R].
|
\f[B]DC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -141,9 +140,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -1037,7 +1036,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
|
|||||||
unlimited amounts of registers, if extended register mode is enabled.
|
unlimited amounts of registers, if extended register mode is enabled.
|
||||||
.PP
|
.PP
|
||||||
If extended register mode is enabled (\f[B]-x\f[R] or
|
If extended register mode is enabled (\f[B]-x\f[R] or
|
||||||
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
|
\f[B]--extended-register\f[R] command-line arguments are given), then
|
||||||
normal single character registers are used \f[I]unless\f[R] the
|
normal single character registers are used \f[I]unless\f[R] the
|
||||||
character immediately following a command that needs a register name is
|
character immediately following a command that needs a register name is
|
||||||
a space (according to \f[B]isspace()\f[R]) and not a newline
|
a space (according to \f[B]isspace()\f[R]) and not a newline
|
||||||
@ -1260,17 +1259,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the
|
In interactive mode, dc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
|
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
|
|||||||
pop arguments off of the stack and push the results.
|
pop arguments off of the stack and push the results.
|
||||||
|
|
||||||
If no files are given on the command-line as extra arguments (i.e., not as
|
If no files are given on the command-line as extra arguments (i.e., not as
|
||||||
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
||||||
those files are processed, and dc(1) will then exit.
|
those files are processed, and dc(1) will then exit.
|
||||||
|
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where **-e** (**--expression**) and **-f** (**--file**)
|
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
|
||||||
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
||||||
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
||||||
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
||||||
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
|
|||||||
|
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
See the **TTY MODE** section) This is mostly for those users that do not
|
See the **TTY MODE** section) This is mostly for those users that do not
|
||||||
@ -87,14 +87,14 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-x** **--extended-register**
|
**-x** **-\-extended-register**
|
||||||
|
|
||||||
: Enables extended register mode. See the *Extended Register Mode* subsection
|
: Enables extended register mode. See the *Extended Register Mode* subsection
|
||||||
of the **REGISTERS** section for more information.
|
of the **REGISTERS** section for more information.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -104,14 +104,14 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, dc(1) will give a fatal error and exit.
|
or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -120,8 +120,8 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -909,7 +909,7 @@ follows any command that needs a register name. The only exception is a newline
|
|||||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
||||||
amounts of registers, if extended register mode is enabled.
|
amounts of registers, if extended register mode is enabled.
|
||||||
|
|
||||||
If extended register mode is enabled (**-x** or **--extended-register**
|
If extended register mode is enabled (**-x** or **-\-extended-register**
|
||||||
command-line arguments are given), then normal single character registers are
|
command-line arguments are given), then normal single character registers are
|
||||||
used *unless* the character immediately following a command that needs a
|
used *unless* the character immediately following a command that needs a
|
||||||
register name is a space (according to **isspace()**) and not a newline
|
register name is a space (according to **isspace()**) and not a newline
|
||||||
@ -1118,17 +1118,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,18 +25,17 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH Name
|
.SH Name
|
||||||
.PP
|
.PP
|
||||||
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
|
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
|
||||||
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
|
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
|
|||||||
results.
|
results.
|
||||||
.PP
|
.PP
|
||||||
If no files are given on the command-line as extra arguments (i.e., not
|
If no files are given on the command-line as extra arguments (i.e., not
|
||||||
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
|
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
|
||||||
\f[B]stdin\f[R].
|
\f[B]stdin\f[R].
|
||||||
Otherwise, those files are processed, and dc(1) will then exit.
|
Otherwise, those files are processed, and dc(1) will then exit.
|
||||||
.PP
|
.PP
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
|
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
|
||||||
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
|
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
|
||||||
and exit.
|
and exit.
|
||||||
The reason for this is that this dc(1) allows users to set arguments in
|
The reason for this is that this dc(1) allows users to set arguments in
|
||||||
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
||||||
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -86,14 +85,14 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
This option is a no-op.
|
This option is a no-op.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
|
\f[B]-x\f[R] \f[B]--extended-register\f[R]
|
||||||
Enables extended register mode.
|
Enables extended register mode.
|
||||||
See the \f[I]Extended Register Mode\f[R] subsection of the
|
See the \f[I]Extended Register Mode\f[R] subsection of the
|
||||||
\f[B]REGISTERS\f[R] section for more information.
|
\f[B]REGISTERS\f[R] section for more information.
|
||||||
@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -115,17 +114,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]DC_ENV_ARGS\f[R].
|
\f[B]DC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -136,9 +135,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -1032,7 +1031,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
|
|||||||
unlimited amounts of registers, if extended register mode is enabled.
|
unlimited amounts of registers, if extended register mode is enabled.
|
||||||
.PP
|
.PP
|
||||||
If extended register mode is enabled (\f[B]-x\f[R] or
|
If extended register mode is enabled (\f[B]-x\f[R] or
|
||||||
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
|
\f[B]--extended-register\f[R] command-line arguments are given), then
|
||||||
normal single character registers are used \f[I]unless\f[R] the
|
normal single character registers are used \f[I]unless\f[R] the
|
||||||
character immediately following a command that needs a register name is
|
character immediately following a command that needs a register name is
|
||||||
a space (according to \f[B]isspace()\f[R]) and not a newline
|
a space (according to \f[B]isspace()\f[R]) and not a newline
|
||||||
@ -1255,17 +1254,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the
|
In interactive mode, dc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
|
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
|
|||||||
pop arguments off of the stack and push the results.
|
pop arguments off of the stack and push the results.
|
||||||
|
|
||||||
If no files are given on the command-line as extra arguments (i.e., not as
|
If no files are given on the command-line as extra arguments (i.e., not as
|
||||||
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
||||||
those files are processed, and dc(1) will then exit.
|
those files are processed, and dc(1) will then exit.
|
||||||
|
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where **-e** (**--expression**) and **-f** (**--file**)
|
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
|
||||||
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
||||||
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
||||||
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
||||||
@ -64,34 +64,34 @@ as the last command-line argument or define the environment variable
|
|||||||
|
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: This option is a no-op.
|
: This option is a no-op.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-x** **--extended-register**
|
**-x** **-\-extended-register**
|
||||||
|
|
||||||
: Enables extended register mode. See the *Extended Register Mode* subsection
|
: Enables extended register mode. See the *Extended Register Mode* subsection
|
||||||
of the **REGISTERS** section for more information.
|
of the **REGISTERS** section for more information.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -101,14 +101,14 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, dc(1) will give a fatal error and exit.
|
or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -117,8 +117,8 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -906,7 +906,7 @@ follows any command that needs a register name. The only exception is a newline
|
|||||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
||||||
amounts of registers, if extended register mode is enabled.
|
amounts of registers, if extended register mode is enabled.
|
||||||
|
|
||||||
If extended register mode is enabled (**-x** or **--extended-register**
|
If extended register mode is enabled (**-x** or **-\-extended-register**
|
||||||
command-line arguments are given), then normal single character registers are
|
command-line arguments are given), then normal single character registers are
|
||||||
used *unless* the character immediately following a command that needs a
|
used *unless* the character immediately following a command that needs a
|
||||||
register name is a space (according to **isspace()**) and not a newline
|
register name is a space (according to **isspace()**) and not a newline
|
||||||
@ -1115,17 +1115,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,18 +25,17 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH Name
|
.SH Name
|
||||||
.PP
|
.PP
|
||||||
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
|
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
|
||||||
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
|
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
|
|||||||
results.
|
results.
|
||||||
.PP
|
.PP
|
||||||
If no files are given on the command-line as extra arguments (i.e., not
|
If no files are given on the command-line as extra arguments (i.e., not
|
||||||
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
|
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
|
||||||
\f[B]stdin\f[R].
|
\f[B]stdin\f[R].
|
||||||
Otherwise, those files are processed, and dc(1) will then exit.
|
Otherwise, those files are processed, and dc(1) will then exit.
|
||||||
.PP
|
.PP
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
|
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
|
||||||
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
|
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
|
||||||
and exit.
|
and exit.
|
||||||
The reason for this is that this dc(1) allows users to set arguments in
|
The reason for this is that this dc(1) allows users to set arguments in
|
||||||
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
||||||
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -86,14 +85,14 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
This option is a no-op.
|
This option is a no-op.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
|
\f[B]-x\f[R] \f[B]--extended-register\f[R]
|
||||||
Enables extended register mode.
|
Enables extended register mode.
|
||||||
See the \f[I]Extended Register Mode\f[R] subsection of the
|
See the \f[I]Extended Register Mode\f[R] subsection of the
|
||||||
\f[B]REGISTERS\f[R] section for more information.
|
\f[B]REGISTERS\f[R] section for more information.
|
||||||
@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -115,17 +114,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]DC_ENV_ARGS\f[R].
|
\f[B]DC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -136,9 +135,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -1032,7 +1031,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
|
|||||||
unlimited amounts of registers, if extended register mode is enabled.
|
unlimited amounts of registers, if extended register mode is enabled.
|
||||||
.PP
|
.PP
|
||||||
If extended register mode is enabled (\f[B]-x\f[R] or
|
If extended register mode is enabled (\f[B]-x\f[R] or
|
||||||
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
|
\f[B]--extended-register\f[R] command-line arguments are given), then
|
||||||
normal single character registers are used \f[I]unless\f[R] the
|
normal single character registers are used \f[I]unless\f[R] the
|
||||||
character immediately following a command that needs a register name is
|
character immediately following a command that needs a register name is
|
||||||
a space (according to \f[B]isspace()\f[R]) and not a newline
|
a space (according to \f[B]isspace()\f[R]) and not a newline
|
||||||
@ -1255,17 +1254,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the
|
In interactive mode, dc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
|
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
|
|||||||
pop arguments off of the stack and push the results.
|
pop arguments off of the stack and push the results.
|
||||||
|
|
||||||
If no files are given on the command-line as extra arguments (i.e., not as
|
If no files are given on the command-line as extra arguments (i.e., not as
|
||||||
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
||||||
those files are processed, and dc(1) will then exit.
|
those files are processed, and dc(1) will then exit.
|
||||||
|
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where **-e** (**--expression**) and **-f** (**--file**)
|
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
|
||||||
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
||||||
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
||||||
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
||||||
@ -64,34 +64,34 @@ as the last command-line argument or define the environment variable
|
|||||||
|
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: This option is a no-op.
|
: This option is a no-op.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-x** **--extended-register**
|
**-x** **-\-extended-register**
|
||||||
|
|
||||||
: Enables extended register mode. See the *Extended Register Mode* subsection
|
: Enables extended register mode. See the *Extended Register Mode* subsection
|
||||||
of the **REGISTERS** section for more information.
|
of the **REGISTERS** section for more information.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -101,14 +101,14 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, dc(1) will give a fatal error and exit.
|
or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -117,8 +117,8 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -906,7 +906,7 @@ follows any command that needs a register name. The only exception is a newline
|
|||||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
||||||
amounts of registers, if extended register mode is enabled.
|
amounts of registers, if extended register mode is enabled.
|
||||||
|
|
||||||
If extended register mode is enabled (**-x** or **--extended-register**
|
If extended register mode is enabled (**-x** or **-\-extended-register**
|
||||||
command-line arguments are given), then normal single character registers are
|
command-line arguments are given), then normal single character registers are
|
||||||
used *unless* the character immediately following a command that needs a
|
used *unless* the character immediately following a command that needs a
|
||||||
register name is a space (according to **isspace()**) and not a newline
|
register name is a space (according to **isspace()**) and not a newline
|
||||||
@ -1115,17 +1115,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,18 +25,17 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH Name
|
.SH Name
|
||||||
.PP
|
.PP
|
||||||
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
|
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
|
||||||
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
|
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
|
|||||||
results.
|
results.
|
||||||
.PP
|
.PP
|
||||||
If no files are given on the command-line as extra arguments (i.e., not
|
If no files are given on the command-line as extra arguments (i.e., not
|
||||||
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
|
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
|
||||||
\f[B]stdin\f[R].
|
\f[B]stdin\f[R].
|
||||||
Otherwise, those files are processed, and dc(1) will then exit.
|
Otherwise, those files are processed, and dc(1) will then exit.
|
||||||
.PP
|
.PP
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
|
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
|
||||||
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
|
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
|
||||||
and exit.
|
and exit.
|
||||||
The reason for this is that this dc(1) allows users to set arguments in
|
The reason for this is that this dc(1) allows users to set arguments in
|
||||||
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
||||||
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -86,7 +85,7 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
Disables the prompt in TTY mode.
|
Disables the prompt in TTY mode.
|
||||||
(The prompt is only enabled in TTY mode.
|
(The prompt is only enabled in TTY mode.
|
||||||
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
See the \f[B]TTY MODE\f[R] section) This is mostly for those users that
|
||||||
@ -98,7 +97,7 @@ Most of those users would want to put this option in
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
|
\f[B]-x\f[R] \f[B]--extended-register\f[R]
|
||||||
Enables extended register mode.
|
Enables extended register mode.
|
||||||
See the \f[I]Extended Register Mode\f[R] subsection of the
|
See the \f[I]Extended Register Mode\f[R] subsection of the
|
||||||
\f[B]REGISTERS\f[R] section for more information.
|
\f[B]REGISTERS\f[R] section for more information.
|
||||||
@ -107,7 +106,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -120,17 +119,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]DC_ENV_ARGS\f[R].
|
\f[B]DC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -141,9 +140,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -1037,7 +1036,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
|
|||||||
unlimited amounts of registers, if extended register mode is enabled.
|
unlimited amounts of registers, if extended register mode is enabled.
|
||||||
.PP
|
.PP
|
||||||
If extended register mode is enabled (\f[B]-x\f[R] or
|
If extended register mode is enabled (\f[B]-x\f[R] or
|
||||||
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
|
\f[B]--extended-register\f[R] command-line arguments are given), then
|
||||||
normal single character registers are used \f[I]unless\f[R] the
|
normal single character registers are used \f[I]unless\f[R] the
|
||||||
character immediately following a command that needs a register name is
|
character immediately following a command that needs a register name is
|
||||||
a space (according to \f[B]isspace()\f[R]) and not a newline
|
a space (according to \f[B]isspace()\f[R]) and not a newline
|
||||||
@ -1260,17 +1259,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the
|
In interactive mode, dc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
|
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
|
|||||||
pop arguments off of the stack and push the results.
|
pop arguments off of the stack and push the results.
|
||||||
|
|
||||||
If no files are given on the command-line as extra arguments (i.e., not as
|
If no files are given on the command-line as extra arguments (i.e., not as
|
||||||
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
||||||
those files are processed, and dc(1) will then exit.
|
those files are processed, and dc(1) will then exit.
|
||||||
|
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where **-e** (**--expression**) and **-f** (**--file**)
|
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
|
||||||
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
||||||
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
||||||
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
||||||
@ -64,21 +64,21 @@ as the last command-line argument or define the environment variable
|
|||||||
|
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
: Disables the prompt in TTY mode. (The prompt is only enabled in TTY mode.
|
||||||
See the **TTY MODE** section) This is mostly for those users that do not
|
See the **TTY MODE** section) This is mostly for those users that do not
|
||||||
@ -87,14 +87,14 @@ The following are the options that dc(1) accepts.
|
|||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-x** **--extended-register**
|
**-x** **-\-extended-register**
|
||||||
|
|
||||||
: Enables extended register mode. See the *Extended Register Mode* subsection
|
: Enables extended register mode. See the *Extended Register Mode* subsection
|
||||||
of the **REGISTERS** section for more information.
|
of the **REGISTERS** section for more information.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -104,14 +104,14 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, dc(1) will give a fatal error and exit.
|
or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -120,8 +120,8 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -909,7 +909,7 @@ follows any command that needs a register name. The only exception is a newline
|
|||||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
||||||
amounts of registers, if extended register mode is enabled.
|
amounts of registers, if extended register mode is enabled.
|
||||||
|
|
||||||
If extended register mode is enabled (**-x** or **--extended-register**
|
If extended register mode is enabled (**-x** or **-\-extended-register**
|
||||||
command-line arguments are given), then normal single character registers are
|
command-line arguments are given), then normal single character registers are
|
||||||
used *unless* the character immediately following a command that needs a
|
used *unless* the character immediately following a command that needs a
|
||||||
register name is a space (according to **isspace()**) and not a newline
|
register name is a space (according to **isspace()**) and not a newline
|
||||||
@ -1118,17 +1118,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,18 +25,17 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH Name
|
.SH Name
|
||||||
.PP
|
.PP
|
||||||
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
|
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
|
||||||
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
|
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
|
|||||||
results.
|
results.
|
||||||
.PP
|
.PP
|
||||||
If no files are given on the command-line as extra arguments (i.e., not
|
If no files are given on the command-line as extra arguments (i.e., not
|
||||||
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
|
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
|
||||||
\f[B]stdin\f[R].
|
\f[B]stdin\f[R].
|
||||||
Otherwise, those files are processed, and dc(1) will then exit.
|
Otherwise, those files are processed, and dc(1) will then exit.
|
||||||
.PP
|
.PP
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
|
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
|
||||||
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
|
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
|
||||||
and exit.
|
and exit.
|
||||||
The reason for this is that this dc(1) allows users to set arguments in
|
The reason for this is that this dc(1) allows users to set arguments in
|
||||||
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
||||||
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -86,14 +85,14 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
This option is a no-op.
|
This option is a no-op.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
|
\f[B]-x\f[R] \f[B]--extended-register\f[R]
|
||||||
Enables extended register mode.
|
Enables extended register mode.
|
||||||
See the \f[I]Extended Register Mode\f[R] subsection of the
|
See the \f[I]Extended Register Mode\f[R] subsection of the
|
||||||
\f[B]REGISTERS\f[R] section for more information.
|
\f[B]REGISTERS\f[R] section for more information.
|
||||||
@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -115,17 +114,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]DC_ENV_ARGS\f[R].
|
\f[B]DC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -136,9 +135,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -1032,7 +1031,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
|
|||||||
unlimited amounts of registers, if extended register mode is enabled.
|
unlimited amounts of registers, if extended register mode is enabled.
|
||||||
.PP
|
.PP
|
||||||
If extended register mode is enabled (\f[B]-x\f[R] or
|
If extended register mode is enabled (\f[B]-x\f[R] or
|
||||||
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
|
\f[B]--extended-register\f[R] command-line arguments are given), then
|
||||||
normal single character registers are used \f[I]unless\f[R] the
|
normal single character registers are used \f[I]unless\f[R] the
|
||||||
character immediately following a command that needs a register name is
|
character immediately following a command that needs a register name is
|
||||||
a space (according to \f[B]isspace()\f[R]) and not a newline
|
a space (according to \f[B]isspace()\f[R]) and not a newline
|
||||||
@ -1255,17 +1254,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the
|
In interactive mode, dc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
|
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
|
|||||||
pop arguments off of the stack and push the results.
|
pop arguments off of the stack and push the results.
|
||||||
|
|
||||||
If no files are given on the command-line as extra arguments (i.e., not as
|
If no files are given on the command-line as extra arguments (i.e., not as
|
||||||
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
||||||
those files are processed, and dc(1) will then exit.
|
those files are processed, and dc(1) will then exit.
|
||||||
|
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where **-e** (**--expression**) and **-f** (**--file**)
|
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
|
||||||
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
||||||
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
||||||
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
||||||
@ -64,34 +64,34 @@ as the last command-line argument or define the environment variable
|
|||||||
|
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: This option is a no-op.
|
: This option is a no-op.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-x** **--extended-register**
|
**-x** **-\-extended-register**
|
||||||
|
|
||||||
: Enables extended register mode. See the *Extended Register Mode* subsection
|
: Enables extended register mode. See the *Extended Register Mode* subsection
|
||||||
of the **REGISTERS** section for more information.
|
of the **REGISTERS** section for more information.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -101,14 +101,14 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, dc(1) will give a fatal error and exit.
|
or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -117,8 +117,8 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -906,7 +906,7 @@ follows any command that needs a register name. The only exception is a newline
|
|||||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
||||||
amounts of registers, if extended register mode is enabled.
|
amounts of registers, if extended register mode is enabled.
|
||||||
|
|
||||||
If extended register mode is enabled (**-x** or **--extended-register**
|
If extended register mode is enabled (**-x** or **-\-extended-register**
|
||||||
command-line arguments are given), then normal single character registers are
|
command-line arguments are given), then normal single character registers are
|
||||||
used *unless* the character immediately following a command that needs a
|
used *unless* the character immediately following a command that needs a
|
||||||
register name is a space (according to **isspace()**) and not a newline
|
register name is a space (according to **isspace()**) and not a newline
|
||||||
@ -1115,17 +1115,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -25,18 +25,17 @@
|
|||||||
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
.\" POSSIBILITY OF SUCH DAMAGE.
|
.\" POSSIBILITY OF SUCH DAMAGE.
|
||||||
.\"
|
.\"
|
||||||
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
.SH Name
|
.SH Name
|
||||||
.PP
|
.PP
|
||||||
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
dc - arbitrary-precision decimal reverse-Polish notation calculator
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
.PP
|
.PP
|
||||||
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]\[en]version\f[R]]
|
\f[B]dc\f[R] [\f[B]-hiPvVx\f[R]] [\f[B]--version\f[R]]
|
||||||
[\f[B]\[en]help\f[R]] [\f[B]\[en]interactive\f[R]]
|
[\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--no-prompt\f[R]]
|
||||||
[\f[B]\[en]no-prompt\f[R]] [\f[B]\[en]extended-register\f[R]]
|
[\f[B]--extended-register\f[R]] [\f[B]-e\f[R] \f[I]expr\f[R]]
|
||||||
[\f[B]-e\f[R] \f[I]expr\f[R]]
|
[\f[B]--expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
||||||
[\f[B]\[en]expression\f[R]=\f[I]expr\f[R]\&...] [\f[B]-f\f[R]
|
\f[I]file\f[R]\&...] [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
|
||||||
\f[I]file\f[R]\&...] [\f[B]-file\f[R]=\f[I]file\f[R]\&...]
|
|
||||||
[\f[I]file\f[R]\&...]
|
[\f[I]file\f[R]\&...]
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
.PP
|
.PP
|
||||||
@ -47,13 +46,13 @@ Arithmetic operations pop arguments off of the stack and push the
|
|||||||
results.
|
results.
|
||||||
.PP
|
.PP
|
||||||
If no files are given on the command-line as extra arguments (i.e., not
|
If no files are given on the command-line as extra arguments (i.e., not
|
||||||
as \f[B]-f\f[R] or \f[B]\[en]file\f[R] arguments), then dc(1) reads from
|
as \f[B]-f\f[R] or \f[B]--file\f[R] arguments), then dc(1) reads from
|
||||||
\f[B]stdin\f[R].
|
\f[B]stdin\f[R].
|
||||||
Otherwise, those files are processed, and dc(1) will then exit.
|
Otherwise, those files are processed, and dc(1) will then exit.
|
||||||
.PP
|
.PP
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where \f[B]-e\f[R] (\f[B]\[en]expression\f[R]) and
|
implementations, where \f[B]-e\f[R] (\f[B]--expression\f[R]) and
|
||||||
\f[B]-f\f[R] (\f[B]\[en]file\f[R]) arguments cause dc(1) to execute them
|
\f[B]-f\f[R] (\f[B]--file\f[R]) arguments cause dc(1) to execute them
|
||||||
and exit.
|
and exit.
|
||||||
The reason for this is that this dc(1) allows users to set arguments in
|
The reason for this is that this dc(1) allows users to set arguments in
|
||||||
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
the environment variable \f[B]DC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT
|
||||||
@ -72,13 +71,13 @@ argument or define the environment variable \f[B]DC_EXPR_EXIT\f[R].
|
|||||||
.PP
|
.PP
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-h\f[R], \f[B]\[en]help\f[R]
|
\f[B]-h\f[R], \f[B]--help\f[R]
|
||||||
Prints a usage message and quits.
|
Prints a usage message and quits.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]\[en]version\f[R]
|
\f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
|
||||||
Print the version information (copyright header) and exit.
|
Print the version information (copyright header) and exit.
|
||||||
.TP
|
.TP
|
||||||
\f[B]-i\f[R], \f[B]\[en]interactive\f[R]
|
\f[B]-i\f[R], \f[B]--interactive\f[R]
|
||||||
Forces interactive mode.
|
Forces interactive mode.
|
||||||
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
(See the \f[B]INTERACTIVE MODE\f[R] section.)
|
||||||
.RS
|
.RS
|
||||||
@ -86,14 +85,14 @@ Forces interactive mode.
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-P\f[R], \f[B]\[en]no-prompt\f[R]
|
\f[B]-P\f[R], \f[B]--no-prompt\f[R]
|
||||||
This option is a no-op.
|
This option is a no-op.
|
||||||
.RS
|
.RS
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-x\f[R] \f[B]\[en]extended-register\f[R]
|
\f[B]-x\f[R] \f[B]--extended-register\f[R]
|
||||||
Enables extended register mode.
|
Enables extended register mode.
|
||||||
See the \f[I]Extended Register Mode\f[R] subsection of the
|
See the \f[I]Extended Register Mode\f[R] subsection of the
|
||||||
\f[B]REGISTERS\f[R] section for more information.
|
\f[B]REGISTERS\f[R] section for more information.
|
||||||
@ -102,7 +101,7 @@ See the \f[I]Extended Register Mode\f[R] subsection of the
|
|||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]\[en]expression\f[R]=\f[I]expr\f[R]
|
\f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
|
||||||
Evaluates \f[I]expr\f[R].
|
Evaluates \f[I]expr\f[R].
|
||||||
If multiple expressions are given, they are evaluated in order.
|
If multiple expressions are given, they are evaluated in order.
|
||||||
If files are given as well (see below), the expressions and files are
|
If files are given as well (see below), the expressions and files are
|
||||||
@ -115,17 +114,17 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R], whether on the command-line or in
|
\f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
|
||||||
\f[B]DC_ENV_ARGS\f[R].
|
\f[B]DC_ENV_ARGS\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
This is a \f[B]non-portable extension\f[R].
|
This is a \f[B]non-portable extension\f[R].
|
||||||
.RE
|
.RE
|
||||||
.TP
|
.TP
|
||||||
\f[B]-f\f[R] \f[I]file\f[R], \f[B]\[en]file\f[R]=\f[I]file\f[R]
|
\f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
|
||||||
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
|
||||||
were read through \f[B]stdin\f[R].
|
were read through \f[B]stdin\f[R].
|
||||||
If expressions are also given (see above), the expressions are evaluated
|
If expressions are also given (see above), the expressions are evaluated
|
||||||
@ -136,9 +135,9 @@ If this option is given on the command-line (i.e., not in
|
|||||||
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
\f[B]DC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
|
||||||
then after processing all expressions and files, dc(1) will exit, unless
|
then after processing all expressions and files, dc(1) will exit, unless
|
||||||
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
\f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
|
||||||
\f[B]-f\f[R] or \f[B]\[en]file\f[R].
|
\f[B]-f\f[R] or \f[B]--file\f[R].
|
||||||
However, if any other \f[B]-e\f[R], \f[B]\[en]expression\f[R],
|
However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
|
||||||
\f[B]-f\f[R], or \f[B]\[en]file\f[R] arguments are given after
|
\f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
|
||||||
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
\f[B]-f-\f[R] or equivalent is given, dc(1) will give a fatal error and
|
||||||
exit.
|
exit.
|
||||||
.PP
|
.PP
|
||||||
@ -1032,7 +1031,7 @@ Unlike most other dc(1) implentations, this dc(1) provides nearly
|
|||||||
unlimited amounts of registers, if extended register mode is enabled.
|
unlimited amounts of registers, if extended register mode is enabled.
|
||||||
.PP
|
.PP
|
||||||
If extended register mode is enabled (\f[B]-x\f[R] or
|
If extended register mode is enabled (\f[B]-x\f[R] or
|
||||||
\f[B]\[en]extended-register\f[R] command-line arguments are given), then
|
\f[B]--extended-register\f[R] command-line arguments are given), then
|
||||||
normal single character registers are used \f[I]unless\f[R] the
|
normal single character registers are used \f[I]unless\f[R] the
|
||||||
character immediately following a command that needs a register name is
|
character immediately following a command that needs a register name is
|
||||||
a space (according to \f[B]isspace()\f[R]) and not a newline
|
a space (according to \f[B]isspace()\f[R]) and not a newline
|
||||||
@ -1255,17 +1254,17 @@ interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
|
|||||||
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
dc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
|
||||||
more input when one of those errors occurs in interactive mode.
|
more input when one of those errors occurs in interactive mode.
|
||||||
This is also the case when interactive mode is forced by the
|
This is also the case when interactive mode is forced by the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.PP
|
.PP
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the
|
checking, and its normal behavior can be forced by using the
|
||||||
\f[B]-i\f[R] flag or \f[B]\[en]interactive\f[R] option.
|
\f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
|
||||||
.SH INTERACTIVE MODE
|
.SH INTERACTIVE MODE
|
||||||
.PP
|
.PP
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both \f[B]stdin\f[R]
|
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
|
and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
|
||||||
and \f[B]\[en]interactive\f[R] option can turn it on in other cases.
|
and \f[B]--interactive\f[R] option can turn it on in other cases.
|
||||||
.PP
|
.PP
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the
|
In interactive mode, dc(1) attempts to recover from errors (see the
|
||||||
\f[B]RESET\f[R] section), and in normal execution, flushes
|
\f[B]RESET\f[R] section), and in normal execution, flushes
|
||||||
|
@ -34,7 +34,7 @@ dc - arbitrary-precision decimal reverse-Polish notation calculator
|
|||||||
|
|
||||||
# SYNOPSIS
|
# SYNOPSIS
|
||||||
|
|
||||||
**dc** [**-hiPvVx**] [**--version**] [**--help**] [**--interactive**] [**--no-prompt**] [**--extended-register**] [**-e** *expr*] [**--expression**=*expr*...] [**-f** *file*...] [**-file**=*file*...] [*file*...]
|
**dc** [**-hiPvVx**] [**-\-version**] [**-\-help**] [**-\-interactive**] [**-\-no-prompt**] [**-\-extended-register**] [**-e** *expr*] [**-\-expression**=*expr*...] [**-f** *file*...] [**-\-file**=*file*...] [*file*...]
|
||||||
|
|
||||||
# DESCRIPTION
|
# DESCRIPTION
|
||||||
|
|
||||||
@ -43,11 +43,11 @@ notation) to store numbers and results of computations. Arithmetic operations
|
|||||||
pop arguments off of the stack and push the results.
|
pop arguments off of the stack and push the results.
|
||||||
|
|
||||||
If no files are given on the command-line as extra arguments (i.e., not as
|
If no files are given on the command-line as extra arguments (i.e., not as
|
||||||
**-f** or **--file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
**-f** or **-\-file** arguments), then dc(1) reads from **stdin**. Otherwise,
|
||||||
those files are processed, and dc(1) will then exit.
|
those files are processed, and dc(1) will then exit.
|
||||||
|
|
||||||
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
This is different from the dc(1) on OpenBSD and possibly other dc(1)
|
||||||
implementations, where **-e** (**--expression**) and **-f** (**--file**)
|
implementations, where **-e** (**-\-expression**) and **-f** (**-\-file**)
|
||||||
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
arguments cause dc(1) to execute them and exit. The reason for this is that this
|
||||||
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
dc(1) allows users to set arguments in the environment variable **DC_ENV_ARGS**
|
||||||
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
(see the **ENVIRONMENT VARIABLES** section). Any expressions given on the
|
||||||
@ -64,34 +64,34 @@ as the last command-line argument or define the environment variable
|
|||||||
|
|
||||||
The following are the options that dc(1) accepts.
|
The following are the options that dc(1) accepts.
|
||||||
|
|
||||||
**-h**, **--help**
|
**-h**, **-\-help**
|
||||||
|
|
||||||
: Prints a usage message and quits.
|
: Prints a usage message and quits.
|
||||||
|
|
||||||
**-v**, **-V**, **--version**
|
**-v**, **-V**, **-\-version**
|
||||||
|
|
||||||
: Print the version information (copyright header) and exit.
|
: Print the version information (copyright header) and exit.
|
||||||
|
|
||||||
**-i**, **--interactive**
|
**-i**, **-\-interactive**
|
||||||
|
|
||||||
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
: Forces interactive mode. (See the **INTERACTIVE MODE** section.)
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-P**, **--no-prompt**
|
**-P**, **-\-no-prompt**
|
||||||
|
|
||||||
: This option is a no-op.
|
: This option is a no-op.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-x** **--extended-register**
|
**-x** **-\-extended-register**
|
||||||
|
|
||||||
: Enables extended register mode. See the *Extended Register Mode* subsection
|
: Enables extended register mode. See the *Extended Register Mode* subsection
|
||||||
of the **REGISTERS** section for more information.
|
of the **REGISTERS** section for more information.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-e** *expr*, **--expression**=*expr*
|
**-e** *expr*, **-\-expression**=*expr*
|
||||||
|
|
||||||
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
: Evaluates *expr*. If multiple expressions are given, they are evaluated in
|
||||||
order. If files are given as well (see below), the expressions and files are
|
order. If files are given as well (see below), the expressions and files are
|
||||||
@ -101,14 +101,14 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**, whether on the
|
as an argument at least once to **-f** or **-\-file**, whether on the
|
||||||
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
command-line or in **DC_ENV_ARGS**. However, if any other **-e**,
|
||||||
**--expression**, **-f**, or **--file** arguments are given after **-f-** or
|
**-\-expression**, **-f**, or **-\-file** arguments are given after **-f-**
|
||||||
equivalent is given, dc(1) will give a fatal error and exit.
|
or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
|
|
||||||
**-f** *file*, **--file**=*file*
|
**-f** *file*, **-\-file**=*file*
|
||||||
|
|
||||||
: Reads in *file* and evaluates it, line by line, as though it were read
|
: Reads in *file* and evaluates it, line by line, as though it were read
|
||||||
through **stdin**. If expressions are also given (see above), the
|
through **stdin**. If expressions are also given (see above), the
|
||||||
@ -117,8 +117,8 @@ The following are the options that dc(1) accepts.
|
|||||||
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
If this option is given on the command-line (i.e., not in **DC_ENV_ARGS**,
|
||||||
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
see the **ENVIRONMENT VARIABLES** section), then after processing all
|
||||||
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
expressions and files, dc(1) will exit, unless **-** (**stdin**) was given
|
||||||
as an argument at least once to **-f** or **--file**. However, if any other
|
as an argument at least once to **-f** or **-\-file**. However, if any other
|
||||||
**-e**, **--expression**, **-f**, or **--file** arguments are given after
|
**-e**, **-\-expression**, **-f**, or **-\-file** arguments are given after
|
||||||
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
**-f-** or equivalent is given, dc(1) will give a fatal error and exit.
|
||||||
|
|
||||||
This is a **non-portable extension**.
|
This is a **non-portable extension**.
|
||||||
@ -906,7 +906,7 @@ follows any command that needs a register name. The only exception is a newline
|
|||||||
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
Unlike most other dc(1) implentations, this dc(1) provides nearly unlimited
|
||||||
amounts of registers, if extended register mode is enabled.
|
amounts of registers, if extended register mode is enabled.
|
||||||
|
|
||||||
If extended register mode is enabled (**-x** or **--extended-register**
|
If extended register mode is enabled (**-x** or **-\-extended-register**
|
||||||
command-line arguments are given), then normal single character registers are
|
command-line arguments are given), then normal single character registers are
|
||||||
used *unless* the character immediately following a command that needs a
|
used *unless* the character immediately following a command that needs a
|
||||||
register name is a space (according to **isspace()**) and not a newline
|
register name is a space (according to **isspace()**) and not a newline
|
||||||
@ -1115,17 +1115,17 @@ The other statuses will only be returned when dc(1) is not in interactive mode
|
|||||||
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
(see the **INTERACTIVE MODE** section), since dc(1) resets its state (see the
|
||||||
**RESET** section) and accepts more input when one of those errors occurs in
|
**RESET** section) and accepts more input when one of those errors occurs in
|
||||||
interactive mode. This is also the case when interactive mode is forced by the
|
interactive mode. This is also the case when interactive mode is forced by the
|
||||||
**-i** flag or **--interactive** option.
|
**-i** flag or **-\-interactive** option.
|
||||||
|
|
||||||
These exit statuses allow dc(1) to be used in shell scripting with error
|
These exit statuses allow dc(1) to be used in shell scripting with error
|
||||||
checking, and its normal behavior can be forced by using the **-i** flag or
|
checking, and its normal behavior can be forced by using the **-i** flag or
|
||||||
**--interactive** option.
|
**-\-interactive** option.
|
||||||
|
|
||||||
# INTERACTIVE MODE
|
# INTERACTIVE MODE
|
||||||
|
|
||||||
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
Like bc(1), dc(1) has an interactive mode and a non-interactive mode.
|
||||||
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
Interactive mode is turned on automatically when both **stdin** and **stdout**
|
||||||
are hooked to a terminal, but the **-i** flag and **--interactive** option can
|
are hooked to a terminal, but the **-i** flag and **-\-interactive** option can
|
||||||
turn it on in other cases.
|
turn it on in other cases.
|
||||||
|
|
||||||
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
In interactive mode, dc(1) attempts to recover from errors (see the **RESET**
|
||||||
|
@ -1 +1 @@
|
|||||||
.TH "BC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "BC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
|
@ -1 +1 @@
|
|||||||
.TH "BCL" "3" "February 2021" "Gavin D. Howard" "Libraries Manual"
|
.TH "BCL" "3" "March 2021" "Gavin D. Howard" "Libraries Manual"
|
||||||
|
@ -1 +1 @@
|
|||||||
.TH "DC" "1" "February 2021" "Gavin D. Howard" "General Commands Manual"
|
.TH "DC" "1" "March 2021" "Gavin D. Howard" "General Commands Manual"
|
||||||
|
@ -2138,7 +2138,7 @@ size_t bc_num_len(const BcNum *restrict n) {
|
|||||||
|
|
||||||
size_t len = n->len;
|
size_t len = n->len;
|
||||||
|
|
||||||
if (BC_NUM_ZERO(n)) return 0;
|
if (BC_NUM_ZERO(n)) return n->scale ? n->scale : 1;
|
||||||
|
|
||||||
if (BC_NUM_RDX_VAL(n) == len) {
|
if (BC_NUM_RDX_VAL(n) == len) {
|
||||||
|
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
length(0)
|
length(0)
|
||||||
|
length(0.0000)
|
||||||
|
length(0.00000000)
|
||||||
|
length(0.00000000000)
|
||||||
length(1)
|
length(1)
|
||||||
length(12)
|
length(12)
|
||||||
length(123)
|
length(123)
|
||||||
|
@ -1,4 +1,7 @@
|
|||||||
0
|
1
|
||||||
|
4
|
||||||
|
8
|
||||||
|
11
|
||||||
1
|
1
|
||||||
2
|
2
|
||||||
3
|
3
|
||||||
|
@ -84,6 +84,12 @@ cbrt(27)
|
|||||||
cbrt(-27)
|
cbrt(-27)
|
||||||
cbrt(4096)
|
cbrt(4096)
|
||||||
cbrt(-4096)
|
cbrt(-4096)
|
||||||
|
root(0, 3)
|
||||||
|
root(0, 4)
|
||||||
|
root(0, 5)
|
||||||
|
root(0.0000000000000, 3)
|
||||||
|
root(0.0000000000000, 4)
|
||||||
|
root(0.0000000000000, 5)
|
||||||
root(16, 4)
|
root(16, 4)
|
||||||
root(3125, 5)
|
root(3125, 5)
|
||||||
root(-3125, 5)
|
root(-3125, 5)
|
||||||
|
@ -84,6 +84,12 @@
|
|||||||
-3.00000000000000000000
|
-3.00000000000000000000
|
||||||
16.00000000000000000000
|
16.00000000000000000000
|
||||||
-16.00000000000000000000
|
-16.00000000000000000000
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
|
0
|
||||||
2.00000000000000000000
|
2.00000000000000000000
|
||||||
5.00000000000000000000
|
5.00000000000000000000
|
||||||
-5.00000000000000000000
|
-5.00000000000000000000
|
||||||
|
@ -15,8 +15,9 @@ t[11] = -1.74
|
|||||||
t[12] = -2
|
t[12] = -2
|
||||||
t[13] = -3.2345
|
t[13] = -3.2345
|
||||||
t[14] = -100
|
t[14] = -100
|
||||||
|
t[15] = 0.0000000000000000
|
||||||
|
|
||||||
l = 15
|
l = 16
|
||||||
|
|
||||||
a[0] = t[0]
|
a[0] = t[0]
|
||||||
|
|
||||||
@ -30,7 +31,11 @@ l -= 1
|
|||||||
|
|
||||||
for (i = 0; i < l; ++i) {
|
for (i = 0; i < l; ++i) {
|
||||||
for (j = 0; j < l; ++j) {
|
for (j = 0; j < l; ++j) {
|
||||||
print "j(", a[i], ", ", a[j], ")\n"
|
print "j(", a[i]
|
||||||
|
if (a[i] == 0 && scale(a[i]) > 0) print ".0000000000000000"
|
||||||
|
print ", ", a[j]
|
||||||
|
if (a[j] == 0 && scale(a[j]) > 0) print ".0000000000000000"
|
||||||
|
print ")\n"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
decimal
|
decimal
|
||||||
|
length
|
||||||
add
|
add
|
||||||
subtract
|
subtract
|
||||||
multiply
|
multiply
|
||||||
|
129
contrib/bc/tests/dc/length.txt
Normal file
129
contrib/bc/tests/dc/length.txt
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
0ZpR
|
||||||
|
0.0000ZpR
|
||||||
|
0.00000000ZpR
|
||||||
|
0.00000000000ZpR
|
||||||
|
1ZpR
|
||||||
|
12ZpR
|
||||||
|
123ZpR
|
||||||
|
1234ZpR
|
||||||
|
12345ZpR
|
||||||
|
123456ZpR
|
||||||
|
1234567ZpR
|
||||||
|
12345678ZpR
|
||||||
|
123456789ZpR
|
||||||
|
1234567890ZpR
|
||||||
|
1.0ZpR
|
||||||
|
12.0ZpR
|
||||||
|
123.0ZpR
|
||||||
|
1234.0ZpR
|
||||||
|
12345.0ZpR
|
||||||
|
123456.0ZpR
|
||||||
|
1234567.0ZpR
|
||||||
|
12345678.0ZpR
|
||||||
|
123456789.0ZpR
|
||||||
|
1234567890.0ZpR
|
||||||
|
.1ZpR
|
||||||
|
.12ZpR
|
||||||
|
.123ZpR
|
||||||
|
.1234ZpR
|
||||||
|
.12345ZpR
|
||||||
|
.123456ZpR
|
||||||
|
.1234567ZpR
|
||||||
|
.12345678ZpR
|
||||||
|
.123456789ZpR
|
||||||
|
.1234567890ZpR
|
||||||
|
.01ZpR
|
||||||
|
.012ZpR
|
||||||
|
.0123ZpR
|
||||||
|
.01234ZpR
|
||||||
|
.012345ZpR
|
||||||
|
.0123456ZpR
|
||||||
|
.01234567ZpR
|
||||||
|
.012345678ZpR
|
||||||
|
.0123456789ZpR
|
||||||
|
.01234567890ZpR
|
||||||
|
.001ZpR
|
||||||
|
.0012ZpR
|
||||||
|
.00123ZpR
|
||||||
|
.001234ZpR
|
||||||
|
.0012345ZpR
|
||||||
|
.00123456ZpR
|
||||||
|
.001234567ZpR
|
||||||
|
.0012345678ZpR
|
||||||
|
.00123456789ZpR
|
||||||
|
.001234567890ZpR
|
||||||
|
.0001ZpR
|
||||||
|
.00012ZpR
|
||||||
|
.000123ZpR
|
||||||
|
.0001234ZpR
|
||||||
|
.00012345ZpR
|
||||||
|
.000123456ZpR
|
||||||
|
.0001234567ZpR
|
||||||
|
.00012345678ZpR
|
||||||
|
.000123456789ZpR
|
||||||
|
.0001234567890ZpR
|
||||||
|
.00001ZpR
|
||||||
|
.000012ZpR
|
||||||
|
.0000123ZpR
|
||||||
|
.00001234ZpR
|
||||||
|
.000012345ZpR
|
||||||
|
.0000123456ZpR
|
||||||
|
.00001234567ZpR
|
||||||
|
.000012345678ZpR
|
||||||
|
.0000123456789ZpR
|
||||||
|
.00001234567890ZpR
|
||||||
|
.000001ZpR
|
||||||
|
.0000012ZpR
|
||||||
|
.00000123ZpR
|
||||||
|
.000001234ZpR
|
||||||
|
.0000012345ZpR
|
||||||
|
.00000123456ZpR
|
||||||
|
.000001234567ZpR
|
||||||
|
.0000012345678ZpR
|
||||||
|
.00000123456789ZpR
|
||||||
|
.000001234567890ZpR
|
||||||
|
.0000001ZpR
|
||||||
|
.00000012ZpR
|
||||||
|
.000000123ZpR
|
||||||
|
.0000001234ZpR
|
||||||
|
.00000012345ZpR
|
||||||
|
.000000123456ZpR
|
||||||
|
.0000001234567ZpR
|
||||||
|
.00000012345678ZpR
|
||||||
|
.000000123456789ZpR
|
||||||
|
.0000001234567890ZpR
|
||||||
|
.00000001ZpR
|
||||||
|
.000000012ZpR
|
||||||
|
.0000000123ZpR
|
||||||
|
.00000001234ZpR
|
||||||
|
.000000012345ZpR
|
||||||
|
.0000000123456ZpR
|
||||||
|
.00000001234567ZpR
|
||||||
|
.000000012345678ZpR
|
||||||
|
.0000000123456789ZpR
|
||||||
|
.00000001234567890ZpR
|
||||||
|
.000000001ZpR
|
||||||
|
.0000000012ZpR
|
||||||
|
.00000000123ZpR
|
||||||
|
.000000001234ZpR
|
||||||
|
.0000000012345ZpR
|
||||||
|
.00000000123456ZpR
|
||||||
|
.000000001234567ZpR
|
||||||
|
.0000000012345678ZpR
|
||||||
|
.00000000123456789ZpR
|
||||||
|
.000000001234567890ZpR
|
||||||
|
.0000000001ZpR
|
||||||
|
.00000000012ZpR
|
||||||
|
.000000000123ZpR
|
||||||
|
.0000000001234ZpR
|
||||||
|
.00000000012345ZpR
|
||||||
|
.000000000123456ZpR
|
||||||
|
.0000000001234567ZpR
|
||||||
|
.00000000012345678ZpR
|
||||||
|
.000000000123456789ZpR
|
||||||
|
.0000000001234567890ZpR
|
||||||
|
289.29837ZpR
|
||||||
|
2893.00000ZpR
|
||||||
|
289.0ZpR
|
||||||
|
1802973.0000000238ZpR
|
||||||
|
.000000000000000093182394080000000000ZpR
|
129
contrib/bc/tests/dc/length_results.txt
Normal file
129
contrib/bc/tests/dc/length_results.txt
Normal file
@ -0,0 +1,129 @@
|
|||||||
|
1
|
||||||
|
4
|
||||||
|
8
|
||||||
|
11
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
11
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
1
|
||||||
|
2
|
||||||
|
3
|
||||||
|
4
|
||||||
|
5
|
||||||
|
6
|
||||||
|
7
|
||||||
|
8
|
||||||
|
9
|
||||||
|
10
|
||||||
|
8
|
||||||
|
9
|
||||||
|
4
|
||||||
|
17
|
||||||
|
20
|
Loading…
Reference in New Issue
Block a user