diff --git a/help/Makefile b/help/Makefile index e94c21c..d65fc89 100644 --- a/help/Makefile +++ b/help/Makefile @@ -217,15 +217,15 @@ DETAIL_HELP= abs access acos acosh acot acoth acsc acsch address agd \ islist islower ismat ismult isnull isnum isobj isobjtype isodd isprime \ isprint isptr ispunct isqrt isrand israndom isreal isrel issimple \ isspace issq isstr istype isupper isxdigit jacobi join lcm lcmfact \ - lfactor ln log lowbit ltol makelist matdim matfill matmax matmin \ - matsum mattrace mattrans max memsize meq min minv mmin mne mod modify \ - name near newerror nextcand nextprime norm null num oldvalue ord param \ - perm pfact pi pix places pmod polar poly pop popcnt pound power \ - prevcand prevprime printf prompt protect ptest push putenv quo quomod \ - r2d r2g rand randbit random randombit randperm rcin rcmul rcout rcpow \ - rcsq re remove reverse rewind rm root round rsearch runtime saveval \ - scale scan scanf search sec sech seed segment select sgn sha1 sin sinh \ - size sizeof sleep sort sqrt srand srandom ssq stoponerror str \ + lfactor ln log log2 logn lowbit ltol makelist matdim matfill matmax \ + matmin matsum mattrace mattrans max memsize meq min minv mmin mne mod \ + modify name near newerror nextcand nextprime norm null num oldvalue \ + ord param perm pfact pi pix places pmod polar poly pop popcnt pound \ + power prevcand prevprime printf prompt protect ptest push putenv quo \ + quomod r2d r2g rand randbit random randombit randperm rcin rcmul rcout \ + rcpow rcsq re remove reverse rewind rm root round rsearch runtime \ + saveval scale scan scanf search sec sech seed segment select sgn sha1 \ + sin sinh size sizeof sleep sort sqrt srand srandom ssq stoponerror str \ strcasecmp strcat strcmp strcpy strerror strlen strncasecmp strncmp \ strncpy strpos strprintf strscan strscanf strtolower strtoupper substr \ sum swap system systime tail tan tanh test time trunc usertime version \ @@ -234,7 +234,7 @@ DETAIL_HELP= abs access acos acosh acot acoth acsc acsch address agd \ # This list is of files that are clones of DETAIL_HELP files. They are # built from DETAIL_HELP files. # -DETAIL_CLONE= copy +DETAIL_CLONE= copy ilogn # Singular files # @@ -501,6 +501,18 @@ releases: ../README.RELEASE ${TRUE}; \ fi +ilogn: ilog + ${RM} -f $@ + ${CP} ilog $@ + ${CHMOD} 0444 $@ + -@if [ -z "${Q}" ]; then \ + echo ''; \ + echo '=-=-= skipping the ${CAT} of help/$@ =-=-='; \ + echo ''; \ + else \ + ${TRUE}; \ + fi + full: ${FULL_HELP_FILES} ${MAKE_FILE} ${Q} echo "forming full" ${Q} ${RM} -f $@ diff --git a/help/ilog b/help/ilog index 121c33b..a559543 100644 --- a/help/ilog +++ b/help/ilog @@ -1,8 +1,10 @@ NAME ilog - floor of logarithm to specified integer base + ilogn - floor of logarithm to specified integer base SYNOPSIS ilog(x, b) + ilogn(x, b) TYPES x nonzero real @@ -13,10 +15,15 @@ TYPES DESCRIPTION Returns the greatest integer n for which b^n <= abs(x). + The ilogn function is an alias for ilog. + EXAMPLE ; print ilog(2, 3), ilog(8, 3), ilog(8.9, 3), ilog(1/8, 3) 0 1 1 -2 + ; print ilogn(2, 3), ilogn(8, 3), ilogn(8.9, 3), ilogn(1/8, 3) + 0 1 1 -2 + LIMITS x > 0 b > 1 @@ -25,9 +32,9 @@ LINK LIBRARY long zlog(ZVALUE x, ZVALUE b) SEE ALSO - ilog2, ilog10 + ilog10, ilog2, ln, log, log2, logn -## Copyright (C) 1999 Landon Curt Noll +## Copyright (C) 1999,2023 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 --git a/help/ilog10 b/help/ilog10 index 8fd8734..f309e21 100644 --- a/help/ilog10 +++ b/help/ilog10 @@ -23,9 +23,9 @@ LINK LIBRARY long qilog10(NUMBER *q) SEE ALSO - ilog2, ilog + ilog, ilogn, ilog2, ln, log, log2, logn -## Copyright (C) 1999 Landon Curt Noll +## Copyright (C) 1999,2023 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 --git a/help/ilog2 b/help/ilog2 index f66f542..7d0b353 100644 --- a/help/ilog2 +++ b/help/ilog2 @@ -23,9 +23,9 @@ LINK LIBRARY long qilog2(NUMBER *q) SEE ALSO - ilog10, ilog + ilog, ilogn, ilog10, ln, log, log2, logn -## Copyright (C) 1999 Landon Curt Noll +## Copyright (C) 1999,2023 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 --git a/help/ln b/help/ln index 6403945..58d1597 100644 --- a/help/ln +++ b/help/ln @@ -32,9 +32,9 @@ LINK LIBRARY COMPLEX *c_ln(COMPLEX *x, NUMBER *eps) SEE ALSO - exp, acosh, asinh, atanh, log + acosh, asinh, atanh, exp, ilog, ilogn, ilog10, ilog2, log, log2, logn -## Copyright (C) 1999,2021 Landon Curt Noll +## Copyright (C) 1999,2021,2023 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 --git a/help/log b/help/log index 4784f8e..90ceafb 100644 --- a/help/log +++ b/help/log @@ -13,8 +13,9 @@ TYPES DESCRIPTION Approximate the base 10 logarithm function of x by a multiple of epsilon, the error having absolute value less than 0.75 * eps. - If n is a positive integer, log(x, 10^-n) will usually be correct - to the n-th decimal place. + + If y is a positive integer, log(x, 10^-y) will usually be correct + to the y-th decimal place. EXAMPLE ; print log(10), log(100), log(1e10), log(1e500) @@ -35,7 +36,7 @@ LINK LIBRARY COMPLEX *c_log(COMPLEX *x, NUMBER *eps) SEE ALSO - ln + ilog, ilogn, ilog10, ilog2, ln, log2, logn ## Copyright (C) 2006 Landon Curt Noll ## diff --git a/help/log2 b/help/log2 new file mode 100644 index 0000000..bea103e --- /dev/null +++ b/help/log2 @@ -0,0 +1,64 @@ +NAME + log2 - base 10 logarithm + +SYNOPSIS + log2(x [,eps]) + +TYPES + x nonzero real or complex + eps nonzero real, defaults to epsilon() + + return real or complex + +DESCRIPTION + Approximate the base 2 logarithm function of x by a multiple of + epsilon, the error having absolute value less than 0.75 * eps. + + If y is a positive integer, log(x, 2^-y) will usually be correct + to the y-th decimal place. + + When x if a power of 2, log2(x) will return an integer regardless + of the value of eps or epsilon(). + +EXAMPLE + ; print log2(2), log2(4), log2(1024), log2(2^500) + 1 2 10 500 + + ; print log(127), log(23209), log(2^17-19) + ~ 6.98868468677216585326 ~ 14.50239674255407864468 ~ 16.99979085393743521984 + + ; print log(2+3i, 1e-5) + ~ 1.85020558320709803073 + ~ 1.41786049195700786266i + +LIMITS + x != 0 + eps > 0 + +LINK LIBRARY + NUMBER *qlog2(NUMBER *x, NUMBER *eps) + COMPLEX *c_log2(COMPLEX *x, NUMBER *eps) + +SEE ALSO + ilog, ilogn, ilog10, ilog2, ln, log, logn + +## Copyright (C) 2023 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 +## as published by the Free Software Foundation. +## +## Calc is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General +## Public License for more details. +## +## A copy of version 2.1 of the GNU Lesser General Public License is +## distributed with calc under the filename COPYING-LGPL. You should have +## received a copy with calc; if not, write to Free Software Foundation, Inc. +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +## +## Under source code control: 2023/08/19 09:14:04 +## File existed as early as: 2023 +## +## chongo /\oo/\ http://www.isthe.com/chongo/ +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ diff --git a/help/logn b/help/logn new file mode 100644 index 0000000..5e4a5a7 --- /dev/null +++ b/help/logn @@ -0,0 +1,68 @@ +NAME + logn - base n logarithm + +SYNOPSIS + logn(x, n [,eps]) + +TYPES + x nonzero real or complex + n nonzero real or complex + eps nonzero real, defaults to epsilon() + + return real or complex + +DESCRIPTION + Approximate the base n logarithm function of x by a multiple of + epsilon, the error having absolute value less than 0.75 * eps. + + The base, n, must not be 0 nor 1. + + If y is a positive integer, log(x, n^-y) will usually be correct + to the y-th decimal place. + +EXAMPLE + ; print logn(15.625, 2.5), logn(15.625, 2.5, 1e-25) + ~ 3.00000000000000000001 3 + + ; print logn(127, 1/13), log(23209, sqrt(3)), logn(2^17-19, 17) + ~ -1.88860925162778125111 6 ~ 4.15900804831225415076 + + ; print logn(-1, 1i), logn(2+3i, 3i+2), logn(2+3i, 3i) + 2 1 ~ 0.80360095345990217753 - ~ 0.25441159318835790311i + + ; print logn(22+3i, 3i, 1e-50) + ~ 0.98489914201047045408 - ~ 1.28484657882287682702i + +LIMITS + x != 0 + n != 0 && n != 1 + eps > 0 + +LINK LIBRARY + NUMBER *qlogn(NUMBER *x, NUMBER *n, NUMBER *eps) + COMPLEX *c_logn(COMPLEX *x, COMPLEX *n, NUMBER *eps) + +SEE ALSO + ilog, ilogn, ilog10, ilog2, ln, log, log2 + +## Copyright (C) 2023 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 +## as published by the Free Software Foundation. +## +## Calc is distributed in the hope that it will be useful, but WITHOUT +## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY +## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General +## Public License for more details. +## +## A copy of version 2.1 of the GNU Lesser General Public License is +## distributed with calc under the filename COPYING-LGPL. You should have +## received a copy with calc; if not, write to Free Software Foundation, Inc. +## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +## +## Under source code control: 2023/08/19 09:14:04 +## File existed as early as: 2023 +## +## chongo /\oo/\ http://www.isthe.com/chongo/ +## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/