Open System Services Shell and Utilities Reference Manual (G06.27+, H06.04+)
bc(1) OSS Shell and Utilities Reference Manual
Operators
+-*/%ˆ (% is remainder; ˆ is power)
++ -- (prefix and suffix; apply to names)
== <= >= != <>
==+=-=*=/=%ˆ=
+= -= *= /= %=
Statements
expression
{statement;...;statement}
if (expression) statement
while (expression) statement
for (expression;expression;expression) statement
(null statement)
break
quit
The statement following a for or while statement must begin on the same line.
Function Definitions
define letter (letter,...,letter){
auto letter,...,letter
statement;...statement
return ( expression )
}
Functions in -l Math Library
s(x) sine
c(x) cosine
e(x) exponential
l(x) log
a(x) arctangent
j(n,x) Bessel function
General Syntax
All function parameters are passed by value.
The value of a statement that is an expression is displayed unless the main operator is an assign-
ment. A semicolon or newline character separates statements. Assignments to scale control the
number of decimal places printed on output and maintained during multiplication, division, and
exponentiation. Assignments to ibase or obase set the input and output number radix, respec-
tively.
The same letter may refer to an array, a function, and a simple variable simultaneously.
Automatic variables are pushed down during function calls. All other variables are global to the
program. When you use arrays as function parameters, or define them as automatic variables,
empty brackets must follow the array name.
1−32 Hewlett-Packard Company 527188-004