Commit Graph

67 Commits

Author SHA1 Message Date
Landon Curt Noll
d8603d3980 rename regression test calc resource files
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.
2023-09-08 12:15:04 -07:00
Landon Curt Noll
3fd55f0431 improve the cal/regress.cal regress test suite structure
Improve 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.
2023-09-07 22:11:36 -07:00
Landon Curt Noll
b67e20881a fix historical trigonometric functions for values of 0
Fixed how the historical trigonometric functions call
the underlying trigonometric functions.  This fixes a
number of issues where the function for values of 0.

Updated cal/regress.cal to test historical trigonometric functions
at the  0 value.
2023-09-06 18:02:46 -07:00
Landon Curt Noll
fdbf53d7e8 add vercos(), avercos(), covercos(), acovercos()
Improved trig help files.

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.
2023-09-06 00:52:37 -07:00
Landon Curt Noll
3abedd6713 fix aversin() and acoversin()
In cases where the real value to the inverse versed sine and the
inverse coversed sine function produces a complex value, the
conversion from real to complex was incorrect.

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

NOTE: There is a XXX bug marked in the f_aversin() and f_acoversin()
that still needs to be fixed.
2023-09-05 16:09:22 -07:00
Landon Curt Noll
86f1d9e029 add new aversin and acoversin builtin functions.
Added new aversin(x, [,eps]) for inverse versed sine and acoversin(x, [,eps])
for inverse coversed sine.

Improved trig function help files to reference use of complex arguments
that while supported were not documented.

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 Makefile testing rule 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".
2023-09-03 23:37:09 -07:00
Landon Curt Noll
20ce75a06d move versin() and coversin() code
Moved versin() and coversin() to bottom of functions in func.c
(however the builtin function list remains sorted).

Created a historical trig functions section for cmath.h and qmath.h.

Moved cal/test3500.cal to cal/test9300.cal to make room
for future trip tests going from test 3427 thru 3599.
2023-09-01 23:53:30 -07:00
Landon Curt Noll
7398fbb2e9 rename vercos to coversin
The code to compute 1 - sin(x) belongs to coversin, not vercos.
2023-09-01 23:26:26 -07:00
Landon Curt Noll
b0a48a2b70 add new versin and vercos builtin functions
Added new versin(x, [,eps]) for versed sine and vercos(x, [,eps])
for versed cosine.

Updated trig help files.
2023-09-01 17:38:14 -07:00
Landon Curt Noll
1c839dfede add logn and error checking for invalue eps and epsilon values
Add 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.
2023-08-31 22:33:41 -07:00
Landon Curt Noll
4e5fcc8812 add log2(x [,eps]) builtin function
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).
2023-08-27 19:02:37 -07:00
Landon Curt Noll
f4f19f21dc Add config("complex_space") to control spaces around + or - in complex values
Added config("fraction_space", boolean) to help/config, along with
a few few minor text improvements.  Updated cal/regress to test
config("tilde_space").

Added config("complex_space", boolean).  The "complex_space" controls
whether or not a space (' ') is printed before and after the + or -
in complex values.

By default, config("complex_space") is false.

For example, with the default, config("complex_space", 0):

    ; asin(2)
	    1.57079632679489661923-1.31695789692481670863i

With config("complex_space", 1):

    ; asin(2)
	    1.57079632679489661923 - 1.31695789692481670863i

NOTE: Use of config("complex_space", 1) can break printing and scanning
      of fractional values via "%r".

NOTE: Use of config("complex_space", 1) can break printing and scanning
      of complex values via "%c".

Added config("complex_space", boolean) to help/config, along with
a few few minor text improvements.  Updated cal/regress to test
config("complex_space").
2022-12-04 00:53:15 -08:00
Landon Curt Noll
17702a4799 Add config("fraction_space") to control spaces around printing fractions
Added config("tilde_space", boolean) to help/config, along with
a few few minor text improvements.  Updated cal/regress to test
config("tilde_space").

Added config("fraction_space", boolean).  The "fraction_space" controls
whether or not a space (' ') is printed before and after fractions.
By default, config("fraction_space") is false.

For example, with the default, config("fraction_space", 0):

    ; base(1/3),
    ; 1/7
            1/7

With config("fraction_space", 1):

    ; base(1/3),
    ; 1/7
            1 / 7

NOTE: Use of config("fraction_space", 1) can break printing and scanning
      of fractional values via "%r".

NOTE: Use of config("fraction_space", 1) can break printing and scanning
      of complex values via "%c".

Added config("fraction_space", boolean) to help/config, along with
a few few minor text improvements.  Updated cal/regress to test
config("tilde_space").
2022-12-03 14:39:25 -08:00
Landon Curt Noll
7c6723db88 Change tilde_space to be 0 by default 2022-12-03 14:02:49 -08:00
Landon Curt Noll
0d99ba54d8 Change default to print space after the approximation tilde
Added config("tilde_space", boolean).  The "tilde_space" controls
whether or not a space (' ') is printed after leading tilde ('~').
By default, config("tilde_space") is true, which is a change
from past behavior.  For example, now:

    ; 1/3
	    ~ 0.33333333333333333333

With config("tilde_space", 0):

    ; 1/3
	    ~0.33333333333333333333

To disable "tilde_space", use config("tilde_space", 0) on the
command line and/or use config("tilde_space", 0),; in your ~/.calcrc.
Thanks goes to <GitHub use ljramalho> for this suggestion.

Added config("tilde_space", boolean) to help/config, along with
a few few minor text improvements.  Updated cal/regress to test
config("tilde_space") and to account for the new default.
2022-12-03 12:22:55 -08:00
Landon Curt Noll
56b6613da8 Fixed 0^y for y > 0
While 0^0 == 1, now for y > 0, 0^y == 0.

Adjusted cal/test8900.cal to reflect the this bug fix.

Added tests to cal/regress.cal to help verify bug fix is fixed.
2022-04-07 23:54:06 -07:00
Landon Curt Noll
5ae3ca059a Fixed old references additive 55
Fixed documentation that referred to the old additive 55
generator.  We have been using the subtractive 100 in place
of the additive 55 generator for a while now.
2021-12-07 02:24:50 -08:00
Landon Curt Noll
f5c5cea8b0 Correct typos 2021-12-05 18:23:27 -08:00
Landon Curt Noll
ada15fdabc Added more builtin inverse conversion functions
Added builtin functions to convert between degrees, minutes and
    seconds and degrees under the config("mod") round rules:

	dms2d(d, m, s [,rnd]) - convert deg, min, and secs to deg
	dm2d(d, m [,rnd]) - convert deg, min to deg

	See help/dms2d and help/dm2d.

    Example:

	; print dms2d(12, 20, 44.16);
	12.3456

	; print dm2d(3601, -25.5594);
	0.57401

    Added builtin functions to convert between gradians, minutes and
    seconds and gradians under the config("mod") round rules:

	gms2g(g, m, s [,rnd]) - convert grad, min, and secs to grad
	gm2g(g, m [,rnd]) - convert grad and min to grad

	See help/g2gms and help/g2gm.

    Example:

	; print gms2g(12, 20, 44.16);
	12.3456

	; print gm2g(4001, -25.5594);
	0.57401

    Added builtin functions to convert between hours, minutes and
    seconds and hours under the config("mod") round rules:

	hms2h(h, m, s [,rnd]) - convert hours, min, and secs to hours
	hm2h(h, m [,rnd]) - convert hours, min to hours

	See help/hms2h and help/hm2h.

    Example:

	; print hms2h(12, 20, 44.16);
	12.3456

	; print hm2h(241, -25.5594);
	0.57401
2021-09-27 02:14:18 -07:00
Landon Curt Noll
cf419fb329 Added several conversion funcions, plus minor updates
Added several conversion functions:

    Added builtin functions to convert between degrees and
    degrees, minutes and seconds under the config("mod")
    round rules:

	d2dms(degs, d, m, s [,rnd]) - given degs, compute d, m, s
	d2dm(degs, d, m [,rnd]) - given degs, compute d, m

	See help/d2dms and help/d2dm.

    Example:

	; print d2dms(360.321,deg=,min=,sec=), deg, min, sec;
	0.321 0 19 15.6

	; print d2dm(360.321,deg=,min=), deg, min;
	0.321 0 19.26

    Added builtin functions to convert between gradians and
    gradians, minutes and seconds under the config("mod")
    round rules:

	g2gms(grads, g, m, s [,rnd]) - given grads, compute g, m, s
	g2gm(grads, g, m [,rnd]) - given grads, compute g, m

	See help/g2gms and help/g2gm.

    Example:

	; print g2gms(400.321,grad=,min=,sec=), grad, min, sec;
	0.321 0 19 15.6

	; print g2gm(400.321,grad=,min=), grad, min;
	0.321 0 19.26

    Added builtin functions to convert between hours and
    hours, minutes and seconds under the config("mod")
    round rules:

	h2hms(hours, h, m, s [,rnd]) - given hours, compute h, m, s
	h2hm(hours, h, m [,rnd]) - given hours, compute h, m

	See help/h2hms and help/h2hm.

    Example:

	; print h2hms(24.321,hour=,min=,sec=), hour, min, sec;
	0.321 0 19 15.6

	; print h2hm(24.321,hour=,min=), hour, min;
	0.321 0 19.26

In addtion:

    Renumbered regression tests 3408 thru 3437, to 9102 thru 9131.

    Updated Added hms.cal resource file to use h2hms() builtin.
    Updated Added dms.cal resource file to use d2dms() builtin.

    Fix minor typo in help/mod SYNOPSIS.
    Fix minor typo in help/quo SYNOPSIS.

    Added a few more examples to help/strcmp.
2021-09-26 04:38:09 -07:00
Landon Curt Noll
ca5a81122a Completed degree, radian, gradian builtin conversions
Updated CHANGES.

Updated help/unexpected.

Added help files for d2g(), d2r(), g2d(), g2r(), r2d(), r2g().

Added regression test code for the same functions.

Fixed a few minor typos.
2021-09-07 13:28:03 -07:00
Landon Curt Noll
f753884008 Expanded regression test code for base() and base2()
Added regression test code for engineering mode.  Improved and
expanded regression test code related to the base() and base2()
builtin functions.
2021-09-06 19:22:57 -07:00
Landon Curt Noll
64e2c6a262 Release 2.12.8.1
Fixed how the *.tar.bz2 are formed.  The calc-2.12.8.0.tar.bz2 file
    that was formed for calc version 2.12.8.0 was missing most files.

    Expanded 'make chk' to also verify that 'make distchk' and 'make
    distlist' execute successfully.  This will help check a regression
    of the bug that produced the bogus calc-2.12.8.0.tar.bz2 file.

    Added additional regression tests related 0^(zero_expression)==1.
2021-02-15 22:53:22 -08:00
Landon Curt Noll
33657bb2cc Test pre-release of 2.12.8.1 2021-02-15 22:32:27 -08:00
Landon Curt Noll
c02725f036 Update copyright date to 2021 for all prev typo fixes 2021-02-12 22:27:51 -08:00
Landon Curt Noll
507fe026e5 Fix many spelling errors 2021-02-12 22:09:47 -08:00
Landon Curt Noll
da6ccc146f Improvements to %g pull request
This code %g is preliminary.

Fixed some code style issues to match the current code style.

Added regression tests and help file updates to printf and strprintf.

Fixed use of magic number -4: using -P instead.

Noted two problem areas with XXX comments in qio.c:

    1) need a qprintfg function
    2) re-write to not modify conf->outdigits
2018-09-30 16:06:28 -07:00
Landon Curt Noll
5fb3db4558 Fixed trigonometric and hyperbolic core dumps 2018-09-30 14:08:20 -07:00
Landon Curt Noll
a31078bbec Remove all RCS @(#) lines and RCS strings
Some folks might think: “you still use RCS”?!?  And we will say,
hey, at least we switched from SCCS to RCS back in … I think it was
around 1994 ... at least we are keeping up! :-) :-) :-)

Logs say that SCCS version 18 became RCS version 19 on 1994 March 18.

RCS served us well.  But now it is time to move on.   And so we are
switching to git.

Calc releases produce a lot of file changes.  In the 125 releases
of calc since 1996, when I started managing calc releases, there
have been 15473 file mods!
2017-05-23 01:33:23 -07:00
Landon Curt Noll
8dd7a3cd2a Release calc version 2.12.5.5 2017-05-21 15:39:01 -07:00
Landon Curt Noll
28d1e35362 Release calc version 2.12.5.2 2017-05-21 15:39:00 -07:00
Landon Curt Noll
57a22a6f39 Release calc version 2.12.4.12 2017-05-21 15:38:58 -07:00
Landon Curt Noll
85bfa30897 Release calc version 2.12.4.11 2017-05-21 15:38:58 -07:00
Landon Curt Noll
17e3535595 Release calc version 2.12.4.10 2017-05-21 15:38:58 -07:00
Landon Curt Noll
7f125396c1 Release calc version 2.12.4.9 2017-05-21 15:38:57 -07:00
Landon Curt Noll
7cf611bca8 Release calc version 2.12.4.0 2017-05-21 15:38:57 -07:00
Landon Curt Noll
c9fce6a5bb Release calc version 2.12.4.1 2017-05-21 15:38:56 -07:00
Landon Curt Noll
5bada5fefd Release calc version 2.12.4.6 2017-05-21 15:38:55 -07:00
Landon Curt Noll
e229393250 Release calc version 2.12.4.2 2017-05-21 15:38:53 -07:00
Landon Curt Noll
bdf495150e Release calc version 2.12.3.0 2017-05-21 15:38:52 -07:00
Landon Curt Noll
ca0dd4560b Release calc version 2.12.2 2017-05-21 15:38:50 -07:00
Landon Curt Noll
ee30d787ea Release calc version 2.12.1.6 2017-05-21 15:38:48 -07:00
Landon Curt Noll
c335809b5f Release calc version 2.12.0.8 2017-05-21 15:38:47 -07:00
Landon Curt Noll
87570b56fe Release calc version 2.12.0.5 2017-05-21 15:38:47 -07:00
Landon Curt Noll
afe37ec851 Release calc version 2.12.0.4 2017-05-21 15:38:46 -07:00
Landon Curt Noll
bd3086138b Release calc version 2.12.0.3 2017-05-21 15:38:46 -07:00
Landon Curt Noll
9d62873a02 Release calc version 2.12.0.2 2017-05-21 15:38:46 -07:00
Landon Curt Noll
58d94b08d8 Release calc version 2.12.0 2017-05-21 15:38:45 -07:00
Landon Curt Noll
64a732b678 Release calc version 2.11.10.1 2017-05-21 15:38:45 -07:00
Landon Curt Noll
a6a37f9cad Release calc version 2.11.10 2017-05-21 15:38:45 -07:00