mirror of
https://github.com/lcn2/calc.git
synced 2025-08-16 01:03:29 +03:00
add help in advance for new log2 and logn builtins
NOTE: The `log2(x [,eps])` and `logn(x, n [,eps])` builtin functions are NOT yet implemented.
This commit is contained in:
@@ -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 \
|
islist islower ismat ismult isnull isnum isobj isobjtype isodd isprime \
|
||||||
isprint isptr ispunct isqrt isrand israndom isreal isrel issimple \
|
isprint isptr ispunct isqrt isrand israndom isreal isrel issimple \
|
||||||
isspace issq isstr istype isupper isxdigit jacobi join lcm lcmfact \
|
isspace issq isstr istype isupper isxdigit jacobi join lcm lcmfact \
|
||||||
lfactor ln log lowbit ltol makelist matdim matfill matmax matmin \
|
lfactor ln log log2 logn lowbit ltol makelist matdim matfill matmax \
|
||||||
matsum mattrace mattrans max memsize meq min minv mmin mne mod modify \
|
matmin matsum mattrace mattrans max memsize meq min minv mmin mne mod \
|
||||||
name near newerror nextcand nextprime norm null num oldvalue ord param \
|
modify name near newerror nextcand nextprime norm null num oldvalue \
|
||||||
perm pfact pi pix places pmod polar poly pop popcnt pound power \
|
ord param perm pfact pi pix places pmod polar poly pop popcnt pound \
|
||||||
prevcand prevprime printf prompt protect ptest push putenv quo quomod \
|
power prevcand prevprime printf prompt protect ptest push putenv quo \
|
||||||
r2d r2g rand randbit random randombit randperm rcin rcmul rcout rcpow \
|
quomod r2d r2g rand randbit random randombit randperm rcin rcmul rcout \
|
||||||
rcsq re remove reverse rewind rm root round rsearch runtime saveval \
|
rcpow rcsq re remove reverse rewind rm root round rsearch runtime \
|
||||||
scale scan scanf search sec sech seed segment select sgn sha1 sin sinh \
|
saveval scale scan scanf search sec sech seed segment select sgn sha1 \
|
||||||
size sizeof sleep sort sqrt srand srandom ssq stoponerror str \
|
sin sinh size sizeof sleep sort sqrt srand srandom ssq stoponerror str \
|
||||||
strcasecmp strcat strcmp strcpy strerror strlen strncasecmp strncmp \
|
strcasecmp strcat strcmp strcpy strerror strlen strncasecmp strncmp \
|
||||||
strncpy strpos strprintf strscan strscanf strtolower strtoupper substr \
|
strncpy strpos strprintf strscan strscanf strtolower strtoupper substr \
|
||||||
sum swap system systime tail tan tanh test time trunc usertime version \
|
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
|
# This list is of files that are clones of DETAIL_HELP files. They are
|
||||||
# built from DETAIL_HELP files.
|
# built from DETAIL_HELP files.
|
||||||
#
|
#
|
||||||
DETAIL_CLONE= copy
|
DETAIL_CLONE= copy ilogn
|
||||||
|
|
||||||
# Singular files
|
# Singular files
|
||||||
#
|
#
|
||||||
@@ -501,6 +501,18 @@ releases: ../README.RELEASE
|
|||||||
${TRUE}; \
|
${TRUE}; \
|
||||||
fi
|
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}
|
full: ${FULL_HELP_FILES} ${MAKE_FILE}
|
||||||
${Q} echo "forming full"
|
${Q} echo "forming full"
|
||||||
${Q} ${RM} -f $@
|
${Q} ${RM} -f $@
|
||||||
|
11
help/ilog
11
help/ilog
@@ -1,8 +1,10 @@
|
|||||||
NAME
|
NAME
|
||||||
ilog - floor of logarithm to specified integer base
|
ilog - floor of logarithm to specified integer base
|
||||||
|
ilogn - floor of logarithm to specified integer base
|
||||||
|
|
||||||
SYNOPSIS
|
SYNOPSIS
|
||||||
ilog(x, b)
|
ilog(x, b)
|
||||||
|
ilogn(x, b)
|
||||||
|
|
||||||
TYPES
|
TYPES
|
||||||
x nonzero real
|
x nonzero real
|
||||||
@@ -13,10 +15,15 @@ TYPES
|
|||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Returns the greatest integer n for which b^n <= abs(x).
|
Returns the greatest integer n for which b^n <= abs(x).
|
||||||
|
|
||||||
|
The ilogn function is an alias for ilog.
|
||||||
|
|
||||||
EXAMPLE
|
EXAMPLE
|
||||||
; print ilog(2, 3), ilog(8, 3), ilog(8.9, 3), ilog(1/8, 3)
|
; print ilog(2, 3), ilog(8, 3), ilog(8.9, 3), ilog(1/8, 3)
|
||||||
0 1 1 -2
|
0 1 1 -2
|
||||||
|
|
||||||
|
; print ilogn(2, 3), ilogn(8, 3), ilogn(8.9, 3), ilogn(1/8, 3)
|
||||||
|
0 1 1 -2
|
||||||
|
|
||||||
LIMITS
|
LIMITS
|
||||||
x > 0
|
x > 0
|
||||||
b > 1
|
b > 1
|
||||||
@@ -25,9 +32,9 @@ LINK LIBRARY
|
|||||||
long zlog(ZVALUE x, ZVALUE b)
|
long zlog(ZVALUE x, ZVALUE b)
|
||||||
|
|
||||||
SEE ALSO
|
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
|
## 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
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
@@ -23,9 +23,9 @@ LINK LIBRARY
|
|||||||
long qilog10(NUMBER *q)
|
long qilog10(NUMBER *q)
|
||||||
|
|
||||||
SEE ALSO
|
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
|
## 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
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
@@ -23,9 +23,9 @@ LINK LIBRARY
|
|||||||
long qilog2(NUMBER *q)
|
long qilog2(NUMBER *q)
|
||||||
|
|
||||||
SEE ALSO
|
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
|
## 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
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
4
help/ln
4
help/ln
@@ -32,9 +32,9 @@ LINK LIBRARY
|
|||||||
COMPLEX *c_ln(COMPLEX *x, NUMBER *eps)
|
COMPLEX *c_ln(COMPLEX *x, NUMBER *eps)
|
||||||
|
|
||||||
SEE ALSO
|
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
|
## 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
|
## the terms of the version 2.1 of the GNU Lesser General Public License
|
||||||
|
7
help/log
7
help/log
@@ -13,8 +13,9 @@ TYPES
|
|||||||
DESCRIPTION
|
DESCRIPTION
|
||||||
Approximate the base 10 logarithm function of x by a multiple of
|
Approximate the base 10 logarithm function of x by a multiple of
|
||||||
epsilon, the error having absolute value less than 0.75 * eps.
|
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
|
EXAMPLE
|
||||||
; print log(10), log(100), log(1e10), log(1e500)
|
; print log(10), log(100), log(1e10), log(1e500)
|
||||||
@@ -35,7 +36,7 @@ LINK LIBRARY
|
|||||||
COMPLEX *c_log(COMPLEX *x, NUMBER *eps)
|
COMPLEX *c_log(COMPLEX *x, NUMBER *eps)
|
||||||
|
|
||||||
SEE ALSO
|
SEE ALSO
|
||||||
ln
|
ilog, ilogn, ilog10, ilog2, ln, log2, logn
|
||||||
|
|
||||||
## Copyright (C) 2006 Landon Curt Noll
|
## Copyright (C) 2006 Landon Curt Noll
|
||||||
##
|
##
|
||||||
|
64
help/log2
Normal file
64
help/log2
Normal file
@@ -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 <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||||
|
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
68
help/logn
Normal file
68
help/logn
Normal file
@@ -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 <was here> /\oo/\ http://www.isthe.com/chongo/
|
||||||
|
## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/
|
Reference in New Issue
Block a user