version 1.7, 2003/10/11 18:31:19 |
version 1.8, 2003/10/18 19:47:10 |
|
|
of scales of the operands. |
of scales of the operands. |
For division the scale of the result is defined |
For division the scale of the result is defined |
by the scale set by the |
by the scale set by the |
.Ar k |
.Ic k |
operation. |
operation. |
For multiplication, the scale is defined by the expression |
For multiplication, the scale is defined by the expression |
.Sy min(a+b,max(a,b,scale)) , |
.Sy min(a+b,max(a,b,scale)) , |
|
|
are the scales of the operands, and |
are the scales of the operands, and |
.Sy scale |
.Sy scale |
is the scale defined by the |
is the scale defined by the |
.Ar k |
.Ic k |
operation. |
operation. |
For exponentation with a non-negative exponent, the scale of the result is |
For exponentation with a non-negative exponent, the scale of the result is |
.Sy min(a*b,max(scale,a)) , |
.Sy min(a*b,max(scale,a)) , |
|
|
of the exponent. |
of the exponent. |
If the exponent is negative, the scale of the result is the scale |
If the exponent is negative, the scale of the result is the scale |
defined by the |
defined by the |
.Ar k |
.Ic k |
operation. |
operation. |
.Pp |
.Pp |
In the case of the division and modulus operator (~), |
In the case of the division and modulus operator (~), |
|
|
.Ar x |
.Ar x |
may be any character, including space, tab or any other special character. |
may be any character, including space, tab or any other special character. |
If the |
If the |
.Ar s |
.Ic s |
is capitalized, |
is capitalized, |
.Ar x |
.Ar x |
is treated as a stack and the value is pushed on it. |
is treated as a stack and the value is pushed on it. |
|
|
If executing a string, the recursion level is |
If executing a string, the recursion level is |
popped by two. |
popped by two. |
If |
If |
.Ar q |
.Ic q |
is capitalized, |
is capitalized, |
the top value on the stack is popped and the string execution level is popped |
the top value on the stack is popped and the string execution level is popped |
by that value. |
by that value. |
|
|
is written in an array that is later popped, to reveal the array that |
is written in an array that is later popped, to reveal the array that |
stored |
stored |
.Ql first . |
.Ql first . |
|
.It Ic J |
|
Pop the top value of the stack. The recursion level is popped by that value, |
|
and following that, the input is skipped until the first occurence of |
|
the |
|
.Ic M |
|
operator. |
|
.It Ic M |
|
Mark used by the |
|
.Ic J |
|
operator. |
|
The |
|
.Ic J |
|
and |
|
.Ic M |
|
operators are non-portable extensions, used by the |
|
.Xr bc 1 |
|
command. |
.El |
.El |
.Sh EXAMPLES |
.Sh EXAMPLES |
An example which prints the first ten values of |
An example which prints the first ten values of |
|
|
.Ed |
.Ed |
.Pp |
.Pp |
will terminate because of a too deep recursion level. |
will terminate because of a too deep recursion level. |
|
.It J command argument exceeded string execution depth |
|
for trying to pop the recursion level more than the current |
|
recursion level. |
|
.It mark not found |
|
for a failed scan for an occurence of the |
|
.Ic M |
|
operator. |
.El |
.El |
.Sh SEE ALSO |
.Sh SEE ALSO |
.Xr bc 1 |
.Xr bc 1 |