bc

QNX SDP8.0Utilities ReferenceUtilities

Bench calculator arbitrary-precision arithmetic language (POSIX, toybox)

Syntax:

bc [-ilqsw] [file...]

Runs on:

QNX OS

Options:

-i --interactive
Force interactive mode.
-l --mathlib
Include a library of defined math functions and set the scale to 20. (See Library functions, below).
-q --quiet
Don't print version and copyright.
-s --standard
Print an error if any non-POSIX extensions are used.
-w --warn
Give warnings if any non-POSIX extensions are used.
file
The pathname of a text file containing commands and function definitions to be interpreted by bc. If any files are specified, bc processes those files, then reads from the standard input.

Description:

The bc utility is an interactive, programmable calculator that supports a complete set of control structures, including functions.

Library functions

The bc library is enabled if you invoke bc with the -l ("el") option, or if you include the interpretation file /usr/lib/bclib.b in the command line. The library sets the scale to 20, which you can override by assigning a new value. The library defines the following functions:
Syntax Function
a(expression) Arctangent (in radians)
c(expression) Cosine (in radians)
e(expression) Exponential function
j(expr1,expr2) Bessel function of integer order
l(expression) Natural logarithm
s(expression) Sine (in radians)

This utility is provided as part of the toybox package. For information on how to enable it, see toybox.

Contributing author:

Rob Landley and the toybox project (see https://landley.net/toybox/).

Page updated: