#4648: bc-2.7.0
--------------------+-----------------------
Reporter: bdubbs | Owner: lfs-book
Type: task | Status: new
Priority: normal | Milestone: 9.2
Component: Book | Version: SVN
Severity: normal | Resolution:
Keywords: |
--------------------+-----------------------
Comment (by bdubbs):
News
## 2.7.0
This is a production release with a bug fix for Linux, new translations,
and new
features.
Bug fixes:
* Option parsing in `BC_ENV_ARGS` was broken on Linux in 2.6.1 because
`glibc`'s
`getopt_long()` is broken. To get around that, and to support long
options on
every platform, an adapted version of [`optparse`][17] was added. Now,
`bc`
does not even use `getopt()`.
* Parsing `BC_ENV_ARGS` with quotes now works. It isn't the smartest, but
it
does the job if there are spaces in file names.
There is only one new feature: `bc` now has a built-in pseudo-random
number
generator (PRNG).
The PRNG is seeded, making it useful for applications where
`/dev/urandom` does not work because output needs to be reproducible.
However,
it also uses `/dev/urandom` to seed itself by default, so it will start
with a
good seed by default.
It also outputs 32-bits on 32-bit platforms and 64-bits on 64-bit
platforms, far
better than the 15 bits of C's `rand()` and `bash`'s `$RANDOM`.
IMPORTANT: read the [`bc` manual][9] and the [`dc` manual][10] to find out
exactly what guarantees the PRNG provides. The underlying implementation
is not
guaranteed to stay the same, but the guarantees that it provides are
guaranteed
to stay the same regardless of the implementation.***
On top of that, four functions were added to `bc`'s [extended math
library][16]
to make using the PRNG easier:
* `frand(p)`: Generates a number between `[0,1)` to `p` decimal places.
* `ifrand(i, p)`: Generates an integer with bound `i` and adds it to
`frand(p)`.
* `srand(x)`: Randomizes the sign of `x`. In other words, it flips the
sign of
`x` with probability `0.5`.
* `brand()`: Returns a random boolean value (either `0` or `1`).
In addition, the PRNG can take a bound, and when it gets a bound, it
automatically adjusts to remove bias. It can also generate numbers of
arbitrary
size. (As of the time of release, the largest pseudo-random number
generated by
this `bc` was generated with a bound of `2^(2^20)`.)
--
Ticket URL: <http://wiki.linuxfromscratch.org/lfs/ticket/4648#comment:1>
LFS Trac <http://wiki.linuxfromscratch.org/lfs/>
Linux From Scratch: Your Distro, Your Rules.
--
http://lists.linuxfromscratch.org/listinfo/lfs-book
FAQ: http://www.linuxfromscratch.org/blfs/faq.html
Unsubscribe: See the above information page