Skip to content

Releases: gavinhoward/bc

Version 2.1.0

04 Jul 01:26
Compare
Choose a tag to compare

This release is a production release.

The following bugs were fixed:

  • A dc bug that caused stack mishandling was fixed.
  • A warning on OpenBSD was fixed.
  • Bugs in ctrl+arrow operations in history were fixed.
  • The ability to paste multiple lines in history was added.
  • A bc bug, mishandling of array arguments to functions, was fixed.
  • A crash caused by freeing the wrong pointer was fixed.
  • A dc bug where strings, in a rare case, were mishandled in parsing was fixed.

In addition, the following changes were made:

  • Division was slightly optimized.
  • An option was added to the build to disable printing of prompts.
  • The special case of empty arguments is now handled. This is to prevent errors in scripts that end up passing empty arguments.
  • A harmless bug was fixed. This bug was that, with the pop instructions (mostly) removed (see below), bc would leave extra values on its stack for void functions and in a few other cases. These extra items would not affect anything put on the stack and would not cause any sort of crash or even buggy behavior, but they would cause bc to take more memory than it needed.

On top of the above changes, the following optimizations were added:

  • The need for pop instructions in bc was removed.
  • Extra tests on every iteration of the interpreter loop were removed.
  • Updating function and code pointers on every iteration of the interpreter loop was changed to only updating them when necessary.
  • Extra assignments to pointers were removed.

Altogether, these changes sped up the interpreter by around 2x.

NOTE: This is the last release with new features because this bc is now considered complete. From now on, only bug fixes and new translations will be added to this bc.

$ sha512sum bc-2.1.0.tar.xz
d117c0433b08d7bf4986ff49a39b6cbd1048399e74a3781ba48b27008d18c1cedfaca79c1d0510919b194bc593699ba99a736c377815cb3659cec772b45b1cd1  bc-2.1.0.tar.xz

$ sha256sum bc-2.1.0.tar.xz
b6b25a44323e42959b2ba4885f54fcc6d889070dbb53c7d0f8db9f56a4faafc8  bc-2.1.0.tar.xz

$ stat -c '%s  %n' bc-2.1.0.tar.xz
153912  bc-2.1.0.tar.xz

Version 2.0.3

11 Jun 01:50
Compare
Choose a tag to compare

This is a production, bug-fix release.

Two bugs were fixed in this release:

  • A rare and subtle signal handling bug was fixed.
  • A misbehavior on 0 to a negative power was fixed.

The last bug bears some mentioning.

When I originally wrote power, I did not thoroughly check its error cases; instead, I had it check if the first number was 0 and then if so, just return 0. However, 0 to a negative power means that 1 will be divided by 0, which is an error.

I caught this, but only after I stopped being cocky. You see, sometime later, I had noticed that GNU bc returned an error, correctly, but I thought it was wrong simply because that's not what my bc did. I saw it again later and had a double take. I checked for real, finally, and found out that my bc was wrong all along.

That was bad on me. But the bug was easy to fix, so it is fixed now.

There are two other things in this release:

  • Subtraction was optimized by Stefan Eßer.
  • Division was also optimized, also by Stefan Eßer.
$ sha512sum bc-2.0.3.tar.xz
1eabc44a33c08e1cc20c7112843e18544860dc8621cf655c2453858d64b720cada4835ab6142110f296c4d6ad82e77725e603fd11b84b61b073efccc9f6a1c45  bc-2.0.3.tar.xz

$ sha256sum bc-2.0.3.tar.xz
320e2616f20ab5636b6256194ad10796864c177fbbfe8bf15057438b01adc5c1  bc-2.0.3.tar.xz

$ stat -c '%s  %n' bc-2.0.3.tar.xz
162360  bc-2.0.3.tar.xz

Version 2.0.2

29 May 01:41
Compare
Choose a tag to compare

This release contains a fix for a possible overflow in the signal handling. I would be surprised if any users ran into it because it would only happen after 2 billion (2^31-1) SIGINT's, but I saw it and had to fix it.

$ sha512sum bc-2.0.2.tar.xz
1548dbb7333eff63e9f30fe902301a9891a531514b95469083f50ae96cbcf6ed4989fac27e4779e2d3c58e1fda1d8d99611327e4411e78c9b85954cf5cc6f555  bc-2.0.2.tar.xz

$ sha256sum bc-2.0.2.tar.xz
de965a1f94b969042472837ab589c38cae533af7ce6387f735f41dc556aebf44  bc-2.0.2.tar.xz

$ stat -c '%s  %n' bc-2.0.2.tar.xz
147844  bc-2.0.2.tar.xz

Version 2.0.1

26 May 15:06
Compare
Choose a tag to compare

This release contains very few things that will apply to any users.

  • A slight bug in dc's interactive mode was fixed.
  • A bug in the test suite that was only triggered on NetBSD was fixed.
  • The -P/--no-prompt option was added for users that do not want a prompt.
  • A make check target was added as an alias for make test.
  • dc got its own read prompt: ?> .
$ sha512sum bc-2.0.1.tar.xz
45d0091958e99621e3543f80db41047221f2b07bcc73f523016a9ed6c27bfa7e6f3dea7776f01f6e1a97b52632531535e0cfa176677cf70a5e34c88ed1ee0643  bc-2.0.1.tar.xz

$ sha256sum bc-2.0.1.tar.xz
bbf92363c88c85757e86261a58d19e56c716d38a5e7f4f5ea1e50a0f1f178347  bc-2.0.1.tar.xz

$ stat -c '%s  %n' bc-2.0.1.tar.xz
147648  bc-2.0.1.tar.xz

Version 2.0.0

25 May 18:00
Compare
Choose a tag to compare

This release is a production release.

This release is also a little different from previous releases. From here on out, I do not plan on adding any more features to this bc; I believe that it is complete. However, there may be bug fix releases in the future, if I or any others manage to find bugs.

This release has only a few new features:

  • atan2(y, x) was added to the extended math library as both a2(y, x) and atan2(y, x).
  • Locales were fixed.
  • A POSIX shell-compatible script was added as an alternative to compiling gen/strgen.c on a host machine. More details about making the choice between the two can be found by running ./configure.sh --help or reading the build manual.
  • Multiplication was optimized by using diagonal multiplication, rather than straight brute force.
  • The locale_install.sh script was fixed.
  • dc was given the ability to use the environment variable DC_ENV_ARGS.
  • dc was also given the ability to use the -i or --interactive options.
  • Printing the prompt was fixed so that it did not print when it shouldn't.
  • Signal handling was fixed.
  • Handling of SIGTERM and SIGQUIT was fixed.
  • The built-in functions maxibase(), maxobase(), and maxscale() (the commands T, U, V in dc, respectively) were added to allow scripts to query for the max allowable values of those globals.
  • Some incompatibilities with POSIX were fixed.

In addition, this release is 2.0.0 for a big reason: the internal format for numbers changed. They used to be a char array. Now, they are an array of larger integers, packing more decimal digits into each integer. This has delivered HUGE performance improvements, especially for multiplication, division, and power.

This bc should be the fastest bc available, but I may be wrong.

$ sha512sum bc-2.0.0.tar.xz
183cec17ed5020e673abb886eb1f391f8a97ac37a67ca63bb00d8b4c8e52ba0e502f7f813d5b4abf650b0fd0dc74a7e8a7a752faf8a47bd7a8014fd4703bca05  bc-2.0.0.tar.xz

$ sha256sum bc-2.0.0.tar.xz
0ddfc78f6588d9c4d33334cb6862e6db96b2e499a8a650701e98de745e3f549e  bc-2.0.0.tar.xz

$ stat -c '%s  %n' bc-2.0.0.tar.xz
147196  bc-2.0.0.tar.xz

Version 1.2.8

20 Apr 06:10
Compare
Choose a tag to compare

This release contains a fix for a harmless bug (it is harmless in that it still works, but it just copies extra data) in the locale_install.sh script.

$ sha512sum bc-1.2.8.tar.xz
34941e73edf35a24f96469453643277b4fb8bfbdabda945ef20fddbb1d42be572659225859939f994d29fc17aab9da7d04ffc1f3217b1875eed3d6070a22bb3f  bc-1.2.8.tar.xz

$ sha256sum bc-1.2.8.tar.xz
7318ab9d4f0755d9c5d6efdd293b5d261a464cac79dec9f32c5a940cbd0ff14f  bc-1.2.8.tar.xz

$ stat -c '%s  %n' bc-1.2.8.tar.xz
127952  bc-1.2.8.tar.xz

Version 1.2.7

17 Apr 23:18
Compare
Choose a tag to compare

This version contains fixes for the build on Arch Linux.

$ sha512sum bc-1.2.7.tar.xz
b8112253006f287a533d55cb308e5a92d75f72c30d9a0a0b726b966e72938c1ce5277c0785631bc168a5e983a6e4e4b0fd5b920fa162b5b99c5cc6ba107e25cd  bc-1.2.7.tar.xz

$ sha256sum bc-1.2.7.tar.xz
3a7626fd258168eb8cff6a488402adba0eeec0be1b82a267448d194445c4e948  bc-1.2.7.tar.xz

$ stat -c '%s  %n' bc-1.2.7.tar.xz
125068  bc-1.2.7.tar.xz

Version 1.2.6

17 Apr 19:50
Compare
Choose a tag to compare

This release removes the use of local in shell scripts and updates a man page that should have been updated a long time ago but was missed.

$ sha512sum bc-1.2.6.tar.xz
c8ff2ac542413bf594a00ea9a8a9e4cd24e48081839a4e11546a08551a73b4f460391edf7f3aa3f5143db5c4e7bc1448ff7cd1104599cfa2fb44fba79c5b24fc  bc-1.2.6.tar.xz

$ sha256sum bc-1.2.6.tar.xz
56ee9256f6864e4b5c2ec053dd2ecd95e6230de9590348101f142c6be69f2f6b  bc-1.2.6.tar.xz

$ stat -c '%s  %n' bc-1.2.6.tar.xz
130888  bc-1.2.6.tar.xz

Version 1.2.5

17 Apr 16:17
Compare
Choose a tag to compare

This release contains some missing locale *.msg files.

$ sha512sum bc-1.2.5.tar.xz
21c46d70bab8a52054f01c4f59ec477f49de9d8246f8304e3509ffdf26379734c5b2c60f18d3522ef383d73100bbe6e452cfd0990fd81a59189b54503b5ce82e  bc-1.2.5.tar.xz

$ sha256sum bc-1.2.5.tar.xz
074afa6047fa41b0498c294345404f3c4308c92abc93c180292bbb9a65be31cd  bc-1.2.5.tar.xz

$ stat -c '%s  %n' bc-1.2.5.tar.xz
124920  bc-1.2.5.tar.xz

Version 1.2.4

17 Apr 05:46
Compare
Choose a tag to compare

This release contains a few bug fixes and new French translations.

$ sha512sum bc-1.2.4.tar.xz
29bfaebd2ea69373f6ff5adf31137f804acc4094d5864d4bf6ac147cd913cc042cdf7cda70a04e16ca6d001953a6b9f161d9a1a49033018d02602afb2dffc07e  bc-1.2.4.tar.xz

$ sha256sum bc-1.2.4.tar.xz
4a8139dc3cde682c7e51b415ce21d9777b3a0b9a37e8fe9edb2b734a8c0fa6a1  bc-1.2.4.tar.xz

$ stat -c '%s  %n' bc-1.2.4.tar.xz
124732  bc-1.2.4.tar.xz