Skip to content

Releases: lcn2/calc

calc 2.17.0.0 release

Choose a tag to compare

@lcn2 lcn2 released this 16 May 00:30

The following are the changes in this release:

Sync calc version 3.0.0.4 changes with calc version 2.16.1.3 to
form a new 2.17.0.0, except that the calc version will be 2.17.0.0 of course.  :-)

**IMPORTANT LEGACY NOTE**: Some very old systems might have trouble with the set
                           of changes.  For example, systems that don't a c17 C
                           compiler, or that lack some standard include files.
                           Such old systems should use the `legacy-calc` branch
                           (i.e., the latest 2.16.1.x version on that branch).

Added `make asan` rule to make it easier to compile with ASAN (Address Sanitizer).
    NOTE: Use `make clobber` first before using the new rule to remove any previous compilation.

Added `make gcc` rule to force a compile with `gcc(1)`, (or `gcc-15`
    for macOS), full warnings, no optimizer, no ASAN.
    NOTE: Use `make clobber` first before using the new rule to remove any previous compilation.

Added `make clang` rule to force a compile with `c1ang(1)`, full warnings, no optimizer, no ASAN.
    NOTE: Use `make clobber` first before using the new rule to remove any previous compilation.

Added `calc-static-asan` rule to to compile cASAN (Address Sanitizer).
    NOTE: Use `make clobber` first before using the new rule to remove any previous compilation.

Added `make asan-run` to compile and run calc in the local directory, and run with ASAN.
    NOTE: Use `make clobber` first before using the new rule to remove any previous compilation.

Added `make check_lcc` to test if the local C compiler (`${LCC}`) can compile a trivial C program.

Added `make check_lcc_include` to check if the local C compiler `${LCC}` has access to <stdio.h>.

Added `make check_cc` to test if the C compiler (`${CC}`) can compile a trivial C program.

Added: `make check_cc_include` to check if the C compiler `${CC}` has access to the <stdio.h>
system include file.  NOTE: `make check_cc_include` was `make check_include`.

Added make variable `${CHECK_TARGETS}` to contain the `check_lcc`, `check_lcc_include`, `check_cc`,
and `check_cc_include` targets.

Added `make sanity_check`, which is based on the make variable `${CHECK_TARGETS}`, to perform
the sanity checks on both the local C compiler (`${LCC}`), and the C compiler (`${CC}`).

Added to both `${STATIC_FIRST_TARGETS}`, and `${DYNAMIC_FIRST_TARGETS}`
to perform the local C compiler (`${LCC}`), and the C compiler (`${CC}`) checks.

Performed a `make clang-format` source format to update the code base as per `.clang-format`.

Fixed rpm spec file.

Fixed how `conf.h` is formed when building an rpm.

From: calc version 3.0.0.3 to 3.0.0.4 changes
---------------------------------------------

Fixed three memcpy calls in `matsort()` in `matfunc.c`.
Thanks go to the GitHub user @orbisai0security for this fix.

Fixed and improved `chk_tree`.
Updated `chk_tree` VERSION to "1.1 2026-02-04".

Added `chk_tree -m` for use with commands such as `make full_debug`, and `make debug`.

Fixed places where the code still used `BIG_ENDIAN` when it needs `CALC_BIG_ENDIAN`.
Fixed places where the code still used `LITTLE_ENDIAN` when it needs `CALC_LITTLE_ENDIAN`.

Fixed a `calloc(3)` mistake where the args were reversed.

Import documentation changes from the calcv2 branch in regards to
the "XDG base dir. spec. adoption", update to the `trailblank` tool
to ignore in `calc.man`, `help/environment`, and `README.md`.

Added `${EXPAND}` to the list of utilities in `Makefile.config`.
Echo `${EXPAND}` in the `make env` rule of `Makefile`.

Use `${EXPAND}` to replace ASCII tabs with ASCII spaces in the
`make len_bits.h` rule, and the `make errsym.h` rule of `Makefile`.

Add support for the XDG Base Directory specification:

    https://specifications.freedesktop.org/basedir/latest/

Thanks to GitHub user @ccjmne for helping add this support.

From: calc version 3.0.0.2 to 3.0.0.3 changes
---------------------------------------------

Add Makefile.target to build for NetBSD per GitHub PR #184.

Cygwin disable a gcc warning as per GitHub PR #186.

Improve error messages and checks for `getscanfield()`.
Improve error messages and checks for `fscanfile()`.
Prevent NULL from being passed to `makestring(str)`.

Added `long`, `unsigned long`, `long long`, and `unsigned long long` to `chk_c.c`.
C compiles must support `long long`, and `unsigned long long` types.
Added `<limits.h>` to  `chk_c.c`.
Changed `CHK_C_VERSION` to "2.1 2026-01-22".

Renamed `longbits.c` to `len_bits.c`.
Renamed `longbits.h` to `len_bits.h`.
Renamed `make longbits.h` to `make len_bits.h`.

Added `unsigned long`, `long long`, and `unsigned long long` to `show sizes` output.

Removed `terminal.h` rule: system include `<termios.h>` must exist
Removed `CALC_CHARBIT` define: system include `<limits.h>` must define `CHAR_BIT`
Removed `HAVE_B64` define: system must have a `int64_t` and `uint64_t` type

Removed code faked 64-bit values: system must have a `int64_t` and `uint64_t` type

Removed `CALC_CHARBIT` make symbol: system include `<limits.h>` must define `CHAR_BIT`
Removed `LONG_BITS` make symbol: `LONG_BITS` define, if undefined, is now defined in `zmath.h`
Removed `HAVE_FPOS_POS` make symbol: `LONG_BITS` define, if undefined, is now defined in `zmath.h`
Removed `FPOS_POS_BITS` make symbol: calc v3 will treat `fpos_t` as opaque
Removed `FPOS_BITS` make symbol: calc v3 will treat `fpos_t` as opaque
Removed `FPOS_T_BITS` make symbol: calc v3 will treat `fpos_t` as opaque
Removed `FPOS_T_LEN` make symbol: calc v3 will treat `fpos_t` as opaque
Removed `HAVE_POSSCL` make symbol: calc v3 will treat `fpos_t` as opaque
Removed `HAVE_OFFSCL` make symbol: system must have a `off_t` integer type
Removed `OFF_T_BITS` make symbol: the value `OFF_T_BITS` is determined by `longbits.c`,
    and is found in `longbits.h` that in turn is generated by `longbits.c`
Removed `DEV_BITS` make symbol: system must have a `dev_t` type
Removed `INODE_BITS` make symbol: system must have a `node_t` type

Removed `charbit.h` rule and `charbit.c`:  system include `<limits.h>` must define `CHAR_BIT`
Removed `longbits.h` rule and `charbit.c`:  system include `<stdint.h>` must exist
Removed `have_posscl.h` rule and `have_posscl.c`: calc v3 will treat `fpos_t` as opaque
Removed `have_fpos_pos.h` rule and `have_fpos_pos.c`: calc v3 will treat `fpos_t` as opaque
Removed `fposval.h` rule and `fposval.c`: system must have a `fpos_t` type
Removed `fposval.h.def`: system must have a `fpos_t` type
Removed `have_offscl.h` rule and `have_offscl.c`: system must have a `off_t` type

Removed code that was not treating `fpos_t` as opaque: `fpos_t` values are only used
    in conjunction with the `fgetpos()` and `fsetpos()` libc functions.
Fully addressed issue #185.

Renamed `DEV_BITS` to `DEV_T_BITS`
Renamed `DEV_LEN` to `DEV_T_LEN`
Renamed `INODE_BITS` to `INO_T_BITS`
Renamed `INODE_LEN` to `INO_T_LEN`

The `LONG_BITS` define, if undefined, is now defined in `zmath.h`

The `len_bits.c` program (was `longbits.c`) now generates `len_bits.h`
The `OFF_T_LEN` define, if undefined, is now defined in `len_bits.h`
The `OFF_T_BITS` define, if undefined, is now defined in `len_bits.h`
The `OFF_T_MAX` define, if undefined, is now defined in `len_bits.h`
The `OFF_T_MIN` define, if undefined, is now defined in `len_bits.h`
    NOTE: we set OFF_T_MIN to one more than the minimum off_t to make it easier to negate.
The `SWAP_HALF_IN_OFF_T` define is now defined in `len_bits.h`
The `DEV_T_BITS` define, if undefined, is now defined in `len_bits.h`
The `DEV_T_LEN` define, if undefined, is now defined in `len_bits.h`
The `SWAP_HALF_IN_DEV_T` define is now defined in `len_bits.h`
The `INO_T_BITS` define, if undefined, is now defined in `len_bits.h`
The `INO_T_LEN` define, if undefined, is now defined in `len_bits.h`
The `SWAP_HALF_IN_INO_T` define is now defined in `len_bits.h`

The `PTR_LEN` define has been renamed to `INTPTR_LEN`
The `INTPTR_LEN` defined, if undefined, is now defined in `zmath.h`

Removed use of the `SB8` type.
Renamed `USB8` type to just `uint8_t`
Removed use of the `SB16` type
Renamed `USB16` type to just `uint16_t`
Renamed `SB32` type to just `int32_t`
Renamed `USB32` type to just `uint32_t`
Renamed `SB64` type to just `int64_t`
Renamed `USB64` type to just `uint64_t`

Removed `SWAP_B16_IN_PRINT(dest, src)` macro: it was unused.
Removed `SWAP_B8_IN_PRINT(dest, src)` macro: it was unused.

Fix how `zprintx()` and `zprinto()` in `zio.c` print C integer
    variables in hex or octal by using PRI macros from `<inttypes.h>`.
Add `PRI_DEC`, `PRI_OCT`, `PRI_HEX` to `zmath.h` to perform the above.
Add `PRI_DEC_LEN`, `PRI_OCT_LEN`, `PRI_HEX_LEN` to `zmath.h` to perform the above.

Added `GDB` make variable to `Makefile.config`.
Added `LLDB` make variable to `Makefile.config`.
Added `make lldb` and `make gdb` to make it easier to debug under either.

Fixed missing `qlink()` calls in `f_search()` and `f_rsearch()` in `func.c`.

Rewrote `fsearch()` in `file.c` as per proper use of `off_t` with libc
`fseeko()`, `ftello()`, `fgetpos()`, and `fsetpos()` as noted above,
and to be backward compatible with regression tests.

Expanded examples in `help/search` while rewriting `fsearch()`.

Rewrote `frs...
Read more

calc 2.16.1.3 release

Choose a tag to compare

@lcn2 lcn2 released this 11 May 06:40

The following are the changes in this release:

Include `<errno.h>`, not '<sys/errno.h>`.

Fixed three memcpy calls in `matsort()` in `matfunc.c`.
Thanks go to the GitHub user @orbisai0security for this fix.

calc 2.16.1.2 release

Choose a tag to compare

@lcn2 lcn2 released this 08 Jan 03:46

The following are the changes in this release:

Fixed a bug where the calc command history was not being properly
saved in the history file.  Thanks go to the GitHub user @Vekhir
for both reporting this problem and helping come up with a solution.

Per request, we expanded number of entries to save from 1024 to 4096.

Release v2.16.1.1

Choose a tag to compare

@lcn2 lcn2 released this 04 Jan 08:34

The following are the changes in this release:

Fix compiler warning for `custom/u_pfe.c`.

Update the `ARCH_CFLAGS` make symbol comments in `Makefile.config`.

Add `ARCH_CFLAGS` to `COMMON_CFLAGS` in `Makefile.config`.

Add "RHEL (Linux) Address Sanitizer (ASAN) for i686" commented out
section to `Makefile.local`.

Improve comments in `Makefile.local` related to "Address Sanitizer (ASAN)".

Add `junk4200` to `.gitignore`.

Use `-${Q}` instead of `-@` while build hsrc files in `Makefile`.

Fix `pseudo_seed()` in `seed.c` to handle 32-bit architectures.

Fixed `reopenid()` in `file.c` to handle 32-bit architectures and
to avoid "glibc detected an invalid stdio handle" using `freopen(3)`.

Fixed bug in `c_power()` in `comfunc.c` that caused 32-bit
architectures to dump core.

Fixed bug in `zrandom()` in `zrandom.c` where results from a
Blum-Blum-Shub operation were incorrectly copied into a ZVALUE
for 32-bit architectures.

Fixed comment typo in `cal/regress.cal` before test 5305.

calc 2.16.1.0 release

Choose a tag to compare

@lcn2 lcn2 released this 31 Dec 05:16

The following are the changes in this release:

Added a new `.clang-format` file as the basis for using the
`clang-format(1)` tool to format calc source in a consistent way.
This code re-formatting will make it easier to work in calc v3 code
changes in the future by making the calc source much more consistent.

Removed `.clang-format` exclusion from `.gitignore`.

Modified `func.c` to prevent the `clang-format(1)` tool from formatting
the `builtins[]` table that builtin make rule in `help/Makefile` uses to
format the `help/builtin` file.  We can live with the `builtins[]`
table as it is today, for now.

Add `make clang-format` make rule to top level `Makefile` and
to the `custom/Makefile`.

Reformatted C code as per the `clang-format(1)` and the
`.clang-format` file: using the `make clang-format` make rule.

calc 2.16.0.3 release

Choose a tag to compare

@lcn2 lcn2 released this 25 Dec 10:09

The following are the changes in this release:

The segmentation fault as reported in issue #174 has been fixed.
When the `powervalue()` function was expanded to (in `value.c`), to
process complex powers, the author forgot that the function `c_power()`
returns NULL when the result is too large to represent in memory.  Now,
when `c_power()` returns NULL within the `powervalue()` function, the
`E_POWER_4` math error ("Too-large value for power") will be raised.
Thanks go to the GitHub user @mengrj for reporting this problem
in issue #174 in a clear and concise way such that we were able
to fix this problem.

Reduced `MAXCMD` (maximum length of command invocation) in `calv.h`
from 16384 to 5120.  On most systems, commands longer than 5.6k would
hit the soft stack size limit and trigger a stack overflow condition
causing calc to crash with a SIGSEGV (segmentation violation).

If you need a super-long calc commands, consider increasing
the `MAXCMD` value in `calc.h`, and increase the stack size
limits for your calc run.  For example under Linux to increase
the maximum stack size to 2^28 bytes:

    prlimit --stack=268435456 calc

or:

    ulimit -s 49152
    calc

Resolved, as much we can, issue #175.

Recommend `-fstack-protector-all` in `Makefile.local` comments.

Fixed signed integer overflow in `c_power()`.

The `c_power(COMPLEX *c1, COMPLEX *c2, NUMBER *epsilon)` function in
`comfunc.c` no longer triggers a signed integer overflow.

Added `qqbitvalue(NUMBER pos)` to `qmarth.c`: like `qbitvalue(long n)`
but with a NUMBER arg, and will return NULL if the shifted bit is too
large to hold in memory.

Added `zzbitvalue(ZVALUE pos, ZVALUE *res)`: similar to the
`zbitvalue(long n, ZVALUE *res)` function but with a `ZVALUE` arg,
and returns a boolean, and does not call math_error().

Added `ZVALUE _baseb_` to hold the `BASEB` as a `ZVALUE`.
Added `MAXDATA_LOG2` to hold the log base 2 value of `MAXDATA`.
Added `MAXLEN_LOG2` to hold the log base 2 value of `MAXLEN`.
Added `HALF_BITS` as an alias for `BASEB`.

Added to `cal/regress.cal`, regression test 9758 to test for
the condition that issue #174 was about.

Improved the Common Address Sanitizer (ASAN) comments in
`Makefile.config` and `Makefile.local`.

Resolved issue #176.

calc 2.16.0.2 release

Choose a tag to compare

@lcn2 lcn2 released this 22 Dec 03:39

The following are the changes from calc version 2.16.0.1 to 2.16.0.2:

Fixed bug, when custom functions were enabled, where returning a
value from the sysinfo custom function such as:

    custom("sysinfo","DEFAULTSHELL")

would cause a segmentation violation due to an improper `free(3)`.

Fixed a memory leak that was related to the sysinfo custom function.

Added paranoia checks on shell value when processing commands
read from the tty that start with the "!" character.

Improved code that converts between UPPER CASE and lower case.

Verify that the default underlying shell defaults to the shell
as given by the `$SHELL` environment variable if that environment
variable is set and is NOT empty, otherwise the `DEFAULTSHELL`
(as defined in `calc.h`) value will be used as the underlying shell.

Fixed memory leaks related to various environment variable values
used by calc code.  All various environment variable values used
used by calc code are processed by `strdup(3)`.

The `libcalc_call_me_last()` function frees any non-NULL values set
by `initenv()`.

If the readline tilde_expand fails to expand "~/.calc_history",
then ".calc_history" will be used as the name of the history file.

Added HIST_NULL_HIST code to indicate that name of the history file
could not be set.

The following are the changes from calc version 2.16.0.0 to 2.16.0.1:

Adding support for "pipe/fork/exec and friends" via custom functions
thanks to a contribution by GitHub user @vike2000.

We to address a bug after adding support for pipe/fork/exec (and
friends) via custom functions

TODO: Before the calc v2 to calc v3 fork, we need to fix a critical
[bug](https://github.com/lcn2/calc/issues/103#issuecomment-3194363618)
related to heap-use-after-free memory errors.  We anticipate this
will involve releasing a bug fix version of calc and then allow
for extensive testing before declaring the resulting 2.16.0.x as a
stable release.  From that 2.16.0.x stable release that a new version
2.16.1.0 stable release, with no changes other than a new version
number and git tag as the basis for the calc v2 to calc v3 fork.

calc 2.16.0.0 release

calc 2.16.0.0 release Pre-release
Pre-release

Choose a tag to compare

@lcn2 lcn2 released this 15 Aug 01:58

The following are the changes in this release:

Starting with calc version 2.16.0.0, the ability to perform arithmetic
on addresses of values in calc objects has been greatly restricted.

Most arithmetic on of value addresses could easily cause calc to
crash.  For example, prior to calc version 2.16.0.0, the following
command was likely to crash calc:

    calc '*((&.)+1e9)'

Subtracting two value addresses is permitted, however there is NO
guarantee that the address of a value will remain consistent across
calc runs.  Addresses of values depend on the circumstances of when
the calc values were formed.

The above restrictions and caveats apply to addresses of values.
Such restrictions and caveats to NOT apply to the addresses of
octets, NOR to the addresses within strings.  If isptr(x) == 2, then
x is value-pointer and the above mentioned restrictions and caveats apply.

See "help address" for more information on value address arithmetic.

Added E_INVALID_DEREF (10610) error code to indicate the invalid
dereferencing a non-variable.

Added E_INVALID_ADDR_OP (10611) error code to indicate an invalid
arithmetic address operation.

We plan to let this most recent change settle down before performing
the calc v2 to calc v3 fork.  Therefore, version 2.16.1.0 will form
the basis for the calc v2 to calc v3 fork.

calc 2.15.1.2 release

calc 2.15.1.2 release Pre-release
Pre-release

Choose a tag to compare

@lcn2 lcn2 released this 13 Aug 20:41

The following are the changes in this release:

Removed use of HAVE_MEMMOVE as well have_memmv.c.  Removed the
building and including of have_memmv.h.  Removed the memmove()
function in blkcpy.c, used when HAVE_MEMMOVE was NOT defined.
The libc memmove(3) function as defined by <string.h> is now
required to compile calc because the replacement code in
blkcpy.c q was problematic, especially when regions overlap.
The HAVE_MEMMOVE make symbol was removed from Makefile.config.
Thanks to GitHub user @skeeto for reporting this problem.

calc 2.15.1.1 release

Choose a tag to compare

@lcn2 lcn2 released this 24 Apr 02:58

The following are the changes in this release:

Change Makefile.config to, if not using not HomeBrew, then try to
detect macports and/or using /opt/local/{lib,include}.

Put full date range (1989-2025) of calc source into version.h.