mirror of
https://github.com/opnsense/src.git
synced 2026-06-09 08:43:19 -04:00
Merge commit 2f57ecae4b
This is a new major release with a number of changes and extensions:
- Limited the number of temporary numbers and made the space for them
static so that allocating more space for them cannot fail.
- Allowed integers with non-zero scale to be used with power, places,
and shift operators.
- Added greatest common divisor and least common multiple to lib2.bc.
- Made bc and dc UTF-8 capable.
- Added the ability for users to have bc and dc quit on SIGINT.
- Added the ability for users to disable prompt and TTY mode by
environment variables.
- Added the ability for users to redefine keywords.
- Added dc's modular exponentiation and divmod to bc.
- Added the ability to assign strings to variables and array elements
and pass them to functions in bc.
- Added dc's asciify command and stream printing to bc.
- Added bitwise and, or, xor, left shift, right shift, reverse,
left rotate, right rotate, and mod functions to lib2.bc.
- Added the functions s2u(x) and s2un(x,n), to lib2.bc.
MFC after: 1 week
26 lines
569 B
Text
26 lines
569 B
Text
#! /usr/bin/bc -lq
|
|
|
|
print "scale = 20\n"
|
|
print "x = 1234567890 * 10^(-scale)\n"
|
|
print "len = 1 + 2 * scale\n"
|
|
print "scale += 10\n"
|
|
|
|
scale = 20
|
|
x = 1234567890 * 10^(-scale)
|
|
len = 1 + 2 * scale
|
|
|
|
scale += 10
|
|
|
|
for (i = 0; i <= len; ++i) {
|
|
print "a[", i, "] = x * (10^", i, ")\n"
|
|
}
|
|
|
|
for (i = 1; i <= 10000; ++i) {
|
|
for (j = 0; j < len; ++j) {
|
|
print "v = a[0] / a[", j, "]\n"
|
|
print "v = a[", i, "] / a[", j, "]\n"
|
|
print "v = (a[0] * ", i, ") / a[", j, "]\n"
|
|
print "v = a[0] / (a[", j, "] * ", i, ")\n"
|
|
print "v = (a[0] * ", i, ") / (a[", j, "] * ", i, ")\n"
|
|
}
|
|
}
|