• Stable 4.0.2 aa8e8aa94f

    Release 4.0.2

    gavin released this 3 days ago | 17 commits to master since this release

    This is a production release that fixes two bugs:

    1. If no files are used and the first statement on stdin is invalid, scale would not be set to 20 even if -l was used.
    2. When using history, bc failed to respond properly to SIGSTOP and SIGTSTP.
    $ sha512sum bc-4.0.2.tar.xz
    f3564cb953bca2003c9fd565b3114a2701de4437c6db3cace29edab186d3270cd98f66f3eb1a45fd074a44736fef39f78675959f400c1c23a4a2e930d469c059  bc-4.0.2.tar.xz
    
    $ sha256sum bc-4.0.2.tar.xz
    b4a7046325557a44d02165874f957c3abf49e2ba4491c8275326cb7c55ef2290  bc-4.0.2.tar.xz
    
    $ stat -c '%s  %n'
    235464  bc-4.0.2.tar.xz
    
    $ sha512sum bc-4.0.2.tar.xz.sig
    3cb05a0d3561acab6fbd6e473c2d8eb32daf825c9aa4840bfb9f2d850e5525661574644d01a4411ff2df099499d226d81bf1b226e975b07f059f2f3c38372a91  bc-4.0.2.tar.xz.sig
    
    $ sha256sum bc-4.0.2.tar.xz.sig
    1b8f8eeff862ddd4c8ed6f40a16f2608a029b86e5cb37a70ce6cf5730d8230a6  bc-4.0.2.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-4.0.2.tar.xz.sig
    
     
  • Stable 4.0.1 e9c191cdda

    Release 4.0.1

    gavin released this 1 week ago | 19 commits to master since this release

    This is a production release that only adds one thing: flushing output when it is printed with a print statement.

    $ sha512sum bc-4.0.1.tar.xz
    c12523ebca7a2419754b65e010d2c0bae15117ed06aa876d01cadc1b45334d4ea774cbb3e94ccf445d1175fe8d500b1d0b53576009b8ed676b6ac6493db98eba  bc-4.0.1.tar.xz
    
    $ sha256sum bc-4.0.1.tar.xz
    cbb20ac36e5250d65db78ff46acd85e4804b603145bb4479d80348552216de19  bc-4.0.1.tar.xz
    
    $ stat -c '%s  %n'
    235320  bc-4.0.1.tar.xz
    
    $ sha512sum bc-4.0.1.tar.xz.sig
    b124ad5795e96bf17146c0f9ba3e3b708b0bf2bc1f8a11fcb500f00cff8a6b3202a925aa0c195320e5dc47ded4f1196dac7e0a2818e7779cc473fef879100e4b  bc-4.0.1.tar.xz.sig
    
    $ sha256sum bc-4.0.1.tar.xz.sig
    6441addcadd1f87ba9e5689a7589486757b698baf3e1923b2b9063658f49f0d0  bc-4.0.1.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-4.0.1.tar.xz.sig
    
     
  • Stable 4.0.0 e9c191cdda

    Release 4.0.0

    gavin released this 1 week ago | 19 commits to master since this release

    This is a production release with many fixes, a new command-line option, and a big surprise:

    • A bug was fixed in dc's P command where the item on the stack was not popped.
    • Various bugs in the manuals have been fixed.
    • A known bug was fixed where history did not interact well with prompts printed by user code without newlines.
    • A new command-line option, -R and --no-read-prompt was added to disable just the prompt when using read() (bc) or ? (dc).
    • And finally, official support for Windows was added.

    The last item is why this is a major version bump.

    Currently, only one set of build options (extra math and prompt enabled, history and NLS/locale support disabled, both calculators enabled) is supported on Windows. However, both debug and release builds are supported.

    In addition, Windows builds are supported for the the library (bcl).

    For more details about how to build on Windows, see the README or the build manual.

    $ sha512sum bc-4.0.0.tar.xz
    e25f4377df81c14f7036fdcbcd503a10ebb4e2663b182da78928aad871b22940c503d54f9a7942798d4e1f38e0487047f492348041a229f18e0fd0e45aab33b3  bc-4.0.0.tar.xz
    
    $ sha256sum bc-4.0.0.tar.xz
    d3c3ea6c3a439d20eb57e4b84b10f16a41af1b069640a591f584d704054f0a48  bc-4.0.0.tar.xz
    
    $ stat -c '%s  %n'
    235496  bc-4.0.0.tar.xz
    
    $ sha512sum bc-4.0.0.tar.xz.sig
    cc511655b2cc68d6b4e5bd1e4228abf9a4ff12d96a7f28dab3f418163e9013063acdc052906c94ce285ed94be7e0c8b957988b1842170adae3c7511f2a451bb9  bc-4.0.0.tar.xz.sig
    
    $ sha256sum bc-4.0.0.tar.xz.sig
    568c27c9bd7b0ac44244aadce2f76760fd5d5dc4f605cdb12a1568b826344be7  bc-4.0.0.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-4.0.0.tar.xz.sig
    
     
  • Stable 3.3.4 e9c191cdda

    Release 3.3.4

    gavin released this 1 week ago | 19 commits to master since this release

    This is a production release that fixes a small bug.

    The bug was that output was not flushed before a read() call, so prompts without a newline on the end were not flushed before the read() call.

    This is such a tiny bug that users only need to upgrade if they are affected.

    $ sha512sum bc-3.3.4.tar.xz
    212b36a3fafbda28c6416d29e2d9e49272c42d95dcdc3bbbb3691e4686ca3f0a9fec883a099d059c5bd21a9b08bf5b2eff01169de20df9777c2fce66a8cda783  bc-3.3.4.tar.xz
    
    $ sha256sum bc-3.3.4.tar.xz
    268dad63e5df73520ff03e54d445bcf4d5c46c4f77a01c3009df57b3e5bb4fa4  bc-3.3.4.tar.xz
    
    $ stat -c '%s  %n'
    230264  bc-3.3.4.tar.xz
    
    $ sha512sum bc-3.3.4.tar.xz.sig
    40425b7ead268b118c5ce85333c093696b843dce171bb98cef267044aae9d565d2a66cff91f66d10e4ead9b92482316e1bbac5824fe7c4a0ed7d877c07cc00ec  bc-3.3.4.tar.xz.sig
    
    $ sha256sum bc-3.3.4.tar.xz.sig
    29d06c17f6d403d074ae5a658f11dbade8a05653ea876b9f617fde17393d652c  bc-3.3.4.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.3.4.tar.xz.sig
    
     
  • Stable 3.3.3 c491550347

    Release 3.3.3

    gavin released this 2 months ago | 61 commits to master since this release

    This is a production release with one tweak and fixes for manuals.

    The tweak is that length(0) returns 1 instead of 0. In 3.3.1, I changed it so length(0.x), where x could be any number of digits, returned the scale, but length(0) still returned 0 because I believe that 0 has 0 significant digits.

    After request of FreeBSD and considering the arguments of a mathematician, compatibility with other bc's, and the expectations of users, I decided to make the change.

    The fixes for manuals fixed a bug where -- was rendered as -.

    $ sha512sum bc-3.3.3.tar.xz
    dfdd8023453406d9f681e04da7acaad4459e632fded0f2edb2b51607438a27074935af6db4b3580120daf56e6b52283275d0c2c809380caa164957f1901e9dde  bc-3.3.3.tar.xz
    
    $ sha256sum bc-3.3.3.tar.xz
    b9fde063b32d4f0c3bab9d069aa8ac4d7d804ce5bebb54d7a2e574e70309bc93  bc-3.3.3.tar.xz
    
    $ stat -c '%s  %n'
    229688  bc-3.3.3.tar.xz
    
    $ sha512sum bc-3.3.3.tar.xz.sig
    aeb0ac35e5b99f101fcf04e57659712a378c22da138ff405866baf4c41963af111b2128fc23aeb672ef0a928948ec9f4eeb9eea51781cb20a24cba7fd92af09a  bc-3.3.3.tar.xz.sig
    
    $ sha256sum bc-3.3.3.tar.xz.sig
    0fe5f256396f0e81d686a728ccf106094f577669877d05e1d82161f5de1d0ede  bc-3.3.3.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.3.3.tar.xz.sig
    
     
  • Stable 3.3.2 198d431d60

    Release 3.3.2

    gavin released this 2 months ago | 65 commits to master since this release

    This is a production release that fixes a divide-by-zero bug in root() in the extended math library. All previous versions with root() have the bug.

    $ sha512sum bc-3.3.2.tar.xz
    ae3e99c49137e1335c6c6c0f5a39a5488d174b98bdf85ce1c9311546ea093cd6ed2d8d0a3e6d401cdf093d509717ae01ec71e6e60d580e71101c673da5efc953  bc-3.3.2.tar.xz
    
    $ sha256sum bc-3.3.2.tar.xz
    d2f39937b1b20375e3cfd675562cd2e061408772298e7bb53668f725b94de8ed  bc-3.3.2.tar.xz
    
    $ stat -c '%s  %n'
    228892  bc-3.3.2.tar.xz
    
    $ sha512sum bc-3.3.2.tar.xz.sig
    5f3392a986e713f0714905e664c89251a8383751c9a52b37686f1063798cba495e61aa5e93069de5b07f0b156bbeebd32c2fb85f43f70b69ae41d1fd43ae9277  bc-3.3.2.tar.xz.sig
    
    $ sha256sum bc-3.3.2.tar.xz.sig
    ca68c4101cb56f6a90915ac28cc75da28853099063ce292b4e9602a6685bfb3e  bc-3.3.2.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.3.2.tar.xz.sig
    
     
  • Stable 3.3.1 986ff371d6

    Release 3.3.1

    gavin released this 3 months ago | 70 commits to master since this release

    This is a production release that fixes a bug.

    The bug was in the reporting of number length when the value was 0.

    $ sha512sum bc-3.3.1.tar.xz
    098bcbe0abc323b295bd46bcf8af00e69898ef560108b660964fb2dfdf6d114a17f051dde0fff06f06aa97f4cee086275eb5dc937166034d795d5cb3da999fca  bc-3.3.1.tar.xz
    
    $ sha256sum bc-3.3.1.tar.xz
    b6328ad691c71d1ae910dc3d45fe4b35faddd15f79b07b482e21b1766c89dda4  bc-3.3.1.tar.xz
    
    $ stat -c '%s  %n'
    229708  bc-3.3.1.tar.xz
    
    $ sha512sum bc-3.3.1.tar.xz.sig
    904a47bc565218d8243920f5c3c6b8a45a9f9914766fbba63730f926e7a08c3fbc28c2adcc23a3e08a4b1939375a5d766270415675afb7f9fe7b245ae498be1c  bc-3.3.1.tar.xz.sig
    
    $ sha256sum bc-3.3.1.tar.xz.sig
    585bf520d50bd6094573aef5ba223c642f5a77e8e643e9c015ca2b111e01d4e4  bc-3.3.1.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.3.1.tar.xz.sig
    
     
  • Stable 3.3.0 d0c044a11e

    Release 3.3.0

    gavin released this 3 months ago | 74 commits to master since this release

    This is a production release that changes one behavior and fixes documentation bugs.

    The changed behavior is the treatment of -e and -f when given through BC_ENV_ARGS or DC_ENV_ARGS. Now bc and dc do not exit when those options (or their equivalents) are given through those environment variables. However, bc and dc still exit when they or their equivalents are given on the command-line.

    $ sha512sum bc-3.3.0.tar.xz
    b8d0b6d6d9c5d4fc62df62d1b9b7e7006a8b430e063fe0d5f646cfaeb4c6fc9c7037b644e853b7ae7d5c5f42f079221e9cdc32564d70c9ddd6bb867ddc7056de  bc-3.3.0.tar.xz
    
    $ sha256sum bc-3.3.0.tar.xz
    d4c0da5a6be9652f55bf237dd44d68602f75c617b486356cb70fc4514f2fd360  bc-3.3.0.tar.xz
    
    $ stat -c '%s  %n'
    229580  bc-3.3.0.tar.xz
    
    $ sha512sum bc-3.3.0.tar.xz.sig
    935b381ce5a84a895fabcdfe87fbcb9c5c2f2af2a6ea12948a704447406932366261a105ce08b95dd9e4257b0f46ab98b6df4de61186c82b602dd81b334a0d4b  bc-3.3.0.tar.xz.sig
    
    $ sha256sum bc-3.3.0.tar.xz.sig
    14be11a9d60b06aed93f2a4cece039d78e49eb3aa4a7b92f9058b9e6e53afb8d  bc-3.3.0.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.3.0.tar.xz.sig
    
     
  • Stable 3.2.7 d7923c937a

    Release 3.2.7

    gavin released this 3 months ago | 80 commits to master since this release

    This is a production release that removes a small non-portable shell operation in configure.sh. This problem was only noticed on OpenBSD, not FreeBSD or Linux.

    Non-OpenBSD users do NOT need to upgrade, although NetBSD users may also need to upgrade.

    $ sha512sum bc-3.2.7.tar.xz
    b516c400625b54b68ed5c1d484d48d80a094495c1d96437129a835dcc5caf2c29d5524d4b67144d11215569bd6ec1ac90113b3fda0d621c8672313119da4f9fa  bc-3.2.7.tar.xz
    
    $ sha256sum bc-3.2.7.tar.xz
    ab3d925d14687e38d971b3f2ea9dff1f3338d0d151644f7fa503dbefe3d8f573  bc-3.2.7.tar.xz
    
    $ stat -c '%s  %n'
    228540  bc-3.2.7.tar.xz
    
    $ sha512sum bc-3.2.7.tar.xz.sig
    8ab7a3595e130e036acac8554a5107a11b5212d93d298e8a0370a402049026c702c6f6f06fcf6f46a7e36eb6b5a7d1b6b42f5987ea39995039e512226b6c6c26  bc-3.2.7.tar.xz.sig
    
    $ sha256sum bc-3.2.7.tar.xz.sig
    55851847a6ec3c20d1cae884f67c7adff712b45a2c1575420645b1228076d9a9  bc-3.2.7.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.2.7.tar.xz.sig
    
     
  • Stable 3.2.6 8b9f8084a0

    Release 3.2.6

    gavin released this 3 months ago | 88 commits to master since this release

    This is a production release that fixes the build on FreeBSD.

    There was a syntax error in configure.sh that the Linux shell did not catch, and FreeBSD depends on the existence of tests/all.sh.

    All users that already upgraded to 3.2.5 should update to this release, with my apologies for the poor release of 3.2.5. Other users should skip 3.2.5 in favor of this version.

    $ sha512sum bc-3.2.6.tar.xz
    4b1f43bb0bcd720d2140d41e089aa78fe8d07903fb745ed1a641ffe25fe46f439e480a1e11b687b7555881bd1ee4044c071c50e4bacd579b8909c704db7a6ede  bc-3.2.6.tar.xz
    
    $ sha256sum bc-3.2.6.tar.xz
    4e664b3f4441fe79e5b0474ca019d23dfd5562e8c6a5efcc3ca08762fb7a1821  bc-3.2.6.tar.xz
    
    $ stat -c '%s  %n'
    234964  bc-3.2.6.tar.xz
    
    $ sha512sum bc-3.2.6.tar.xz.sig
    031ceb082537bea132f7a6544987f94a815eb1f63d1dbf1732f987cb8caee8763c2d1137298c5b4ca4d822c3220d147db2e92a1e5406fa33f3d13943a6827948  bc-3.2.6.tar.xz.sig
    
    $ sha256sum bc-3.2.6.tar.xz.sig
    38d87ce3fcaf0867f0507f74a1e79ec7978ff18c521984a71581e4b8b68cafc3  bc-3.2.6.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.2.6.tar.xz.sig
    
     
  • Pre-Release 3.2.5 8cc14cfdb1

    Release 3.2.5

    gavin released this 3 months ago | 93 commits to master since this release

    This is a (non)production release that fixes several bugs and adds a couple small things.

    The two most important bugs were bugs that causes dc to access memory out-of-bounds (crash in debug builds). This was found by upgrading to afl++ from afl. Both were caused by a failure to distinguish between the same two cases.

    Another bug was the failure to put all of the licenses in the LICENSE.md file.

    Third, some warnings by scan-build were found and eliminated. This needed one big change: bc and dc now bail out as fast as possible on fatal errors instead of unwinding the stack.

    Fourth, the pseudo-random number now attempts to seed itself with /dev/random if /dev/urandom fails.

    Finally, this release has a few quality-of-life changes to the build system. The usage should not change at all; the only thing that changed was making sure the Makefile.in was written to rebuild properly when headers changed and to not rebuild when not necessary.

    $ sha512sum bc-3.2.5.tar.xz
    6e03d6549376b4350fe1d079d7f1cc3cf430a893af8bae004c752fabb7acdb7802f9039a9227f3439e1d73925bfc8f9b973339cebc8fa851ae8a45658eb65c74  bc-3.2.5.tar.xz
    
    $ sha256sum bc-3.2.5.tar.xz
    9b6b8be28bf617312f49309163477272822e9f8537436d81741340b083d11ca7  bc-3.2.5.tar.xz
    
    $ stat -c '%s  %n'
    234252  bc-3.2.5.tar.xz
    
    $ sha512sum bc-3.2.5.tar.xz.sig
    8fd65f6d8fb83563bcfde3d56d6a48201205c33f746e623a298185b433be1b6af7d7d90cf7dbce397c011d7046fe293907ff8305e7ac8609dccf96e4195ec690  bc-3.2.5.tar.xz.sig
    
    $ sha256sum bc-3.2.5.tar.xz.sig
    cb88aa2b9b29dc963cbe1e0c61f7c029bd88090e453c2920b8116a885cf3c48c  bc-3.2.5.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.2.5.tar.xz.sig
    
     
  • Stable 3.2.4 63583d3ac1

    Release 3.2.4

    gavin released this 5 months ago | 135 commits to master since this release

    This is a production release that fixes a warning on gcc 6 or older, which does not have an attribute that is used.

    Users do NOT need to upgrade if they don't use gcc 6 or older.

    $ sha512sum bc-3.2.4.tar.xz
    9a22d829b7346d08ad0066dd65dfeb832b5eb7c77b52798d05da9450d77590d264ecfe9318955f7335ddcfb11bb48f44854c760c0b4c173e128378ccf297d443  bc-3.2.4.tar.xz
    
    $ sha256sum bc-3.2.4.tar.xz
    b4aba186094999a78ee9d76419f71c9b02c73bc4ace4069802199cccc0a0e41a  bc-3.2.4.tar.xz
    
    $ stat -c '%s  %n'
    225344  bc-3.2.4.tar.xz
    
    $ sha512sum bc-3.2.4.tar.xz.sig
    307419689c906f09af79d7479a38de410f8b77f1d8e36cff42685877b4f5cf6e5723e95f062a574a40613149ccf1a6adcc50feb02ac8abe074b3b8f3282effde  bc-3.2.4.tar.xz.sig
    
    $ sha256sum bc-3.2.4.tar.xz.sig
    adc0739334632b6461194d2564b5680d7a8e6351627fab36564df08a076c8b88  bc-3.2.4.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.2.4.tar.xz.sig
    
     
  • Stable 3.2.3 c19bc989ed

    Release 3.2.3

    gavin released this 6 months ago | 138 commits to master since this release

    This is a production release that fixes a bug in gen/strgen.sh. I recently changed gen/strgen.c, but I did not change gen/strgen.sh.

    Users that do not use gen/strgen.sh do not need to upgrade.

    $ sha512sum bc-3.2.3.tar.xz
    efd040d46f2ed1eff5a2eb336e55fd465176c23c728935ee488a474b2f0c8dddd275805ee3be79f20afc523a183adb3d88a0e7bee095047912cf70741e2c0b32  bc-3.2.3.tar.xz
    
    $ sha256sum bc-3.2.3.tar.xz
    e9610eca329e3346c0d5b76f675f90be36d5c019378ea98f10931daba1c98314  bc-3.2.3.tar.xz
    
    $ stat -c '%s  %n'
    225420  bc-3.2.3.tar.xz
    
    $ sha512sum bc-3.2.3.tar.xz.sig
    4c62f9183fb0ec8f6273108e5f4dd143615db5b1ab428463f0cb859d5f5f4f32cee3ba7c4f6d7278953e8a25466e68de7aab24eca7f607f998129a61ecce2ff5  bc-3.2.3.tar.xz.sig
    
    $ sha256sum bc-3.2.3.tar.xz.sig
    dbbe92c8c1eef8bfab5792d03d325c4de5fa7bf46faf55eeb1134ba755847a12  bc-3.2.3.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.2.3.tar.xz.sig
    
     
  • Stable 3.2.2 207abe80e8

    Release 3.2.2

    gavin released this 6 months ago | 140 commits to master since this release

    This is a production release that fixes a portability bug in configure.sh. The bug was using the GNU find extension -wholename.

    $ sha512sum bc-3.2.2.tar.xz
    2e8f121c751e987569a0acdfbf648c3ef120d4c808de1a1a0c9f2421f4ef3e45e5031ccd7c3e144a4502cc36ed433ca8e56c943b87f26193dcf4c745adf12ddc  bc-3.2.2.tar.xz
    
    $ sha256sum bc-3.2.2.tar.xz
    d38fb0e846576d010afb86abc19d810ad9ac29904a47a50b4f7e5459f0f924d2  bc-3.2.2.tar.xz
    
    $ stat -c '%s  %n'
    225228  bc-3.2.2.tar.xz
    
    $ sha512sum bc-3.2.2.tar.xz.sig
    bbfa6926e2f58e2c8e77dc35ba48b2383872d73e59f81f8bc2f6279cbe8948a9e8b41c7f4ac1698d8c40c3a5335a6ea1648d536a18281aec9e861e2c7a1a39a8  bc-3.2.2.tar.xz.sig
    
    $ sha256sum bc-3.2.2.tar.xz.sig
    3f00d425bdeba03f938e910bedbbd689fd2d7920549eb890f4613faf6809343c  bc-3.2.2.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.2.2.tar.xz.sig
    
     
  • Stable 3.2.1 44d9a63ab2

    Release 3.2.1

    gavin released this 6 months ago | 142 commits to master since this release

    This is a production release that has one fix for bcl(3). It is technically not a bug fix since the behavior is undefined, but the BclNumbers that bcl_divmod() returns will be set to BCL_ERROR_INVALID_NUM if there is an error. Previously, they were not set.

    $ sha512sum bc-3.2.1.tar.xz
    1f861d9571523a5f1bb75d69aa21b470ae833fd748edb2dc78e02dee9925aea1ccff5b8a52ca74ea1945cfdca64eb8bc58919c90c39040749cb550a6372077c9  bc-3.2.1.tar.xz
    
    $ sha256sum bc-3.2.1.tar.xz
    b7bb88c8207338aa65246e7065823f6f415822b196b9a49126fe89d4b357e546  bc-3.2.1.tar.xz
    
    $ stat -c '%s  %n'
    225116  bc-3.2.1.tar.xz
    
    $ sha512sum bc-3.2.1.tar.xz.sig
    d1ece61e43ad1c05dc82b9dff4886846ed63f0f46e77cd098f237d97ca53dbd0c60b1d32d7c4e04bac74593315b217b64503bc7b264f78061c18cdb696b6a9c5  bc-3.2.1.tar.xz.sig
    
    $ sha256sum bc-3.2.1.tar.xz.sig
    61061fbbe6a3660621bfc04b600297c1cb167934cec4dc2d14aa5ef4115e9271  bc-3.2.1.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.2.1.tar.xz.sig
    
     
  • Stable 3.2.0 cb070f46cb

    Release 3.2.0

    gavin released this 6 months ago | 144 commits to master since this release

    This is a production release that has one bug fix and a major addition.

    The bug fix was a missing auto variable in the bessel j() function in the math library.

    The major addition is a way to build a version of bc's math code as a library. This is done with the -a option to configure.sh. The API for the library can be read in ./manuals/bcl.3.md or man bcl once the library is installed with make install.

    This library was requested by developers before I even finished version 1.0, but I could not figure out how to do it until now.

    If the library has API breaking changes, the major version of bc will be incremented.

    $ sha512sum bc-3.2.0.tar.xz
    b6e3ab2d4599f8e0c9ba0bcbe8d45e8b62453720063a9cb893bcf55995005f9d09ab803df19cc73920a1f4e4868ba069b110e2ac22f21bb8c8dfcee01a419d6a  bc-3.2.0.tar.xz
    
    $ sha256sum bc-3.2.0.tar.xz
    0f536d65dbdcd3d6a419b071aa66ba6c80172c1c705106054b859cc8e6df1c96  bc-3.2.0.tar.xz
    
    $ stat -c '%s  %n'
    225012  bc-3.2.0.tar.xz
    
    $ sha512sum bc-3.2.0.tar.xz.sig
    f49d0d8587afe80c904a5389819515c58b6177a2d09c3f5754dc4ec1ed50e698ad4c1268f32467848ece89045ba3b6ce7113e3130d47a009d7d36677c74dcfd7  bc-3.2.0.tar.xz.sig
    
    $ sha256sum bc-3.2.0.tar.xz.sig
    7c4f0dcb5b57be000681a72ae7b97f52612dd86f6e3ec04370286ba6bc64933b  bc-3.2.0.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.2.0.tar.xz.sig
    
     
  • Stable 3.1.6 2f91e8ee00

    Release 3.1.6

    gavin released this 8 months ago | 223 commits to master since this release

    This is a production release that fixes a new warning from Clang 12 for FreeBSD and also removes some possible undefined behavior found by UBSan that compilers did not seem to take advantage of.

    Users do NOT need to upgrade, if they do not want to.

    $ sha512sum bc-3.1.6.tar.xz
    1219a074845b8c66a431ddb78bab643793f5275c26404e92e360e655418d70d1aafa02be2fc4dec25d99a85ae2da1aab7d615de893f85913ca8834448dcade53  bc-3.1.6.tar.xz
    
    $ sha256sum bc-3.1.6.tar.xz
    e523296e59f6ca82210d10baa12bd97de02cab0fd62be554bc6f0772869ad445  bc-3.1.6.tar.xz
    
    $ stat -c '%s  %n'
    210976  bc-3.1.6.tar.xz
    
    $ sha512sum bc-3.1.6.tar.xz.sig
    117aef03b8ffbf95c5f480130b5553f72ce8872a2677d2712f10de80b29a4643be60f9cd463b1df026e99e97fc38fc486ff0a2ac4725761dd47fcf04d05c128d  bc-3.1.6.tar.xz.sig
    
    $ sha256sum bc-3.1.6.tar.xz.sig
    dcbb5291f594718fbc8109aa451847770361d7ff7457954c1c34d4aeef6e5880  bc-3.1.6.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.1.6.tar.xz.sig
    
     
  • Stable 3.1.5 9487714deb

    Release 3.1.5

    gavin released this 9 months ago | 231 commits to master since this release

    This is a production release that fixes the Chinese locales (which caused bc to crash) and a crash caused by bc executing code when it should not have been able to.

    ALL USERS SHOULD UPGRADE.

    $ sha512sum bc-3.1.5.tar.xz
    34be1c186df5906ab7a966739220a20afd7e3b227a5c7ba32a77256a36e097bbcc39b99ce6d6855de3e6e2296612f8fbe63dc0983ad91d4eb4c1e630dbb587a0  bc-3.1.5.tar.xz
    
    $ sha256sum bc-3.1.5.tar.xz
    0493c1eb76e94ace7a00532824121ab901ac1bd3580a340ea5de92a7d9c1a19e  bc-3.1.5.tar.xz
    
    $ stat -c '%s  %n'
    211632  bc-3.1.5.tar.xz
    
    $ sha512sum bc-3.1.5.tar.xz.sig
    92d05d9d55729c3a62bb452bc389edc9a23f1bf3c2f59ef43b2a86e429777a68121bfb195ed7f59171c17fb944bda16a1848ad224b316114cf707b2dd45a71fe  bc-3.1.5.tar.xz.sig
    
    $ sha256sum bc-3.1.5.tar.xz.sig
    18450efb04ffb9111290ae65f8e899e2966cf3dd1f74292203c6f0d96a441c3c  bc-3.1.5.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.1.5.tar.xz.sig
    
     
  • Stable 3.1.4 ccad710baf

    Release 3.1.4

    gavin released this 9 months ago | 240 commits to master since this release

    This is a production release that fixes one bug, changes two behaviors, and removes one environment variable.

    The bug is like the one in the last release except it applies if files are being executed. I also made the fix more general.

    The behavior that was changed is that bc now exits when given -e, -f, --expression or --file. However, if the last one of those is -f- (using stdin as the file), bc does not exit. If -f- exists and is not the last of the -e and -f options (and equivalents), bc gives a fatal error and exits.

    Next, I removed the BC_EXPR_EXIT and DC_EXPR_EXIT environment variables since their use is not needed with the behavior change.

    Finally, I made it so bc does not print the header, though the -q and --quiet options were kept for compatibility with GNU bc.

    $ sha512sum bc-3.1.4.tar.xz
    3f8cf5f0d130b75370a1b077f437a4f8c6b38b65378027be6035e8a9417cce83d1618b09ff4e1d8bb6132af35bafc673a8372d854e8cbbed847040aadc234a3a  bc-3.1.4.tar.xz
    
    $ sha256sum bc-3.1.4.tar.xz
    0dda6686e76907157f4b4844268b302a319a2756dc974caf2a3e246a7b02c523  bc-3.1.4.tar.xz
    
    $ stat -c '%s  %n'
    210976  bc-3.1.4.tar.xz
    
    $ sha512sum bc-3.1.4.tar.xz.sig
    1c89676a064c59ae4207a9d7806741e9dce4d59c324751064aac1087ac51693c4c3bb3c34bc9aaa2520c7c2a302876e81943b697a496703e1f31ec037a3dfdb8  bc-3.1.4.tar.xz.sig
    
    $ sha256sum bc-3.1.4.tar.xz.sig
    c2ca215539d3fcc7980ac7ab8386ad4faade8208d5e600c1172e943b8bf47333  bc-3.1.4.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.1.4.tar.xz.sig
    
     
  • Stable 3.1.3 5514bd7945

    Release 3.1.3

    gavin released this 10 months ago | 254 commits to master since this release

    This is a production release that fixes one minor bug: if bc was invoked like the following, it would error:

    echo "if (1 < 3) 1" | bc
    

    Unless users run into this bug, they do not need to upgrade, but it is suggested that they do.

    $ sha512sum bc-3.1.3.tar.xz
    fb702e45fb994d4f1be55c2b05c4c4b4c67ae838f4f46864ba944890c1810b871fbafaa323d432f0f600f8182b4370757b75de756ae2795b595776e3fe03ba7b  bc-3.1.3.tar.xz
    
    $ sha256sum bc-3.1.3.tar.xz
    5e4a2fac5ac9a49bdec7dc3fa06547fdb83629dc7b854fb0ce63d484521f9684  bc-3.1.3.tar.xz
    
    $ stat -c '%s  %n'
    210924  bc-3.1.3.tar.xz
    
    $ sha512sum bc-3.1.3.tar.xz.sig
    cb6c2d0784c85483c174392ff9bfd148f2a837074d4cd44c25b17e8d0c3d78612bc00c58aea0e7b2b61239cadf68cf0ac68c698e79befc05a1a8614c71753124  bc-3.1.3.tar.xz.sig
    
    $ sha256sum bc-3.1.3.tar.xz.sig
    fb63237b8aa0e7f63ce96540531ea2fda7b30250625a6d08cda597d753a3b1e7  bc-3.1.3.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.1.3.tar.xz.sig
    
     
  • Stable 3.1.2 248ca9cb42

    Release 3.1.2

    gavin released this 10 months ago | 263 commits to master since this release

    This is a production release that adds a way to install all locales. Users do NOT need to upgrade.

    For package maintainers wishing to make use of the change, just pass -l to configure.sh.

    $ sha512sum bc-3.1.2.tar.xz
    c123a322578e7b2213317db8fd95c5596b45f59f8890ce05d0d25bac983d3038c1bda65c8998b760e15efc0ee3a10241f3ca712442b4f444f691dd6c5065e53d  bc-3.1.2.tar.xz
    
    $ sha256sum bc-3.1.2.tar.xz
    61d4833ffddd33b87b528e35a438c1fec4c1ecbb2fe339924fb0947b13663e65  bc-3.1.2.tar.xz
    
    $ stat -c '%s  %n'
    209820  bc-3.1.2.tar.xz
    
    $ sha512sum bc-3.1.2.tar.xz.sig
    f82933bbfc5cbe595d8e752e7bf92b5d841b2c90aee596b06346eb6fb7279cf6f21489744ea8493c1f76b225a7f295245978802a6c6175d67164b16181c42722  bc-3.1.2.tar.xz.sig
    
    $ sha256sum bc-3.1.2.tar.xz.sig
    010af7ba46d133d6d94547f6c885bec549ed39abc8c9c0168154b5182838ebfc  bc-3.1.2.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.1.2.tar.xz.sig
    
     
  • Stable 3.1.1 6354165652

    Release 3.1.1

    gavin released this 10 months ago | 269 commits to master since this release

    This is a production release that adds two Spanish locales. Users do NOT need to upgrade, unless they want those locales.

    $ sha512sum bc-3.1.1.tar.xz
    1f770edf619ade8780d0a494934071bfa82d1298043459cab6e3db6a5617e6aad0d7193635c868ef0d0312b808027ad3734cb92b0c8eff826cd5a860eb3fe6d2  bc-3.1.1.tar.xz
    
    $ sha256sum bc-3.1.1.tar.xz
    7401c68baef31622251eac47cabe0e35c973baec6b938b20741f777cf58d2dce  bc-3.1.1.tar.xz
    
    $ stat -c '%s  %n'
    209328  bc-3.1.1.tar.xz
    
    $ sha512sum bc-3.1.1.tar.xz.sig
    ee6f0d7e3b2120b59373b2d35316da43350c397e7005efa90da181805307d475057ea846f76a2751e57803918381dee08e5e3e1c12df66daedc83ba72b90bcf5  bc-3.1.1.tar.xz.sig
    
    $ sha256sum bc-3.1.1.tar.xz.sig
    0067d965d94ff87f8f9cbf8a95ae76f72b72f60607231b4437313e4ae435d13a  bc-3.1.1.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.1.1.tar.xz.sig
    
     
  • Stable 3.1.0 175921f774

    Release 3.1.0

    gavin released this 10 months ago | 272 commits to master since this release

    This is a production release that adjusts one behavior, fixes eight bugs, and improves manpages for FreeBSD. Because this release fixes bugs, users and package maintainers should update to this version as soon as possible.

    The behavior that was adjusted was how code from the -e and -f arguments (and equivalents) were executed. They used to be executed as one big chunk, but in this release, they are now executed line-by-line.

    The first bug fix in how output to stdout was handled in SIGINT. If a SIGINT came in, the stdout buffer was not correctly flushed. In fact, a clean-up function was not getting called. This release fixes that bug.

    The second bug is in how dc handled input from stdin. This affected bc as well since it was a mishandling of the stdin buffer.

    The third fixed bug was that bc and dc could abort() (in debug mode) when receiving a SIGTERM. This one was a race condition with pushing and popping items onto and out of vectors.

    The fourth bug fixed was that bc could leave extra items on the stack and thus, not properly clean up some memory. (The memory would still get free()'ed, but it would not be free()'ed when it could have been.)

    The next two bugs were bugs in bc's parser that caused crashes when executing the resulting code.

    The last two bugs were crashes in dc that resulted from mishandling of strings.

    The manpage improvement was done by switching from ronn to Pandoc to generate manpages. Pandoc generates much cleaner manpages and doesn't leave blank lines where they shouldn't be.

    $ sha512sum bc-3.1.0.tar.xz
    1858afe0c15bd518637cc7a34d0905042ea424f8398c85d97024ee0a397b15f549c8dfc1b8fe46c6ee9cdd38949de18e927951463cbbde007188809d8acd33cb  bc-3.1.0.tar.xz
    
    $ sha256sum bc-3.1.0.tar.xz
    73966d9e8627584f3d3498e12c42a7d3bfa01bfc0b14395a0822205d5611fd27  bc-3.1.0.tar.xz
    
    $ stat -c '%s  %n'
    209392  bc-3.1.0.tar.xz
    
    $ sha512sum bc-3.1.0.tar.xz.sig
    d0114e0ce0d6fd5379bf9d76d73001ccdc148554351dcc7512c8cbbab504580e5c0316fd7a7110d1a656a9ed98758c48085f61c97830c6e4a251302830670f68  bc-3.1.0.tar.xz.sig
    
    $ sha256sum bc-3.1.0.tar.xz.sig
    1a881b897f8039a0f0edfc2732bcd34f3f90ae7c35cf9e28a2edb8280aa343c0  bc-3.1.0.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.1.0.tar.xz.sig
    
     
  • Stable 3.0.3 e9ca90c265

    Release 3.0.3

    gavin released this 11 months ago | 346 commits to master since this release

    This is a production release that adds one new feature: specific manpages.

    Before this release, bc and dc only used one manpage each that referred to various build options. This release changes it so there is one manpage set per relevant build type. Each manual only has information about its particular build, and configure.sh selects the correct set for install.

    $ sha512sum bc-3.0.3.tar.xz
    a29ed390f33b9d19d4e5a06037a0c43c9289d7b46e52c5e01ccebbf0c7daf2a022acd35669c25e33492d0c83270bf0611f4959111fd4e5871ae064ae27416d88  bc-3.0.3.tar.xz
    
    $ sha256sum bc-3.0.3.tar.xz
    8cf87e994f9f74c19dacdb623c870cbfe7486a64119842add65222c12b48e006  bc-3.0.3.tar.xz
    
    $ stat -c '%s  %n'
    202448  bc-3.0.3.tar.xz
    
    $ sha512sum bc-3.0.3.tar.xz.sig
    b37d608bf3d8e5bbc594a3b8bf120a265f61d75f009b3806a6155107d4350efa1dfbc7a9e0143442ea7725efde6d07ec3a4687edcfd110448cb1f3c977d7e4ae  bc-3.0.3.tar.xz.sig
    
    $ sha256sum bc-3.0.3.tar.xz.sig
    985d208ecac1e7b680c64cfd4def891c747e51e80f4a0aef011d1fd897d6f69b  bc-3.0.3.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.0.3.tar.xz.sig
    
     
  • Stable 3.0.2 5f068b26b6

    Release 3.0.2

    gavin released this 11 months ago | 355 commits to master since this release

    This is a production release that adds utf8 locale symlinks and removes an unused auto variable from the ceil() function in the extended math library.

    Users do NOT need to update unless they want the locales.

    $ sha512sum bc-3.0.2.tar.xz
    2b9eb7cd9f3c589c35b4d271c97afd32bac3d8c7e845a3639571dfb26a48d0eb1649035ef0f7c63de5a7d65d31c61b2ac3cf584225237c53aeb9ce3828b8093d  bc-3.0.2.tar.xz
    
    $ sha256sum bc-3.0.2.tar.xz
    44975f59d979aefdf3f4735ac1072ef6920342b69003d8942752eb249a9a0e33  bc-3.0.2.tar.xz
    
    $ stat -c '%s  %n'
    199484  bc-3.0.2.tar.xz
    
    $ sha512sum bc-3.0.2.tar.xz.sig
    d78828e6cedf1a93b4a18d6e816732b8cf0bd41078baa5923406a908fb7a3f44a21539499c05630e42f0f2b2ae76d5c036b9ba0dfdf4efea515e7099d8a7dc2a  bc-3.0.2.tar.xz.sig
    
    $ sha256sum bc-3.0.2.tar.xz.sig
    0c504782fcb14b6b6e8705cafd8b375f66dd89aca01f5cd8d17f76872db138b9  bc-3.0.2.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.0.2.tar.xz.sig
    
     
  • Stable 3.0.1 febe0bd42c

    Release 3.0.1

    gavin released this 11 months ago | 360 commits to master since this release

    This is a production release with two small changes. Users do NOT need to upgrade to this release; however, if they haven't upgraded to 3.0.0 yet, it may be worthwhile to upgrade to this release instead.

    The first change is fixing a compiler warning on FreeBSD with strict warnings on.

    The second change is to make the new implementation of ceil() in lib2.bc much more efficient.

    $ sha512sum bc-3.0.1.tar.xz
    553d14b3439e6f7d5ec370db3a7104808e263692fdae795d5f97fca3bb40d371e75bbab615d81975c87da9c84fbbb39bc148cf12a122b0e0e3c9036abb9b7cd8  bc-3.0.1.tar.xz
    
    $ sha256sum bc-3.0.1.tar.xz
    a06a7791030e98b69004ba0f02d7dc625c444ccf0882c04c454e397aeb481283  bc-3.0.1.tar.xz
    
    $ stat -c '%s  %n'
    199732  bc-3.0.1.tar.xz
    
    $ sha512sum bc-3.0.1.tar.xz.sig
    9f840c5c756a09e24ed8aac3e17639dabf965badc8784fe6495d9a6f2b4b2a03d51ced1b98ae266285fba54124619ea734f9c5d6c52bc33dccef27cb7ffb2f7d  bc-3.0.1.tar.xz.sig
    
    $ sha256sum bc-3.0.1.tar.xz.sig
    6851e863f1fe70fa1b41fe29c03aad019b6b454073c6b9e75e99cbb4f8244ba6  bc-3.0.1.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.0.1.tar.xz.sig
    
     
  • Stable 3.0.0 c320c2d92f

    Release 3.0.0

    gavin released this 11 months ago | 364 commits to master since this release

    Notes for package maintainers:

    First, the 2.7.0 release series saw a change in the option parsing. This made me change one error message and add a few others. The error message that was changed removed one format specifier. This means that printf() will seqfault on old locale files. Unfortunately, bc cannot use any locale files except the global ones that are already installed, so it will use the previous ones while running tests during install. If bc segfaults while running arg tests when updating, it is because the global locale files have not been replaced. Make sure to either prevent the test suite from running on update or remove the old locale files before updating. Once this is done, bc should install without problems.

    Second, the option to build without signal support has been removed. See below for the reasons why.

    This is a production release with some small bug fixes, a few improvements, three major bug fixes, and a complete redesign of bc's error and signal handling. Users and package maintainers should update to this version as soon as possible.

    The first major bug fix was in how bc executed files. Previously, a whole file was parsed before it was executed, but if a function is defined after code, especially if the function definition was actually a redefinition, and the code before the definition referred to the previous function, this bc would replace the function before executing any code. The fix was to make sure that all code that existed before a function definition was executed.

    The second major bug fix was in bc's lib2.bc. The ceil() function had a bug where a 0 in the decimal place after the truncation position, caused it to output the wrong numbers if there was any non-zero digit after.

    The third major bug is that when passing parameters to functions, if an expression included an array (not an array element) as a parameter, it was accepted, when it should have been rejected. It is now correctly rejected.

    Beyond that, this bc got several improvements that both sped it up, improved the handling of signals, and improved the error handling.

    First, the requirements for bc were pushed back to POSIX 2008. bc uses one function, strdup(), which is not in POSIX 2001, and it is in the X/Open System Interfaces group 2001. It is, however, in POSIX 2008, and since POSIX 2008 is old enough to be supported anywhere that I care, that should be the requirement.

    Second, the BcVm global variable was put into bss. This actually slightly reduces the size of the executable from a massive code shrink, and it will stop bc from allocating a large set of memory when bc starts.

    Third, the default Karatsuba length was updated from 64 to 32 after making the optimization changes below, since 32 is going to be better than 64 after the changes.

    Fourth, Spanish translations were added.

    Fifth, the interpreter received a speedup to make performance on non-math-heavy scripts more competitive with GNU bc. While improvements did, in fact, get it much closer (see the [benchmarks][19]), it isn't quite there.

    There were several things done to speed up the interpreter:

    First, several small inefficiencies were removed. These inefficiencies included calling the function bc_vec_pop(v) twice instead of calling bc_vec_npop(v, 2). They also included an extra function call for checking the size of the stack and checking the size of the stack more than once on several operations.

    Second, since the current bc function is the one that stores constants and strings, the program caches pointers to the current function's vectors of constants and strings to prevent needing to grab the current function in order to grab a constant or a string.

    Third, bc tries to reuse BcNum's (the internal representation of arbitary-precision numbers). If a BcNum has the default capacity of BC_NUM_DEF_SIZE (32 on 64-bit and 16 on 32-bit) when it is freed, it is added to a list of available BcNum's. And then, when a BcNum is allocated with a capacity of BC_NUM_DEF_SIZE and any BcNum's exist on the list of reusable ones, one of those ones is grabbed instead.

    In order to support these changes, the BC_NUM_DEF_SIZE was changed. It used to be 16 bytes on all systems, but it was changed to more closely align with the minimum allocation size on Linux, which is either 32 bytes (64-bit musl), 24 bytes (64-bit glibc), 16 bytes (32-bit musl), or 12 bytes (32-bit glibc). Since these are the minimum allocation sizes, these are the sizes that would be allocated anyway, making it worth it to just use the whole space, so the value of BC_NUM_DEF_SIZE on 64-bit systems was changed to 32 bytes.

    On top of that, at least on 64-bit, BC_NUM_DEF_SIZE supports numbers with either 72 integer digits or 45 integer digits and 27 fractional digits. This should be more than enough for most cases since bc's default scale values are 0 or 20, meaning that, by default, it has at most 20 fractional digits. And 45 integer digits are a lot; it's enough to calculate the amount of mass in the Milky Way galaxy in kilograms. Also, 72 digits is enough to calculate the diameter of the universe in Planck lengths.

    (For 32-bit, these numbers are either 32 integer digits or 12 integer digits and 20 fractional digits. These are also quite big, and going much bigger on a 32-bit system seems a little pointless since 12 digits in just under a trillion and 20 fractional digits is still enough for about any use since 10^-20 light years is just under a millimeter.)

    All of this together means that for ordinary uses, and even uses in scientific work, the default number size will be all that is needed, which means that nearly all, if not all, numbers will be reused, relieving pressure on the system allocator.

    I did several experiments to find the changes that had the most impact, especially with regard to reusing BcNum's. One was putting BcNum's into buckets according to their capacity in powers of 2 up to 512. That performed worse than bc did in 2.7.2. Another was putting any BcNum on the reuse list that had a capacity of BC_NUM_DEF_SIZE * 2 and reusing them for BcNum's that requested BC_NUM_DEF_SIZE. This did reduce the amount of time spent, but it also spent a lot of time in the system allocator for an unknown reason. (When using strace, a bunch more brk calls showed up.) Just reusing BcNum's that had exactly BC_NUM_DEF_SIZE capacity spent the smallest amount of time in both user and system time. This makes sense, especially with the changes to make BC_NUM_DEF_SIZE bigger on 64-bit systems, since the vast majority of numbers will only ever use numbers with a size less than or equal to BC_NUM_DEF_SIZE.

    Last of all, bc's signal handling underwent a complete redesign. (This is the reason that this version is 3.0.0 and not 2.8.0.) The change was to move from a polling approach to signal handling to an interrupt-based approach.

    Previously, every single loop condition had a check for signals. I suspect that this could be expensive when in tight loops.

    Now, the signal handler just uses longjmp() (actually siglongjmp()) to start an unwinding of the stack until it is stopped or the stack is unwound to main(), which just returns. If bc is currently executing code that cannot be safely interrupted (according to POSIX), then signals are "locked." The signal handler checks if the lock is taken, and if it is, it just sets the status to indicate that a signal arrived. Later, when the signal lock is released, the status is checked to see if a signal came in. If so, the stack unwinding starts.

    This design eliminates polling in favor of maintaining a stack of jmp_buf's. This has its own performance implications, but it gives better interaction. And the cost of pushing and popping a jmp_buf in a function is paid at most twice. Most functions do not pay that price, and most of the rest only pay it once. (There are only some 3 functions in bc that push and pop a jmp_buf twice.)

    As a side effect of this change, I had to eliminate the use of stdio.h in bc because stdio does not play nice with signals and longjmp(). I implemented custom I/O buffer code that takes a fraction of the size. This means that static builds will be smaller, but non-static builds will be bigger, though they will have less linking time.

    This change is also good because my history implementation was already bypassing stdio for good reasons, and unifying the architecture was a win.

    Another reason for this change is that my bc should always behave correctly in the presence of signals like SIGINT, SIGTERM, and SIGQUIT. With the addition of my own I/O buffering, I needed to also make sure that the buffers were correctly flushed even when such signals happened.

    For this reason, I removed the option to build without signal support.

    As a nice side effect of this change, the error handling code could be changed to take advantage of the stack unwinding that signals used. This means that signals and error handling use the same code paths, which means that the stack unwinding is well-tested. (Errors are tested heavily in the test suite.)

    It also means that functions do not need to return a status code that every caller needs to check. This eliminated over 100 branches that simply checked return codes and then passed that return code up the stack if necessary. The code bloat savings from this is at least 1700 bytes on x86_64, before taking into account the extra code from removing stdio.h.

    $ sha512sum bc-3.0.0.tar.xz
    4961e030274e763aa02541457aa5aab6cd0d61758861b98d2cdac6acc42c3fb55b6adba72749edd3b663225ab844d7ef60809972478992165b071645fe6af65f  bc-3.0.0.tar.xz
    
    $ sha256sum bc-3.0.0.tar.xz
    4a7c5cbd5c7c2d3fea4a898c6ce87ff705756dd362cb2e3b241ae55e514e8280  bc-3.0.0.tar.xz
    
    $ stat -c '%s  %n'
    199304  bc-3.0.0.tar.xz
    
    $ sha512sum bc-3.0.0.tar.xz.sig
    db495a449b528a6bee555bafdeb965c1a780d0f9d15d069749e50d96ac9e1fff14a2487bf7dc7f2268011bc0c53093f880fadc4172c50a9ac59d29b280d7f6bf  bc-3.0.0.tar.xz.sig
    
    $ sha256sum bc-3.0.0.tar.xz.sig
    980fadbac5e7b5f722cb43df6fd8546e2eb3cc0cbdc2940606a63be523c3023e  bc-3.0.0.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-3.0.0.tar.xz.sig
    
     
  • Stable 2.7.2 6f5fdd4ff6

    Version 2.7.2

    gavin released this 1 year ago | 689 commits to master since this release

    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.

    $ sha512sum bc-2.7.2.tar.xz
    c2014b16165bf5f8bdadf42bb60ea967a060753c17e13a7c3569d16d218bb3fb644e6a46950e9e7b3aa5a9f6bee4da9b158694909a0ab1fe390b7bb4dc20b303  bc-2.7.2.tar.xz
    
    $ sha256sum bc-2.7.2.tar.xz
    c017a6c0482cf7c4a2b31dae1f406028017a5e939d98dd6c78aa94ce3ecc8d38  bc-2.7.2.tar.xz
    
    $ stat -c '%s  %n'
    189020  bc-2.7.2.tar.xz
    
    $ sha512sum bc-2.7.2.tar.xz.sig
    076fc464dd6c3825707bf75b413357bfe3ebe340c4ff8350da36ef6b33fdbcba00ffbcb16991d853bd9179a72befc94105241e0384a7d463c5807f2fada5b975  bc-2.7.2.tar.xz.sig
    
    $ sha256sum bc-2.7.2.tar.xz.sig
    487152d9585a9d39b7bc845c7b7b50c93ad23e1ffd0169c2a58590c2d1f91105  bc-2.7.2.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-2.7.2.tar.xz.sig
    
     
  • Stable 2.7.1 1f2f285ef1

    Version 2.7.1

    gavin released this 1 year ago | 693 commits to master since this release

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

    $ sha512sum bc-2.7.1.tar.xz
    f4900ccb7ca09b33e663136df12e6b02c1ca69e46f049107f359968921289e85bf3435be835f47b2ad6e4b0d33faefa8920d389e9648734f9daf7d1641389904  bc-2.7.1.tar.xz
    
    $ sha256sum bc-2.7.1.tar.xz
    6f1fd8900f0f5d98356730c11214a9adcf99a1d15b94b1991f33a4346533c624  bc-2.7.1.tar.xz
    
    $ stat -c '%s  %n'
    188584  bc-2.7.1.tar.xz
    
    $ sha512sum bc-2.7.1.tar.xz.sig
    925f308e9316392db01447ca4dceb6fbaaebe60374334a6721dbffa7b58521ecac4ebb8bed47a017627e36c786eaa59b24c894439c717e7155172d2e174d2a08  bc-2.7.1.tar.xz.sig
    
    $ sha256sum bc-2.7.1.tar.xz.sig
    fa8b23ab6d895a61a32c15c3feeb1364433c088fd9abcff3f69206ecac7952ef  bc-2.7.1.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-2.7.1.tar.xz.sig
    
     
  • Stable 2.7.0 8635d1d0b7

    Version 2.7.0

    gavin released this 1 year ago | 697 commits to master since this release

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

    The following new languages are supported:

    • Dutch
    • Polish
    • Russian
    • Japanes
    • Simplified Chinese

    All of these translations were generated using DeepL, so improvements are welcome.

    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.

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

    IMPORTANT: read the bc manual and the dc manual 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 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).
    $ sha512sum bc-2.7.0.tar.xz
    f482e0799e41d173539b3fcf41facdb399d3eebb993aed03ac134ef8ae68d508507862ee2869ca33f6749f7137528a5f7d9f1413b3c5d4ac345fb7bd44c68b62  bc-2.7.0.tar.xz
    
    $ sha256sum bc-2.7.0.tar.xz
    70e17a55c9fb115bd4028561d515ce72c609288b6479deeab47669770951c196  bc-2.7.0.tar.xz
    
    $ stat -c '%s  %n'
    188380  bc-2.7.0.tar.xz
    
    $ sha512sum bc-2.7.0.tar.xz.sig
    bb6481f7105c0201f6b3569d0d671f44aae312bd14b95f938f41bf5d3fa281c0f6671ca020b70f21db8f5cc36f607329ea199c853db6ef807af80eced772a10a  bc-2.7.0.tar.xz.sig
    
    $ sha256sum bc-2.7.0.tar.xz.sig
    f91e763054111413c86f4165ec099ecdcf380ea0402a147c3aeb53cf618a2637  bc-2.7.0.tar.xz.sig
    
    $ stat -c '%s  %n'
    662  bc-2.7.0.tar.xz.sig