Opened 15 months ago

Closed 15 months ago

Last modified 13 months ago

#4648 closed task (fixed)

bc-2.7.2

Reported by: Bruce Dubbs Owned by: lfs-book
Priority: normal Milestone: 10.0
Component: Book Version: SVN
Severity: normal Keywords:
Cc:

Description

New minor version.

Change History (6)

comment:1 by Bruce Dubbs, 15 months ago

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).)

comment:2 by Bruce Dubbs, 15 months ago

Summary: bc-2.7.0bc-2.7.1

Now version 2.7.1.

comment:3 by Bruce Dubbs, 15 months ago

Summary: bc-2.7.1bc-2.7.2

Now version 2.7.2.

comment:4 by Bruce Dubbs, 15 months ago

# 2.7.2

This is a production release with one major bug fix.

The length() built-in function can take either a number or an array. If it takes an array, it returns the length of the array. Arrays can be passed by reference. The bug is that the length() function would not properly dereference arrays that were references. This is a bug that affects all users.

ALL USERS SHOULD UPDATE bc.

# 2.7.1

This is a production release with fixes for new locales and fixes for compiler warnings on FreeBSD.

comment:5 by Bruce Dubbs, 15 months ago

Resolution: fixed
Status: newclosed

Fixed at revision 11840.

comment:6 by Bruce Dubbs, 13 months ago

Milestone: 9.210.0

Milestone renamed

Note: See TracTickets for help on using tickets.