Hello community, here is the log from the commit of package calc for openSUSE:Factory checked in at 2018-10-18 15:39:24 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/calc (Old) and /work/SRC/openSUSE:Factory/.calc.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "calc" Thu Oct 18 15:39:24 2018 rev:17 rq:642800 version:2.12.6.9 Changes: -------- --- /work/SRC/openSUSE:Factory/calc/calc.changes 2018-10-11 11:55:44.238001767 +0200 +++ /work/SRC/openSUSE:Factory/.calc.new/calc.changes 2018-10-18 15:39:42.954066561 +0200 @@ -1,0 +2,6 @@ +Tue Oct 16 16:07:46 UTC 2018 - d...@opensuse.org + +- update to 2.12.6.9 + + various fixes and improvements, e.g. a number of core dump bugs + +------------------------------------------------------------------- Old: ---- calc-2.12.6.8.tar.bz2 New: ---- calc-2.12.6.9.tar.bz2 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ calc.spec ++++++ --- /var/tmp/diff_new_pack.lW4nEq/_old 2018-10-18 15:39:43.798065603 +0200 +++ /var/tmp/diff_new_pack.lW4nEq/_new 2018-10-18 15:39:43.802065598 +0200 @@ -19,7 +19,7 @@ %define soname 2 %define libname libcalc%{soname} Name: calc -Version: 2.12.6.8 +Version: 2.12.6.9 Release: 0 Summary: C-style arbitrary precision calculator License: LGPL-2.1 ++++++ calc-2.12.6.8.tar.bz2 -> calc-2.12.6.9.tar.bz2 ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/CHANGES new/calc-2.12.6.9/CHANGES --- old/calc-2.12.6.8/CHANGES 2018-09-30 18:26:46.000000000 +0200 +++ new/calc-2.12.6.9/CHANGES 2018-10-16 04:36:43.000000000 +0200 @@ -1,4 +1,43 @@ -The following are the changes from calc version 2.12.6.6 to date: +The following are the changes from calc version 2.12.6.9 to date: + + Fixed a number of core dump bugs related to the calculation of + tan(), cot(), sec(), csc(), tanh(), coth(), sech(), and csch(), + asin(), acos(), asinh(), acosh(), where when a call to an + underlying function produced an invalid value. Thanks goes to + github user wuxiuheng for reporting this problem. + + A number of trigonometric and hyperbolic functions that incorrectly + returned E_LOGINF, now return a new error code that is more + specific to the trigonometric or hyperbolic function. The + following is a list of these new error codes: E_TAN3 E_TAN4 + E_COT3 E_COT4 E_SEC3 E_CSC3 E_TANH3 E_TANH4 E_COTH3 E_COTH4 + E_SECH3 E_CSCH3 E_ASIN3 E_ACOS3 E_ASINH3 E_ACOSH3 E_ATAN3 E_ACOT3 + E_ASEC3 E_ACSC3 E_ATANH3 E_ACOTH3 E_ASECH3 E_ACSCH3. + + Added regression tests 3729 thru 3732 to test E_TAN3, E_COT3, + E_SEC3 and E_CSC3 respectively. + + Added experimential %g printf (and strprintf) format implementation + based on pull request from github user 10110111. + + Made exterimental changes to macOS builds to not require use of + /usr/include. The INCDIR for macOS uses: + + INCDIR= $(shell xcrun --show-sdk-path --sdk macosx)/usr/include + + to determine the upper path of the /usr/include directory for macOS. + The Darwin target seems to not automatically detected. For now, + under macOS, declare the target as darwin: + + # for macOS users only, force the target to be darwin + # + make target=Darwin clobber + make target=Darwin all + make target=Darwin chk + make target=Darwin install + + +The following are the changes from calc version 2.12.6.6 to 2.12.6.8: For historical purposes, in lucas.cal, gen_v1(1, n) always returns 4. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/HOWTO.INSTALL new/calc-2.12.6.9/HOWTO.INSTALL --- old/calc-2.12.6.8/HOWTO.INSTALL 2017-06-02 23:50:17.000000000 +0200 +++ new/calc-2.12.6.9/HOWTO.INSTALL 2018-10-16 04:36:49.000000000 +0200 @@ -32,6 +32,16 @@ targets, the default make is sufficent. On FreeBSD for example, one must use gmake instead of make. + Some report that under macOS, one has to declare the target + to be darwin. So for macOS, one might have to do: + + # for macOS users only, force the target to be darwin + # + make target=Darwin clobber + make target=Darwin all + make target=Darwin chk + make target=Darwin install + If your target system does not have GNU Make (or equivalent), then you should try using the Makefile.simple and custom/Makefile.simple files: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/Makefile new/calc-2.12.6.9/Makefile --- old/calc-2.12.6.8/Makefile 2018-09-30 18:14:31.000000000 +0200 +++ new/calc-2.12.6.9/Makefile 2018-10-16 03:45:05.000000000 +0200 @@ -575,7 +575,7 @@ ifeq ($(target),Darwin) # default INCDIR for macOS -INCDIR= /usr/local/include +INCDIR= $(shell xcrun --show-sdk-path --sdk macosx)/usr/include else #endif /* end of skip for non-Gnu makefiles */ @@ -1054,7 +1054,7 @@ # The default calc versions # -VERSION= 2.12.6.8 +VERSION= 2.12.6.9 # Names of shared libraries with versions # @@ -2179,7 +2179,7 @@ all: check_include ${BLD_TYPE} CHANGES check_include: - $(Q) if [ ! -d /usr/include ]; then \ + $(Q) if [ ! -d ${INCDIR} ]; then \ echo "ERROR: critical directory missing: /usr/include" 1>&2; \ echo "Without this critical directory, we cannot compile." 1>&2; \ echo 1>&2; \ @@ -2191,7 +2191,7 @@ echo 1>&2; \ exit 1; \ fi - $(Q) if [ ! -f /usr/include/stdio.h ]; then \ + $(Q) if [ ! -f ${INCDIR}/stdio.h ]; then \ echo "ERROR: critical include files are missing" 1>&2; \ echo "Without this critical directory, we cannot compile." 1>&2; \ echo 1>&2; \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/Makefile.simple new/calc-2.12.6.9/Makefile.simple --- old/calc-2.12.6.8/Makefile.simple 2018-09-30 19:05:37.000000000 +0200 +++ new/calc-2.12.6.9/Makefile.simple 2018-10-16 04:40:28.000000000 +0200 @@ -981,7 +981,7 @@ # The default calc versions # -VERSION= 2.12.6.8 +VERSION= 2.12.6.9 # Names of shared libraries with versions # @@ -1911,7 +1911,7 @@ all: check_include ${BLD_TYPE} CHANGES check_include: - $(Q) if [ ! -d /usr/include ]; then \ + $(Q) if [ ! -d ${INCDIR} ]; then \ echo "ERROR: critical directory missing: /usr/include" 1>&2; \ echo "Without this critical directory, we cannot compile." 1>&2; \ echo 1>&2; \ @@ -1923,7 +1923,7 @@ echo 1>&2; \ exit 1; \ fi - $(Q) if [ ! -f /usr/include/stdio.h ]; then \ + $(Q) if [ ! -f ${INCDIR}/stdio.h ]; then \ echo "ERROR: critical include files are missing" 1>&2; \ echo "Without this critical directory, we cannot compile." 1>&2; \ echo 1>&2; \ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/cal/regress.cal new/calc-2.12.6.9/cal/regress.cal --- old/calc-2.12.6.8/cal/regress.cal 2017-06-02 23:50:17.000000000 +0200 +++ new/calc-2.12.6.9/cal/regress.cal 2018-10-01 01:11:23.000000000 +0200 @@ -3227,9 +3227,9 @@ print '3600: Beginning test_error'; - /* bump ecnt up by 148 */ - ecnt += 148; - print '3601: ecnt += 148'; + /* bump ecnt up by 156 */ + ecnt += 156; + print '3601: ecnt += 156'; strx = "x"; print '3602: strx = "x"'; @@ -3418,11 +3418,15 @@ n = 8191; print '3727: n = 8191'; /* test 3728 removed due to non-portable strerror() output */ + vrfy(tan(2e9i) == error(10435), '3729: tan(2e9i) == error(10435)'); + vrfy(cot(2e9i) == error(10437), '3730: cot(2e9i) == error(10437)'); + vrfy(sec(2e9i) == error(10439), '3731: sec(2e9i) == error(10439)'); + vrfy(csc(2e9i) == error(10440), '3732: csc(2e9i) == error(10440)'); /* errmax and errcount should be bumped up the 148 errors above */ - vrfy(errcount() == ecnt, '3729: errcount() == ecnt'); + vrfy(errcount() == ecnt, '3733: errcount() == ecnt'); - print '3730: Ending test_error'; + print '3734: Ending test_error'; } print '054: parsed test_error()'; @@ -4102,38 +4106,46 @@ '4821: strprintf("%b", 27/29) == "0b11011/0b11101"'); vrfy(strprintf("%e", 12345) == "~1.23e4", '4822: strprintf("%e", 12345) == "~1.23e4"'); + vrfy(strprintf("%g", .385) == "~.38", + '4823: strprintf("%g", .385) == "~.38"'); + vrfy(strprintf("%g", 385) == "~3.8e2", + '4824: strprintf("%g", 385) == "~3.8e2"'); /* mode tests with tilde == 0 */ c = config("tilde", 0); - print '4823: c = config("tilde", 0)'; + print '4825: c = config("tilde", 0)'; vrfy(strprintf("%e", 12345) == "1.23e4", - '4824: strprintf("%e", 12345) == "1.23e4"'); + '4826: strprintf("%e", 12345) == "1.23e4"'); vrfy(strprintf("%.3e", 12345) == "1.234e4", - '4825: strprintf("%.3e", 12345) == "1.234e4"'); + '4827: strprintf("%.3e", 12345) == "1.234e4"'); vrfy(strprintf("%e", .00012345) == "1.23e-4", - '4826: strprintf("%e", .00012345) == "1.23e-4"'); + '4828: strprintf("%e", .00012345) == "1.23e-4"'); vrfy(strprintf("%d %d", 27) == "27 ", - '4827: strprintf("%d %d", 27) == "27 "'); + '4829: strprintf("%d %d", 27) == "27 "'); vrfy(strprintf("%d", 27, 29) == "27", - '4828: strprintf("%d", 27, 29) == "27"'); + '4830: strprintf("%d", 27, 29) == "27"'); vrfy(strprintf("%r = %f", 27/29, 27/29) == "27/29 = .93", - '4829: strprintf("%r = %f", 27/29, 27/29) == "27/29 = .93"'); + '4831: strprintf("%r = %f", 27/29, 27/29) == "27/29 = .93"'); vrfy(strprintf("%s", "abc") == "abc", - '4830: strprintf("%s", "abc") == "abc"'); + '4832: strprintf("%s", "abc") == "abc"'); vrfy(strprintf("%f", "abc") == "abc", - '4831: strprintf("%f", "abc") == "abc"'); + '4833: strprintf("%f", "abc") == "abc"'); vrfy(strprintf("%e", "abc") == "abc", - '4832: strprintf("%e", "abc") == "abc"'); + '4834: strprintf("%e", "abc") == "abc"'); vrfy(strprintf("%5s", "abc") == " abc", - '4833: strprintf("%5s", "abc") == " abc"'); + '4835: strprintf("%5s", "abc") == " abc"'); vrfy(strprintf("%-5s", "abc") == "abc ", - '4834: strprintf("%-5s", "abc") == "abc "'); + '4836: strprintf("%-5s", "abc") == "abc "'); + vrfy(strprintf("%g", .385) == ".38", + '4837: strprintf("%g", .385) == ".38"'); + vrfy(strprintf("%g", 385) == "3.8e2", + '4838: strprintf("%g", 385) == "3.8e2"'); /* restore config */ c = config("all", callcfg); - print '4835: c = config("all", callcfg)'; + print '4839: c = config("all", callcfg)'; - print '4836: Ending test_strprintf'; + print '4840: Ending test_strprintf'; } print '088: parsed test_fileop()'; @@ -7932,8 +7944,8 @@ read -once "test8900"; print '8902: about to run test8900(1,,8903)'; testnum = test8900(1,,8903); -print '8999: ecnt = 203;' -ecnt = 203; +print '8999: ecnt = 211;' +ecnt = 211; /* 89xx: test calc resource functions by Christoph Zurnieden */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/calcerr.tbl new/calc-2.12.6.9/calcerr.tbl --- old/calc-2.12.6.8/calcerr.tbl 2017-06-02 23:50:17.000000000 +0200 +++ new/calc-2.12.6.9/calcerr.tbl 2018-09-30 22:31:49.000000000 +0200 @@ -451,6 +451,7 @@ E_FPATHOPEN2 Unrecognized mode for fpathopen E_LOG1 Bad epsilon argument for log E_LOG2 Non-numeric first argument for log +E_LOG3 Cannot calculate log for this value E_FGETFILE1 Non-file argument for fgetfile E_FGETFILE2 File argument for fgetfile not open for reading E_FGETFILE3 Unable to set file position in fgetfile @@ -471,3 +472,27 @@ E_ISXDIGIT Bad argument for isxdigit E_STRTOUPPER Bad argument type for strtoupper E_STRTOLOWER Bad argument type for strtolower +E_TAN3 Invalid value for calculating the sin numerator for tan +E_TAN4 Invalid value for calculating the cos denominator for tan +E_COT3 Invalid value for calculating the sin numerator for cot +E_COT4 Invalid value for calculating the cos denominator for cot +E_SEC3 Invalid value for calculating the cos reciprocal for sec +E_CSC3 Invalid value for calculating the sin reciprocal for csc +E_TANH3 Invalid value for calculating the sinh numerator for tanh +E_TANH4 Invalid value for calculating the cosh denominator for tanh +E_COTH3 Invalid value for calculating the sinh numerator for coth +E_COTH4 Invalid value for calculating the cosh denominator for coth +E_SECH3 Invalid value for calculating the cosh reciprocal for sech +E_CSCH3 Invalid value for calculating the sinh reciprocal for csch +E_ASIN3 Invalid value for calculating asin +E_ACOS3 Invalid value for calculating acos +E_ASINH3 Invalid value for calculating asinh +E_ACOSH3 Invalid value for calculating acosn +E_ATAN3 Invalid value for calculating atan +E_ACOT3 Invalid value for calculating acot +E_ASEC3 Invalid value for calculating asec +E_ACSC3 Invalid value for calculating acsc +E_ATANH3 Invalid value for calculating atan +E_ACOTH3 Invalid value for calculating acot +E_ASECH3 Invalid value for calculating asec +E_ACSCH3 Invalid value for calculating acsc diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/config.c new/calc-2.12.6.9/config.c --- old/calc-2.12.6.8/config.c 2017-06-02 23:50:17.000000000 +0200 +++ new/calc-2.12.6.9/config.c 2018-10-01 01:11:23.000000000 +0200 @@ -274,6 +274,7 @@ {"oct", MODE_OCTAL}, {"binary", MODE_BINARY}, {"bin", MODE_BINARY}, + {"float-auto", MODE_REAL_AUTO}, {"off", MODE2_OFF}, {NULL, 0} }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/custom/Makefile new/calc-2.12.6.9/custom/Makefile --- old/calc-2.12.6.8/custom/Makefile 2018-09-30 19:04:52.000000000 +0200 +++ new/calc-2.12.6.9/custom/Makefile 2018-10-16 04:39:43.000000000 +0200 @@ -348,7 +348,7 @@ # The default calc versions # -VERSION= 2.12.6.8 +VERSION= 2.12.6.9 # Names of shared libraries with versions # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/custom/Makefile.head new/calc-2.12.6.9/custom/Makefile.head --- old/calc-2.12.6.8/custom/Makefile.head 2018-09-30 18:22:51.000000000 +0200 +++ new/calc-2.12.6.9/custom/Makefile.head 2018-09-30 19:48:53.000000000 +0200 @@ -348,7 +348,7 @@ # The default calc versions # -VERSION= 2.12.6.8 +VERSION= 2.12.6.9 # Names of shared libraries with versions # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/custom/Makefile.simple new/calc-2.12.6.9/custom/Makefile.simple --- old/calc-2.12.6.8/custom/Makefile.simple 2018-09-30 19:05:37.000000000 +0200 +++ new/calc-2.12.6.9/custom/Makefile.simple 2018-10-16 04:40:28.000000000 +0200 @@ -333,7 +333,7 @@ # The default calc versions # -VERSION= 2.12.6.8 +VERSION= 2.12.6.9 # Names of shared libraries with versions # diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/file.c new/calc-2.12.6.9/file.c --- old/calc-2.12.6.8/file.c 2018-09-30 18:37:57.000000000 +0200 +++ new/calc-2.12.6.9/file.c 2018-10-01 01:11:23.000000000 +0200 @@ -1031,6 +1031,9 @@ case 'e': newmode = MODE_EXP; break; + case 'g': + newmode = MODE_REAL_AUTO; + break; case 'r': newmode = MODE_FRAC; break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/func.c new/calc-2.12.6.9/func.c --- old/calc-2.12.6.8/func.c 2018-09-30 18:32:46.000000000 +0200 +++ new/calc-2.12.6.9/func.c 2018-09-30 22:31:39.000000000 +0200 @@ -2122,6 +2122,9 @@ default: return error_value(E_LOG2); } + if (c == NULL) { + return error_value(E_LOG3); + } result.v_type = V_COM; result.v_com = c; if (cisreal(c)) { @@ -2239,8 +2242,15 @@ case V_COM: tmp1.v_type = V_COM; tmp1.v_com = c_sin(vals[0]->v_com, err); + if (tmp1.v_com == NULL) { + return error_value(E_TAN3); + } tmp2.v_type = V_COM; tmp2.v_com = c_cos(vals[0]->v_com, err); + if (tmp2.v_com == NULL) { + comfree(tmp1.v_com); + return error_value(E_TAN4); + } divvalue(&tmp1, &tmp2, &result); comfree(tmp1.v_com); comfree(tmp2.v_com); @@ -2276,6 +2286,9 @@ case V_COM: tmp.v_type = V_COM; tmp.v_com = c_cos(vals[0]->v_com, err); + if (tmp.v_com == NULL) { + return error_value(E_SEC3); + } invertvalue(&tmp, &result); comfree(tmp.v_com); break; @@ -2314,8 +2327,15 @@ case V_COM: tmp1.v_type = V_COM; tmp1.v_com = c_cos(vals[0]->v_com, err); + if (tmp1.v_com == NULL) { + return error_value(E_COT3); + } tmp2.v_type = V_COM; tmp2.v_com = c_sin(vals[0]->v_com, err); + if (tmp2.v_com == NULL) { + comfree(tmp1.v_com); + return error_value(E_COT4); + } divvalue(&tmp1, &tmp2, &result); comfree(tmp1.v_com); comfree(tmp2.v_com); @@ -2354,6 +2374,9 @@ case V_COM: tmp.v_type = V_COM; tmp.v_com = c_sin(vals[0]->v_com, err); + if (tmp.v_com == NULL) { + return error_value(E_CSC3); + } invertvalue(&tmp, &result); comfree(tmp.v_com); break; @@ -2476,8 +2499,15 @@ case V_COM: tmp1.v_type = V_COM; tmp1.v_com = c_sinh(vals[0]->v_com, err); + if (tmp1.v_com == NULL) { + return error_value(E_TANH3); + } tmp2.v_type = V_COM; tmp2.v_com = c_cosh(vals[0]->v_com, err); + if (tmp2.v_com == NULL) { + comfree(tmp1.v_com); + return error_value(E_TANH4); + } divvalue(&tmp1, &tmp2, &result); comfree(tmp1.v_com); comfree(tmp2.v_com); @@ -2517,8 +2547,15 @@ case V_COM: tmp1.v_type = V_COM; tmp1.v_com = c_cosh(vals[0]->v_com, err); + if (tmp1.v_com == NULL) { + return error_value(E_COTH3); + } tmp2.v_type = V_COM; tmp2.v_com = c_sinh(vals[0]->v_com, err); + if (tmp2.v_com == NULL) { + comfree(tmp1.v_com); + return error_value(E_COTH4); + } divvalue(&tmp1, &tmp2, &result); comfree(tmp1.v_com); comfree(tmp2.v_com); @@ -2555,6 +2592,9 @@ case V_COM: tmp.v_type = V_COM; tmp.v_com = c_cosh(vals[0]->v_com, err); + if (tmp.v_com == NULL) { + return error_value(E_SECH3); + } invertvalue(&tmp, &result); comfree(tmp.v_com); break; @@ -2592,6 +2632,9 @@ case V_COM: tmp.v_type = V_COM; tmp.v_com = c_sinh(vals[0]->v_com, err); + if (tmp.v_com == NULL) { + return error_value(E_CSCH3); + } invertvalue(&tmp, &result); comfree(tmp.v_com); break; @@ -2626,7 +2669,7 @@ case V_COM: tmp = c_atan(vals[0]->v_com, err); if (tmp == NULL) - return error_value(E_LOGINF); + return error_value(E_ATAN3); result.v_type = V_COM; result.v_com = tmp; if (cisreal(tmp)) { @@ -2666,7 +2709,7 @@ case V_COM: tmp = c_acot(vals[0]->v_com, err); if (tmp == NULL) - return error_value(E_LOGINF); + return error_value(E_ACOT3); result.v_type = V_COM; result.v_com = tmp; if (cisreal(tmp)) { @@ -2718,6 +2761,9 @@ default: return error_value(E_ASIN2); } + if (result.v_com == NULL) { + return error_value(E_ASIN3); + } if (result.v_type == V_COM && cisreal(result.v_com)) { q = qlink(result.v_com->real); comfree(result.v_com); @@ -2764,6 +2810,9 @@ default: return error_value(E_ACOS2); } + if (result.v_com == NULL) { + return error_value(E_ACOS3); + } if (result.v_type == V_COM && cisreal(result.v_com)) { q = qlink(result.v_com->real); comfree(result.v_com); @@ -2794,7 +2843,7 @@ switch (vals[0]->v_type) { case V_NUM: if (qiszero(vals[0]->v_num)) - return error_value(E_LOGINF); + return error_value(E_ASEC3); result.v_num = qasec(vals[0]->v_num, err); result.v_type = V_NUM; if (result.v_num == NULL) { @@ -2813,9 +2862,10 @@ default: return error_value(E_ASEC2); } + if (result.v_com == NULL) { + return error_value(E_ASEC3); + } if (result.v_type == V_COM) { - if (result.v_com == NULL) - return error_value(E_LOGINF); if (cisreal(result.v_com)) { q = qlink(result.v_com->real); comfree(result.v_com); @@ -2847,7 +2897,7 @@ switch (vals[0]->v_type) { case V_NUM: if (qiszero(vals[0]->v_num)) - return error_value(E_LOGINF); + return error_value(E_ACSC3); result.v_num = qacsc(vals[0]->v_num, err); result.v_type = V_NUM; if (result.v_num == NULL) { @@ -2866,9 +2916,10 @@ default: return error_value(E_ACSC2); } + if (result.v_com == NULL) { + return error_value(E_ACSC3); + } if (result.v_type == V_COM) { - if (result.v_com == NULL) - return error_value(E_LOGINF); if (cisreal(result.v_com)) { q = qlink(result.v_com->real); comfree(result.v_com); @@ -2903,6 +2954,9 @@ break; case V_COM: tmp = c_asinh(vals[0]->v_com, err); + if (tmp == NULL) { + return error_value(E_ASINH3); + } result.v_type = V_COM; result.v_com = tmp; if (cisreal(tmp)) { @@ -2955,6 +3009,9 @@ default: return error_value(E_ACOSH2); } + if (result.v_com == NULL) { + return error_value(E_ACOSH3); + } if (result.v_type == V_COM && cisreal(result.v_com)) { q = qlink(result.v_com->real); comfree(result.v_com); @@ -3002,9 +3059,10 @@ default: return error_value(E_ATANH2); } + if (result.v_com == NULL) { + return error_value(E_ATANH3); + } if (result.v_type == V_COM) { - if (result.v_com == NULL) - return error_value(E_LOGINF); if (cisreal(result.v_com)) { q = qlink(result.v_com->real); comfree(result.v_com); @@ -3053,9 +3111,10 @@ default: return error_value(E_ACOTH2); } + if (result.v_com == NULL) { + return error_value(E_ACOTH3); + } if (result.v_type == V_COM) { - if (result.v_com == NULL) - return error_value(E_LOGINF); if (cisreal(result.v_com)) { q = qlink(result.v_com->real); comfree(result.v_com); @@ -3087,7 +3146,7 @@ switch (vals[0]->v_type) { case V_NUM: if (qiszero(vals[0]->v_num)) - return error_value(E_LOGINF); + return error_value(E_ASECH3); result.v_num = qasech(vals[0]->v_num, err); result.v_type = V_NUM; if (result.v_num == NULL) { @@ -3106,9 +3165,10 @@ default: return error_value(E_ASECH2); } + if (result.v_com == NULL) { + return error_value(E_ASECH3); + } if (result.v_type == V_COM) { - if (result.v_com == NULL) - return error_value(E_LOGINF); if (cisreal(result.v_com)) { q = qlink(result.v_com->real); comfree(result.v_com); @@ -3140,7 +3200,7 @@ switch (vals[0]->v_type) { case V_NUM: if (qiszero(vals[0]->v_num)) - return error_value(E_LOGINF); + return error_value(E_ACSCH3); result.v_num = qacsch(vals[0]->v_num, err); result.v_type = V_NUM; if (result.v_num == NULL) { @@ -3159,9 +3219,10 @@ default: return error_value(E_ACSCH2); } + if (result.v_com == NULL) { + return error_value(E_ACSCH3); + } if (result.v_type == V_COM) { - if (result.v_com == NULL) - return error_value(E_LOGINF); if (cisreal(result.v_com)) { q = qlink(result.v_com->real); comfree(result.v_com); @@ -3260,7 +3321,7 @@ return error_value(E_AGD2); } if (result.v_com == NULL) - return error_value(E_AGD3); + return error_value(E_AGD3); if (cisreal(result.v_com)) { q = qlink(result.v_com->real); comfree(result.v_com); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/help/printf new/calc-2.12.6.9/help/printf --- old/calc-2.12.6.8/help/printf 2017-06-02 23:50:17.000000000 +0200 +++ new/calc-2.12.6.9/help/printf 2018-10-01 01:11:23.000000000 +0200 @@ -28,7 +28,7 @@ zero or more decimal digits an optional '. followed by zero or more decimal deigits an optional 'l' - one of the letters: d, s, c, f, e, r, o, x, b, + one of the letters: d, s, c, f, e, g, r, o, x, b, If any other character is read, the '%' and any characters between '%' and the character are ignored and no specifier is @@ -51,26 +51,27 @@ d, s, c current config("mode") f real (decimal, floating point) e exponential + g real or exponential depending on config("display") r fractional o octal x hexadecimal b binary - If the number of arguments after fmt is less than the - number of format specifiers in fmt, the "missing" arguments - may be taken to be null values - these contribute nothing to the - output; if a positive width w has been specified, the effect is - to produce w spaces, e.g. printf("abc%6dxyz") prints "abc xyz". - - If i <= the number of specifiers in fmt, the value of argument x_i - is printed in the format specified by the i-th specifier. - If a positive width w has been specified and normal printing of x_i - does not include a '\n' character, what is printed will if necessary - be padded with spaces so that the length of the printed output - is at least the w. Note that control - characters like '\t', '\b' each count as one character. If - the 'right-pad' flag has been set, the padding is on the right; - otherwise it is on the left. + If the number of arguments after fmt is less than the number + of format specifiers in fmt, the "missing" arguments may be + taken to be null values - these contribute nothing to the output; + if a positive width w has been specified, the effect is to + produce w spaces, e.g., printf("abc%6dxyz") prints "abc xyz". + + If i <= the number of specifiers in fmt, the value of argument + x_i is printed in the format specified by the i-th specifier. + If a positive width w has been specified and normal printing + of x_i does not include a '\n' character, what is printed will + if necessary be padded with spaces so that the length of the + printed output is at least the w. Note that control characters + like '\t', '\b' each count as one character. If the 'right-pad' + flag has been set, the padding is on the right; otherwise it + is on the left. If i > the number of specifiers in fmt, the value of argument x_i does not contribute to the printing. However, as all arguments @@ -84,9 +85,9 @@ mode. In the case of floating-point (f) format the precision determines - the maximum number of decimal places to be - displayed. Other aspects of this printing may be affected by the - configuration parameters "outround", "tilde", "fullzero", "leadzero". + the maximum number of decimal places to be displayed. Other + aspects of this printing may be affected by the configuration + parameters "outround", "tilde", "fullzero", "leadzero". EXAMPLE ; c = config("epsilon", 1e-6); c = config("display", 6); @@ -116,6 +117,11 @@ [2] = "undefined" [3] = NULL + ; c = config("display", 50); + ; printf("%g %g\n%g %g\n", 1e5, 1e49, 1e50, 1e500); + 100000 100000000000000000000000000000000000000000000000000 + 1e50 1e500 + LIMITS The number of arguments of printf() is not to exceed 1024. @@ -126,7 +132,7 @@ SEE ALSO fprintf, strprintf, print -## Copyright (C) 1999-2006 Landon Curt Noll +## Copyright (C) 1999-2006,2018 Landon Curt Noll ## ## Calc is open software; you can redistribute it and/or modify it under ## the terms of the version 2.1 of the GNU Lesser General Public License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/help/strprintf new/calc-2.12.6.9/help/strprintf --- old/calc-2.12.6.8/help/strprintf 2017-06-02 23:50:17.000000000 +0200 +++ new/calc-2.12.6.9/help/strprintf 2018-10-01 01:11:23.000000000 +0200 @@ -27,6 +27,13 @@ "1.732051, 1.732051,1.732051 , ~1.7320,~1.7320,~1. " + ; c = config("display", 50); + ; fmt2 = "%g %g\n%g %g\n" + ; strprintf(fmt2, 1e5, 1e49, 1e50, 1e500); + "100000 100000000000000000000000000000000000000000000000000 + 1e50 1e500 + " + LIMITS The number of arguments of strprintf() is not to exceed 1024. @@ -39,7 +46,7 @@ printf, fprintf, print -## Copyright (C) 1999-2006 Landon Curt Noll +## Copyright (C) 1999-2006,2018 Landon Curt Noll ## ## Calc is open software; you can redistribute it and/or modify it under ## the terms of the version 2.1 of the GNU Lesser General Public License diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/qio.c new/calc-2.12.6.9/qio.c --- old/calc-2.12.6.8/qio.c 2017-06-02 23:50:17.000000000 +0200 +++ new/calc-2.12.6.9/qio.c 2018-10-16 03:49:56.000000000 +0200 @@ -97,6 +97,15 @@ q = va_arg(ap, NUMBER *); qprintfe(q, width, precision); break; + case 'g': + q = va_arg(ap, NUMBER *); + /* XXX - we need a qprintfg function */ +#if 0 /* XXX - we need a qprintfg() function */ + qprintfg(q, width, precision); +#else /* XXX - use qprintfe until we have a qprintfg() function */ + qprintfe(q, width, precision); +#endif /* XXX - we need a qprintfg() function */ + break; case 'r': case 'R': q = va_arg(ap, NUMBER *); @@ -233,6 +242,33 @@ PRINTF1("e%ld", exp); break; + case MODE_REAL_AUTO: + { + /* + * XXX - re-write to not modify conf->outdigits + * + * Modifying the configuration value could be dangerious + * when a calculation is aborted within an opcode. + * Better to use qprintfg() use inline code that + * does not depend on changing conf->outdigits. + */ + const int P = conf->outdigits ? conf->outdigits : 1; + long olddigits; + tmpval = *q; + tmpval.num.sign = 0; + exp = qilog10(&tmpval); + olddigits = conf->outdigits; + if (P > exp && exp >= -P) { + conf->outdigits = P - 1 - exp; + qprintnum(q, MODE_REAL); + } else { + conf->outdigits = P - 1; + qprintnum(q, MODE_EXP); + } + conf->outdigits = olddigits; + break; + } + case MODE_HEX: qprintfx(q, 0L); break; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/version.c new/calc-2.12.6.9/version.c --- old/calc-2.12.6.8/version.c 2018-09-30 18:37:37.000000000 +0200 +++ new/calc-2.12.6.9/version.c 2018-09-30 19:46:41.000000000 +0200 @@ -45,7 +45,7 @@ #define MAJOR_VER 2 /* major library version */ #define MINOR_VER 12 /* minor library version */ #define MAJOR_PATCH 6 /* major software level under library version */ -#define MINOR_PATCH 8 /* minor software level or 0 if not patched */ +#define MINOR_PATCH 9 /* minor software level or 0 if not patched */ /* diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/win32/calcerr.c new/calc-2.12.6.9/win32/calcerr.c --- old/calc-2.12.6.8/win32/calcerr.c 2018-09-30 19:05:36.000000000 +0200 +++ new/calc-2.12.6.9/win32/calcerr.c 2018-10-16 04:40:27.000000000 +0200 @@ -427,6 +427,7 @@ "Unrecognized mode for fpathopen", "Bad epsilon argument for log", "Non-numeric first argument for log", + "Cannot calculate log for this value", "Non-file argument for fgetfile", "File argument for fgetfile not open for reading", "Unable to set file position in fgetfile", @@ -447,5 +448,29 @@ "Bad argument for isxdigit", "Bad argument type for strtoupper", "Bad argument type for strtolower", + "Invalid value for calculating the sin numerator for tan", + "Invalid value for calculating the cos denominator for tan", + "Invalid value for calculating the sin numerator for cot", + "Invalid value for calculating the cos denominator for cot", + "Invalid value for calculating the cos reciprocal for sec", + "Invalid value for calculating the sin reciprocal for csc", + "Invalid value for calculating the sinh numerator for tanh", + "Invalid value for calculating the cosh denominator for tanh", + "Invalid value for calculating the sinh numerator for coth", + "Invalid value for calculating the cosh denominator for coth", + "Invalid value for calculating the cosh reciprocal for sech", + "Invalid value for calculating the sinh reciprocal for csch", + "Invalid value for calculating asin", + "Invalid value for calculating acos", + "Invalid value for calculating asinh", + "Invalid value for calculating acosn", + "Invalid value for calculating atan", + "Invalid value for calculating acot", + "Invalid value for calculating asec", + "Invalid value for calculating acsc", + "Invalid value for calculating atan", + "Invalid value for calculating acot", + "Invalid value for calculating asec", + "Invalid value for calculating acsc", NULL }; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/win32/calcerr.h new/calc-2.12.6.9/win32/calcerr.h --- old/calc-2.12.6.8/win32/calcerr.h 2018-09-30 19:05:34.000000000 +0200 +++ new/calc-2.12.6.9/win32/calcerr.h 2018-10-16 04:40:25.000000000 +0200 @@ -424,29 +424,54 @@ #define E_FPATHOPEN2 10411 /* Unrecognized mode for fpathopen */ #define E_LOG1 10412 /* Bad epsilon argument for log */ #define E_LOG2 10413 /* Non-numeric first argument for log */ -#define E_FGETFILE1 10414 /* Non-file argument for fgetfile */ -#define E_FGETFILE2 10415 /* File argument for fgetfile not open for reading */ -#define E_FGETFILE3 10416 /* Unable to set file position in fgetfile */ -#define E_ESTR 10417 /* Non-representable type for estr */ -#define E_STRCASECMP 10418 /* Non-string argument for strcasecmp */ -#define E_STRNCASECMP 10419 /* Bad argument type for strncasecmp */ -#define E_ISUPPER 10420 /* Bad argument for isupper */ -#define E_ISLOWER 10421 /* Bad argument for islower */ -#define E_ISALNUM 10422 /* Bad argument for isalnum */ -#define E_ISALPHA 10423 /* Bad argument for isalpha */ -#define E_ISASCII 10424 /* Bad argument for isascii */ -#define E_ISCNTRL 10425 /* Bad argument for iscntrl */ -#define E_ISDIGIT 10426 /* Bad argument for isdigit */ -#define E_ISGRAPH 10427 /* Bad argument for isgraph */ -#define E_ISPRINT 10428 /* Bad argument for isprint */ -#define E_ISPUNCT 10429 /* Bad argument for ispunct */ -#define E_ISSPACE 10430 /* Bad argument for isspace */ -#define E_ISXDIGIT 10431 /* Bad argument for isxdigit */ -#define E_STRTOUPPER 10432 /* Bad argument type for strtoupper */ -#define E_STRTOLOWER 10433 /* Bad argument type for strtolower */ +#define E_LOG3 10414 /* Cannot calculate log for this value */ +#define E_FGETFILE1 10415 /* Non-file argument for fgetfile */ +#define E_FGETFILE2 10416 /* File argument for fgetfile not open for reading */ +#define E_FGETFILE3 10417 /* Unable to set file position in fgetfile */ +#define E_ESTR 10418 /* Non-representable type for estr */ +#define E_STRCASECMP 10419 /* Non-string argument for strcasecmp */ +#define E_STRNCASECMP 10420 /* Bad argument type for strncasecmp */ +#define E_ISUPPER 10421 /* Bad argument for isupper */ +#define E_ISLOWER 10422 /* Bad argument for islower */ +#define E_ISALNUM 10423 /* Bad argument for isalnum */ +#define E_ISALPHA 10424 /* Bad argument for isalpha */ +#define E_ISASCII 10425 /* Bad argument for isascii */ +#define E_ISCNTRL 10426 /* Bad argument for iscntrl */ +#define E_ISDIGIT 10427 /* Bad argument for isdigit */ +#define E_ISGRAPH 10428 /* Bad argument for isgraph */ +#define E_ISPRINT 10429 /* Bad argument for isprint */ +#define E_ISPUNCT 10430 /* Bad argument for ispunct */ +#define E_ISSPACE 10431 /* Bad argument for isspace */ +#define E_ISXDIGIT 10432 /* Bad argument for isxdigit */ +#define E_STRTOUPPER 10433 /* Bad argument type for strtoupper */ +#define E_STRTOLOWER 10434 /* Bad argument type for strtolower */ +#define E_TAN3 10435 /* Invalid value for calculating the sin numerator for tan */ +#define E_TAN4 10436 /* Invalid value for calculating the cos denominator for tan */ +#define E_COT3 10437 /* Invalid value for calculating the sin numerator for cot */ +#define E_COT4 10438 /* Invalid value for calculating the cos denominator for cot */ +#define E_SEC3 10439 /* Invalid value for calculating the cos reciprocal for sec */ +#define E_CSC3 10440 /* Invalid value for calculating the sin reciprocal for csc */ +#define E_TANH3 10441 /* Invalid value for calculating the sinh numerator for tanh */ +#define E_TANH4 10442 /* Invalid value for calculating the cosh denominator for tanh */ +#define E_COTH3 10443 /* Invalid value for calculating the sinh numerator for coth */ +#define E_COTH4 10444 /* Invalid value for calculating the cosh denominator for coth */ +#define E_SECH3 10445 /* Invalid value for calculating the cosh reciprocal for sech */ +#define E_CSCH3 10446 /* Invalid value for calculating the sinh reciprocal for csch */ +#define E_ASIN3 10447 /* Invalid value for calculating asin */ +#define E_ACOS3 10448 /* Invalid value for calculating acos */ +#define E_ASINH3 10449 /* Invalid value for calculating asinh */ +#define E_ACOSH3 10450 /* Invalid value for calculating acosn */ +#define E_ATAN3 10451 /* Invalid value for calculating atan */ +#define E_ACOT3 10452 /* Invalid value for calculating acot */ +#define E_ASEC3 10453 /* Invalid value for calculating asec */ +#define E_ACSC3 10454 /* Invalid value for calculating acsc */ +#define E_ATANH3 10455 /* Invalid value for calculating atan */ +#define E_ACOTH3 10456 /* Invalid value for calculating acot */ +#define E_ASECH3 10457 /* Invalid value for calculating asec */ +#define E_ACSCH3 10458 /* Invalid value for calculating acsc */ -#define E__HIGHEST 10433 /* highest calc error */ -#define E__COUNT 433 /* number of calc errors */ +#define E__HIGHEST 10458 /* highest calc error */ +#define E__COUNT 458 /* number of calc errors */ #define E_USERDEF 20000 /* base of user defined errors */ /* names of calc error values */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/calc-2.12.6.8/zmath.h new/calc-2.12.6.9/zmath.h --- old/calc-2.12.6.8/zmath.h 2017-06-02 23:50:17.000000000 +0200 +++ new/calc-2.12.6.9/zmath.h 2018-10-01 01:11:23.000000000 +0200 @@ -579,10 +579,16 @@ #define MODE_HEX 5 #define MODE_OCTAL 6 #define MODE_BINARY 7 -#define MODE_MAX 7 +#define MODE_REAL_AUTO 8 +#define MODE_MAX 8 #define MODE2_OFF (MODE_MAX+1) +/* XXX - perhaps we need the MODE_REAL_AUTO vs MODE_REAL as a config mode? */ +#if 0 /* XXX - can we safely set MODE_INITIAL to MODE_REAL_AUTO ?? */ +#define MODE_INITIAL MODE_REAL_AUTO +#else #define MODE_INITIAL MODE_REAL +#endif #define MODE2_INITIAL MODE2_OFF ++++++ checksum.sha-256 ++++++ --- /var/tmp/diff_new_pack.lW4nEq/_old 2018-10-18 15:39:44.498064807 +0200 +++ /var/tmp/diff_new_pack.lW4nEq/_new 2018-10-18 15:39:44.498064807 +0200 @@ -31,6 +31,9 @@ 24b38ea23898bfcee6309d525aa09559d5d82aa93f26a6a5514669956142f953 calc-2.12.6.8-12.src.rpm 21662525a435df165ffc499206ffbeb54f1ccd36ffc69eba7261fda57bc0771c calc-2.12.6.8-12.x86_64.rpm 0b92d5c72d26759c2a65bf85de0c111fa9653d9e2756578639100e952fa88a90 calc-2.12.6.8.tar.bz2 +314b5eaf2edddd675860d3ff287e9b9256ae92cc99083d92a005a0ca11092d95 calc-2.12.6.9-12.src.rpm +28d0bdded7c61d9dea5592eaef459c76f49555f083b6b887754fbea507711a26 calc-2.12.6.9-12.x86_64.rpm +6ac100f9ccec40e20838023113ed86c3a0f10037e37b8168bbf85bc11d675313 calc-2.12.6.9.tar.bz2 befb1ef348704f0c4c0a5ebf55b57acf6fa75119e3c8c267379814980ae70e83 calc-debuginfo-2.12.5.6-12.x86_64.rpm 83c7f2728496692f19bab7c957ba9867ed436f5048d595883831b7fdf9db0d31 calc-debuginfo-2.12.6.0-12.x86_64.rpm e9aac5102f90ec81f8a3ec0d476d6cd89dc44f43823cff4f9415b10e076e8791 calc-debuginfo-2.12.6.1-12.x86_64.rpm @@ -40,6 +43,7 @@ 41a261ba48b8e1185cbceff6613fecfa5dde78bf2f92d8ffc7c85a4ffa0f6457 calc-debuginfo-2.12.6.6-12.x86_64.rpm 538c14d02ae94243ee678a93d92893df39d11ad317c28573d9a9710388b10e81 calc-debuginfo-2.12.6.7-12.x86_64.rpm 92e1c4d2426a3ec74abccd27b0745c1c73b452878250c5ff8868923ef5d06ce8 calc-debuginfo-2.12.6.8-12.x86_64.rpm +924b04b852a300b57fcda68271c58745d576ab3f4207e581c92b8037627518a7 calc-debuginfo-2.12.6.9-12.x86_64.rpm 91949fd27a789eab99817d93d1e4f12424948bb4910f0a23755cab5fed2fb658 calc-devel-2.12.5.6-12.x86_64.rpm e79286c4b40913bdac87759dc5bf50b616af68c6fbda3c53c7703d66e311b9fa calc-devel-2.12.6.0-12.x86_64.rpm 97f16cf48b519285f6c8d10f64e56ac5aa4a50f7bfed82b57d2f711482c30930 calc-devel-2.12.6.1-12.x86_64.rpm @@ -49,3 +53,4 @@ 00ba5e70442ca62e3768ebb7b4cc22216c1c99c63f99b36faccf6aaafc751d50 calc-devel-2.12.6.6-12.x86_64.rpm 40f9a9bebcc71978579b1d5d8f75a8282e41fadbc43ede097f86ec51b6bb619a calc-devel-2.12.6.7-12.x86_64.rpm bfa025a42ecaf9345b49f7f8059179ea0abc40091d2fde7d2090de877f86e18d calc-devel-2.12.6.8-12.x86_64.rpm +a27915ff307df638eedb796ba7f121da2e2ed9eb6f7fc2288128eb611951ae5a calc-devel-2.12.6.9-12.x86_64.rpm