Lines Matching +full:ascii +full:. +full:r

0 .\"
2 .\" SPDX-License-Identifier: BSD-2-Clause
3 .\"
4 .\" Copyright (c) 2018-2023 Gavin D. Howard and contributors.
5 .\"
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions are met:
8 .\"
9 .\" * Redistributions of source code must retain the above copyright notice,
10 .\" this list of conditions and the following disclaimer.
11 .\"
12 .\" * Redistributions in binary form must reproduce the above copyright notice,
13 .\" this list of conditions and the following disclaimer in the documentation
14 .\" and/or other materials provided with the distribution.
15 .\"
16 .\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17 .\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 .\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
20 .\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21 .\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22 .\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23 .\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24 .\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26 .\" POSSIBILITY OF SUCH DAMAGE.
27 .\"
28 .TH "BC" "1" "November 2023" "Gavin D. Howard" "General Commands Manual"
29 .nh
30 .ad l
31 .SH NAME
33 .SH SYNOPSIS
34 \f[B]bc\f[R] [\f[B]-cCghilPqRsvVw\f[R]] [\f[B]--digit-clamp\f[R]]
35 [\f[B]--no-digit-clamp\f[R]] [\f[B]--global-stacks\f[R]]
36 [\f[B]--help\f[R]] [\f[B]--interactive\f[R]] [\f[B]--mathlib\f[R]]
37 [\f[B]--no-prompt\f[R]] [\f[B]--no-read-prompt\f[R]] [\f[B]--quiet\f[R]]
38 [\f[B]--standard\f[R]] [\f[B]--warn\f[R]] [\f[B]--version\f[R]]
39 [\f[B]-e\f[R] \f[I]expr\f[R]]
40 [\f[B]--expression\f[R]=\f[I]expr\f[R]\&...]
41 [\f[B]-f\f[R] \f[I]file\f[R]\&...]
42 [\f[B]--file\f[R]=\f[I]file\f[R]\&...]
43 [\f[I]file\f[R]\&...]
44 [\f[B]-I\f[R] \f[I]ibase\f[R]] [\f[B]--ibase\f[R]=\f[I]ibase\f[R]]
45 [\f[B]-O\f[R] \f[I]obase\f[R]] [\f[B]--obase\f[R]=\f[I]obase\f[R]]
46 [\f[B]-S\f[R] \f[I]scale\f[R]] [\f[B]--scale\f[R]=\f[I]scale\f[R]]
47 [\f[B]-E\f[R] \f[I]seed\f[R]] [\f[B]--seed\f[R]=\f[I]seed\f[R]]
48 .SH DESCRIPTION
50 1991 by POSIX.
51 (See the \f[B]STANDARDS\f[R] section.)
53 somewhat C-like, but there are differences.
54 Such differences will be noted in this document.
55 .PP
57 the command line and executes them before reading from \f[B]stdin\f[R].
58 .PP
59 This bc(1) is a drop-in replacement for \f[I]any\f[R] bc(1), including
60 (and especially) the GNU bc(1).
62 implementations.
63 .PP
64 \f[B]Note\f[R]: If running this bc(1) on \f[I]any\f[R] script meant for
67 or array.
68 To fix that, use the command-line option \f[B]-r\f[R] \f[I]keyword\f[R],
69 where \f[I]keyword\f[R] is the keyword that is used as a name in the
70 script.
71 For more information, see the \f[B]OPTIONS\f[R] section.
72 .PP
74 work, that is a bug and should be reported.
75 See the \f[B]BUGS\f[R] section.
76 .SH OPTIONS
77 The following are the options that bc(1) accepts.
78 .TP
79 \f[B]-C\f[R], \f[B]--no-digit-clamp\f[R]
81 \f[B]ibase\f[R] when parsing numbers.
82 .RS
83 .PP
87 significant digit.
88 .PP
89 If this and/or the \f[B]-c\f[R] or \f[B]--digit-clamp\f[R] options are
90 given multiple times, the last one given is used.
91 .PP
92 This option overrides the \f[B]BC_DIGIT_CLAMP\f[R] environment variable
93 (see the \f[B]ENVIRONMENT VARIABLES\f[R] section) and the default, which
94 can be queried with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
95 .PP
96 This is a \f[B]non-portable extension\f[R].
97 .RE
98 .TP
99 \f[B]-c\f[R], \f[B]--digit-clamp\f[R]
101 \f[B]ibase\f[R] when parsing numbers.
102 .RS
103 .PP
108 digit.
109 .PP
110 If this and/or the \f[B]-C\f[R] or \f[B]--no-digit-clamp\f[R] options
111 are given multiple times, the last one given is used.
112 .PP
113 This option overrides the \f[B]BC_DIGIT_CLAMP\f[R] environment variable
114 (see the \f[B]ENVIRONMENT VARIABLES\f[R] section) and the default, which
115 can be queried with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
116 .PP
117 This is a \f[B]non-portable extension\f[R].
118 .RE
119 .TP
120 \f[B]-E\f[R] \f[I]seed\f[R], \f[B]--seed\f[R]=\f[I]seed\f[R]
121 Sets the builtin variable \f[B]seed\f[R] to the value \f[I]seed\f[R]
122 assuming that \f[I]seed\f[R] is in base 10.
123 It is a fatal error if \f[I]seed\f[R] is not a valid number.
124 .RS
125 .PP
126 If multiple instances of this option are given, the last is used.
127 .PP
128 This is a \f[B]non-portable extension\f[R].
129 .RE
130 .TP
131 \f[B]-e\f[R] \f[I]expr\f[R], \f[B]--expression\f[R]=\f[I]expr\f[R]
132 Evaluates \f[I]expr\f[R].
133 If multiple expressions are given, they are evaluated in order.
134 If files are given as well (see the \f[B]-f\f[R] and \f[B]--file\f[R]
135 options), the expressions and files are evaluated in the order given.
137 read in and evaluated first.
138 .RS
139 .PP
140 If this option is given on the command-line (i.e., not in
141 \f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
143 \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
144 \f[B]-f\f[R] or \f[B]--file\f[R], whether on the command-line or in
145 \f[B]BC_ENV_ARGS\f[R].
146 However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
147 \f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
148 \f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
149 exit.
150 .PP
151 This is a \f[B]non-portable extension\f[R].
152 .RE
153 .TP
154 \f[B]-f\f[R] \f[I]file\f[R], \f[B]--file\f[R]=\f[I]file\f[R]
155 Reads in \f[I]file\f[R] and evaluates it, line by line, as though it
156 were read through \f[B]stdin\f[R].
157 If expressions are also given (see the \f[B]-e\f[R] and
158 \f[B]--expression\f[R] options), the expressions are evaluated in the
159 order given.
160 .RS
161 .PP
162 If this option is given on the command-line (i.e., not in
163 \f[B]BC_ENV_ARGS\f[R], see the \f[B]ENVIRONMENT VARIABLES\f[R] section),
165 \f[B]-\f[R] (\f[B]stdin\f[R]) was given as an argument at least once to
166 \f[B]-f\f[R] or \f[B]--file\f[R].
167 However, if any other \f[B]-e\f[R], \f[B]--expression\f[R],
168 \f[B]-f\f[R], or \f[B]--file\f[R] arguments are given after
169 \f[B]-f-\f[R] or equivalent is given, bc(1) will give a fatal error and
170 exit.
171 .PP
172 This is a \f[B]non-portable extension\f[R].
173 .RE
174 .TP
175 \f[B]-g\f[R], \f[B]--global-stacks\f[R]
176 Turns the globals \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], and
177 \f[B]seed\f[R] into stacks.
178 .RS
179 .PP
182 every function returns.
184 without worrying that the change will affect other functions.
185 Thus, a hypothetical function named \f[B]output(x,b)\f[R] that simply
186 printed \f[B]x\f[R] in base \f[B]b\f[R] could be written like this:
187 .IP
188 .EX
193 .EE
194 .PP
196 .IP
197 .EX
205 .EE
206 .PP
207 This makes writing functions much easier.
208 .PP
209 (\f[B]Note\f[R]: the function \f[B]output(x,b)\f[R] exists in the
210 extended math library.
211 See the \f[B]LIBRARY\f[R] section.)
212 .PP
214 \f[B]ibase\f[R], \f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R]
215 globally, functions that are made to do so cannot work anymore.
216 There are two possible use cases for that, and each has a solution.
217 .PP
220 aliases.
222 .IP
223 .EX
226 .EE
227 .PP
228 Second, if the purpose of a function is to set \f[B]ibase\f[R],
229 \f[B]obase\f[R], \f[B]scale\f[R], or \f[B]seed\f[R] globally for any
232 desired value for a global.
233 .PP
234 For functions that set \f[B]seed\f[R], the value assigned to
235 \f[B]seed\f[R] is not propagated to parent functions.
237 not be the same sequence of pseudo-random numbers that any parent sees.
238 This is only the case once \f[B]seed\f[R] has been set.
239 .PP
241 numbers of its parents, but wants to use the same \f[B]seed\f[R], it can
243 .IP
244 .EX
246 .EE
247 .PP
249 users could make sure to define \f[B]BC_ENV_ARGS\f[R] and include this
250 option (see the \f[B]ENVIRONMENT VARIABLES\f[R] section for more
251 details).
252 .PP
253 If \f[B]-s\f[R], \f[B]-w\f[R], or any equivalents are used, this option
254 is ignored.
255 .PP
256 This is a \f[B]non-portable extension\f[R].
257 .RE
258 .TP
259 \f[B]-h\f[R], \f[B]--help\f[R]
260 Prints a usage message and exits.
261 .TP
262 \f[B]-I\f[R] \f[I]ibase\f[R], \f[B]--ibase\f[R]=\f[I]ibase\f[R]
263 Sets the builtin variable \f[B]ibase\f[R] to the value \f[I]ibase\f[R]
264 assuming that \f[I]ibase\f[R] is in base 10.
265 It is a fatal error if \f[I]ibase\f[R] is not a valid number.
266 .RS
267 .PP
268 If multiple instances of this option are given, the last is used.
269 .PP
270 This is a \f[B]non-portable extension\f[R].
271 .RE
272 .TP
273 \f[B]-i\f[R], \f[B]--interactive\f[R]
274 Forces interactive mode.
275 (See the \f[B]INTERACTIVE MODE\f[R] section.)
276 .RS
277 .PP
278 This is a \f[B]non-portable extension\f[R].
279 .RE
280 .TP
281 \f[B]-L\f[R], \f[B]--no-line-length\f[R]
283 newlines.
284 In other words, this option sets \f[B]BC_LINE_LENGTH\f[R] to \f[B]0\f[R]
285 (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
286 .RS
287 .PP
288 This is a \f[B]non-portable extension\f[R].
289 .RE
290 .TP
291 \f[B]-l\f[R], \f[B]--mathlib\f[R]
292 Sets \f[B]scale\f[R] (see the \f[B]SYNTAX\f[R] section) to \f[B]20\f[R]
295 command line.
296 .RS
297 .PP
298 To learn what is in the libraries, see the \f[B]LIBRARY\f[R] section.
299 .RE
300 .TP
301 \f[B]-O\f[R] \f[I]obase\f[R], \f[B]--obase\f[R]=\f[I]obase\f[R]
302 Sets the builtin variable \f[B]obase\f[R] to the value \f[I]obase\f[R]
303 assuming that \f[I]obase\f[R] is in base 10.
304 It is a fatal error if \f[I]obase\f[R] is not a valid number.
305 .RS
306 .PP
307 If multiple instances of this option are given, the last is used.
308 .PP
309 This is a \f[B]non-portable extension\f[R].
310 .RE
311 .TP
312 \f[B]-P\f[R], \f[B]--no-prompt\f[R]
313 Disables the prompt in TTY mode.
314 (The prompt is only enabled in TTY mode.
315 See the \f[B]TTY MODE\f[R] section.)
317 to having them in bc(1).
319 \f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
320 .RS
321 .PP
322 These options override the \f[B]BC_PROMPT\f[R] and \f[B]BC_TTY_MODE\f[R]
323 environment variables (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
324 .PP
325 This is a \f[B]non-portable extension\f[R].
326 .RE
327 .TP
328 \f[B]-q\f[R], \f[B]--quiet\f[R]
330 (https://www.gnu.org/software/bc/); it is a no-op.
331 Without this option, GNU bc(1) prints a copyright header.
333 \f[B]-v\f[R], \f[B]-V\f[R], or \f[B]--version\f[R] options are given
334 unless the \f[B]BC_BANNER\f[R] environment variable is set and contains
336 by default.
337 If \f[I]any\f[R] of that is the case, then this option \f[I]does\f[R]
338 prevent bc(1) from printing the header.
339 .RS
340 .PP
341 This is a \f[B]non-portable extension\f[R].
342 .RE
343 .TP
344 \f[B]-R\f[R], \f[B]--no-read-prompt\f[R]
345 Disables the read prompt in TTY mode.
346 (The read prompt is only enabled in TTY mode.
347 See the \f[B]TTY MODE\f[R] section.)
349 used to having them in bc(1).
351 \f[B]BC_ENV_ARGS\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
353 prompt for user input.
354 .RS
355 .PP
357 is only used when the \f[B]read()\f[R] built-in function is called.
358 .PP
359 These options \f[I]do\f[R] override the \f[B]BC_PROMPT\f[R] and
360 \f[B]BC_TTY_MODE\f[R] environment variables (see the \f[B]ENVIRONMENT
361 VARIABLES\f[R] section), but only for the read prompt.
362 .PP
363 This is a \f[B]non-portable extension\f[R].
364 .RE
365 .TP
366 \f[B]-r\f[R] \f[I]keyword\f[R], \f[B]--redefine\f[R]=\f[I]keyword\f[R]
367 Redefines \f[I]keyword\f[R] in order to allow it to be used as a
368 function, variable, or array name.
370 meant for other bc(1) implementations.
371 .RS
372 .PP
374 .IP \[bu] 2
375 \f[B]abs\f[R]
376 .IP \[bu] 2
377 \f[B]asciify\f[R]
378 .IP \[bu] 2
379 \f[B]continue\f[R]
380 .IP \[bu] 2
381 \f[B]divmod\f[R]
382 .IP \[bu] 2
383 \f[B]else\f[R]
384 .IP \[bu] 2
385 \f[B]halt\f[R]
386 .IP \[bu] 2
387 \f[B]irand\f[R]
388 .IP \[bu] 2
389 \f[B]last\f[R]
390 .IP \[bu] 2
391 \f[B]limits\f[R]
392 .IP \[bu] 2
393 \f[B]maxibase\f[R]
394 .IP \[bu] 2
395 \f[B]maxobase\f[R]
396 .IP \[bu] 2
397 \f[B]maxrand\f[R]
398 .IP \[bu] 2
399 \f[B]maxscale\f[R]
400 .IP \[bu] 2
401 \f[B]modexp\f[R]
402 .IP \[bu] 2
403 \f[B]print\f[R]
404 .IP \[bu] 2
405 \f[B]rand\f[R]
406 .IP \[bu] 2
407 \f[B]read\f[R]
408 .IP \[bu] 2
409 \f[B]seed\f[R]
410 .IP \[bu] 2
411 \f[B]stream\f[R]
412 .PP
414 in a script, use this option with the keyword as the argument.
416 multiple times.
417 .PP
418 Keywords are \f[I]not\f[R] redefined when parsing the builtin math
419 library (see the \f[B]LIBRARY\f[R] section).
420 .PP
422 (see the \f[B]STANDARDS\f[R] section).
424 not reserve as keywords.
425 .RE
426 .TP
427 \f[B]-S\f[R] \f[I]scale\f[R], \f[B]--scale\f[R]=\f[I]scale\f[R]
428 Sets the builtin variable \f[B]scale\f[R] to the value \f[I]scale\f[R]
429 assuming that \f[I]scale\f[R] is in base 10.
430 It is a fatal error if \f[I]scale\f[R] is not a valid number.
431 .RS
432 .PP
433 If multiple instances of this option are given, the last is used.
434 .PP
435 This is a \f[B]non-portable extension\f[R].
436 .RE
437 .TP
438 \f[B]-s\f[R], \f[B]--standard\f[R]
440 \f[B]STANDARDS\f[R] section) and error if any extensions are used.
441 .RS
442 .PP
443 This is a \f[B]non-portable extension\f[R].
444 .RE
445 .TP
446 \f[B]-v\f[R], \f[B]-V\f[R], \f[B]--version\f[R]
447 Print the version information (copyright header) and exits.
448 .RS
449 .PP
450 This is a \f[B]non-portable extension\f[R].
451 .RE
452 .TP
453 \f[B]-w\f[R], \f[B]--warn\f[R]
454 Like \f[B]-s\f[R] and \f[B]--standard\f[R], except that warnings (and
456 continues normally.
457 .RS
458 .PP
459 This is a \f[B]non-portable extension\f[R].
460 .RE
461 .TP
462 \f[B]-z\f[R], \f[B]--leading-zeroes\f[R]
463 Makes bc(1) print all numbers greater than \f[B]-1\f[R] and less than
464 \f[B]1\f[R], and not equal to \f[B]0\f[R], with a leading zero.
465 .RS
466 .PP
467 This can be set for individual numbers with the \f[B]plz(x)\f[R],
468 \f[B]plznl(x)\f[R], \f[B]pnlz(x)\f[R], and \f[B]pnlznl(x)\f[R] functions
469 in the extended math library (see the \f[B]LIBRARY\f[R] section).
470 .PP
471 This is a \f[B]non-portable extension\f[R].
472 .RE
473 .PP
474 All long options are \f[B]non-portable extensions\f[R].
475 .SH STDIN
476 If no files or expressions are given by the \f[B]-f\f[R],
477 \f[B]--file\f[R], \f[B]-e\f[R], or \f[B]--expression\f[R] options, then
478 bc(1) reads from \f[B]stdin\f[R].
479 .PP
480 However, there are a few caveats to this.
481 .PP
482 First, \f[B]stdin\f[R] is evaluated a line at a time.
483 The only exception to this is if the parse cannot complete.
485 function, \f[B]if\f[R] statement, or loop without ending it will also
486 cause bc(1) to not execute.
487 .PP
488 Second, after an \f[B]if\f[R] statement, bc(1) doesn\[cq]t know if an
489 \f[B]else\f[R] statement will follow, so it will not execute until it
490 knows there will not be an \f[B]else\f[R] statement.
491 .SH STDOUT
492 Any non-error output is written to \f[B]stdout\f[R].
493 In addition, if history (see the \f[B]HISTORY\f[R] section) and the
494 prompt (see the \f[B]TTY MODE\f[R] section) are enabled, both are output
495 to \f[B]stdout\f[R].
496 .PP
497 \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
498 issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
499 write to \f[B]stdout\f[R], so if \f[B]stdout\f[R] is closed, as in
500 \f[B]bc >&-\f[R], it will quit with an error.
501 This is done so that bc(1) can report problems when \f[B]stdout\f[R] is
502 redirected to a file.
503 .PP
506 redirect \f[B]stdout\f[R] to \f[B]/dev/null\f[R].
507 .SH STDERR
508 Any error output is written to \f[B]stderr\f[R].
509 .PP
510 \f[B]Note\f[R]: Unlike other bc(1) implementations, this bc(1) will
511 issue a fatal error (see the \f[B]EXIT STATUS\f[R] section) if it cannot
512 write to \f[B]stderr\f[R], so if \f[B]stderr\f[R] is closed, as in
513 \f[B]bc 2>&-\f[R], it will quit with an error.
515 \f[B]stderr\f[R] is redirected to a file.
516 .PP
519 redirect \f[B]stderr\f[R] to \f[B]/dev/null\f[R].
520 .SH SYNTAX
521 The syntax for bc(1) programs is mostly C-like, with some differences.
522 This bc(1) follows the POSIX standard (see the \f[B]STANDARDS\f[R]
524 bc(1) accepts.
526 extensions to the standard.
527 .PP
528 In the sections below, \f[B]E\f[R] means expression, \f[B]S\f[R] means
529 statement, and \f[B]I\f[R] means identifier.
530 .PP
531 Identifiers (\f[B]I\f[R]) start with a lowercase letter and can be
532 followed by any number (up to \f[B]BC_NAME_MAX-1\f[R]) of lowercase
533 letters (\f[B]a-z\f[R]), digits (\f[B]0-9\f[R]), and underscores
534 (\f[B]_\f[R]).
535 The regex is \f[B][a-z][a-z0-9_]*\f[R].
537 \f[B]non-portable extension\f[R].
538 .PP
539 \f[B]ibase\f[R] is a global variable determining how to interpret
540 constant numbers.
542 input numbers.
543 \f[B]ibase\f[R] is initially \f[B]10\f[R].
544 If the \f[B]-s\f[R] (\f[B]--standard\f[R]) and \f[B]-w\f[R]
545 (\f[B]--warn\f[R]) flags were not given on the command line, the max
546 allowable value for \f[B]ibase\f[R] is \f[B]36\f[R].
547 Otherwise, it is \f[B]16\f[R].
548 The min allowable value for \f[B]ibase\f[R] is \f[B]2\f[R].
549 The max allowable value for \f[B]ibase\f[R] can be queried in bc(1)
550 programs with the \f[B]maxibase()\f[R] built-in function.
551 .PP
552 \f[B]obase\f[R] is a global variable determining how to output results.
554 numbers.
555 \f[B]obase\f[R] is initially \f[B]10\f[R].
556 The max allowable value for \f[B]obase\f[R] is \f[B]BC_BASE_MAX\f[R] and
557 can be queried in bc(1) programs with the \f[B]maxobase()\f[R] built-in
558 function.
559 The min allowable value for \f[B]obase\f[R] is \f[B]0\f[R].
560 If \f[B]obase\f[R] is \f[B]0\f[R], values are output in scientific
561 notation, and if \f[B]obase\f[R] is \f[B]1\f[R], values are output in
562 engineering notation.
563 Otherwise, values are output in the specified base.
564 .PP
566 extensions\f[R].
567 .PP
568 The \f[I]scale\f[R] of an expression is the number of digits in the
569 result of the expression right of the decimal point, and \f[B]scale\f[R]
571 exceptions.
572 \f[B]scale\f[R] is initially \f[B]0\f[R].
573 \f[B]scale\f[R] cannot be negative.
574 The max allowable value for \f[B]scale\f[R] is \f[B]BC_SCALE_MAX\f[R]
575 and can be queried in bc(1) programs with the \f[B]maxscale()\f[R]
576 built-in function.
577 .PP
578 bc(1) has both \f[I]global\f[R] variables and \f[I]local\f[R] variables.
579 All \f[I]local\f[R] variables are local to the function; they are
580 parameters or are introduced in the \f[B]auto\f[R] list of a function
581 (see the \f[B]FUNCTIONS\f[R] section).
583 \f[B]auto\f[R] list, it is assumed to be \f[I]global\f[R].
584 If a parent function has a \f[I]local\f[R] variable version of a
585 variable that a child function considers \f[I]global\f[R], the value of
586 that \f[I]global\f[R] variable in the child function is the value of the
588 \f[I]global\f[R] variable.
589 .PP
590 All of the above applies to arrays as well.
591 .PP
592 The value of a statement that is an expression (i.e., any of the named
594 operator is an assignment operator \f[I]and\f[R] the expression is
595 notsurrounded by parentheses.
596 .PP
598 \f[B]last\f[R].
599 A single dot (\f[B].\f[R]) may also be used as a synonym for
600 \f[B]last\f[R].
601 These are \f[B]non-portable extensions\f[R].
602 .PP
603 Either semicolons or newlines may separate statements.
604 .SS Comments
606 .IP "1." 3
607 Block comments are enclosed in \f[B]/*\f[R] and \f[B]*/\f[R].
608 .IP "2." 3
609 Line comments go from \f[B]#\f[R] until, and not including, the next
610 newline.
611 This is a \f[B]non-portable extension\f[R].
612 .SS Named Expressions
614 .IP "1." 3
615 Variables: \f[B]I\f[R]
616 .IP "2." 3
617 Array Elements: \f[B]I[E]\f[R]
618 .IP "3." 3
619 \f[B]ibase\f[R]
620 .IP "4." 3
621 \f[B]obase\f[R]
622 .IP "5." 3
623 \f[B]scale\f[R]
624 .IP "6." 3
625 \f[B]seed\f[R]
626 .IP "7." 3
627 \f[B]last\f[R] or a single dot (\f[B].\f[R])
628 .PP
629 Numbers 6 and 7 are \f[B]non-portable extensions\f[R].
630 .PP
631 The meaning of \f[B]seed\f[R] is dependent on the current pseudo-random
633 versions.
634 .PP
635 The \f[I]scale\f[R] and sign of the value may be significant.
636 .PP
637 If a previously used \f[B]seed\f[R] value is assigned to \f[B]seed\f[R]
640 \f[B]seed\f[R] value was previously used.
641 .PP
642 The exact value assigned to \f[B]seed\f[R] is not guaranteed to be
643 returned if \f[B]seed\f[R] is queried again immediately.
644 However, if \f[B]seed\f[R] \f[I]does\f[R] return a different value, both
645 values, when assigned to \f[B]seed\f[R], are guaranteed to produce the
646 same sequence of pseudo-random numbers.
647 This means that certain values assigned to \f[B]seed\f[R] will
648 \f[I]not\f[R] produce unique sequences of pseudo-random numbers.
649 The value of \f[B]seed\f[R] will change after any use of the
650 \f[B]rand()\f[R] and \f[B]irand(E)\f[R] operands (see the
651 \f[I]Operands\f[R] subsection below), except if the parameter passed to
652 \f[B]irand(E)\f[R] is \f[B]0\f[R], \f[B]1\f[R], or negative.
653 .PP
655 or \f[I]scale\f[R] of the value that can be assigned to \f[B]seed\f[R].
656 .PP
658 same as variables.
659 This also applies to functions (see the \f[B]FUNCTIONS\f[R] section), so
662 or not.
663 .PP
665 \f[B]increment\f[R]/\f[B]decrement\f[R] operators and as the left side
666 of \f[B]assignment\f[R] operators (see the \f[I]Operators\f[R]
667 subsection).
668 .SS Operands
670 .IP " 1." 4
671 Numbers (see the \f[I]Numbers\f[R] subsection below).
672 .IP " 2." 4
673 Array indices (\f[B]I[E]\f[R]).
674 .IP " 3." 4
675 \f[B](E)\f[R]: The value of \f[B]E\f[R] (used to change precedence).
676 .IP " 4." 4
677 \f[B]sqrt(E)\f[R]: The square root of \f[B]E\f[R].
678 \f[B]E\f[R] must be non-negative.
679 .IP " 5." 4
680 \f[B]length(E)\f[R]: The number of significant decimal digits in
681 \f[B]E\f[R].
682 Returns \f[B]1\f[R] for \f[B]0\f[R] with no decimal places.
683 If given a string, the length of the string is returned.
684 Passing a string to \f[B]length(E)\f[R] is a \f[B]non-portable
685 extension\f[R].
686 .IP " 6." 4
687 \f[B]length(I[])\f[R]: The number of elements in the array \f[B]I\f[R].
688 This is a \f[B]non-portable extension\f[R].
689 .IP " 7." 4
690 \f[B]scale(E)\f[R]: The \f[I]scale\f[R] of \f[B]E\f[R].
691 .IP " 8." 4
692 \f[B]abs(E)\f[R]: The absolute value of \f[B]E\f[R].
693 This is a \f[B]non-portable extension\f[R].
694 .IP " 9." 4
695 \f[B]is_number(E)\f[R]: \f[B]1\f[R] if the given argument is a number,
696 \f[B]0\f[R] if it is a string.
697 This is a \f[B]non-portable extension\f[R].
698 .IP "10." 4
699 \f[B]is_string(E)\f[R]: \f[B]1\f[R] if the given argument is a string,
700 \f[B]0\f[R] if it is a number.
701 This is a \f[B]non-portable extension\f[R].
702 .IP "11." 4
703 \f[B]modexp(E, E, E)\f[R]: Modular exponentiation, where the first
705 modulus.
706 All three values must be integers.
707 The second argument must be non-negative.
708 The third argument must be non-zero.
709 This is a \f[B]non-portable extension\f[R].
710 .IP "12." 4
711 \f[B]divmod(E, E, I[])\f[R]: Division and modulus in one operation.
712 This is for optimization.
714 which must be non-zero.
716 \f[B]0\f[R] of the provided array (the last argument).
717 This is a \f[B]non-portable extension\f[R].
718 .IP "13." 4
719 \f[B]asciify(E)\f[R]: If \f[B]E\f[R] is a string, returns a string that
720 is the first letter of its argument.
721 If it is a number, calculates the number mod \f[B]256\f[R] and returns
722 that number as a one-character string.
723 This is a \f[B]non-portable extension\f[R].
724 .IP "14." 4
725 \f[B]asciify(I[])\f[R]: A string that is made up of the characters that
726 would result from running \f[B]asciify(E)\f[R] on each element of the
727 array identified by the argument.
728 This allows creating multi-character strings and storing them.
729 This is a \f[B]non-portable extension\f[R].
730 .IP "15." 4
731 \f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
732 \f[B]I\f[R] is an identifier for a non-\f[B]void\f[R] function (see the
733 \f[I]Void Functions\f[R] subsection of the \f[B]FUNCTIONS\f[R] section).
734 The \f[B]E\f[R] argument(s) may also be arrays of the form
735 \f[B]I[]\f[R], which will automatically be turned into array references
736 (see the \f[I]Array References\f[R] subsection of the
737 \f[B]FUNCTIONS\f[R] section) if the corresponding parameter in the
738 function definition is an array reference.
739 .IP "16." 4
740 \f[B]read()\f[R]: Reads a line from \f[B]stdin\f[R] and uses that as an
741 expression.
742 The result of that expression is the result of the \f[B]read()\f[R]
743 operand.
744 This is a \f[B]non-portable extension\f[R].
745 .IP "17." 4
746 \f[B]maxibase()\f[R]: The max allowable \f[B]ibase\f[R].
747 This is a \f[B]non-portable extension\f[R].
748 .IP "18." 4
749 \f[B]maxobase()\f[R]: The max allowable \f[B]obase\f[R].
750 This is a \f[B]non-portable extension\f[R].
751 .IP "19." 4
752 \f[B]maxscale()\f[R]: The max allowable \f[B]scale\f[R].
753 This is a \f[B]non-portable extension\f[R].
754 .IP "20." 4
755 \f[B]line_length()\f[R]: The line length set with
756 \f[B]BC_LINE_LENGTH\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
757 section).
758 This is a \f[B]non-portable extension\f[R].
759 .IP "21." 4
760 \f[B]global_stacks()\f[R]: \f[B]0\f[R] if global stacks are not enabled
761 with the \f[B]-g\f[R] or \f[B]--global-stacks\f[R] options, non-zero
762 otherwise.
763 See the \f[B]OPTIONS\f[R] section.
764 This is a \f[B]non-portable extension\f[R].
765 .IP "22." 4
766 \f[B]leading_zero()\f[R]: \f[B]0\f[R] if leading zeroes are not enabled
767 with the \f[B]-z\f[R] or \f[B]\[en]leading-zeroes\f[R] options, non-zero
768 otherwise.
769 See the \f[B]OPTIONS\f[R] section.
770 This is a \f[B]non-portable extension\f[R].
771 .IP "23." 4
772 \f[B]rand()\f[R]: A pseudo-random integer between \f[B]0\f[R]
773 (inclusive) and \f[B]BC_RAND_MAX\f[R] (inclusive).
774 Using this operand will change the value of \f[B]seed\f[R].
775 This is a \f[B]non-portable extension\f[R].
776 .IP "24." 4
777 \f[B]irand(E)\f[R]: A pseudo-random integer between \f[B]0\f[R]
778 (inclusive) and the value of \f[B]E\f[R] (exclusive).
779 If \f[B]E\f[R] is negative or is a non-integer (\f[B]E\f[R]\[cq]s
780 \f[I]scale\f[R] is not \f[B]0\f[R]), an error is raised, and bc(1)
781 resets (see the \f[B]RESET\f[R] section) while \f[B]seed\f[R] remains
782 unchanged.
783 If \f[B]E\f[R] is larger than \f[B]BC_RAND_MAX\f[R], the higher bound is
785 by appropriate powers of \f[B]BC_RAND_MAX+1\f[R], and adding them
786 together.
788 unbounded.
789 Using this operand will change the value of \f[B]seed\f[R], unless the
790 value of \f[B]E\f[R] is \f[B]0\f[R] or \f[B]1\f[R].
791 In that case, \f[B]0\f[R] is returned, and \f[B]seed\f[R] is
792 \f[I]not\f[R] changed.
793 This is a \f[B]non-portable extension\f[R].
794 .IP "25." 4
795 \f[B]maxrand()\f[R]: The max integer returned by \f[B]rand()\f[R].
796 This is a \f[B]non-portable extension\f[R].
797 .PP
798 The integers generated by \f[B]rand()\f[R] and \f[B]irand(E)\f[R] are
800 the pseudo-random number generator.
801 .PP
802 \f[B]Note\f[R]: The values returned by the pseudo-random number
803 generator with \f[B]rand()\f[R] and \f[B]irand(E)\f[R] are guaranteed to
804 \f[I]NOT\f[R] be cryptographically secure.
805 This is a consequence of using a seeded pseudo-random number generator.
806 However, they \f[I]are\f[R] guaranteed to be reproducible with identical
807 \f[B]seed\f[R] values.
810 \f[I]ESSENTIAL\f[R].
811 In any other case, use a non-seeded pseudo-random number generator.
812 .SS Numbers
814 \f[B]1\f[R] period for a radix.
815 Numbers can have up to \f[B]BC_NUM_MAX\f[R] digits.
816 Uppercase letters are equal to \f[B]9\f[R] plus their position in the
817 alphabet, starting from \f[B]1\f[R] (i.e., \f[B]A\f[R] equals
818 \f[B]10\f[R], or \f[B]9+1\f[R]).
819 .PP
821 \f[B]ibase\f[R] (i.e., they are greater than or equal to the current
822 value of \f[B]ibase\f[R]), then the behavior depends on the existence of
823 the \f[B]-c\f[R]/\f[B]--digit-clamp\f[R] or
824 \f[B]-C\f[R]/\f[B]--no-digit-clamp\f[R] options (see the
825 \f[B]OPTIONS\f[R] section), the existence and setting of the
826 \f[B]BC_DIGIT_CLAMP\f[R] environment variable (see the \f[B]ENVIRONMENT
827 VARIABLES\f[R] section), or the default, which can be queried with the
828 \f[B]-h\f[R]/\f[B]--help\f[R] option.
829 .PP
831 equal to the current value of \f[B]ibase\f[R] are not changed.
833 \f[B]ibase\f[R] and added into the number.
834 This means that, with an \f[B]ibase\f[R] of \f[B]3\f[R], the number
835 \f[B]AB\f[R] is equal to \f[B]3\[ha]1*A+3\[ha]0*B\f[R], which is
836 \f[B]3\f[R] times \f[B]10\f[R] plus \f[B]11\f[R], or \f[B]41\f[R].
837 .PP
839 to the current value of \f[B]ibase\f[R] are set to the value of the
840 highest valid digit in \f[B]ibase\f[R] before being multiplied by the
841 appropriate power of \f[B]ibase\f[R] and added into the number.
842 This means that, with an \f[B]ibase\f[R] of \f[B]3\f[R], the number
843 \f[B]AB\f[R] is equal to \f[B]3\[ha]1*2+3\[ha]0*2\f[R], which is
844 \f[B]3\f[R] times \f[B]2\f[R] plus \f[B]2\f[R], or \f[B]8\f[R].
845 .PP
846 There is one exception to clamping: single-character numbers (i.e.,
847 \f[B]A\f[R] alone).
849 in the highest possible \f[B]ibase\f[R].
850 This means that \f[B]A\f[R] alone always equals decimal \f[B]10\f[R] and
851 \f[B]Z\f[R] alone always equals decimal \f[B]35\f[R].
853 and is meant to provide an easy way to set the current \f[B]ibase\f[R]
854 (with the \f[B]i\f[R] command) regardless of the current value of
855 \f[B]ibase\f[R].
856 .PP
858 leading zero, i.e., for \f[B]A\f[R], use \f[B]0A\f[R].
859 .PP
860 In addition, bc(1) accepts numbers in scientific notation.
861 These have the form \f[B]<number>e<integer>\f[R].
862 The exponent (the portion after the \f[B]e\f[R]) must be an integer.
863 An example is \f[B]1.89237e9\f[R], which is equal to
864 \f[B]1892370000\f[R].
865 Negative exponents are also allowed, so \f[B]4.2890e-3\f[R] is equal to
866 \f[B]0.0042890\f[R].
867 .PP
868 Using scientific notation is an error or warning if the \f[B]-s\f[R] or
869 \f[B]-w\f[R], respectively, command-line options (or equivalents) are
870 given.
871 .PP
872 \f[B]WARNING\f[R]: Both the number and the exponent in scientific
873 notation are interpreted according to the current \f[B]ibase\f[R], but
874 the number is still multiplied by \f[B]10\[ha]exponent\f[R] regardless
875 of the current \f[B]ibase\f[R].
876 For example, if \f[B]ibase\f[R] is \f[B]16\f[R] and bc(1) is given the
877 number string \f[B]FFeA\f[R], the resulting decimal number will be
878 \f[B]2550000000000\f[R], and if bc(1) is given the number string
879 \f[B]10e-4\f[R], the resulting decimal number will be \f[B]0.0016\f[R].
880 .PP
882 extension\f[R].
883 .SS Operators
884 The following arithmetic and logical operators can be used.
885 They are listed in order of decreasing precedence.
886 Operators in the same group have the same precedence.
887 .TP
888 \f[B]++\f[R] \f[B]--\f[R]
890 .RS
891 .PP
893 .PP
894 Description: \f[B]increment\f[R], \f[B]decrement\f[R]
895 .RE
896 .TP
897 \f[B]-\f[R] \f[B]!\f[R]
899 .RS
900 .PP
902 .PP
903 Description: \f[B]negation\f[R], \f[B]boolean not\f[R]
904 .RE
905 .TP
906 \f[B]$\f[R]
908 .RS
909 .PP
911 .PP
912 Description: \f[B]truncation\f[R]
913 .RE
914 .TP
915 \f[B]\[at]\f[R]
917 .RS
918 .PP
920 .PP
921 Description: \f[B]set precision\f[R]
922 .RE
923 .TP
924 \f[B]\[ha]\f[R]
926 .RS
927 .PP
929 .PP
930 Description: \f[B]power\f[R]
931 .RE
932 .TP
933 \f[B]*\f[R] \f[B]/\f[R] \f[B]%\f[R]
935 .RS
936 .PP
938 .PP
939 Description: \f[B]multiply\f[R], \f[B]divide\f[R], \f[B]modulus\f[R]
940 .RE
941 .TP
942 \f[B]+\f[R] \f[B]-\f[R]
944 .RS
945 .PP
947 .PP
948 Description: \f[B]add\f[R], \f[B]subtract\f[R]
949 .RE
950 .TP
951 \f[B]<<\f[R] \f[B]>>\f[R]
953 .RS
954 .PP
956 .PP
957 Description: \f[B]shift left\f[R], \f[B]shift right\f[R]
958 .RE
959 .TP
960 \f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
962 .RS
963 .PP
965 .PP
966 Description: \f[B]assignment\f[R]
967 .RE
968 .TP
969 \f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
971 .RS
972 .PP
974 .PP
975 Description: \f[B]relational\f[R]
976 .RE
977 .TP
978 \f[B]&&\f[R]
980 .RS
981 .PP
983 .PP
984 Description: \f[B]boolean and\f[R]
985 .RE
986 .TP
987 \f[B]||\f[R]
989 .RS
990 .PP
992 .PP
993 Description: \f[B]boolean or\f[R]
994 .RE
995 .PP
996 The operators will be described in more detail below.
997 .TP
998 \f[B]++\f[R] \f[B]--\f[R]
999 The prefix and postfix \f[B]increment\f[R] and \f[B]decrement\f[R]
1000 operators behave exactly like they would in C. They require a named
1001 expression (see the \f[I]Named Expressions\f[R] subsection) as an
1002 operand.
1003 .RS
1004 .PP
1006 where possible.
1007 .RE
1008 .TP
1009 \f[B]-\f[R]
1010 The \f[B]negation\f[R] operator returns \f[B]0\f[R] if a user attempts
1011 to negate any expression with the value \f[B]0\f[R].
1012 Otherwise, a copy of the expression with its sign flipped is returned.
1013 .TP
1014 \f[B]!\f[R]
1015 The \f[B]boolean not\f[R] operator returns \f[B]1\f[R] if the expression
1016 is \f[B]0\f[R], or \f[B]0\f[R] otherwise.
1017 .RS
1018 .PP
1019 This is a \f[B]non-portable extension\f[R].
1020 .RE
1021 .TP
1022 \f[B]$\f[R]
1023 The \f[B]truncation\f[R] operator returns a copy of the given expression
1024 with all of its \f[I]scale\f[R] removed.
1025 .RS
1026 .PP
1027 This is a \f[B]non-portable extension\f[R].
1028 .RE
1029 .TP
1030 \f[B]\[at]\f[R]
1031 The \f[B]set precision\f[R] operator takes two expressions and returns a
1032 copy of the first with its \f[I]scale\f[R] equal to the value of the
1033 second expression.
1035 the \f[I]scale\f[R] of the first expression matches the value of the
1037 more).
1038 .RS
1039 .PP
1040 The second expression must be an integer (no \f[I]scale\f[R]) and
1041 non-negative.
1042 .PP
1043 This is a \f[B]non-portable extension\f[R].
1044 .RE
1045 .TP
1046 \f[B]\[ha]\f[R]
1047 The \f[B]power\f[R] operator (not the \f[B]exclusive or\f[R] operator,
1049 power of the value of the second.
1050 The \f[I]scale\f[R] of the result is equal to \f[B]scale\f[R].
1051 .RS
1052 .PP
1053 The second expression must be an integer (no \f[I]scale\f[R]), and if it
1054 is negative, the first value must be non-zero.
1055 .RE
1056 .TP
1057 \f[B]*\f[R]
1058 The \f[B]multiply\f[R] operator takes two expressions, multiplies them,
1059 and returns the product.
1060 If \f[B]a\f[R] is the \f[I]scale\f[R] of the first expression and
1061 \f[B]b\f[R] is the \f[I]scale\f[R] of the second expression, the
1062 \f[I]scale\f[R] of the result is equal to
1063 \f[B]min(a+b,max(scale,a,b))\f[R] where \f[B]min()\f[R] and
1064 \f[B]max()\f[R] return the obvious values.
1065 .TP
1066 \f[B]/\f[R]
1067 The \f[B]divide\f[R] operator takes two expressions, divides them, and
1068 returns the quotient.
1069 The \f[I]scale\f[R] of the result shall be the value of \f[B]scale\f[R].
1070 .RS
1071 .PP
1072 The second expression must be non-zero.
1073 .RE
1074 .TP
1075 \f[B]%\f[R]
1076 The \f[B]modulus\f[R] operator takes two expressions, \f[B]a\f[R] and
1077 \f[B]b\f[R], and evaluates them by 1) Computing \f[B]a/b\f[R] to current
1078 \f[B]scale\f[R] and 2) Using the result of step 1 to calculate
1079 \f[B]a-(a/b)*b\f[R] to \f[I]scale\f[R]
1080 \f[B]max(scale+scale(b),scale(a))\f[R].
1081 .RS
1082 .PP
1083 The second expression must be non-zero.
1084 .RE
1085 .TP
1086 \f[B]+\f[R]
1087 The \f[B]add\f[R] operator takes two expressions, \f[B]a\f[R] and
1088 \f[B]b\f[R], and returns the sum, with a \f[I]scale\f[R] equal to the
1089 max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
1090 .TP
1091 \f[B]-\f[R]
1092 The \f[B]subtract\f[R] operator takes two expressions, \f[B]a\f[R] and
1093 \f[B]b\f[R], and returns the difference, with a \f[I]scale\f[R] equal to
1094 the max of the \f[I]scale\f[R]s of \f[B]a\f[R] and \f[B]b\f[R].
1095 .TP
1096 \f[B]<<\f[R]
1097 The \f[B]left shift\f[R] operator takes two expressions, \f[B]a\f[R] and
1098 \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
1099 decimal point moved \f[B]b\f[R] places to the right.
1100 .RS
1101 .PP
1102 The second expression must be an integer (no \f[I]scale\f[R]) and
1103 non-negative.
1104 .PP
1105 This is a \f[B]non-portable extension\f[R].
1106 .RE
1107 .TP
1108 \f[B]>>\f[R]
1109 The \f[B]right shift\f[R] operator takes two expressions, \f[B]a\f[R]
1110 and \f[B]b\f[R], and returns a copy of the value of \f[B]a\f[R] with its
1111 decimal point moved \f[B]b\f[R] places to the left.
1112 .RS
1113 .PP
1114 The second expression must be an integer (no \f[I]scale\f[R]) and
1115 non-negative.
1116 .PP
1117 This is a \f[B]non-portable extension\f[R].
1118 .RE
1119 .TP
1120 \f[B]=\f[R] \f[B]<<=\f[R] \f[B]>>=\f[R] \f[B]+=\f[R] \f[B]-=\f[R] \f[B]*=\f[R] \f[B]/=\f[R] \f[B]%=\f[R] \f[B]\[ha]=\f[R] \f[B]\[at]=\f[R]
1121 The \f[B]assignment\f[R] operators take two expressions, \f[B]a\f[R] and
1122 \f[B]b\f[R] where \f[B]a\f[R] is a named expression (see the \f[I]Named
1123 Expressions\f[R] subsection).
1124 .RS
1125 .PP
1126 For \f[B]=\f[R], \f[B]b\f[R] is copied and the result is assigned to
1127 \f[B]a\f[R].
1128 For all others, \f[B]a\f[R] and \f[B]b\f[R] are applied as operands to
1130 \f[B]a\f[R].
1131 .PP
1132 The \f[B]assignment\f[R] operators that correspond to operators that are
1133 extensions are themselves \f[B]non-portable extensions\f[R].
1134 .RE
1135 .TP
1136 \f[B]==\f[R] \f[B]<=\f[R] \f[B]>=\f[R] \f[B]!=\f[R] \f[B]<\f[R] \f[B]>\f[R]
1137 The \f[B]relational\f[R] operators compare two expressions, \f[B]a\f[R]
1138 and \f[B]b\f[R], and if the relation holds, according to C language
1139 semantics, the result is \f[B]1\f[R].
1140 Otherwise, it is \f[B]0\f[R].
1141 .RS
1142 .PP
1144 \f[B]assignment\f[R] operators, which means that \f[B]a=b>c\f[R] is
1145 interpreted as \f[B](a=b)>c\f[R].
1146 .PP
1147 Also, unlike the standard (see the \f[B]STANDARDS\f[R] section)
1149 be used.
1150 This allowance is a \f[B]non-portable extension\f[R].
1151 .RE
1152 .TP
1153 \f[B]&&\f[R]
1154 The \f[B]boolean and\f[R] operator takes two expressions and returns
1155 \f[B]1\f[R] if both expressions are non-zero, \f[B]0\f[R] otherwise.
1156 .RS
1157 .PP
1158 This is \f[I]not\f[R] a short-circuit operator.
1159 .PP
1160 This is a \f[B]non-portable extension\f[R].
1161 .RE
1162 .TP
1163 \f[B]||\f[R]
1164 The \f[B]boolean or\f[R] operator takes two expressions and returns
1165 \f[B]1\f[R] if one of the expressions is non-zero, \f[B]0\f[R]
1166 otherwise.
1167 .RS
1168 .PP
1169 This is \f[I]not\f[R] a short-circuit operator.
1170 .PP
1171 This is a \f[B]non-portable extension\f[R].
1172 .RE
1173 .SS Statements
1175 .IP " 1." 4
1176 \f[B]E\f[R]
1177 .IP " 2." 4
1178 \f[B]{\f[R] \f[B]S\f[R] \f[B];\f[R] \&...
1179 \f[B];\f[R] \f[B]S\f[R] \f[B]}\f[R]
1180 .IP " 3." 4
1181 \f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
1182 .IP " 4." 4
1183 \f[B]if\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
1184 \f[B]else\f[R] \f[B]S\f[R]
1185 .IP " 5." 4
1186 \f[B]while\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
1187 .IP " 6." 4
1188 \f[B]for\f[R] \f[B](\f[R] \f[B]E\f[R] \f[B];\f[R] \f[B]E\f[R]
1189 \f[B];\f[R] \f[B]E\f[R] \f[B])\f[R] \f[B]S\f[R]
1190 .IP " 7." 4
1192 .IP " 8." 4
1193 \f[B]break\f[R]
1194 .IP " 9." 4
1195 \f[B]continue\f[R]
1196 .IP "10." 4
1197 \f[B]quit\f[R]
1198 .IP "11." 4
1199 \f[B]halt\f[R]
1200 .IP "12." 4
1201 \f[B]limits\f[R]
1202 .IP "13." 4
1204 .IP "14." 4
1205 \f[B]print\f[R] \f[B]E\f[R] \f[B],\f[R] \&...
1206 \f[B],\f[R] \f[B]E\f[R]
1207 .IP "15." 4
1208 \f[B]stream\f[R] \f[B]E\f[R] \f[B],\f[R] \&...
1209 \f[B],\f[R] \f[B]E\f[R]
1210 .IP "16." 4
1211 \f[B]I()\f[R], \f[B]I(E)\f[R], \f[B]I(E, E)\f[R], and so on, where
1212 \f[B]I\f[R] is an identifier for a \f[B]void\f[R] function (see the
1213 \f[I]Void Functions\f[R] subsection of the \f[B]FUNCTIONS\f[R] section).
1214 The \f[B]E\f[R] argument(s) may also be arrays of the form
1215 \f[B]I[]\f[R], which will automatically be turned into array references
1216 (see the \f[I]Array References\f[R] subsection of the
1217 \f[B]FUNCTIONS\f[R] section) if the corresponding parameter in the
1218 function definition is an array reference.
1219 .PP
1221 extensions\f[R].
1222 .PP
1223 Also, as a \f[B]non-portable extension\f[R], any or all of the
1224 expressions in the header of a for loop may be omitted.
1226 constant \f[B]1\f[R].
1227 .PP
1228 The \f[B]break\f[R] statement causes a loop to stop iterating and resume
1229 execution immediately following a loop.
1230 This is only allowed in loops.
1231 .PP
1232 The \f[B]continue\f[R] statement causes a loop iteration to stop early
1234 condition.
1235 This is only allowed in loops.
1236 .PP
1237 The \f[B]if\f[R] \f[B]else\f[R] statement does the same thing as in C.
1238 .PP
1239 The \f[B]quit\f[R] statement causes bc(1) to quit, even if it is on a
1240 branch that will not be executed (it is a compile-time command).
1241 .PP
1242 \f[B]Warning\f[R]: The behavior of this bc(1) on \f[B]quit\f[R] is
1243 slightly different from other bc(1) implementations.
1245 line that a \f[B]quit\f[R] command is on.
1247 occur before the \f[B]quit\f[R] statement before exiting.
1248 .PP
1250 .IP
1251 .EX
1253 .EE
1254 .PP
1256 print \f[B]0\f[R], \f[B]1\f[R], and \f[B]2\f[R] on successive lines
1257 before exiting.
1258 .PP
1259 The \f[B]halt\f[R] statement causes bc(1) to quit, if it is executed.
1260 (Unlike \f[B]quit\f[R] if it is on a branch of an \f[B]if\f[R] statement
1261 that is not executed, bc(1) does not quit.)
1262 .PP
1263 The \f[B]limits\f[R] statement prints the limits that this bc(1) is
1264 subject to.
1265 This is like the \f[B]quit\f[R] statement in that it is a compile-time
1266 command.
1267 .PP
1268 An expression by itself is evaluated and printed, followed by a newline.
1269 .PP
1271 printing the results of expressions.
1272 Scientific notation is activated by assigning \f[B]0\f[R] to
1273 \f[B]obase\f[R], and engineering notation is activated by assigning
1274 \f[B]1\f[R] to \f[B]obase\f[R].
1275 To deactivate them, just assign a different value to \f[B]obase\f[R].
1276 .PP
1278 run with either the \f[B]-s\f[R] or \f[B]-w\f[R] command-line options
1279 (or equivalents).
1280 .PP
1282 \f[B]non-portable extension\f[R].
1283 .SS Strings
1285 a trailing newline.
1286 .PP
1288 be assigned to variables and array elements.
1289 They can also be passed to functions in variable parameters.
1290 .PP
1293 string.
1294 .PP
1297 resets (see the \f[B]RESET\f[R] section).
1298 .PP
1300 functions are \f[B]non-portable extensions\f[R].
1301 .SS Print Statement
1302 The \[lq]expressions\[rq] in a \f[B]print\f[R] statement may also be
1303 strings.
1305 specially.
1308 .PP
1309 \f[B]\[rs]a\f[R]: \f[B]\[rs]a\f[R]
1310 .PP
1311 \f[B]\[rs]b\f[R]: \f[B]\[rs]b\f[R]
1312 .PP
1313 \f[B]\[rs]\[rs]\f[R]: \f[B]\[rs]\f[R]
1314 .PP
1315 \f[B]\[rs]e\f[R]: \f[B]\[rs]\f[R]
1316 .PP
1317 \f[B]\[rs]f\f[R]: \f[B]\[rs]f\f[R]
1318 .PP
1319 \f[B]\[rs]n\f[R]: \f[B]\[rs]n\f[R]
1320 .PP
1321 \f[B]\[rs]q\f[R]: \f[B]\[lq]\f[R]
1322 .PP
1323 \f[B]\[rs]r\f[R]: \f[B]\[rs]r\f[R]
1324 .PP
1325 \f[B]\[rs]t\f[R]: \f[B]\[rs]t\f[R]
1326 .PP
1328 character to be printed as-is.
1329 .PP
1331 \f[B]last\f[R], like any other expression that is printed.
1332 .SS Stream Statement
1333 The expressions in a \f[B]stream\f[R] statement may also be strings.
1334 .PP
1335 If a \f[B]stream\f[R] statement is given a string, it prints the string
1336 as though the string had appeared as its own statement.
1337 In other words, the \f[B]stream\f[R] statement prints strings normally,
1338 without a newline.
1339 .PP
1340 If a \f[B]stream\f[R] statement is given a number, a copy of it is
1341 truncated and its absolute value is calculated.
1342 The result is then printed as though \f[B]obase\f[R] is \f[B]256\f[R]
1343 and each digit is interpreted as an 8-bit ASCII character, making it a
1344 byte stream.
1345 .SS Order of Evaluation
1347 necessary to maintain order of operations.
1348 This means, for example, assuming that \f[B]i\f[R] is equal to
1349 \f[B]0\f[R], in the expression
1350 .IP
1351 .EX
1353 .EE
1354 .PP
1355 the first (or 0th) element of \f[B]a\f[R] is set to \f[B]1\f[R], and
1356 \f[B]i\f[R] is equal to \f[B]2\f[R] at the end of the expression.
1357 .PP
1358 This includes function arguments.
1359 Thus, assuming \f[B]i\f[R] is equal to \f[B]0\f[R], this means that in
1361 .IP
1362 .EX
1364 .EE
1365 .PP
1366 the first argument passed to \f[B]x()\f[R] is \f[B]0\f[R], and the
1367 second argument is \f[B]1\f[R], while \f[B]i\f[R] is equal to
1368 \f[B]2\f[R] before the function starts executing.
1369 .SH FUNCTIONS
1371 .IP
1372 .EX
1373 define I(I,...,I){
1374 auto I,...,I
1375 S;...;S
1378 .EE
1379 .PP
1380 Any \f[B]I\f[R] in the parameter list or \f[B]auto\f[R] list may be
1381 replaced with \f[B]I[]\f[R] to make a parameter or \f[B]auto\f[R] var an
1382 array, and any \f[B]I\f[R] in the parameter list may be replaced with
1383 \f[B]*I[]\f[R] to make a parameter an array reference.
1385 asterisk in the call; they must be called with just \f[B]I[]\f[R] like
1387 references.
1388 .PP
1389 As a \f[B]non-portable extension\f[R], the opening brace of a
1390 \f[B]define\f[R] statement may appear on the next line.
1391 .PP
1392 As a \f[B]non-portable extension\f[R], the return statement may also be
1394 .IP "1." 3
1395 \f[B]return\f[R]
1396 .IP "2." 3
1397 \f[B]return\f[R] \f[B](\f[R] \f[B])\f[R]
1398 .IP "3." 3
1399 \f[B]return\f[R] \f[B]E\f[R]
1400 .PP
1401 The first two, or not specifying a \f[B]return\f[R] statement, is
1402 equivalent to \f[B]return (0)\f[R], unless the function is a
1403 \f[B]void\f[R] function (see the \f[I]Void Functions\f[R] subsection
1404 below).
1405 .SS Void Functions
1406 Functions can also be \f[B]void\f[R] functions, defined as follows:
1407 .IP
1408 .EX
1409 define void I(I,...,I){
1410 auto I,...,I
1411 S;...;S
1414 .EE
1415 .PP
1417 expression would be printed alone, except in a print statement.
1418 .PP
1419 Void functions can only use the first two \f[B]return\f[R] statements
1420 listed above.
1421 They can also omit the return statement entirely.
1422 .PP
1424 possible to have variables, arrays, and functions named \f[B]void\f[R].
1426 \f[B]define\f[R] keyword.
1427 .PP
1428 This is a \f[B]non-portable extension\f[R].
1429 .SS Array References
1432 .IP
1433 .EX
1435 .EE
1436 .PP
1437 it is a \f[B]reference\f[R].
1439 function returns, to the array that was passed in.
1440 .PP
1441 Other than this, all function arguments are passed by value.
1442 .PP
1443 This is a \f[B]non-portable extension\f[R].
1444 .SH LIBRARY
1446 library (see the \f[I]Extended Library\f[R] subsection below), are
1447 available when the \f[B]-l\f[R] or \f[B]--mathlib\f[R] command-line
1449 when the \f[B]-s\f[R] option, the \f[B]-w\f[R] option, or equivalents
1450 are given.
1451 .SS Standard Library
1452 The standard (see the \f[B]STANDARDS\f[R] section) defines the following
1454 .TP
1455 \f[B]s(x)\f[R]
1456 Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
1457 .RS
1458 .PP
1460 Functions\f[R] subsection below).
1461 .RE
1462 .TP
1463 \f[B]c(x)\f[R]
1464 Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
1465 .RS
1466 .PP
1468 Functions\f[R] subsection below).
1469 .RE
1470 .TP
1471 \f[B]a(x)\f[R]
1472 Returns the arctangent of \f[B]x\f[R], in radians.
1473 .RS
1474 .PP
1476 Functions\f[R] subsection below).
1477 .RE
1478 .TP
1479 \f[B]l(x)\f[R]
1480 Returns the natural logarithm of \f[B]x\f[R].
1481 .RS
1482 .PP
1484 Functions\f[R] subsection below).
1485 .RE
1486 .TP
1487 \f[B]e(x)\f[R]
1488 Returns the mathematical constant \f[B]e\f[R] raised to the power of
1489 \f[B]x\f[R].
1490 .RS
1491 .PP
1493 Functions\f[R] subsection below).
1494 .RE
1495 .TP
1496 \f[B]j(x, n)\f[R]
1497 Returns the bessel integer order \f[B]n\f[R] (truncated) of \f[B]x\f[R].
1498 .RS
1499 .PP
1501 Functions\f[R] subsection below).
1502 .RE
1503 .SS Extended Library
1504 The extended library is \f[I]not\f[R] loaded when the
1505 \f[B]-s\f[R]/\f[B]--standard\f[R] or \f[B]-w\f[R]/\f[B]--warn\f[R]
1507 standard (see the \f[B]STANDARDS\f[R] section).
1508 .PP
1509 The extended library is a \f[B]non-portable extension\f[R].
1510 .TP
1511 \f[B]p(x, y)\f[R]
1512 Calculates \f[B]x\f[R] to the power of \f[B]y\f[R], even if \f[B]y\f[R]
1514 \f[B]scale\f[R].
1515 .RS
1516 .PP
1517 It is an error if \f[B]y\f[R] is negative and \f[B]x\f[R] is
1518 \f[B]0\f[R].
1519 .PP
1521 Functions\f[R] subsection below).
1522 .RE
1523 .TP
1524 \f[B]r(x, p)\f[R]
1525 Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
1526 the rounding mode round half away from \f[B]0\f[R]
1527 (https://en.wikipedia.org/wiki/Rounding#Round_half_away_from_zero).
1528 .TP
1529 \f[B]ceil(x, p)\f[R]
1530 Returns \f[B]x\f[R] rounded to \f[B]p\f[R] decimal places according to
1531 the rounding mode round away from \f[B]0\f[R]
1532 (https://en.wikipedia.org/wiki/Rounding#Rounding_away_from_zero).
1533 .TP
1534 \f[B]f(x)\f[R]
1535 Returns the factorial of the truncated absolute value of \f[B]x\f[R].
1536 .TP
1537 \f[B]max(a, b)\f[R]
1538 Returns \f[B]a\f[R] if \f[B]a\f[R] is greater than \f[B]b\f[R];
1539 otherwise, returns \f[B]b\f[R].
1540 .TP
1541 \f[B]min(a, b)\f[R]
1542 Returns \f[B]a\f[R] if \f[B]a\f[R] is less than \f[B]b\f[R]; otherwise,
1543 returns \f[B]b\f[R].
1544 .TP
1545 \f[B]perm(n, k)\f[R]
1546 Returns the permutation of the truncated absolute value of \f[B]n\f[R]
1547 of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
1548 If not, it returns \f[B]0\f[R].
1549 .TP
1550 \f[B]comb(n, k)\f[R]
1551 Returns the combination of the truncated absolute value of \f[B]n\f[R]
1552 of the truncated absolute value of \f[B]k\f[R], if \f[B]k <= n\f[R].
1553 If not, it returns \f[B]0\f[R].
1554 .TP
1555 \f[B]fib(n)\f[R]
1557 \f[B]n\f[R].
1558 .TP
1559 \f[B]l2(x)\f[R]
1560 Returns the logarithm base \f[B]2\f[R] of \f[B]x\f[R].
1561 .RS
1562 .PP
1564 Functions\f[R] subsection below).
1565 .RE
1566 .TP
1567 \f[B]l10(x)\f[R]
1568 Returns the logarithm base \f[B]10\f[R] of \f[B]x\f[R].
1569 .RS
1570 .PP
1572 Functions\f[R] subsection below).
1573 .RE
1574 .TP
1575 \f[B]log(x, b)\f[R]
1576 Returns the logarithm base \f[B]b\f[R] of \f[B]x\f[R].
1577 .RS
1578 .PP
1580 Functions\f[R] subsection below).
1581 .RE
1582 .TP
1583 \f[B]cbrt(x)\f[R]
1584 Returns the cube root of \f[B]x\f[R].
1585 .TP
1586 \f[B]root(x, n)\f[R]
1587 Calculates the truncated value of \f[B]n\f[R], \f[B]r\f[R], and returns
1588 the \f[B]r\f[R]th root of \f[B]x\f[R] to the current \f[B]scale\f[R].
1589 .RS
1590 .PP
1591 If \f[B]r\f[R] is \f[B]0\f[R] or negative, this raises an error and
1592 causes bc(1) to reset (see the \f[B]RESET\f[R] section).
1593 It also raises an error and causes bc(1) to reset if \f[B]r\f[R] is even
1594 and \f[B]x\f[R] is negative.
1595 .RE
1596 .TP
1597 \f[B]gcd(a, b)\f[R]
1599 value of \f[B]a\f[R] and the truncated absolute value of \f[B]b\f[R].
1600 .TP
1601 \f[B]lcm(a, b)\f[R]
1603 \f[B]a\f[R] and the truncated absolute value of \f[B]b\f[R].
1604 .TP
1605 \f[B]pi(p)\f[R]
1606 Returns \f[B]pi\f[R] to \f[B]p\f[R] decimal places.
1607 .RS
1608 .PP
1610 Functions\f[R] subsection below).
1611 .RE
1612 .TP
1613 \f[B]t(x)\f[R]
1614 Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
1615 .RS
1616 .PP
1618 Functions\f[R] subsection below).
1619 .RE
1620 .TP
1621 \f[B]a2(y, x)\f[R]
1622 Returns the arctangent of \f[B]y/x\f[R], in radians.
1623 If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
1624 an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
1625 Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
1626 \f[B]a(y/x)\f[R].
1627 If \f[B]x\f[R] is less than \f[B]0\f[R], and \f[B]y\f[R] is greater than
1628 or equal to \f[B]0\f[R], it returns \f[B]a(y/x)+pi\f[R].
1629 If \f[B]x\f[R] is less than \f[B]0\f[R], and \f[B]y\f[R] is less than
1630 \f[B]0\f[R], it returns \f[B]a(y/x)-pi\f[R].
1631 If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
1632 \f[B]0\f[R], it returns \f[B]pi/2\f[R].
1633 If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
1634 \f[B]0\f[R], it returns \f[B]-pi/2\f[R].
1635 .RS
1636 .PP
1637 This function is the same as the \f[B]atan2()\f[R] function in many
1638 programming languages.
1639 .PP
1641 Functions\f[R] subsection below).
1642 .RE
1643 .TP
1644 \f[B]sin(x)\f[R]
1645 Returns the sine of \f[B]x\f[R], which is assumed to be in radians.
1646 .RS
1647 .PP
1648 This is an alias of \f[B]s(x)\f[R].
1649 .PP
1651 Functions\f[R] subsection below).
1652 .RE
1653 .TP
1654 \f[B]cos(x)\f[R]
1655 Returns the cosine of \f[B]x\f[R], which is assumed to be in radians.
1656 .RS
1657 .PP
1658 This is an alias of \f[B]c(x)\f[R].
1659 .PP
1661 Functions\f[R] subsection below).
1662 .RE
1663 .TP
1664 \f[B]tan(x)\f[R]
1665 Returns the tangent of \f[B]x\f[R], which is assumed to be in radians.
1666 .RS
1667 .PP
1668 If \f[B]x\f[R] is equal to \f[B]1\f[R] or \f[B]-1\f[R], this raises an
1669 error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
1670 .PP
1671 This is an alias of \f[B]t(x)\f[R].
1672 .PP
1674 Functions\f[R] subsection below).
1675 .RE
1676 .TP
1677 \f[B]atan(x)\f[R]
1678 Returns the arctangent of \f[B]x\f[R], in radians.
1679 .RS
1680 .PP
1681 This is an alias of \f[B]a(x)\f[R].
1682 .PP
1684 Functions\f[R] subsection below).
1685 .RE
1686 .TP
1687 \f[B]atan2(y, x)\f[R]
1688 Returns the arctangent of \f[B]y/x\f[R], in radians.
1689 If both \f[B]y\f[R] and \f[B]x\f[R] are equal to \f[B]0\f[R], it raises
1690 an error and causes bc(1) to reset (see the \f[B]RESET\f[R] section).
1691 Otherwise, if \f[B]x\f[R] is greater than \f[B]0\f[R], it returns
1692 \f[B]a(y/x)\f[R].
1693 If \f[B]x\f[R] is less than \f[B]0\f[R], and \f[B]y\f[R] is greater than
1694 or equal to \f[B]0\f[R], it returns \f[B]a(y/x)+pi\f[R].
1695 If \f[B]x\f[R] is less than \f[B]0\f[R], and \f[B]y\f[R] is less than
1696 \f[B]0\f[R], it returns \f[B]a(y/x)-pi\f[R].
1697 If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is greater than
1698 \f[B]0\f[R], it returns \f[B]pi/2\f[R].
1699 If \f[B]x\f[R] is equal to \f[B]0\f[R], and \f[B]y\f[R] is less than
1700 \f[B]0\f[R], it returns \f[B]-pi/2\f[R].
1701 .RS
1702 .PP
1703 This function is the same as the \f[B]atan2()\f[R] function in many
1704 programming languages.
1705 .PP
1706 This is an alias of \f[B]a2(y, x)\f[R].
1707 .PP
1709 Functions\f[R] subsection below).
1710 .RE
1711 .TP
1712 \f[B]r2d(x)\f[R]
1713 Converts \f[B]x\f[R] from radians to degrees and returns the result.
1714 .RS
1715 .PP
1717 Functions\f[R] subsection below).
1718 .RE
1719 .TP
1720 \f[B]d2r(x)\f[R]
1721 Converts \f[B]x\f[R] from degrees to radians and returns the result.
1722 .RS
1723 .PP
1725 Functions\f[R] subsection below).
1726 .RE
1727 .TP
1728 \f[B]frand(p)\f[R]
1729 Generates a pseudo-random integer between \f[B]0\f[R] (inclusive) and
1730 \f[B]1\f[R] (exclusive) with the number of decimal digits after the
1731 decimal point equal to the truncated absolute value of \f[B]p\f[R].
1732 If \f[B]p\f[R] is not \f[B]0\f[R], then calling this function will
1733 change the value of \f[B]seed\f[R].
1734 If \f[B]p\f[R] is \f[B]0\f[R], then \f[B]0\f[R] is returned, and
1735 \f[B]seed\f[R] is \f[I]not\f[R] changed.
1736 .TP
1737 \f[B]ifrand(i, p)\f[R]
1738 Generates a pseudo-random integer that is between \f[B]0\f[R]
1739 (inclusive) and the truncated absolute value of \f[B]i\f[R] (exclusive)
1741 truncated absolute value of \f[B]p\f[R].
1742 If the absolute value of \f[B]i\f[R] is greater than or equal to
1743 \f[B]2\f[R], and \f[B]p\f[R] is not \f[B]0\f[R], then calling this
1744 function will change the value of \f[B]seed\f[R]; otherwise, \f[B]0\f[R]
1745 is returned, and \f[B]seed\f[R] is not changed.
1746 .TP
1747 \f[B]i2rand(a, b)\f[R]
1748 Takes the truncated value of \f[B]a\f[R] and \f[B]b\f[R] and uses them
1749 as inclusive bounds to enerate a pseudo-random integer.
1750 If the difference of the truncated values of \f[B]a\f[R] and \f[B]b\f[R]
1751 is \f[B]0\f[R], then the truncated value is returned, and \f[B]seed\f[R]
1752 is \f[I]not\f[R] changed.
1753 Otherwise, this function will change the value of \f[B]seed\f[R].
1754 .TP
1755 \f[B]srand(x)\f[R]
1756 Returns \f[B]x\f[R] with its sign flipped with probability
1757 \f[B]0.5\f[R].
1758 In other words, it randomizes the sign of \f[B]x\f[R].
1759 .TP
1760 \f[B]brand()\f[R]
1761 Returns a random boolean value (either \f[B]0\f[R] or \f[B]1\f[R]).
1762 .TP
1763 \f[B]band(a, b)\f[R]
1764 Takes the truncated absolute value of both \f[B]a\f[R] and \f[B]b\f[R]
1765 and calculates and returns the result of the bitwise \f[B]and\f[R]
1766 operation between them.
1767 .RS
1768 .PP
1770 \f[B]s2u(x)\f[R] to convert.
1771 .RE
1772 .TP
1773 \f[B]bor(a, b)\f[R]
1774 Takes the truncated absolute value of both \f[B]a\f[R] and \f[B]b\f[R]
1775 and calculates and returns the result of the bitwise \f[B]or\f[R]
1776 operation between them.
1777 .RS
1778 .PP
1780 \f[B]s2u(x)\f[R] to convert.
1781 .RE
1782 .TP
1783 \f[B]bxor(a, b)\f[R]
1784 Takes the truncated absolute value of both \f[B]a\f[R] and \f[B]b\f[R]
1785 and calculates and returns the result of the bitwise \f[B]xor\f[R]
1786 operation between them.
1787 .RS
1788 .PP
1790 \f[B]s2u(x)\f[R] to convert.
1791 .RE
1792 .TP
1793 \f[B]bshl(a, b)\f[R]
1794 Takes the truncated absolute value of both \f[B]a\f[R] and \f[B]b\f[R]
1795 and calculates and returns the result of \f[B]a\f[R] bit-shifted left by
1796 \f[B]b\f[R] places.
1797 .RS
1798 .PP
1800 \f[B]s2u(x)\f[R] to convert.
1801 .RE
1802 .TP
1803 \f[B]bshr(a, b)\f[R]
1804 Takes the truncated absolute value of both \f[B]a\f[R] and \f[B]b\f[R]
1805 and calculates and returns the truncated result of \f[B]a\f[R]
1806 bit-shifted right by \f[B]b\f[R] places.
1807 .RS
1808 .PP
1810 \f[B]s2u(x)\f[R] to convert.
1811 .RE
1812 .TP
1813 \f[B]bnotn(x, n)\f[R]
1814 Takes the truncated absolute value of \f[B]x\f[R] and does a bitwise not
1816 value of \f[B]n\f[R].
1817 .RS
1818 .PP
1820 \f[B]s2u(x)\f[R] to convert.
1821 .RE
1822 .TP
1823 \f[B]bnot8(x)\f[R]
1824 Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
1825 though it has \f[B]8\f[R] binary digits (\f[B]1\f[R] unsigned byte).
1826 .RS
1827 .PP
1829 \f[B]s2u(x)\f[R] to convert.
1830 .RE
1831 .TP
1832 \f[B]bnot16(x)\f[R]
1833 Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
1834 though it has \f[B]16\f[R] binary digits (\f[B]2\f[R] unsigned bytes).
1835 .RS
1836 .PP
1838 \f[B]s2u(x)\f[R] to convert.
1839 .RE
1840 .TP
1841 \f[B]bnot32(x)\f[R]
1842 Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
1843 though it has \f[B]32\f[R] binary digits (\f[B]4\f[R] unsigned bytes).
1844 .RS
1845 .PP
1847 \f[B]s2u(x)\f[R] to convert.
1848 .RE
1849 .TP
1850 \f[B]bnot64(x)\f[R]
1851 Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
1852 though it has \f[B]64\f[R] binary digits (\f[B]8\f[R] unsigned bytes).
1853 .RS
1854 .PP
1856 \f[B]s2u(x)\f[R] to convert.
1857 .RE
1858 .TP
1859 \f[B]bnot(x)\f[R]
1860 Does a bitwise not of the truncated absolute value of \f[B]x\f[R] as
1861 though it has the minimum number of power of two unsigned bytes.
1862 .RS
1863 .PP
1865 \f[B]s2u(x)\f[R] to convert.
1866 .RE
1867 .TP
1868 \f[B]brevn(x, n)\f[R]
1869 Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
1871 value of \f[B]n\f[R].
1872 .RS
1873 .PP
1875 \f[B]s2u(x)\f[R] to convert.
1876 .RE
1877 .TP
1878 \f[B]brev8(x)\f[R]
1879 Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
1880 though it has 8 binary digits (\f[B]1\f[R] unsigned byte).
1881 .RS
1882 .PP
1884 \f[B]s2u(x)\f[R] to convert.
1885 .RE
1886 .TP
1887 \f[B]brev16(x)\f[R]
1888 Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
1889 though it has 16 binary digits (\f[B]2\f[R] unsigned bytes).
1890 .RS
1891 .PP
1893 \f[B]s2u(x)\f[R] to convert.
1894 .RE
1895 .TP
1896 \f[B]brev32(x)\f[R]
1897 Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
1898 though it has 32 binary digits (\f[B]4\f[R] unsigned bytes).
1899 .RS
1900 .PP
1902 \f[B]s2u(x)\f[R] to convert.
1903 .RE
1904 .TP
1905 \f[B]brev64(x)\f[R]
1906 Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
1907 though it has 64 binary digits (\f[B]8\f[R] unsigned bytes).
1908 .RS
1909 .PP
1911 \f[B]s2u(x)\f[R] to convert.
1912 .RE
1913 .TP
1914 \f[B]brev(x)\f[R]
1915 Runs a bit reversal on the truncated absolute value of \f[B]x\f[R] as
1916 though it has the minimum number of power of two unsigned bytes.
1917 .RS
1918 .PP
1920 \f[B]s2u(x)\f[R] to convert.
1921 .RE
1922 .TP
1923 \f[B]broln(x, p, n)\f[R]
1925 \f[B]x\f[R], as though it has the same number of unsigned 8-bit bytes as
1926 the truncated absolute value of \f[B]n\f[R], by the number of places
1927 equal to the truncated absolute value of \f[B]p\f[R] modded by the
1928 \f[B]2\f[R] to the power of the number of binary digits in \f[B]n\f[R]
1929 8-bit bytes.
1930 .RS
1931 .PP
1933 \f[B]s2u(x)\f[R] to convert.
1934 .RE
1935 .TP
1936 \f[B]brol8(x, p)\f[R]
1938 \f[B]x\f[R], as though it has \f[B]8\f[R] binary digits (\f[B]1\f[R]
1940 value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]8\f[R].
1941 .RS
1942 .PP
1944 \f[B]s2u(x)\f[R] to convert.
1945 .RE
1946 .TP
1947 \f[B]brol16(x, p)\f[R]
1949 \f[B]x\f[R], as though it has \f[B]16\f[R] binary digits (\f[B]2\f[R]
1951 value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]16\f[R].
1952 .RS
1953 .PP
1955 \f[B]s2u(x)\f[R] to convert.
1956 .RE
1957 .TP
1958 \f[B]brol32(x, p)\f[R]
1960 \f[B]x\f[R], as though it has \f[B]32\f[R] binary digits (\f[B]4\f[R]
1962 value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]32\f[R].
1963 .RS
1964 .PP
1966 \f[B]s2u(x)\f[R] to convert.
1967 .RE
1968 .TP
1969 \f[B]brol64(x, p)\f[R]
1971 \f[B]x\f[R], as though it has \f[B]64\f[R] binary digits (\f[B]8\f[R]
1973 value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]64\f[R].
1974 .RS
1975 .PP
1977 \f[B]s2u(x)\f[R] to convert.
1978 .RE
1979 .TP
1980 \f[B]brol(x, p)\f[R]
1982 \f[B]x\f[R], as though it has the minimum number of power of two
1984 absolute value of \f[B]p\f[R] modded by 2 to the power of the number of
1985 binary digits in the minimum number of 8-bit bytes.
1986 .RS
1987 .PP
1989 \f[B]s2u(x)\f[R] to convert.
1990 .RE
1991 .TP
1992 \f[B]brorn(x, p, n)\f[R]
1994 \f[B]x\f[R], as though it has the same number of unsigned 8-bit bytes as
1995 the truncated absolute value of \f[B]n\f[R], by the number of places
1996 equal to the truncated absolute value of \f[B]p\f[R] modded by the
1997 \f[B]2\f[R] to the power of the number of binary digits in \f[B]n\f[R]
1998 8-bit bytes.
1999 .RS
2000 .PP
2002 \f[B]s2u(x)\f[R] to convert.
2003 .RE
2004 .TP
2005 \f[B]bror8(x, p)\f[R]
2007 \f[B]x\f[R], as though it has \f[B]8\f[R] binary digits (\f[B]1\f[R]
2009 value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]8\f[R].
2010 .RS
2011 .PP
2013 \f[B]s2u(x)\f[R] to convert.
2014 .RE
2015 .TP
2016 \f[B]bror16(x, p)\f[R]
2018 \f[B]x\f[R], as though it has \f[B]16\f[R] binary digits (\f[B]2\f[R]
2020 value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]16\f[R].
2021 .RS
2022 .PP
2024 \f[B]s2u(x)\f[R] to convert.
2025 .RE
2026 .TP
2027 \f[B]bror32(x, p)\f[R]
2029 \f[B]x\f[R], as though it has \f[B]32\f[R] binary digits (\f[B]2\f[R]
2031 value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]32\f[R].
2032 .RS
2033 .PP
2035 \f[B]s2u(x)\f[R] to convert.
2036 .RE
2037 .TP
2038 \f[B]bror64(x, p)\f[R]
2040 \f[B]x\f[R], as though it has \f[B]64\f[R] binary digits (\f[B]2\f[R]
2042 value of \f[B]p\f[R] modded by \f[B]2\f[R] to the power of \f[B]64\f[R].
2043 .RS
2044 .PP
2046 \f[B]s2u(x)\f[R] to convert.
2047 .RE
2048 .TP
2049 \f[B]bror(x, p)\f[R]
2051 \f[B]x\f[R], as though it has the minimum number of power of two
2053 absolute value of \f[B]p\f[R] modded by 2 to the power of the number of
2054 binary digits in the minimum number of 8-bit bytes.
2055 .RS
2056 .PP
2058 \f[B]s2u(x)\f[R] to convert.
2059 .RE
2060 .TP
2061 \f[B]bmodn(x, n)\f[R]
2062 Returns the modulus of the truncated absolute value of \f[B]x\f[R] by
2063 \f[B]2\f[R] to the power of the multiplication of the truncated absolute
2064 value of \f[B]n\f[R] and \f[B]8\f[R].
2065 .RS
2066 .PP
2068 \f[B]s2u(x)\f[R] to convert.
2069 .RE
2070 .TP
2071 \f[B]bmod8(x, n)\f[R]
2072 Returns the modulus of the truncated absolute value of \f[B]x\f[R] by
2073 \f[B]2\f[R] to the power of \f[B]8\f[R].
2074 .RS
2075 .PP
2077 \f[B]s2u(x)\f[R] to convert.
2078 .RE
2079 .TP
2080 \f[B]bmod16(x, n)\f[R]
2081 Returns the modulus of the truncated absolute value of \f[B]x\f[R] by
2082 \f[B]2\f[R] to the power of \f[B]16\f[R].
2083 .RS
2084 .PP
2086 \f[B]s2u(x)\f[R] to convert.
2087 .RE
2088 .TP
2089 \f[B]bmod32(x, n)\f[R]
2090 Returns the modulus of the truncated absolute value of \f[B]x\f[R] by
2091 \f[B]2\f[R] to the power of \f[B]32\f[R].
2092 .RS
2093 .PP
2095 \f[B]s2u(x)\f[R] to convert.
2096 .RE
2097 .TP
2098 \f[B]bmod64(x, n)\f[R]
2099 Returns the modulus of the truncated absolute value of \f[B]x\f[R] by
2100 \f[B]2\f[R] to the power of \f[B]64\f[R].
2101 .RS
2102 .PP
2104 \f[B]s2u(x)\f[R] to convert.
2105 .RE
2106 .TP
2107 \f[B]bunrev(t)\f[R]
2108 Assumes \f[B]t\f[R] is a bitwise-reversed number with an extra set bit
2110 the least significant bit in the original number).
2111 This number is reversed and returned without the extra set bit.
2112 .RS
2113 .PP
2115 meant to be used by users, but it can be.
2116 .RE
2117 .TP
2118 \f[B]plz(x)\f[R]
2119 If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
2120 and less than \f[B]1\f[R], it is printed with a leading zero, regardless
2121 of the use of the \f[B]-z\f[R] option (see the \f[B]OPTIONS\f[R]
2122 section) and without a trailing newline.
2123 .RS
2124 .PP
2125 Otherwise, \f[B]x\f[R] is printed normally, without a trailing newline.
2126 .RE
2127 .TP
2128 \f[B]plznl(x)\f[R]
2129 If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
2130 and less than \f[B]1\f[R], it is printed with a leading zero, regardless
2131 of the use of the \f[B]-z\f[R] option (see the \f[B]OPTIONS\f[R]
2132 section) and with a trailing newline.
2133 .RS
2134 .PP
2135 Otherwise, \f[B]x\f[R] is printed normally, with a trailing newline.
2136 .RE
2137 .TP
2138 \f[B]pnlz(x)\f[R]
2139 If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
2140 and less than \f[B]1\f[R], it is printed without a leading zero,
2141 regardless of the use of the \f[B]-z\f[R] option (see the
2142 \f[B]OPTIONS\f[R] section) and without a trailing newline.
2143 .RS
2144 .PP
2145 Otherwise, \f[B]x\f[R] is printed normally, without a trailing newline.
2146 .RE
2147 .TP
2148 \f[B]pnlznl(x)\f[R]
2149 If \f[B]x\f[R] is not equal to \f[B]0\f[R] and greater that \f[B]-1\f[R]
2150 and less than \f[B]1\f[R], it is printed without a leading zero,
2151 regardless of the use of the \f[B]-z\f[R] option (see the
2152 \f[B]OPTIONS\f[R] section) and with a trailing newline.
2153 .RS
2154 .PP
2155 Otherwise, \f[B]x\f[R] is printed normally, with a trailing newline.
2156 .RE
2157 .TP
2158 \f[B]ubytes(x)\f[R]
2160 truncated absolute value of \f[B]x\f[R].
2161 .TP
2162 \f[B]sbytes(x)\f[R]
2164 required to hold the truncated value of \f[B]x\f[R].
2165 .TP
2166 \f[B]s2u(x)\f[R]
2167 Returns \f[B]x\f[R] if it is non-negative.
2168 If it \f[I]is\f[R] negative, then it calculates what \f[B]x\f[R] would
2170 integer that would have the same representation in binary.
2171 .TP
2172 \f[B]s2un(x,n)\f[R]
2173 Returns \f[B]x\f[R] if it is non-negative.
2174 If it \f[I]is\f[R] negative, then it calculates what \f[B]x\f[R] would
2175 be as a 2\[cq]s-complement signed integer with \f[B]n\f[R] bytes and
2177 in binary.
2178 If \f[B]x\f[R] cannot fit into \f[B]n\f[R] 2\[cq]s-complement signed
2179 bytes, it is truncated to fit.
2180 .TP
2181 \f[B]hex(x)\f[R]
2182 Outputs the hexadecimal (base \f[B]16\f[R]) representation of
2183 \f[B]x\f[R].
2184 .RS
2185 .PP
2186 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2187 subsection of the \f[B]FUNCTIONS\f[R] section).
2188 .RE
2189 .TP
2190 \f[B]binary(x)\f[R]
2191 Outputs the binary (base \f[B]2\f[R]) representation of \f[B]x\f[R].
2192 .RS
2193 .PP
2194 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2195 subsection of the \f[B]FUNCTIONS\f[R] section).
2196 .RE
2197 .TP
2198 \f[B]output(x, b)\f[R]
2199 Outputs the base \f[B]b\f[R] representation of \f[B]x\f[R].
2200 .RS
2201 .PP
2202 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2203 subsection of the \f[B]FUNCTIONS\f[R] section).
2204 .RE
2205 .TP
2206 \f[B]uint(x)\f[R]
2207 Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
2208 an unsigned integer in as few power of two bytes as possible.
2209 Both outputs are split into bytes separated by spaces.
2210 .RS
2211 .PP
2212 If \f[B]x\f[R] is not an integer or is negative, an error message is
2213 printed instead, but bc(1) is not reset (see the \f[B]RESET\f[R]
2214 section).
2215 .PP
2216 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2217 subsection of the \f[B]FUNCTIONS\f[R] section).
2218 .RE
2219 .TP
2220 \f[B]int(x)\f[R]
2221 Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
2223 possible.
2224 Both outputs are split into bytes separated by spaces.
2225 .RS
2226 .PP
2227 If \f[B]x\f[R] is not an integer, an error message is printed instead,
2228 but bc(1) is not reset (see the \f[B]RESET\f[R] section).
2229 .PP
2230 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2231 subsection of the \f[B]FUNCTIONS\f[R] section).
2232 .RE
2233 .TP
2234 \f[B]uintn(x, n)\f[R]
2235 Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
2236 an unsigned integer in \f[B]n\f[R] bytes.
2237 Both outputs are split into bytes separated by spaces.
2238 .RS
2239 .PP
2240 If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
2241 \f[B]n\f[R] bytes, an error message is printed instead, but bc(1) is not
2242 reset (see the \f[B]RESET\f[R] section).
2243 .PP
2244 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2245 subsection of the \f[B]FUNCTIONS\f[R] section).
2246 .RE
2247 .TP
2248 \f[B]intn(x, n)\f[R]
2249 Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
2250 a signed, two\[cq]s-complement integer in \f[B]n\f[R] bytes.
2251 Both outputs are split into bytes separated by spaces.
2252 .RS
2253 .PP
2254 If \f[B]x\f[R] is not an integer or cannot fit into \f[B]n\f[R] bytes,
2256 \f[B]RESET\f[R] section).
2257 .PP
2258 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2259 subsection of the \f[B]FUNCTIONS\f[R] section).
2260 .RE
2261 .TP
2262 \f[B]uint8(x)\f[R]
2263 Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
2264 an unsigned integer in \f[B]1\f[R] byte.
2265 Both outputs are split into bytes separated by spaces.
2266 .RS
2267 .PP
2268 If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
2269 \f[B]1\f[R] byte, an error message is printed instead, but bc(1) is not
2270 reset (see the \f[B]RESET\f[R] section).
2271 .PP
2272 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2273 subsection of the \f[B]FUNCTIONS\f[R] section).
2274 .RE
2275 .TP
2276 \f[B]int8(x)\f[R]
2277 Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
2278 a signed, two\[cq]s-complement integer in \f[B]1\f[R] byte.
2279 Both outputs are split into bytes separated by spaces.
2280 .RS
2281 .PP
2282 If \f[B]x\f[R] is not an integer or cannot fit into \f[B]1\f[R] byte, an
2284 \f[B]RESET\f[R] section).
2285 .PP
2286 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2287 subsection of the \f[B]FUNCTIONS\f[R] section).
2288 .RE
2289 .TP
2290 \f[B]uint16(x)\f[R]
2291 Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
2292 an unsigned integer in \f[B]2\f[R] bytes.
2293 Both outputs are split into bytes separated by spaces.
2294 .RS
2295 .PP
2296 If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
2297 \f[B]2\f[R] bytes, an error message is printed instead, but bc(1) is not
2298 reset (see the \f[B]RESET\f[R] section).
2299 .PP
2300 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2301 subsection of the \f[B]FUNCTIONS\f[R] section).
2302 .RE
2303 .TP
2304 \f[B]int16(x)\f[R]
2305 Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
2306 a signed, two\[cq]s-complement integer in \f[B]2\f[R] bytes.
2307 Both outputs are split into bytes separated by spaces.
2308 .RS
2309 .PP
2310 If \f[B]x\f[R] is not an integer or cannot fit into \f[B]2\f[R] bytes,
2312 \f[B]RESET\f[R] section).
2313 .PP
2314 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2315 subsection of the \f[B]FUNCTIONS\f[R] section).
2316 .RE
2317 .TP
2318 \f[B]uint32(x)\f[R]
2319 Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
2320 an unsigned integer in \f[B]4\f[R] bytes.
2321 Both outputs are split into bytes separated by spaces.
2322 .RS
2323 .PP
2324 If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
2325 \f[B]4\f[R] bytes, an error message is printed instead, but bc(1) is not
2326 reset (see the \f[B]RESET\f[R] section).
2327 .PP
2328 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2329 subsection of the \f[B]FUNCTIONS\f[R] section).
2330 .RE
2331 .TP
2332 \f[B]int32(x)\f[R]
2333 Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
2334 a signed, two\[cq]s-complement integer in \f[B]4\f[R] bytes.
2335 Both outputs are split into bytes separated by spaces.
2336 .RS
2337 .PP
2338 If \f[B]x\f[R] is not an integer or cannot fit into \f[B]4\f[R] bytes,
2340 \f[B]RESET\f[R] section).
2341 .PP
2342 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2343 subsection of the \f[B]FUNCTIONS\f[R] section).
2344 .RE
2345 .TP
2346 \f[B]uint64(x)\f[R]
2347 Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
2348 an unsigned integer in \f[B]8\f[R] bytes.
2349 Both outputs are split into bytes separated by spaces.
2350 .RS
2351 .PP
2352 If \f[B]x\f[R] is not an integer, is negative, or cannot fit into
2353 \f[B]8\f[R] bytes, an error message is printed instead, but bc(1) is not
2354 reset (see the \f[B]RESET\f[R] section).
2355 .PP
2356 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2357 subsection of the \f[B]FUNCTIONS\f[R] section).
2358 .RE
2359 .TP
2360 \f[B]int64(x)\f[R]
2361 Outputs the representation, in binary and hexadecimal, of \f[B]x\f[R] as
2362 a signed, two\[cq]s-complement integer in \f[B]8\f[R] bytes.
2363 Both outputs are split into bytes separated by spaces.
2364 .RS
2365 .PP
2366 If \f[B]x\f[R] is not an integer or cannot fit into \f[B]8\f[R] bytes,
2368 \f[B]RESET\f[R] section).
2369 .PP
2370 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2371 subsection of the \f[B]FUNCTIONS\f[R] section).
2372 .RE
2373 .TP
2374 \f[B]hex_uint(x, n)\f[R]
2376 \f[B]x\f[R] as an unsigned integer in hexadecimal using \f[B]n\f[R]
2377 bytes.
2378 Not all of the value will be output if \f[B]n\f[R] is too small.
2379 .RS
2380 .PP
2381 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2382 subsection of the \f[B]FUNCTIONS\f[R] section).
2383 .RE
2384 .TP
2385 \f[B]binary_uint(x, n)\f[R]
2387 \f[B]x\f[R] as an unsigned integer in binary using \f[B]n\f[R] bytes.
2388 Not all of the value will be output if \f[B]n\f[R] is too small.
2389 .RS
2390 .PP
2391 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2392 subsection of the \f[B]FUNCTIONS\f[R] section).
2393 .RE
2394 .TP
2395 \f[B]output_uint(x, n)\f[R]
2397 \f[B]x\f[R] as an unsigned integer in the current \f[B]obase\f[R] (see
2398 the \f[B]SYNTAX\f[R] section) using \f[B]n\f[R] bytes.
2399 Not all of the value will be output if \f[B]n\f[R] is too small.
2400 .RS
2401 .PP
2402 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2403 subsection of the \f[B]FUNCTIONS\f[R] section).
2404 .RE
2405 .TP
2406 \f[B]output_byte(x, i)\f[R]
2407 Outputs byte \f[B]i\f[R] of the truncated absolute value of \f[B]x\f[R],
2408 where \f[B]0\f[R] is the least significant byte and \f[B]number_of_bytes
2409 - 1\f[R] is the most significant byte.
2410 .RS
2411 .PP
2412 This is a \f[B]void\f[R] function (see the \f[I]Void Functions\f[R]
2413 subsection of the \f[B]FUNCTIONS\f[R] section).
2414 .RE
2415 .SS Transcendental Functions
2417 to 1 ULP (https://en.wikipedia.org/wiki/Unit_in_the_last_place).
2419 https://people.eecs.berkeley.edu/\[ti]wkahan/LOG10HAF.TXT explains why
2421 transcendental functions.
2422 .PP
2424 functions with the precision (\f[B]scale\f[R]) set to at least 1 higher
2425 than is necessary.
2426 If exact results are \f[I]absolutely\f[R] required, users can double the
2427 precision (\f[B]scale\f[R]) and then truncate.
2428 .PP
2430 .IP \[bu] 2
2431 \f[B]s(x)\f[R]
2432 .IP \[bu] 2
2433 \f[B]c(x)\f[R]
2434 .IP \[bu] 2
2435 \f[B]a(x)\f[R]
2436 .IP \[bu] 2
2437 \f[B]l(x)\f[R]
2438 .IP \[bu] 2
2439 \f[B]e(x)\f[R]
2440 .IP \[bu] 2
2441 \f[B]j(x, n)\f[R]
2442 .PP
2444 .IP \[bu] 2
2445 \f[B]l2(x)\f[R]
2446 .IP \[bu] 2
2447 \f[B]l10(x)\f[R]
2448 .IP \[bu] 2
2449 \f[B]log(x, b)\f[R]
2450 .IP \[bu] 2
2451 \f[B]pi(p)\f[R]
2452 .IP \[bu] 2
2453 \f[B]t(x)\f[R]
2454 .IP \[bu] 2
2455 \f[B]a2(y, x)\f[R]
2456 .IP \[bu] 2
2457 \f[B]sin(x)\f[R]
2458 .IP \[bu] 2
2459 \f[B]cos(x)\f[R]
2460 .IP \[bu] 2
2461 \f[B]tan(x)\f[R]
2462 .IP \[bu] 2
2463 \f[B]atan(x)\f[R]
2464 .IP \[bu] 2
2465 \f[B]atan2(y, x)\f[R]
2466 .IP \[bu] 2
2467 \f[B]r2d(x)\f[R]
2468 .IP \[bu] 2
2469 \f[B]d2r(x)\f[R]
2470 .SH RESET
2472 handler for, it resets.
2473 This means that several things happen.
2474 .PP
2476 stack.
2477 The behavior is not unlike that of exceptions in programming languages.
2479 (after all functions returned) is skipped.
2480 .PP
2482 executed.
2484 (see the \f[B]EXIT STATUS\f[R] section), it asks for more input;
2485 otherwise, it exits with the appropriate return code.
2486 .PP
2489 caused an error.
2490 .SH PERFORMANCE
2491 Most bc(1) implementations use \f[B]char\f[R] types to calculate the
2492 value of \f[B]1\f[R] decimal digit at a time, but that can be slow.
2493 This bc(1) does something different.
2494 .PP
2495 It uses large integers to calculate more than \f[B]1\f[R] decimal digit
2496 at a time.
2497 If built in a environment where \f[B]BC_LONG_BIT\f[R] (see the
2498 \f[B]LIMITS\f[R] section) is \f[B]64\f[R], then each integer has
2499 \f[B]9\f[R] decimal digits.
2500 If built in an environment where \f[B]BC_LONG_BIT\f[R] is \f[B]32\f[R]
2501 then each integer has \f[B]4\f[R] decimal digits.
2503 \f[B]BC_BASE_DIGS\f[R].
2504 .PP
2505 The actual values of \f[B]BC_LONG_BIT\f[R] and \f[B]BC_BASE_DIGS\f[R]
2506 can be queried with the \f[B]limits\f[R] statement.
2507 .PP
2509 checking.
2510 This integer type depends on the value of \f[B]BC_LONG_BIT\f[R], but is
2511 always at least twice as large as the integer type used to store digits.
2512 .SH LIMITS
2514 .TP
2515 \f[B]BC_LONG_BIT\f[R]
2516 The number of bits in the \f[B]long\f[R] type in the environment where
2517 bc(1) was built.
2519 integer (see the \f[B]PERFORMANCE\f[R] section).
2520 .TP
2521 \f[B]BC_BASE_DIGS\f[R]
2523 \f[B]PERFORMANCE\f[R] section).
2524 Depends on \f[B]BC_LONG_BIT\f[R].
2525 .TP
2526 \f[B]BC_BASE_POW\f[R]
2528 \f[B]BC_BASE_DIGS\f[R]) plus \f[B]1\f[R].
2529 Depends on \f[B]BC_BASE_DIGS\f[R].
2530 .TP
2531 \f[B]BC_OVERFLOW_MAX\f[R]
2532 The max number that the overflow type (see the \f[B]PERFORMANCE\f[R]
2533 section) can hold.
2534 Depends on \f[B]BC_LONG_BIT\f[R].
2535 .TP
2536 \f[B]BC_BASE_MAX\f[R]
2537 The maximum output base.
2538 Set at \f[B]BC_BASE_POW\f[R].
2539 .TP
2540 \f[B]BC_DIM_MAX\f[R]
2541 The maximum size of arrays.
2542 Set at \f[B]SIZE_MAX-1\f[R].
2543 .TP
2544 \f[B]BC_SCALE_MAX\f[R]
2545 The maximum \f[B]scale\f[R].
2546 Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
2547 .TP
2548 \f[B]BC_STRING_MAX\f[R]
2549 The maximum length of strings.
2550 Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
2551 .TP
2552 \f[B]BC_NAME_MAX\f[R]
2553 The maximum length of identifiers.
2554 Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
2555 .TP
2556 \f[B]BC_NUM_MAX\f[R]
2558 digits after the decimal point.
2559 Set at \f[B]BC_OVERFLOW_MAX-1\f[R].
2560 .TP
2561 \f[B]BC_RAND_MAX\f[R]
2562 The maximum integer (inclusive) returned by the \f[B]rand()\f[R]
2563 operand.
2564 Set at \f[B]2\[ha]BC_LONG_BIT-1\f[R].
2565 .TP
2567 The maximum allowable exponent (positive or negative).
2568 Set at \f[B]BC_OVERFLOW_MAX\f[R].
2569 .TP
2571 The maximum number of vars/arrays.
2572 Set at \f[B]SIZE_MAX-1\f[R].
2573 .PP
2574 The actual values can be queried with the \f[B]limits\f[R] statement.
2575 .PP
2578 at which they become a problem.
2579 In fact, memory should be exhausted before these limits should be hit.
2580 .SH ENVIRONMENT VARIABLES
2581 As \f[B]non-portable extensions\f[R], bc(1) recognizes the following
2583 .TP
2584 \f[B]POSIXLY_CORRECT\f[R]
2586 the \f[B]-s\f[R] option was given.
2587 .TP
2588 \f[B]BC_ENV_ARGS\f[R]
2589 This is another way to give command-line arguments to bc(1).
2590 They should be in the same format as all other command-line arguments.
2592 \f[B]BC_ENV_ARGS\f[R] will be processed before arguments and files given
2593 on the command-line.
2595 files to be used at every invocation.
2597 functions that the user might want every time bc(1) runs.
2598 .RS
2599 .PP
2600 The code that parses \f[B]BC_ENV_ARGS\f[R] will correctly handle quoted
2601 arguments, but it does not understand escape sequences.
2602 For example, the string \f[B]\[lq]/home/gavin/some bc file.bc\[rq]\f[R]
2604 \[dq]bc\[dq] file.bc\[rq]\f[R] will include the backslashes.
2605 .PP
2606 The quote parsing will handle either kind of quotes, \f[B]\[cq]\f[R] or
2607 \f[B]\[lq]\f[R].
2610 `bc' file.bc\[rq]\f[R], and vice versa if you have a file with double
2611 quotes.
2613 \f[B]BC_ENV_ARGS\f[R] is not supported due to the complexity of the
2615 the parsing is done by the shell.
2616 .RE
2617 .TP
2618 \f[B]BC_LINE_LENGTH\f[R]
2620 greater than \f[B]1\f[R] and is less than \f[B]UINT16_MAX\f[R]
2621 (\f[B]2\[ha]16-1\f[R]), bc(1) will output lines to that length,
2622 including the backslash (\f[B]\[rs]\f[R]).
2623 The default line length is \f[B]70\f[R].
2624 .RS
2625 .PP
2626 The special value of \f[B]0\f[R] will disable line length checking and
2628 newlines.
2629 .RE
2630 .TP
2631 \f[B]BC_BANNER\f[R]
2634 interactive mode, while zero deactivates it.
2635 .RS
2636 .PP
2637 If bc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
2639 does not print the banner when not in interactive mode.
2640 .PP
2642 with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
2643 .RE
2644 .TP
2645 \f[B]BC_SIGINT_RESET\f[R]
2646 If bc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
2648 exits on \f[B]SIGINT\f[R] when not in interactive mode.
2649 .RS
2650 .PP
2653 reset on \f[B]SIGINT\f[R], rather than exit, and zero makes bc(1) exit.
2654 If this environment variable exists and is \f[I]not\f[R] an integer,
2655 then bc(1) will exit on \f[B]SIGINT\f[R].
2656 .PP
2658 with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
2659 .RE
2660 .TP
2661 \f[B]BC_TTY_MODE\f[R]
2662 If TTY mode is \f[I]not\f[R] available (see the \f[B]TTY MODE\f[R]
2663 section), then this environment variable has no effect.
2664 .RS
2665 .PP
2668 TTY mode, and zero makes bc(1) not use TTY mode.
2669 .PP
2671 with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
2672 .RE
2673 .TP
2674 \f[B]BC_PROMPT\f[R]
2675 If TTY mode is \f[I]not\f[R] available (see the \f[B]TTY MODE\f[R]
2676 section), then this environment variable has no effect.
2677 .RS
2678 .PP
2681 prompt, and zero or a non-integer makes bc(1) not use a prompt.
2682 If this environment variable does not exist and \f[B]BC_TTY_MODE\f[R]
2683 does, then the value of the \f[B]BC_TTY_MODE\f[R] environment variable
2684 is used.
2685 .PP
2686 This environment variable and the \f[B]BC_TTY_MODE\f[R] environment
2688 \f[B]-h\f[R] or \f[B]--help\f[R] options.
2689 .RE
2690 .TP
2691 \f[B]BC_EXPR_EXIT\f[R]
2693 with \f[B]-e\f[R], \f[B]--expression\f[R], \f[B]-f\f[R], or
2694 \f[B]--file\f[R], then if this environment variable exists and contains
2696 expressions and expression files, and a zero value makes bc(1) not exit.
2697 .RS
2698 .PP
2700 with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
2701 .RE
2702 .TP
2703 \f[B]BC_DIGIT_CLAMP\f[R]
2706 greater than or equal to the current \f[B]ibase\f[R] so that all such
2707 digits are considered equal to the \f[B]ibase\f[R] minus 1, and a zero
2709 their value, which is multiplied by the power of the \f[B]ibase\f[R].
2710 .RS
2711 .PP
2713 \f[B]STANDARDS\f[R] section).
2714 .PP
2716 with the \f[B]-h\f[R] or \f[B]--help\f[R] options.
2717 .RE
2718 .SH EXIT STATUS
2720 .TP
2721 \f[B]0\f[R]
2722 No error.
2723 .TP
2724 \f[B]1\f[R]
2725 A math error occurred.
2726 This follows standard practice of using \f[B]1\f[R] for expected errors,
2727 since math errors will happen in the process of normal execution.
2728 .RS
2729 .PP
2730 Math errors include divide by \f[B]0\f[R], taking the square root of a
2735 to use a non-integer where an integer is required.
2736 .PP
2738 power (\f[B]\[ha]\f[R]), places (\f[B]\[at]\f[R]), left shift
2739 (\f[B]<<\f[R]), and right shift (\f[B]>>\f[R]) operators and their
2740 corresponding assignment operators.
2741 .RE
2742 .TP
2743 \f[B]2\f[R]
2744 A parse error occurred.
2745 .RS
2746 .PP
2747 Parse errors include unexpected \f[B]EOF\f[R], using an invalid
2752 \f[I]Named Expressions\f[R] subsection of the \f[B]SYNTAX\f[R] section),
2753 giving an invalid \f[B]auto\f[R] list, having a duplicate
2754 \f[B]auto\f[R]/function parameter, failing to find the end of a code
2755 block, attempting to return a value from a \f[B]void\f[R] function,
2757 when the option \f[B]-s\f[R] or any equivalents were given.
2758 .RE
2759 .TP
2760 \f[B]3\f[R]
2761 A runtime error occurred.
2762 .RS
2763 .PP
2765 (\f[B]ibase\f[R], \f[B]obase\f[R], or \f[B]scale\f[R]), giving a bad
2766 expression to a \f[B]read()\f[R] call, calling \f[B]read()\f[R] inside
2767 of a \f[B]read()\f[R] call, type errors, passing the wrong number of
2769 attempting to use a \f[B]void\f[R] function call as a value in an
2770 expression.
2771 .RE
2772 .TP
2773 \f[B]4\f[R]
2774 A fatal error occurred.
2775 .RS
2776 .PP
2778 open files, attempting to use files that do not have only ASCII
2779 characters (bc(1) only accepts ASCII characters), attempting to open a
2780 directory as a file, and giving invalid command-line options.
2781 .RE
2782 .PP
2783 The exit status \f[B]4\f[R] is special; when a fatal error occurs, bc(1)
2784 always exits and returns \f[B]4\f[R], no matter what mode bc(1) is in.
2785 .PP
2787 interactive mode (see the \f[B]INTERACTIVE MODE\f[R] section), since
2788 bc(1) resets its state (see the \f[B]RESET\f[R] section) and accepts
2789 more input when one of those errors occurs in interactive mode.
2791 \f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
2792 .PP
2795 \f[B]-i\f[R] flag or \f[B]--interactive\f[R] option.
2796 .SH INTERACTIVE MODE
2797 Per the standard (see the \f[B]STANDARDS\f[R] section), bc(1) has an
2798 interactive mode and a non-interactive mode.
2799 Interactive mode is turned on automatically when both \f[B]stdin\f[R]
2800 and \f[B]stdout\f[R] are hooked to a terminal, but the \f[B]-i\f[R] flag
2801 and \f[B]--interactive\f[R] option can turn it on in other situations.
2802 .PP
2804 \f[B]RESET\f[R] section), and in normal execution, flushes
2805 \f[B]stdout\f[R] as soon as execution is done for the current input.
2806 bc(1) may also reset on \f[B]SIGINT\f[R] instead of exit, depending on
2807 the contents of, or default for, the \f[B]BC_SIGINT_RESET\f[R]
2808 environment variable (see the \f[B]ENVIRONMENT VARIABLES\f[R] section).
2809 .SH TTY MODE
2810 If \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
2813 settings.
2814 .PP
2815 If there is the environment variable \f[B]BC_TTY_MODE\f[R] in the
2816 environment (see the \f[B]ENVIRONMENT VARIABLES\f[R] section), then if
2818 on TTY mode when \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R]
2819 are all connected to a TTY.
2820 If the \f[B]BC_TTY_MODE\f[R] environment variable exists but is
2821 \f[I]not\f[R] a non-zero integer, then bc(1) will not turn TTY mode on.
2822 .PP
2823 If the environment variable \f[B]BC_TTY_MODE\f[R] does \f[I]not\f[R]
2824 exist, the default setting is used.
2825 The default setting can be queried with the \f[B]-h\f[R] or
2826 \f[B]--help\f[R] options.
2827 .PP
2829 required in the bc(1) standard (see the \f[B]STANDARDS\f[R] section),
2830 and interactive mode requires only \f[B]stdin\f[R] and \f[B]stdout\f[R]
2831 to be connected to a terminal.
2832 .SS Command-Line History
2833 Command-line history is only enabled if TTY mode is, i.e., that
2834 \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are connected to
2835 a TTY and the \f[B]BC_TTY_MODE\f[R] environment variable (see the
2836 \f[B]ENVIRONMENT VARIABLES\f[R] section) and its default do not disable
2837 TTY mode.
2838 See the \f[B]COMMAND LINE HISTORY\f[R] section for more information.
2839 .SS Prompt
2840 If TTY mode is available, then a prompt can be enabled.
2842 variable: \f[B]BC_PROMPT\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
2843 section).
2844 .PP
2845 If the environment variable \f[B]BC_PROMPT\f[R] exists and is a non-zero
2846 integer, then the prompt is turned on when \f[B]stdin\f[R],
2847 \f[B]stdout\f[R], and \f[B]stderr\f[R] are connected to a TTY and the
2848 \f[B]-P\f[R] and \f[B]--no-prompt\f[R] options were not used.
2850 the \f[B]-R\f[R] and \f[B]--no-read-prompt\f[R] options must also not be
2851 used.
2852 .PP
2853 However, if \f[B]BC_PROMPT\f[R] does not exist, the prompt can be
2854 enabled or disabled with the \f[B]BC_TTY_MODE\f[R] environment variable,
2855 the \f[B]-P\f[R] and \f[B]--no-prompt\f[R] options, and the \f[B]-R\f[R]
2856 and \f[B]--no-read-prompt\f[R] options.
2857 See the \f[B]ENVIRONMENT VARIABLES\f[R] and \f[B]OPTIONS\f[R] sections
2858 for more details.
2859 .SH SIGNAL HANDLING
2860 Sending a \f[B]SIGINT\f[R] will cause bc(1) to do one of two things.
2861 .PP
2862 If bc(1) is not in interactive mode (see the \f[B]INTERACTIVE MODE\f[R]
2863 section), or the \f[B]BC_SIGINT_RESET\f[R] environment variable (see the
2864 \f[B]ENVIRONMENT VARIABLES\f[R] section), or its default, is either not
2865 an integer or it is zero, bc(1) will exit.
2866 .PP
2868 \f[B]BC_SIGINT_RESET\f[R] or its default is an integer and non-zero,
2870 \f[B]RESET\f[R] section) upon receiving a \f[B]SIGINT\f[R].
2871 .PP
2872 Note that \[lq]current input\[rq] can mean one of two things.
2873 If bc(1) is processing input from \f[B]stdin\f[R] in interactive mode,
2874 it will ask for more input.
2877 exists, or ask for input from \f[B]stdin\f[R] if no other file exists.
2878 .PP
2879 This means that if a \f[B]SIGINT\f[R] is sent to bc(1) as it is
2881 signal since it will immediately start executing the next file.
2883 bc(1) have function definitions, which are quick to parse.
2884 If a file takes a long time to execute, there may be a bug in that file.
2886 the user to continue.
2887 .PP
2888 \f[B]SIGTERM\f[R] and \f[B]SIGQUIT\f[R] cause bc(1) to clean up and
2889 exit, and it uses the default handler for all other signals.
2890 The one exception is \f[B]SIGHUP\f[R]; in that case, and only when bc(1)
2891 is in TTY mode (see the \f[B]TTY MODE\f[R] section), a \f[B]SIGHUP\f[R]
2892 will cause bc(1) to clean up and exit.
2893 .SH COMMAND LINE HISTORY
2894 bc(1) supports interactive command-line editing.
2895 .PP
2896 If bc(1) can be in TTY mode (see the \f[B]TTY MODE\f[R] section),
2897 history can be enabled.
2899 \f[B]stdin\f[R], \f[B]stdout\f[R], and \f[B]stderr\f[R] are all
2900 connected to a TTY.
2901 .PP
2903 variable \f[B]BC_TTY_MODE\f[R] (see the \f[B]ENVIRONMENT VARIABLES\f[R]
2904 section).
2905 .PP
2907 the arrow keys.
2908 .PP
2909 \f[B]Note\f[R]: tabs are converted to 8 spaces.
2910 .SH LOCALES
2912 locales and thus, supports \f[B]LC_MESSAGES\f[R].
2913 .SH SEE ALSO
2915 .SH STANDARDS
2917 (\[lq]POSIX.1-2017\[rq]) specification at
2918 https://pubs.opengroup.org/onlinepubs/9699919799/utilities/bc.html .
2919 The flags \f[B]-efghiqsvVw\f[R], all long options, and the extensions
2920 noted above are extensions to that specification.
2921 .PP
2922 In addition, the behavior of the \f[B]quit\f[R] implements an
2924 implementations.
2925 For more information see the \f[B]Statements\f[R] subsection of the
2926 \f[B]SYNTAX\f[R] section.
2927 .PP
2929 numbers that use a period (\f[B].\f[R]) as a radix point, regardless of
2930 the value of \f[B]LC_NUMERIC\f[R].
2931 .PP
2933 supports \f[B]LC_MESSAGES\f[R].
2934 .SH BUGS
2935 Before version \f[B]6.1.0\f[R], this bc(1) had incorrect behavior for
2936 the \f[B]quit\f[R] statement.
2937 .PP
2938 No other bugs are known.
2939 Report bugs at https://git.gavinhoward.com/gavin/bc .
2940 .SH AUTHORS
2941 Gavin D. Howard \c
2942 .MT gavin@gavinhoward.com
2943 .ME \c
2944 \ and contributors.