Commit Graph

659 Commits

Author SHA1 Message Date
Landon Curt Noll
fbaff69c92 improve how random seed state is determined
Added "STATIC bool blum_initialized = false" to zrandom.c to improve
how the code detects if the Blum-Blum-Shub pseudo-random number
generator is seeded or not, and how to free the state correctly.

NOTE: There is a very minor memory leak in zrandom.c that will be
fixed in a later release.
2023-12-08 13:51:14 -08:00
Landon Curt Noll
c724227ef9 thank GitHub user @gromit1811 for have_sys_mount.h fix 2023-11-02 17:25:51 -07:00
Landon Curt Noll
3fd64578a6 Merge pull request #132 from gromit1811/fix_have_sys_mount
Actually check for sys/mount.h when forming have_sys_mount.h
2023-11-02 17:24:25 -07:00
Martin Buck
c9c4105ddc Actually check for sys/mount.h when forming have_sys_mount.h
So far, the Makefile checked for sys/param.h instead and that suspiciously
looks like a copy & paste error.

Found by the Debian hurd-i386 build daemon because calc failed to compile
there and it seems to lack sys/mount.h. Not that this would be an extremely
relevant architecture these days, but nevertheless... ;-)
2023-11-02 21:43:10 +01:00
Landon Curt Noll
80b7cd34fe final tweak to the thanks in CHANGES .. promise :-)
We could collapse the last 3+ commits, but
then again why try to cover up the fun!  :-)
2023-11-01 16:17:59 -07:00
Landon Curt Noll
630947d35c improve thanks in CHANGES :-) 2023-11-01 16:15:15 -07:00
Landon Curt Noll
45f62fd7b4 fixed a typo in the previous commit :-) 2023-11-01 16:14:33 -07:00
Landon Curt Noll
8ca980b2bb Thank GitHub user @gromit1811 for zmath.h fix 2023-11-01 16:13:25 -07:00
Landon Curt Noll
2ace631d00 Merge branch 'master' of github.com:lcn2/calc 2023-11-01 16:05:56 -07:00
Landon Curt Noll
41d339c60e updated trigonometric function list in help/unexpected 2023-11-01 16:04:45 -07:00
Landon Curt Noll
cc3bb98fa0 Merge pull request #131 from gromit1811/fix-fposval-build-failure 2023-11-01 15:58:53 -07:00
Martin Buck
2b506a74e7 Fix file.c build failure on 32 bit big endian machines
On ancient 32 bit big endian machines (e.g. MIPS) file.c fails to build
when FILEPOS is a struct and not a scalar. This happens because the
SWAP_HALF_IN_FILEPOS macro essentially expands to a simple assignment in
this case but the types are incompatile (HALF and FILEPOS).

Detailed compile error (this is from an older version so line numbers might
be wrong but the error is the same):

gcc  -DCALC_SRC -DCUSTOM -Wall  -g -O2 -fstack-protector-strong -Wformat -Werror=format-security   -O3 -g3 -Wno-error=long-long -Wno-long-long -c file.c
In file included from qmath.h:32,
                 from cmath.h:32,
                 from value.h:33,
                 from calc.h:33,
                 from file.c:39:
file.c: In function 'filepos2z':
zmath.h:85:46: error: incompatible types when assigning to type 'HALF' {aka 'long unsigned int'} from type 'FILEPOS' {aka 'struct _G_fpos_t'}
 #define SWAP_HALF_IN_B32(dest, src) (*(dest) = *(src))
                                              ^
fposval.h:15:42: note: in expansion of macro 'SWAP_HALF_IN_B32'
 #define SWAP_HALF_IN_FILEPOS(dest, src)  SWAP_HALF_IN_B32(dest, src)
                                          ^~~~~~~~~~~~~~~~
file.c:1370:2: note: in expansion of macro 'SWAP_HALF_IN_FILEPOS'
  SWAP_HALF_IN_FILEPOS(ret.v, &pos);
  ^~~~~~~~~~~~~~~~~~~~

Fix this by adding suitable casts to the definition of SWAP_HALF_IN_FILEPOS
on big endian machines. Strictly speaking, the casts only seem to be
necessary when using SWAP_HALF_IN_B32, but they can't hurt in the other
cases either.
2023-11-01 21:30:43 +01:00
Landon Curt Noll
826d2d8175 Merge pull request #129 from gromit1811/man-wrap-long-paths 2023-10-17 15:53:14 -07:00
Landon Curt Noll
af8ffb3098 Merge pull request #128 from gromit1811/master 2023-10-17 15:11:31 -07:00
Martin Buck
71dd30c4c6 Allow word-wrapping in long path names in man page 2023-10-18 00:09:37 +02:00
Martin Buck
8ca96a8c29 Fix minor man page spelling errors 2023-10-17 23:41:02 +02:00
Landon Curt Noll
0bba80c92b Merge pull request #118 from planet36/help-typos
Fix minor typos in help docs
2023-10-10 07:08:34 -07:00
Steven Ward
c1882e2ea0 Use full name of function to match help file 2023-10-09 21:29:56 -04:00
Steven Ward
79964338d1 Fix minor typos 2023-10-09 21:29:47 -04:00
Steven Ward
d809ce5cf0 Use null() instead of nul() 2023-10-09 21:24:47 -04:00
Steven Ward
daac7b35af ctime() does not remove the trailing newline 2023-10-09 21:23:53 -04:00
Steven Ward
40d6e22318 s/windowz/Windows/ 2023-10-09 21:23:36 -04:00
Landon Curt Noll
ab2038ecbc fix more memory leaks
Fixed more memory leaks in the aversin, acoversin, avercos,
acovercos, ahaversin, ahavercos, ahacovercos, aexsec,
aexcsc, and acrd.
2023-10-06 23:54:55 -07:00
Landon Curt Noll
0b57d6b605 fix memory leak in the logn builtin function 2023-10-06 23:27:42 -07:00
Landon Curt Noll
01f0605055 improve chk_tree and trailblank
The chk_tree will check for files in distlist that
would otherwise be ignored by trailblank or that
are used, by convention, as tempory / test files.

Fixed a shellcheck nit in trailblank.
2023-10-06 22:25:00 -07:00
Landon Curt Noll
0e6016f429 improve Address Sanitizer (ASAN) support and chk_tree
Updated BUGS about MSYS2 on Windows compiling of calc.

    Added more git related checks and sanity checks to chk_tree.

    Added ${FSANITIZE} make variable to Makefile.config to hold
    common Address Sanitizer (ASAN) optins to modern Linux and macOS.
    The Address Sanitizer is NOT enabled not compiled in by default.
    Improved comments in Makefile.local for RHEL9.2 (Linux) and for
    macOS 14.0 that, when uncommented and calc is recompiled (i.e.,
    make clobber all) will enable the Address Sanitizer (ASAN) for calc.
2023-10-06 21:59:06 -07:00
Landon Curt Noll
2d2e1c5894 change make prep to report on chk_tree failures
Before, make prep would show but not object to chk_tree failures.
Now, if all except chk_tree is OK, make prep will report:

    almost satifactory except for chk_tree
2023-10-06 18:39:04 -07:00
Landon Curt Noll
50ba5f9a3e improve and update FSANITIZE comments in Makefile.local 2023-10-06 18:38:06 -07:00
Landon Curt Noll
850cdbef1d fix chk_tree ahead / behind direction 2023-10-06 18:05:59 -07:00
Landon Curt Noll
21cedfcae4 improve branch check for chk_tree 2023-10-06 18:04:05 -07:00
Landon Curt Noll
4fa137a638 update BUGS about MSYS2 and Windows success 2023-10-06 18:00:06 -07:00
Landon Curt Noll
6ebe707670 fix git branch checks 2023-10-06 17:55:12 -07:00
Landon Curt Noll
885db22315 add git branch checks to chk_tree 2023-10-06 17:52:30 -07:00
Landon Curt Noll
06a9997da7 fix git diff and improve git diff detection 2023-10-06 17:38:01 -07:00
Landon Curt Noll
fae4b8e81b add git checks for staged and unstaged changes 2023-10-06 17:31:37 -07:00
Landon Curt Noll
ddf0c8f1f5 fixed some warnings for errtbl.c on Cygwin systems prod-2.15.0.1 v2.15.0.1 2023-10-05 05:02:05 -07:00
Landon Curt Noll
d52cbcea14 avoid issues where funclist.sed forms help/funclist.c
The funclist.sed sed script, when transforming func.c
into help/funclist.c, was creating nested comments.
While those were hardless, a single change to func.c
avoids the naive funclist.sed processing and avoids
(harmless) warnings when compiling help/funclist.c
in the course of building the function list.
2023-10-05 04:59:13 -07:00
Landon Curt Noll
d14d525a6a Release v2.15.0.1
The following are the changes in this release:

    The tarball for calc version 2.15.0.0 was missing version.h.
    The version.h is now listed as part of the calc distribution.

    Added the following new trigonometric functions:

	versin(x [,eps])	versed trigonometric sine
	coversin(x [,eps])	coversed trigonometric sine
	vercos(x [,eps])	versed trigonometric cosine
	covercos(x [,eps])	coversed trigonometric cosine
	aversin(x [,eps])	inverse versed trigonometric sine
	acoversin(x [,eps])	inverse coversed trigonometric sine
	avercos(x [,eps])	inverse versed trigonometric cosine
	acovercos(x [,eps])	inverse coversed trigonometric cosine
	haversin(x [,eps])	half versed trigonometric sine
	hacoversin(x [,eps])	half coversed trigonometric sine
	havercos(x [,eps])	half versed trigonometric cosine
	hacovercos(x [,eps])	half coversed trigonometric cosine
	ahaversin(x [,eps])	inverse half versed trigonometric sine
	ahacoversin(x [,eps])	inverse half coversed trigonometric sine
	ahavercos(x [,eps])	inverse half versed trigonometric cosine
	ahacovercos(x [,eps])	inverse half coversed trigonometric cosine
	exsec(x [,eps])		exterior trigonometric secant
	aexsec(x [,eps])	inverse exterior trigonometric secant
	excsc(x [,eps])		exterior trigonometric cosecant
	aexcsc(x [,eps])	inverse exterior trigonometric cosecant
	crd(x [,eps])		trigonometric chord of a unit circle
	acrd(x [,eps])		inverse trigonometric chord of a unit circle
	cas(x [,eps])		trigonometric cosine plus sine
	cis(x [,eps])		Euler's formula

    As Msys2 is a fork of Cygwin, if the OSNAME is Msys, the Cygwin
    target will be used.  Thanks to GitHub user @iahung2 for the
    pull request.

    Support for win32 and DJGPP has been dropped.  Calc version
    2.14.3.5 was the last to make references to win32 and make
    references to DJGPP.  Future versions of calc may work under
    those systems, we just elected to remove the somewhat out of
    date and awkward `win32.mkdef` and related win32 references.

    If you are a win32 user, please feel free to create a win32
    target in Makefile.target and submit as a pull request.
    If you are a DJGPP user, please feel free to create a DJGPP
    target in Makefile.target and submit as a pull request.
    Until someone can test such systems, we prefer to wait
    until someone is able to test and supply a pull request.

    Added PTR_LEN (length of a pointer) and PTR_BITS (bit length
    of a pointer) to longbits.h.

    Moved calc version definition from version.c to version.h.

    Sorted the order of symbols printed by "make env".

    Test if <stdbool.h> exists and set HAVE_STDBOOL_H accordingly
    in have_stdbool.h.  Added HAVE_STDBOOL_H to allow one to force
    this value.

    Added "bool.h" include file to support use of boolean symbols,
    true and false for pre-c99 C compilers.  The "bool.h" include
    file defines TRUE as true, FALSE as false, and BOOL as bool:
    for backward compatibility.

    Replaced in C source, TRUE with true, FALSE with false, and
    BOOL with bool.

    Fixed have_statfs optional executable file extension ${EXT{ in
    the ${UTIL_PROGS} make variable.

    Test if <stdint.h> exists and set HAVE_STDINT_H accordingly
    in have_stdint.h.  Added HAVE_STDINT_H to allow one to force
    this value.

    Test if <inttypes.h> exists and set HAVE_INTTYPES_H accordingly
    in have_inttypes.h.  Added HAVE_INTTYPES_H to allow one to force
    this value.

    Added c_chk.c to check the compiler and C include for calc
    requirements.  If you are unable to compile this program, or
    if this program when compiles does not exit 0, then your C
    compiler and/or C include fails to meet calc requirements.
    Compilers that are at least c99 MUST be able to compile this
    program such that when run will exit 0.

    The "make hsrc" file will attempt to compile and run c_chk and
    will warn if the C compiler and/or C include fails to meet
    calc requirements.  The "make debug" system will run c_chk -c
    to print information about the C compiler and C include.
    Currently failure to compile cc_chk.c or c_chk exiting non-0
    will just print "WARNING!!" strings to stderr.

    The make chk_c file also forms status.chk_c.h which either
    defines CHK_C when the C compiler and select include files
    appear to meet calc requirements, or undefines CHK_C
    when it does not.

    Added int.h as a central place for calc integer types and
    integer macros.

    Removed `-R release_file` and `-r release_file` command
    line options from `ver_calc`.  Add `-h` option.  Updated
    comments in "README.RELEASE", which serves as the contents
    of the calc command "help release".

    Added log2(x [,eps]) builtin function.  When x is an integer
    power of 2, log2(x) will return an integer, otherwise it will
    return the equivalent of ln(x)/ln(2).

    Removed CALC2_COMPAT in favor of ckecking if MAJOR_VER < 3.

    The sign element in a ZVALUE is now of type SIGN, which is either
    SB32 when MAJOR_VER < 3, or a bool otherwise.

    The len element in a ZVALUE is of type LEN.  LEN type is SB32 when
    MAJOR_VER < 3, or a uintptr_t otherwise.

    Setting an invalid epsilon via the epsilon(value) or confiv("epsilon",
    value) triggers an error.  The epsilon value must be: 0 < epsilon < 1.

    Added new logn(x, n [,eps]) builtin to compute logarithms to base n.

    Verify that eps arguments (error tolerance arguments that override
    the default epsilon value) to builtin functions have proper values.
    Previously the eps argument had little to no value checks for
    many builtin functions.

    Document in help files for builtin functions that take eps arguments,
    the LIMIT range for such eps values.

    Removed old Makefile testing rules for make dbx and make gdb.

    Improved "make run" to execute calccalc using shared libraries
    from the local directory, and with reading of the startup scripts
    disabled.

    Changed "make prep" to perform various tests that are used to
    help verify that calc is ready for a release.  Added the
    update_ver tool, (formerly verupdate) and the trailblank tool
    that existed outside of the calc source base but neverthless
    used in the calc release process.  Both of these tools are used
    by "make prep".

    Added Makefile testing rule "make testfuncsort" to check for
    the sort of the builtin function list.  Changed the order that
    builtin functions are listed by "show builtin" and the help/builtin
    to match the sorting of "LANG=C LC_ALL=C sort -d -u".

    Added c_to_q(COMPLEX *c, bool cfree) to make is easier to convert
    a COMPLEX value that is real (imag part is 0) into a NUMBER and
    optionally free the COMPLEX value.  The func.c code now uses c_to_q().

    Added q_to_c(NUMBER *q) to make it easier to convert a NUMBER
    into an allocated COMPLEX value.

    Added new vercos(x, [,eps]) for versed cosine and covercos(x, [,eps])
    for inverse versed cosine.

    Added new avercos(x, [,eps]) for inverse versed cosine and acovercos(x, [,eps])
    for inverse coversed cosine.

    Improved comments about use of the ${CALC_ENV} Makefile variable.
    Noted in Makefile.cal where and how the ${CALC_ENV} is used.
    Use ${CALC_ENV} Makefile variable were needed.

    Modified regression test cal/regress.cal: in some cases test numbers
    were adjusted.  Add comments indicate which test numbers apply to
    which code.  Indicated where there is room for new tests.
    Expanded the end of test numbers from 9999 to  99999.

    To make the meaning a bit more clear in cal/regress.cal, we have
    renamed the following test calc resource files that are related to
    the calc regression test suite:

	cal/test1700.cal -> cal/test8000.read.cal
	cal/test2300.cal -> cal/test2300.obj_incdec.cal
	cal/test2600.cal -> cal/test2600.numfunc.cal
	cal/test2700.cal -> cal/test2700.isqrt.cal
	cal/test3100.cal -> cal/test3100.matobj.cal
	cal/test3400.cal -> cal/test3400.trig.cal
	cal/test4000.cal -> cal/test4000.ptest.cal
	cal/test4100.cal -> cal/test4100.redc.cal
	cal/test4600.cal -> cal/test4600.fileop.cal
	cal/test5100.cal -> cal/test5100.newdecl.cal
	cal/test5200.cal -> cal/test5200.globstat.cal
	cal/test8400.cal -> cal/test8400.quit.cal
	cal/test8500.cal -> cal/test8500.divmod.cal
	cal/test8600.cal -> cal/test8600.maxargs.cal
	cal/set8700.cal -> cal/test8700.dotest.cal
	cal/test8900.cal -> cal/test8900.special.cal
	cal/test9300.cal -> cal/test9300.frem.cal

    Added to test 94dd, read of a number of new calc resource files
    that are not already read as a result of the calc regression test suite.

    Fixed more documentation and code comments that referred to the
    old additive 55 (a55) shuffle pseudo-random number generator.
    We have been using the subtractive 100 shuffle pseudo-random
    number generator in place of the additive 55 generator for a
    while now.

    Improved help files trigonometric functions.  They were corrected
    to indicate that complex arguments are allowed: an oversight
    from long ago when those trigonometric functions were expanded
    to include complex arguments.  The EXAMPLE sections were expanded
    and made consistent, where applicable, across the trigonometric
    help files.  Documented libcalc functions in the SEE ALSO sections.

    Improved "SEE ALSO" for the hyperbolic function help files.

    Expanded the calc regression test suite test 34dd to test various
    real and complex values for trigonometric functions.

    Added complex multiple approximation function to commath.c so
    that users of libcalc may directly round complex number to
    nearest multiple of a given real number:

	E_FUNC COMPLEX *cmappr(COMPLEX *c, NUMBER *e, long rnd, bool cfree);

    For example:

	COMPLEX *c;             /* complex number to round to nearest epsilon */
	NUMBER *eps;            /* epsilon rounding precision */
	COMPLEX *res;           /* c rounded to nearest epsilon */
	long rnd = 24L;         /* a common rounding mode */
	bool ok_to_free;        /* true ==> free c, false ==> do not free c */

	...

	res = cmappr(c, eps, ok_to_free);

    The complex trigonometric functions tan, cot, sec, csc were
    implemented in func.c as calls to complex sin and complex cos.
    We added the following direct calls to comfunc.c so that users
    of libcalc may call them directly:

	E_FUNC COMPLEX *c_tan(COMPLEX *c, NUMBER *eps);
	E_FUNC COMPLEX *c_cot(COMPLEX *c, NUMBER *eps);
	E_FUNC COMPLEX *c_sec(COMPLEX *c, NUMBER *eps);
	E_FUNC COMPLEX *c_cot(COMPLEX *c, NUMBER *eps);

    Added help/errorcodes rule to the top level Makefile.

    Added E_USERMAX symbol (== 32767) to indicate the maximum value
    allowed for user error codes.

    Improved help/error.  Added text about error code ranges and
    range symbols.

    Changed calc_errno a global int variable so that is may be directly
    accessed by libcalc users.

    Further improve help files for help/errno, help/error, help/newerror,
    help/stoponerror and help/strerror by adding to documentation
    of the calc error code system as well as libcalc interface
    where applicable.

    Changed #define E_USERDEF to #define E__USERDEF.

    Removed use of E_USERDEF, E__BASE, E__COUNT, and E__HIGHEST
    from custom/c_sysinfo because the c_sysinfo is just a demo
    and this will simplify the custom/Makefile.

    The include file calcerr.h is now the errsym.h include file.
    The calcerr.tbl has been replaced by errtbl.c and errtbl.h.

    The calcerr_c.awk, calcerr_c.sed, calcerr_h.awk, and
    calcerr_h.sed files are now obsolete and have been removed.
    The calcerr.c and calcerr.h now obsolete and are no longer built.

    The calc computation error codes, symbols and messages are now in
    a error_table[] array of struct errtbl.

    An E_STRING is a string corresponds to an error code #define.
    For example, the E_STRING for the calc error E_STRCAT,
    is the string "E_STRING".  An E_STRING must now match
    the regular expression: "^E_[A-Z0-9_]+$".

    The old array error_table[] of error message strings has been
    replaced by a new error_table[] array of struct errtbl.  The struct
    errtbl array holds calc errnum error codes, the related E_STRING
    symbol as a string, and the original related error message.
    To add new computation error codes, add them near the bottom of the
    error_table[] array, just before the NULL entry.

    The ./errcode utility, when run, will verify the consistency of
    the error_table[] array.

    The Makefile uses ./errcode -e to generate the contents of
    help/errorcodes file.  The help errorcodes now prints
    information from the new cstruct errtbl error_table[] array.

    The help/errorcodes.hdr and help/errorcodes.sed files are
    now obsolete and have been removed.

    The Makefile uses ./errcode -d to generate the contents of the
    errsym.h include file.

    Code that used the old array error_table[] of error message strings
    such as:

	#include "calcerr.h"

	char *msg;	/* calc computation error message */

	msg = error_table[errnum - E__BASE];

    where errnum is the calc computation error code
    E__BASE <= errnum <= E__HIGHEST, may now use:

	#include "errtbl.h"
	#include "errsym.h"

	char *msg;	/* calc computation error message */

	msg = error_table[errnum - E__BASE].errmsg;

    Rename the #define E__COUNT to ECOUNT to avoid confusion
    with "E_STRING" error symbols.

    Renamed "E_1OVER0" to "E_DIVBYZERO".
    Renamed "E_0OVER0" to "E_ZERODIVZERO".

    The verify_error_table() function that does a verification
    the error_table[] array and setup private_error_alias[] array
    is now called by libcalc_call_me_first().

    Fix comment about wrong include file in have_sys_mount.h.

    Removed unused booltostr() and strtobool() macros from bool.h.

    Moved define of math_error(char *, ...) from zmath.h to errtbl.h.
    The errtbl.h include file, unless ERRCODE_SRC is defined
    also includes attribute.h and errsym.h.

    Added E_STRING to error([errnum | "E_STRING"]) builtin function.
    Added E_STRING to errno([errnum | "E_STRING"]) builtin function.
    Added E_STRING to strerror([errnum | "E_STRING"]) builtin function.
    Calling these functions with an E_STRING errsym is the same as calling
    them with the matching errnum code.

    Standardized on calc computation error related E_STRING strings
    where there are a set of related codes.  Changed "E_...digits" into
    "E_..._digits".  For example, E_FPUTC1 became E_FPUTC_1, E_FPUTC2
    became E_FPUTC_2, and E_FPUTC3 became E_FPUTC_3.  In a few cases
    such as E_APPR became E_APPR_1, because there was a E_APPR2 (which
    became E_APPR_2) and E_APPR3 (which became E_APPR_3).  To other
    special cases, E_ILOG10 became E_IBASE10_LOG and E_ILOG2 became
    E_IBASE2_LOG because E_ILOG10 and E_ILOG2 are both independent calc
    computation error related E_STRING strings.  Now related sets of
    E_STRING strings end in _ (underscore) followed by digits.

    Added errsym builtin function.  The errsym(errnum | "E_STRING")
    builtin, , when given a valid integer errnum that corresponds to a
    calc error condition, will return an E_STRING string, AND when given
    a valid E_STRING string that is associated with a calc error
    condition, will return errnum integer that corresponds to a calc
    error condition.

    Supplying a non-integer numeric errnum code to error(), errno(),
    strerror(), or errsym() will result in an error.

    Added tests to the calc regression test suite (cal/regress.cal) to
    verify that the errnum calc computation error codes and their
    E_STRING values have not changed.

    Improved the clarity of calc regression suite (regress.cal) to mostly
    use E_STRING errsym instead of numeric errnum values for error()
    and errno() related tests.

    Fixed SEE ALSO typo in help randperm.

    Fixed calc regression test 42dd to set the display value back to 20.

    Added to test 95dd and test9500.trigeq.cal to the calc regression test
    suite to perform extensive test of trigonometric functions.

    Added to test 34dd, some if the missing inverse trigonometric tests.

    Improved builtin function strings, as printed by help builtin,
    that use an optional accuracy (epsilon) arg by adding a comma.

The following are the changes from calc version 2.14.3.4 to 2.14.3.5:

    Under macOS, to reduce dependency chains, we remove functions
    and data that are unreachable by the entry point or exported
    symbols.  In particular, the macOS linker is used with both
    "-dead_strip" and "-dead_strip_dylibs".

    The libcalc shared library is now linked with libcustcalc.

    The config("triground") controls rounding for the following
    trigonometric and hyperbolic functions:

	sin, cos, tan, cot, sec, csc
	asin, acos, atan, acot, asec, acsc
	versin, coversin, vercos, covercos
	aversin, acoversin, avercos, acovercos
	haversin, hacoversin, havercos, hacovercos
	ahaversin, hacoversin, havercos, ahacovercos
	exsec, aexsec, excsc, aexcsc
	crd, acrd
	cas, cis
	sinh, cosh, tanh, coth, sech, csch
	asinh, acosh, atanh, acoth, asech, acsch

    In addition to taking a complex root (such as via the power
    function on a complex value), "triground" is used for:

	exp, polar

    For the above mentioned functions, the rounding mode used to
    round the result to the nearest epsilon value is controlled by,
    and defaults to:

	config("triground", 24)

    As with other config options, the call returns the previous mode,
    without a 2nd argument, returns the current mode without changing it:

	config("triground")

    When printing an error, calc used to print the errnum (error number):

	; 1/0
		Error 10001

    Calc now prints the errsym (errsym):

	; 1/0
		Error E_DIVBYZERO

    Added errsym E_LN_3 for ln(0).
    Added errsym E_LOG_5 for log(0).
    Added errsym E_LOG2_4 for log2(0).
    Added errsym E_LOGN_6 for logn(0,base).

    Added a chk_tree tool to help look for problems such as files that are
    result of building calc that are also part of the calc distribution,
    and files that are part of the calc source that are missing from the
    calc distribution, and files that are of unknown status that are either
    result of building calc nor missing from the calc distribution.

    Updated file lists in Makefile, sorting as needed.

    Updated Makefile PHONY rule to include Makefile rules that are NOT files.

    Reduced make chatter for rules that build lists.

    Added make verifydist to verify the existence of files that are part of
    the calc distribution.

    Added make verifydist to make prep.

    Added a chk_tree double check, one after make clobber, one before
    the final make chk, to make prep.  Added double pass of chk_tree to
    make full_debug (and thus to the make debug output).

    Improved notes for install locations in Makefile.config.

    Added printing of ${BUILD_ALL} to make env output.
2023-10-05 04:37:59 -07:00
Landon Curt Noll
698f73cd3e prep CHANGES for the next release of calc 2023-10-05 04:34:22 -07:00
Landon Curt Noll
e1888d9b9e note recent chk_tree changes in CHANGES 2023-10-05 04:33:30 -07:00
Landon Curt Noll
b54f68a797 Add comments to Makefile.local
Added comments to Makefile.local about how to force calc to install
under /usr/local.
2023-10-05 03:42:26 -07:00
Landon Curt Noll
77d7e665e0 Improve Makefile comments and tests
Improved notes for install locations in Makefile.config.

Added printing of ${BUILD_ALL} to make env output.

Added double pass of chk_tree to make full_debug (and thus to the make
debug output).
2023-10-05 03:27:14 -07:00
Landon Curt Noll
e96ef61718 fix missing version.h, add chk_tree tool
The tarball for calc version 2.15.0.0 was missing version.h.
The version.h is now listed as part of the calc distribution.

Added a chk_tree tool to help look for problems such as files that are
result of building calc that are also part of the calc distribution,
and files that are part of the calc source that are missing from the
calc distribution, and files that are of unknown status that are either
result of building calc nor missing from the calc distribution.

Updated file lists in Makefile, sorting as needed.

Updated Makefile PHONY rule to include Makefile rules that are NOT files.

Reduced make chatter for rules that build lists.

Added make verifydist to verify the existence of files that are part of
the calc distribution.

Added make verifydist to make prep.

Added a chk_tree double check, one after make clobber, one before the
final make chk, to make prep.
2023-10-05 02:50:45 -07:00
Landon Curt Noll
0eee1a615d add calc version regex on update_ver 2023-10-03 23:45:38 -07:00
Landon Curt Noll
d2025c5f24 fix make ver_calc in Makefile prod-2.15.0.0 v2.15.0.0 2023-10-03 23:03:19 -07:00
Landon Curt Noll
801dad8f57 fix make clobber for cal/Makefile 2023-10-03 23:00:44 -07:00
Landon Curt Noll
5a227873e5 Release v2.15.0.0
The following are the changes in this release:

    Added the following new trigonometric functions:

	versin(x [,eps])	versed trigonometric sine
	coversin(x [,eps])	coversed trigonometric sine
	vercos(x [,eps])	versed trigonometric cosine
	covercos(x [,eps])	coversed trigonometric cosine
	aversin(x [,eps])	inverse versed trigonometric sine
	acoversin(x [,eps])	inverse coversed trigonometric sine
	avercos(x [,eps])	inverse versed trigonometric cosine
	acovercos(x [,eps])	inverse coversed trigonometric cosine
	haversin(x [,eps])	half versed trigonometric sine
	hacoversin(x [,eps])	half coversed trigonometric sine
	havercos(x [,eps])	half versed trigonometric cosine
	hacovercos(x [,eps])	half coversed trigonometric cosine
	ahaversin(x [,eps])	inverse half versed trigonometric sine
	ahacoversin(x [,eps])	inverse half coversed trigonometric sine
	ahavercos(x [,eps])	inverse half versed trigonometric cosine
	ahacovercos(x [,eps])	inverse half coversed trigonometric cosine
	exsec(x [,eps])		exterior trigonometric secant
	aexsec(x [,eps])	inverse exterior trigonometric secant
	excsc(x [,eps])		exterior trigonometric cosecant
	aexcsc(x [,eps])	inverse exterior trigonometric cosecant
	crd(x [,eps])		trigonometric chord of a unit circle
	acrd(x [,eps])		inverse trigonometric chord of a unit circle
	cas(x [,eps])		trigonometric cosine plus sine
	cis(x [,eps])		Euler's formula

    As Msys2 is a fork of Cygwin, if the OSNAME is Msys, the Cygwin
    target will be used.  Thanks to GitHub user @iahung2 for the
    pull request.

    Support for win32 and DJGPP has been dropped.  Calc version
    2.14.3.5 was the last to make references to win32 and make
    references to DJGPP.  Future versions of calc may work under
    those systems, we just elected to remove the somewhat out of
    date and awkward `win32.mkdef` and related win32 references.

    If you are a win32 user, please feel free to create a win32
    target in Makefile.target and submit as a pull request.
    If you are a DJGPP user, please feel free to create a DJGPP
    target in Makefile.target and submit as a pull request.
    Until someone can test such systems, we prefer to wait
    until someone is able to test and supply a pull request.

    Added PTR_LEN (length of a pointer) and PTR_BITS (bit length
    of a pointer) to longbits.h.

    Moved calc version definition from version.c to version.h.

    Sorted the order of symbols printed by "make env".

    Test if <stdbool.h> exists and set HAVE_STDBOOL_H accordingly
    in have_stdbool.h.  Added HAVE_STDBOOL_H to allow one to force
    this value.

    Added "bool.h" include file to support use of boolean symbols,
    true and false for pre-c99 C compilers.  The "bool.h" include
    file defines TRUE as true, FALSE as false, and BOOL as bool:
    for backward compatibility.

    Replaced in C source, TRUE with true, FALSE with false, and
    BOOL with bool.

    Fixed have_statfs optional executable file extension ${EXT{ in
    the ${UTIL_PROGS} make variable.

    Test if <stdint.h> exists and set HAVE_STDINT_H accordingly
    in have_stdint.h.  Added HAVE_STDINT_H to allow one to force
    this value.

    Test if <inttypes.h> exists and set HAVE_INTTYPES_H accordingly
    in have_inttypes.h.  Added HAVE_INTTYPES_H to allow one to force
    this value.

    Added c_chk.c to check the compiler and C include for calc
    requirements.  If you are unable to compile this program, or
    if this program when compiles does not exit 0, then your C
    compiler and/or C include fails to meet calc requirements.
    Compilers that are at least c99 MUST be able to compile this
    program such that when run will exit 0.

    The "make hsrc" file will attempt to compile and run c_chk and
    will warn if the C compiler and/or C include fails to meet
    calc requirements.  The "make debug" system will run c_chk -c
    to print information about the C compiler and C include.
    Currently failure to compile cc_chk.c or c_chk exiting non-0
    will just print "WARNING!!" strings to stderr.

    The make chk_c file also forms status.chk_c.h which either
    defines CHK_C when the C compiler and select include files
    appear to meet calc requirements, or undefines CHK_C
    when it does not.

    Added int.h as a central place for calc integer types and
    integer macros.

    Removed `-R release_file` and `-r release_file` command
    line options from `ver_calc`.  Add `-h` option.  Updated
    comments in "README.RELEASE", which serves as the contents
    of the calc command "help release".

    Added log2(x [,eps]) builtin function.  When x is an integer
    power of 2, log2(x) will return an integer, otherwise it will
    return the equivalent of ln(x)/ln(2).

    Removed CALC2_COMPAT in favor of ckecking if MAJOR_VER < 3.

    The sign element in a ZVALUE is now of type SIGN, which is either
    SB32 when MAJOR_VER < 3, or a bool otherwise.

    The len element in a ZVALUE is of type LEN.  LEN type is SB32 when
    MAJOR_VER < 3, or a uintptr_t otherwise.

    Setting an invalid epsilon via the epsilon(value) or confiv("epsilon",
    value) triggers an error.  The epsilon value must be: 0 < epsilon < 1.

    Added new logn(x, n [,eps]) builtin to compute logarithms to base n.

    Verify that eps arguments (error tolerance arguments that override
    the default epsilon value) to builtin functions have proper values.
    Previously the eps argument had little to no value checks for
    many builtin functions.

    Document in help files for builtin functions that take eps arguments,
    the LIMIT range for such eps values.

    Removed old Makefile testing rules for make dbx and make gdb.

    Improved "make run" to execute calccalc using shared libraries
    from the local directory, and with reading of the startup scripts
    disabled.

    Changed "make prep" to perform various tests that are used to
    help verify that calc is ready for a release.  Added the
    update_ver tool, (formerly verupdate) and the trailblank tool
    that existed outside of the calc source base but neverthless
    used in the calc release process.  Both of these tools are used
    by "make prep".

    Added Makefile testing rule "make testfuncsort" to check for
    the sort of the builtin function list.  Changed the order that
    builtin functions are listed by "show builtin" and the help/builtin
    to match the sorting of "LANG=C LC_ALL=C sort -d -u".

    Added c_to_q(COMPLEX *c, bool cfree) to make is easier to convert
    a COMPLEX value that is real (imag part is 0) into a NUMBER and
    optionally free the COMPLEX value.  The func.c code now uses c_to_q().

    Added q_to_c(NUMBER *q) to make it easier to convert a NUMBER
    into an allocated COMPLEX value.

    Added new vercos(x, [,eps]) for versed cosine and covercos(x, [,eps])
    for inverse versed cosine.

    Added new avercos(x, [,eps]) for inverse versed cosine and acovercos(x, [,eps])
    for inverse coversed cosine.

    Improved comments about use of the ${CALC_ENV} Makefile variable.
    Noted in Makefile.cal where and how the ${CALC_ENV} is used.
    Use ${CALC_ENV} Makefile variable were needed.

    Modified regression test cal/regress.cal: in some cases test numbers
    were adjusted.  Add comments indicate which test numbers apply to
    which code.  Indicated where there is room for new tests.
    Expanded the end of test numbers from 9999 to  99999.

    To make the meaning a bit more clear in cal/regress.cal, we have
    renamed the following test calc resource files that are related to
    the calc regression test suite:

	cal/test1700.cal -> cal/test8000.read.cal
	cal/test2300.cal -> cal/test2300.obj_incdec.cal
	cal/test2600.cal -> cal/test2600.numfunc.cal
	cal/test2700.cal -> cal/test2700.isqrt.cal
	cal/test3100.cal -> cal/test3100.matobj.cal
	cal/test3400.cal -> cal/test3400.trig.cal
	cal/test4000.cal -> cal/test4000.ptest.cal
	cal/test4100.cal -> cal/test4100.redc.cal
	cal/test4600.cal -> cal/test4600.fileop.cal
	cal/test5100.cal -> cal/test5100.newdecl.cal
	cal/test5200.cal -> cal/test5200.globstat.cal
	cal/test8400.cal -> cal/test8400.quit.cal
	cal/test8500.cal -> cal/test8500.divmod.cal
	cal/test8600.cal -> cal/test8600.maxargs.cal
	cal/set8700.cal -> cal/test8700.dotest.cal
	cal/test8900.cal -> cal/test8900.special.cal
	cal/test9300.cal -> cal/test9300.frem.cal

    Added to test 94dd, read of a number of new calc resource files
    that are not already read as a result of the calc regression test suite.

    Fixed more documentation and code comments that referred to the
    old additive 55 (a55) shuffle pseudo-random number generator.
    We have been using the subtractive 100 shuffle pseudo-random
    number generator in place of the additive 55 generator for a
    while now.

    Improved help files trigonometric functions.  They were corrected
    to indicate that complex arguments are allowed: an oversight
    from long ago when those trigonometric functions were expanded
    to include complex arguments.  The EXAMPLE sections were expanded
    and made consistent, where applicable, across the trigonometric
    help files.  Documented libcalc functions in the SEE ALSO sections.

    Improved "SEE ALSO" for the hyperbolic function help files.

    Expanded the calc regression test suite test 34dd to test various
    real and complex values for trigonometric functions.

    Added complex multiple approximation function to commath.c so
    that users of libcalc may directly round complex number to
    nearest multiple of a given real number:

	E_FUNC COMPLEX *cmappr(COMPLEX *c, NUMBER *e, long rnd, bool cfree);

    For example:

	COMPLEX *c;             /* complex number to round to nearest epsilon */
	NUMBER *eps;            /* epsilon rounding precision */
	COMPLEX *res;           /* c rounded to nearest epsilon */
	long rnd = 24L;         /* a common rounding mode */
	bool ok_to_free;        /* true ==> free c, false ==> do not free c */

	...

	res = cmappr(c, eps, ok_to_free);

    The complex trigonometric functions tan, cot, sec, csc were
    implemented in func.c as calls to complex sin and complex cos.
    We added the following direct calls to comfunc.c so that users
    of libcalc may call them directly:

	E_FUNC COMPLEX *c_tan(COMPLEX *c, NUMBER *eps);
	E_FUNC COMPLEX *c_cot(COMPLEX *c, NUMBER *eps);
	E_FUNC COMPLEX *c_sec(COMPLEX *c, NUMBER *eps);
	E_FUNC COMPLEX *c_cot(COMPLEX *c, NUMBER *eps);

    Added help/errorcodes rule to the top level Makefile.

    Added E_USERMAX symbol (== 32767) to indicate the maximum value
    allowed for user error codes.

    Improved help/error.  Added text about error code ranges and
    range symbols.

    Changed calc_errno a global int variable so that is may be directly
    accessed by libcalc users.

    Further improve help files for help/errno, help/error, help/newerror,
    help/stoponerror and help/strerror by adding to documentation
    of the calc error code system as well as libcalc interface
    where applicable.

    Changed #define E_USERDEF to #define E__USERDEF.

    Removed use of E_USERDEF, E__BASE, E__COUNT, and E__HIGHEST
    from custom/c_sysinfo because the c_sysinfo is just a demo
    and this will simplify the custom/Makefile.

    The include file calcerr.h is now the errsym.h include file.
    The calcerr.tbl has been replaced by errtbl.c and errtbl.h.

    The calcerr_c.awk, calcerr_c.sed, calcerr_h.awk, and
    calcerr_h.sed files are now obsolete and have been removed.
    The calcerr.c and calcerr.h now obsolete and are no longer built.

    The calc computation error codes, symbols and messages are now in
    a error_table[] array of struct errtbl.

    An E_STRING is a string corresponds to an error code #define.
    For example, the E_STRING for the calc error E_STRCAT,
    is the string "E_STRING".  An E_STRING must now match
    the regular expression: "^E_[A-Z0-9_]+$".

    The old array error_table[] of error message strings has been
    replaced by a new error_table[] array of struct errtbl.  The struct
    errtbl array holds calc errnum error codes, the related E_STRING
    symbol as a string, and the original related error message.
    To add new computation error codes, add them near the bottom of the
    error_table[] array, just before the NULL entry.

    The ./errcode utility, when run, will verify the consistency of
    the error_table[] array.

    The Makefile uses ./errcode -e to generate the contents of
    help/errorcodes file.  The help errorcodes now prints
    information from the new cstruct errtbl error_table[] array.

    The help/errorcodes.hdr and help/errorcodes.sed files are
    now obsolete and have been removed.

    The Makefile uses ./errcode -d to generate the contents of the
    errsym.h include file.

    Code that used the old array error_table[] of error message strings
    such as:

	#include "calcerr.h"

	char *msg;	/* calc computation error message */

	msg = error_table[errnum - E__BASE];

    where errnum is the calc computation error code
    E__BASE <= errnum <= E__HIGHEST, may now use:

	#include "errtbl.h"
	#include "errsym.h"

	char *msg;	/* calc computation error message */

	msg = error_table[errnum - E__BASE].errmsg;

    Rename the #define E__COUNT to ECOUNT to avoid confusion
    with "E_STRING" error symbols.

    Renamed "E_1OVER0" to "E_DIVBYZERO".
    Renamed "E_0OVER0" to "E_ZERODIVZERO".

    The verify_error_table() function that does a verification
    the error_table[] array and setup private_error_alias[] array
    is now called by libcalc_call_me_first().

    Fix comment about wrong include file in have_sys_mount.h.

    Removed unused booltostr() and strtobool() macros from bool.h.

    Moved define of math_error(char *, ...) from zmath.h to errtbl.h.
    The errtbl.h include file, unless ERRCODE_SRC is defined
    also includes attribute.h and errsym.h.

    Added E_STRING to error([errnum | "E_STRING"]) builtin function.
    Added E_STRING to errno([errnum | "E_STRING"]) builtin function.
    Added E_STRING to strerror([errnum | "E_STRING"]) builtin function.
    Calling these functions with an E_STRING errsym is the same as calling
    them with the matching errnum code.

    Standardized on calc computation error related E_STRING strings
    where there are a set of related codes.  Changed "E_...digits" into
    "E_..._digits".  For example, E_FPUTC1 became E_FPUTC_1, E_FPUTC2
    became E_FPUTC_2, and E_FPUTC3 became E_FPUTC_3.  In a few cases
    such as E_APPR became E_APPR_1, because there was a E_APPR2 (which
    became E_APPR_2) and E_APPR3 (which became E_APPR_3).  To other
    special cases, E_ILOG10 became E_IBASE10_LOG and E_ILOG2 became
    E_IBASE2_LOG because E_ILOG10 and E_ILOG2 are both independent calc
    computation error related E_STRING strings.  Now related sets of
    E_STRING strings end in _ (underscore) followed by digits.

    Added errsym builtin function.  The errsym(errnum | "E_STRING")
    builtin, , when given a valid integer errnum that corresponds to a
    calc error condition, will return an E_STRING string, AND when given
    a valid E_STRING string that is associated with a calc error
    condition, will return errnum integer that corresponds to a calc
    error condition.

    Supplying a non-integer numeric errnum code to error(), errno(),
    strerror(), or errsym() will result in an error.

    Added tests to the calc regression test suite (cal/regress.cal) to
    verify that the errnum calc computation error codes and their
    E_STRING values have not changed.

    Improved the clarity of calc regression suite (regress.cal) to mostly
    use E_STRING errsym instead of numeric errnum values for error()
    and errno() related tests.

    Fixed SEE ALSO typo in help randperm.

    Fixed calc regression test 42dd to set the display value back to 20.

    Added to test 95dd and test9500.trigeq.cal to the calc regression test
    suite to perform extensive test of trigonometric functions.

    Added to test 34dd, some if the missing inverse trigonometric tests.

    Improved builtin function strings, as printed by help builtin,
    that use an optional accuracy (epsilon) arg by adding a comma.
2023-10-03 22:39:35 -07:00
Landon Curt Noll
915054391e changed a few CHANGES notes to use changed instead of change 2023-10-03 22:28:42 -07:00
Landon Curt Noll
4b7ba942ee prep CHANGES for the next release of calc 2023-10-03 22:25:23 -07:00
Landon Curt Noll
42129a3672 change error printing from errnum to errsym
When printing an error, calc used to print the errnum (error number):

    ; 1/0
	    Error 10001

Calc now prints the errsym (errsym):

    ; 1/0
	    Error E_DIVBYZERO

Added errsym E_LN_3 for ln(0).
Added errsym E_LOG_5 for log(0).
Added errsym E_LOG2_4 for log2(0).
Added errsym E_LOGN_6 for logn(0,base).
2023-10-03 22:12:14 -07:00