├── .github ├── ISSUE_TEMPLATE │ ├── calc-bug-report.md │ └── feature_request.md ├── dependabot.yml └── workflows │ └── codeql-analysis.yml ├── .gitignore ├── .lldbinit ├── BUGS ├── CHANGES ├── CODE_OF_CONDUCT.md ├── CONTRIB-CODE ├── CONTRIBUTING.md ├── COPYING ├── COPYING-LGPL ├── HOWTO.INSTALL ├── LIBRARY ├── Makefile ├── Makefile.config ├── Makefile.local ├── Makefile.target ├── QUESTIONS ├── README.FIRST ├── README.RELEASE ├── README.WINDOWS ├── README.md ├── SECURITY.md ├── addop.c ├── align32.c ├── alloc.h ├── assocfunc.c ├── attribute.h ├── banned.h ├── blkcpy.c ├── blkcpy.h ├── block.c ├── block.h ├── bool.h ├── byteswap.c ├── byteswap.h ├── cal ├── Makefile ├── README ├── alg_config.cal ├── beer.cal ├── bernoulli.cal ├── bernpoly.cal ├── bigprime.cal ├── bindings ├── brentsolve.cal ├── chi.cal ├── chrem.cal ├── comma.cal ├── constants.cal ├── deg.cal ├── dms.cal ├── dotest.cal ├── ellip.cal ├── factorial.cal ├── factorial2.cal ├── fnv_tool.cal ├── gvec.cal ├── hello.cal ├── hms.cal ├── infinities.cal ├── intfile.cal ├── intnum.cal ├── lambertw.cal ├── linear.cal ├── lnseries.cal ├── lucas.cal ├── lucas_chk.cal ├── mersenne.cal ├── mfactor.cal ├── mod.cal ├── natnumset.cal ├── palindrome.cal ├── pell.cal ├── pi.cal ├── pix.cal ├── pollard.cal ├── poly.cal ├── prompt.cal ├── psqrt.cal ├── qtime.cal ├── quat.cal ├── randbitrun.cal ├── randmprime.cal ├── randombitrun.cal ├── randomrun.cal ├── randrun.cal ├── regress.cal ├── repeat.cal ├── screen.cal ├── seedrandom.cal ├── set8700.line ├── smallfactors.cal ├── solve.cal ├── specialfunctions.cal ├── splitbits.cal ├── statistics.cal ├── strings.cal ├── sumsq.cal ├── sumtimes.cal ├── surd.cal ├── test2300.obj_incdec.cal ├── test2600.numfunc.cal ├── test2700.isqrt.cal ├── test3100.matobj.cal ├── test3300.det.cal ├── test3400.trig.cal ├── test4000.ptest.cal ├── test4100.redc.cal ├── test4600.fileop.cal ├── test5100.newdecl.cal ├── test5200.globstat.cal ├── test8000.read.cal ├── test8400.quit.cal ├── test8500.divmod.cal ├── test8600.maxargs.cal ├── test8700.dotest.cal ├── test8900.special.cal ├── test9300.frem.cal ├── test9500.trigeq.cal ├── toomcook.cal ├── unitfrac.cal ├── varargs.cal ├── write2file.cal ├── xx_print.cal └── zeta2.cal ├── calc.c ├── calc.h ├── calc.man ├── calc.spec.in ├── charbit.c ├── check.awk ├── chk_c.c ├── chk_tree ├── cmath.h ├── codegen.c ├── comfunc.c ├── commath.c ├── config.c ├── config.h ├── const.c ├── cscript ├── 4dsphere.calc ├── Makefile ├── README.src ├── fproduct.calc ├── mersenne.calc ├── piforever.calc ├── plus.calc ├── powerterm.calc ├── simple.calc └── square.calc ├── custom.c ├── custom.h ├── custom ├── CUSTOM_CAL ├── HOW_TO_ADD ├── Makefile ├── argv ├── argv.cal ├── c_argv.c ├── c_devnull.c ├── c_help.c ├── c_pmodm127.c ├── c_pzasusb8.c ├── c_register.c ├── c_sysinfo.c ├── custtbl.c ├── devnull ├── halflen.cal ├── help ├── pmodm127 ├── pmodm127.cal ├── pzasusb8 ├── pzasusb8.cal ├── register ├── register.cal └── sysinfo ├── decl.h ├── endian.c ├── errtbl.c ├── errtbl.h ├── file.c ├── file.h ├── fposval.c ├── fposval.h.def ├── func.c ├── func.h ├── hash.c ├── hash.h ├── have_arc4random.c ├── have_ban_pragma.c ├── have_const.c ├── have_environ.c ├── have_fgetsetpos.c ├── have_fpos_pos.c ├── have_getpgid.c ├── have_getprid.c ├── have_getsid.c ├── have_gettime.c ├── have_memmv.c ├── have_newstr.c ├── have_offscl.c ├── have_posscl.c ├── have_rusage.c ├── have_statfs.c ├── have_stdvs.c ├── have_strdup.c ├── have_strlcat.c ├── have_strlcpy.c ├── have_uid_t.c ├── have_unused.c ├── have_ustat.c ├── have_varvs.c ├── help.c ├── help ├── Makefile ├── abs ├── access ├── acos ├── acosh ├── acot ├── acoth ├── acovercos ├── acoversin ├── acrd ├── acsc ├── acsch ├── address ├── aexcsc ├── aexsec ├── agd ├── ahacovercos ├── ahacoversin ├── ahavercos ├── ahaversin ├── append ├── appr ├── archive ├── arg ├── argv ├── arrow ├── asec ├── asech ├── asin ├── asinh ├── assign ├── assoc ├── atan ├── atan2 ├── atanh ├── avercos ├── aversin ├── avg ├── base ├── base2 ├── bernoulli ├── bit ├── blk ├── blkcpy ├── blkfree ├── blocks ├── bround ├── btrunc ├── builtin.end ├── builtin.top ├── calc_tty ├── calclevel ├── calcpath ├── cas ├── catalan ├── ceil ├── cfappr ├── cfsim ├── char ├── cis ├── cmdbuf ├── cmp ├── comb ├── command ├── config ├── conj ├── cos ├── cosh ├── cot ├── coth ├── count ├── covercos ├── coversin ├── cp ├── crd ├── credit ├── csc ├── csch ├── ctime ├── custom ├── d2dm ├── d2dms ├── d2g ├── d2r ├── define ├── delete ├── den ├── dereference ├── det ├── digit ├── digits ├── display ├── dms2d ├── dp ├── environment ├── epsilon ├── errcount ├── errmax ├── errno ├── error ├── errsym ├── estr ├── euler ├── eval ├── excsc ├── exp ├── expression ├── exsec ├── fact ├── factor ├── fclose ├── fcnt ├── feof ├── ferror ├── fflush ├── fgetc ├── fgetfield ├── fgetfile ├── fgetline ├── fgets ├── fgetstr ├── fib ├── file ├── files ├── floor ├── fopen ├── forall ├── fpathopen ├── fprintf ├── fputc ├── fputs ├── fputstr ├── frac ├── free ├── freebernoulli ├── freeeuler ├── freeglobals ├── freeredc ├── freestatics ├── frem ├── freopen ├── fscan ├── fscanf ├── fseek ├── fsize ├── ftell ├── funclist.sed ├── g2d ├── g2gm ├── g2gms ├── g2r ├── gcd ├── gcdrem ├── gd ├── getenv ├── gms2g ├── h2hm ├── h2hms ├── hacovercos ├── hacoversin ├── hash ├── havercos ├── haversin ├── head ├── help ├── highbit ├── history ├── hmean ├── hms2h ├── hnrmod ├── hypot ├── ilog ├── ilog10 ├── ilog2 ├── im ├── indices ├── inputlevel ├── insert ├── int ├── interrupt ├── intro ├── inverse ├── iroot ├── isalnum ├── isalpha ├── isassoc ├── isatty ├── isblk ├── iscntrl ├── isconfig ├── isdefined ├── isdigit ├── iserror ├── iseven ├── isfile ├── isgraph ├── ishash ├── isident ├── isint ├── 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 ├── list ├── ln ├── log ├── log2 ├── logn ├── lowbit ├── ltol ├── makelist ├── mat ├── matdim ├── matfill ├── matmax ├── matmin ├── matsum ├── mattrace ├── mattrans ├── max ├── memsize ├── meq ├── min ├── minv ├── mmin ├── mne ├── mod ├── modify ├── name ├── near ├── newerror ├── nextcand ├── nextprime ├── norm ├── null ├── num ├── obj.file ├── oldvalue ├── operator ├── ord ├── overview ├── 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 ├── script ├── search ├── sec ├── sech ├── seed ├── segment ├── select ├── sgn ├── sha1 ├── sin ├── sinh ├── size ├── sizeof ├── sleep ├── sort ├── sqrt ├── srand ├── srandom ├── ssq ├── statement ├── 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 ├── todo ├── trunc ├── types ├── unexpected ├── usertime ├── variable ├── vercos ├── versin ├── version ├── wishlist └── xor ├── hist.c ├── hist.h ├── input.c ├── int.h ├── jump.c ├── jump.h ├── label.c ├── label.h ├── lib_calc.c ├── lib_calc.h ├── lib_util.c ├── lib_util.h ├── listfunc.c ├── longbits.c ├── matfunc.c ├── math_error.c ├── nametype.h ├── obj.c ├── opcodes.c ├── opcodes.h ├── pix.c ├── poly.c ├── prime.c ├── prime.h ├── qfunc.c ├── qio.c ├── qmath.c ├── qmath.h ├── qmod.c ├── qtrans.c ├── quickhash.c ├── rpm.mk ├── sample.README ├── sample_many.c ├── sample_rand.c ├── seed.c ├── sha1.c ├── sha1.h ├── size.c ├── str.c ├── str.h ├── strl.c ├── strl.h ├── symbol.c ├── symbol.h ├── token.c ├── token.h ├── trailblank ├── update_ver ├── value.c ├── value.h ├── version.c ├── version.h ├── zfunc.c ├── zio.c ├── zmath.c ├── zmath.h ├── zmod.c ├── zmul.c ├── zprime.c ├── zrand.c ├── zrand.h ├── zrandom.c └── zrandom.h /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # Set update schedule for GitHub Actions 2 | # 3 | # See https://docs.github.com/en/code-security/dependabot/working-with-dependabot/keeping-your-actions-up-to-date-with-dependabot 4 | 5 | version: 2 6 | updates: 7 | 8 | - package-ecosystem: "github-actions" 9 | directory: "/" 10 | schedule: 11 | # Check for updates to GitHub Actions every week 12 | interval: "weekly" 13 | -------------------------------------------------------------------------------- /.lldbinit: -------------------------------------------------------------------------------- 1 | # 2 | # lldb calc 3 | # 4 | # IMPORTANT: Under macOS, use this local ./lldbinit file, your home directory file: 5 | # 6 | # ~/.lldbinit 7 | # 8 | # must contain this line (w/o the leading # and whitespace): 9 | # 10 | # settings set target.load-cwd-lldbinit true 11 | # 12 | # Optimizing calc may make it harder to trace what calc is doing, 13 | # To turn off optimization while debugging, try: 14 | # 15 | # make clobber all DEBUG="-g3" 16 | # 17 | # To debug calc with lldb from this directory, just run: 18 | # 19 | # lldb 20 | # 21 | target create "./calc" 22 | process launch -tty --environment CALCPATH=./cal --environment LD_LIBRARY_PATH=. --environment DYLD_LIBRARY_PATH=. --environment CALCHELP=./help --environment CALCCUSTOMHELP=./custom -- -q -d 23 | b main 24 | -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # How to contribue code to calc 2 | 3 | ## CONTRIB-CODE 4 | 5 | See the file 6 | CONTRIB-CODE 7 | for how to contribue code to calc. 8 | -------------------------------------------------------------------------------- /QUESTIONS: -------------------------------------------------------------------------------- 1 | If you have a general question about calc, consider opening 2 | a new Github discussion under: 3 | 4 | https://github.com/lcn2/calc/discussions 5 | 6 | Look over the existing discussions to see of your question fits 7 | under one of those exiting discussions. 8 | 9 | You may wish to add your question as a comment to an existing discussion. 10 | Otherwise click on: 11 | 12 | ((New discussion)) 13 | 14 | and ask your question in that new discussion. 15 | 16 | Please limit your questions to general questions about calc. We 17 | cannot go into great detail in our answers, nor can we do your 18 | homework, nor can we do much more than answer general questions 19 | about calc. 20 | 21 | Please be patient as we cannot always respond to discussion messages quickly. 22 | 23 | =-= 24 | 25 | ## Copyright (C) 2021,2023 Landon Curt Noll 26 | ## 27 | ## Calc is open software; you can redistribute it and/or modify it under 28 | ## the terms of the version 2.1 of the GNU Lesser General Public License 29 | ## as published by the Free Software Foundation. 30 | ## 31 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 32 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 33 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 34 | ## Public License for more details. 35 | ## 36 | ## A copy of version 2.1 of the GNU Lesser General Public License is 37 | ## distributed with calc under the filename COPYING-LGPL. You should have 38 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 39 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 40 | ## 41 | ## Under source code control: 2021/02/10 00:15:05 42 | ## File existed as early as: 2021 43 | ## 44 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 45 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 46 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Reporting Security Issues 2 | 3 | We take security bugs seriously. We appreciate your efforts to responsibly 4 | disclose your findings, and will make every effort to acknowledge your 5 | contributions for any verified security issues when they have been fixed. 6 | 7 | To report a security issue, click on: "[Open a draft security advisory](https://github.com/lcn2/calc/security/advisories/new)" 8 | 9 | We will send a response indicating the next steps in handling your 10 | report. After the initial reply to your report, we will keep you informed 11 | of the progress towards a fix and full announcement, and may ask for 12 | additional information or guidance. 13 | 14 | 15 | ## Supported Versions 16 | 17 | The most recent version of calc is supported with security updates. 18 | 19 | If the most recent stable of calc is also supported with security updates. 20 | 21 | FYI: please review the BUGS file, or enter the calc command: 22 | 23 | ; help BUGS 24 | -------------------------------------------------------------------------------- /bool.h: -------------------------------------------------------------------------------- 1 | /* 2 | * bool - calc standard truth :-) 3 | * 4 | * Copyright (C) 2023 David I. Bell and Landon Curt Noll 5 | * 6 | * Primary author: David I. Bell 7 | * 8 | * Calc is open software; you can redistribute it and/or modify it under 9 | * the terms of the version 2.1 of the GNU Lesser General Public License 10 | * as published by the Free Software Foundation. 11 | * 12 | * Calc is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * A copy of version 2.1 of the GNU Lesser General Public License is 18 | * distributed with calc under the filename COPYING-LGPL. You should have 19 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | * 22 | * Under source code control: 2023/07/19 17:58:42 23 | * File existed as early as: 2023 24 | * 25 | * chongo /\oo/\ http://www.isthe.com/chongo/ 26 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 27 | */ 28 | 29 | 30 | #if !defined(INCLUDE_BOOL_H) 31 | #define INCLUDE_BOOL_H 32 | 33 | #include "have_stdbool.h" 34 | #if defined(HAVE_STDBOOL_H) 35 | #include 36 | #endif /* HAVE_STDBOOL_H */ 37 | 38 | 39 | /* 40 | * standard truth :-) 41 | */ 42 | #if !defined(HAVE_STDBOOL_H) 43 | 44 | /* fake a header file */ 45 | typedef unsigned char bool; /* fake boolean typedef */ 46 | #undef true 47 | #define true ((bool)(1)) 48 | #undef false 49 | #define false ((bool)(0)) 50 | 51 | #endif /* !HAVE_STDBOOL_H */ 52 | 53 | 54 | /* 55 | * calc historic booleans 56 | */ 57 | #undef TRUE 58 | #define TRUE (true) 59 | #undef FALSE 60 | #define FALSE (false) 61 | #undef BOOL 62 | #define BOOL bool 63 | 64 | 65 | #endif /* !INCLUDE_BOOL_H*/ 66 | -------------------------------------------------------------------------------- /cal/beer.cal: -------------------------------------------------------------------------------- 1 | /* 2 | * beer - 99 bottles of beer 3 | * 4 | * Copyright (C) 1999 Landon Curt Noll 5 | * 6 | * Calc is open software; you can redistribute it and/or modify it under 7 | * the terms of the version 2.1 of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation. 9 | * 10 | * Calc is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 13 | * Public License for more details. 14 | * 15 | * A copy of version 2.1 of the GNU Lesser General Public License is 16 | * distributed with calc under the filename COPYING-LGPL. You should have 17 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | * 20 | * Under source code control: 1996/11/13 13:21:05 21 | * File existed as early as: 1996 22 | * 23 | * chongo /\oo/\ http://www.isthe.com/chongo/ 24 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 25 | */ 26 | 27 | /* 28 | * See: http://www.ionet.net/~timtroyr/funhouse/beer.html#calc 29 | */ 30 | 31 | 32 | for (i=99; i > 0;) { 33 | /* current wall state */ 34 | some_bottles = (i != 1) ? "bottles" : "bottle"; 35 | print i, some_bottles, "of beer on the wall,",; 36 | print i, some_bottles, "of beer!"; 37 | 38 | /* glug, glug */ 39 | --i; 40 | print "Take one down and pass it around,",; 41 | 42 | /* new wall state */ 43 | less = (i > 0) ? i : "no"; 44 | bottles = (i!=1) ? "bottles" : "bottle"; 45 | print less, bottles, "of beer on the wall!\n"; 46 | } 47 | -------------------------------------------------------------------------------- /cal/bernpoly.cal: -------------------------------------------------------------------------------- 1 | /* 2 | * bernpoly - Bernoulli polynomials B_n(z) for arbitrary n,z.. 3 | * 4 | * Copyright (C) 2013,2021 Christoph Zurnieden 5 | * 6 | * Calc is open software; you can redistribute it and/or modify it under 7 | * the terms of the version 2.1 of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation. 9 | * 10 | * Calc is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 13 | * Public License for more details. 14 | * 15 | * A copy of version 2.1 of the GNU Lesser General Public License is 16 | * distributed with calc under the filename COPYING-LGPL. You should have 17 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | * 20 | * Under source code control: 2013/08/11 01:31:28 21 | * File existed as early as: 2013 22 | */ 23 | 24 | 25 | static resource_debug_level; 26 | resource_debug_level = config("resource_debug", 0); 27 | 28 | 29 | read -once zeta2 30 | 31 | 32 | /* Idea by Don Zagier */ 33 | define bernpoly(n,z){ 34 | local h s c k; 35 | if(isint(n) && n>=0){ 36 | h=0;s=0;c=-1; 37 | for(k=1;k<=n+1;k++){ 38 | c*=1-(n+2)/k; 39 | s+=z^n; 40 | z++; 41 | h+=c*s/k; 42 | } 43 | return h; 44 | } 45 | else return -n*hurwitzzeta(1-n,z); 46 | } 47 | 48 | 49 | /* 50 | * restore internal function from resource debugging 51 | */ 52 | config("resource_debug", resource_debug_level),; 53 | if (config("resource_debug") & 3) { 54 | print "bernpoly(n,z)"; 55 | } 56 | -------------------------------------------------------------------------------- /cal/bigprime.cal: -------------------------------------------------------------------------------- 1 | /* 2 | * bigprime - a prime test, base a, on p*2^x+1 for even x>m 3 | * 4 | * Copyright (C) 1999 David I. Bell 5 | * 6 | * Calc is open software; you can redistribute it and/or modify it under 7 | * the terms of the version 2.1 of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation. 9 | * 10 | * Calc is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 13 | * Public License for more details. 14 | * 15 | * A copy of version 2.1 of the GNU Lesser General Public License is 16 | * distributed with calc under the filename COPYING-LGPL. You should have 17 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | * 20 | * Under source code control: 1991/05/22 21:56:32 21 | * File existed as early as: 1991 22 | * 23 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 24 | */ 25 | 26 | 27 | define bigprime(a, m, p) 28 | { 29 | local n1, n; 30 | 31 | n1 = 2^m * p; 32 | for (;;) { 33 | m++; 34 | n1 += n1; 35 | n = n1 + 1; 36 | if (isodd(m)) 37 | continue; 38 | print m; 39 | if (pmod(a, n1 / 2, n) != n1) 40 | continue; 41 | if (pmod(a, n1 / p, n) == 1) 42 | continue; 43 | print " " : n; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /cal/hello.cal: -------------------------------------------------------------------------------- 1 | /* 2 | * hello - print Hello World! forever 3 | * 4 | * Copyright (C) 1999 Landon Curt Noll 5 | * 6 | * Calc is open software; you can redistribute it and/or modify it under 7 | * the terms of the version 2.1 of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation. 9 | * 10 | * Calc is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 13 | * Public License for more details. 14 | * 15 | * A copy of version 2.1 of the GNU Lesser General Public License is 16 | * distributed with calc under the filename COPYING-LGPL. You should have 17 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | * 20 | * Under source code control: 1996/11/13 13:25:43 21 | * File existed as early as: 1996 22 | * 23 | * chongo /\oo/\ http://www.isthe.com/chongo/ 24 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 25 | */ 26 | 27 | /* 28 | * See: http://www.latech.edu/~acm/helloworld/calc.html 29 | */ 30 | 31 | 32 | while(1) print "Hello World!"; 33 | -------------------------------------------------------------------------------- /cal/mersenne.cal: -------------------------------------------------------------------------------- 1 | /* 2 | * mersenne - perform a primality test of 2^p-1, for prime p>1 3 | * 4 | * Copyright (C) 1999 David I. Bell and Landon Curt Noll 5 | * 6 | * Primary author: David I. Bell 7 | * 8 | * Calc is open software; you can redistribute it and/or modify it under 9 | * the terms of the version 2.1 of the GNU Lesser General Public License 10 | * as published by the Free Software Foundation. 11 | * 12 | * Calc is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * A copy of version 2.1 of the GNU Lesser General Public License is 18 | * distributed with calc under the filename COPYING-LGPL. You should have 19 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | * 22 | * Under source code control: 1991/05/22 21:56:36 23 | * File existed as early as: 1991 24 | * 25 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 26 | */ 27 | 28 | /* 29 | * NOTE: See lucas.cal for a more general routine. 30 | */ 31 | 32 | 33 | define mersenne(p) 34 | { 35 | local u, i, p_mask; 36 | 37 | /* firewall */ 38 | if (! isint(p)) 39 | quit "p is not an integer"; 40 | 41 | /* two is a special case */ 42 | if (p == 2) 43 | return 1; 44 | 45 | /* if p is not prime, then 2^p-1 is not prime */ 46 | if (! ptest(p,1)) 47 | return 0; 48 | 49 | /* lltest: u(i+1) = u(i)^2 - 2 mod 2^p-1 */ 50 | u = 4; 51 | for (i = 2; i < p; ++i) { 52 | u = hnrmod(u^2 - 2, 1, p, -1); 53 | } 54 | 55 | /* 2^p-1 is prime iff u(p) = 0 mod 2^p-1 */ 56 | return (u == 0); 57 | } 58 | -------------------------------------------------------------------------------- /cal/pollard.cal: -------------------------------------------------------------------------------- 1 | /* 2 | * pollard - factor using Pollard's p-1 method 3 | * 4 | * Copyright (C) 1999 David I. Bell 5 | * 6 | * Calc is open software; you can redistribute it and/or modify it under 7 | * the terms of the version 2.1 of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation. 9 | * 10 | * Calc is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 13 | * Public License for more details. 14 | * 15 | * A copy of version 2.1 of the GNU Lesser General Public License is 16 | * distributed with calc under the filename COPYING-LGPL. You should have 17 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | * 20 | * Under source code control: 1991/05/22 21:56:37 21 | * File existed as early as: 1991 22 | * 23 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 24 | */ 25 | 26 | 27 | define pfactor(N, B, ai, af) 28 | { 29 | local a, k, i, d; 30 | 31 | if (isnull(B)) 32 | B = 1000; 33 | if (isnull(ai)) 34 | ai = 2; 35 | if (isnull(af)) 36 | af = ai + 20; 37 | k = lcmfact(B); 38 | d = lfactor(N, B); 39 | if (d > 1) 40 | return d; 41 | for (a = ai; a <= af; a++) { 42 | i = pmod(a, k, N); 43 | d = gcd(i - 1, N); 44 | if ((d > 1) && (d != N)) 45 | return d; 46 | } 47 | return 1; 48 | } 49 | -------------------------------------------------------------------------------- /cal/repeat.cal: -------------------------------------------------------------------------------- 1 | /* 2 | * repeat - return the value of a repeated set of digits 3 | * 4 | * Copyright (C) 2003 Landon Curt Noll 5 | * 6 | * Calc is open software; you can redistribute it and/or modify it under 7 | * the terms of the version 2.1 of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation. 9 | * 10 | * Calc is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 13 | * Public License for more details. 14 | * 15 | * A copy of version 2.1 of the GNU Lesser General Public License is 16 | * distributed with calc under the filename COPYING-LGPL. You should have 17 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | * 20 | * Under source code control: 2003/01/05 00:00:01 21 | * File existed as early as: 2003 22 | * 23 | * chongo /\oo/\ http://www.isthe.com/chongo/ 24 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 25 | */ 26 | 27 | 28 | /* 29 | * repeat - return the value of a repeated set of digits 30 | * 31 | * usage: 32 | * repeat(digit_set, repeat_count) 33 | */ 34 | define repeat(digit_set, repeat_count) 35 | { 36 | local digit_count; /* digits in the digit_set */ 37 | 38 | /* firewall */ 39 | if (!isint(digit_set) || digit_set <= 0) { 40 | quit "digit set must be an integer > 0"; 41 | } 42 | if (!isint(repeat_count) || repeat_count <= 0) { 43 | quit "repeat count must be an integer > 0"; 44 | } 45 | 46 | /* return repeated set of digits */ 47 | digit_count = digits(digit_set); 48 | return digit_set * (10^(digit_count*repeat_count)-1) / (10^digit_count-1); 49 | } 50 | -------------------------------------------------------------------------------- /cal/strings.cal: -------------------------------------------------------------------------------- 1 | /* 2 | * strings - implementation of some of the macros in ctype.h 3 | * 4 | * Copyright (C) 2013 Christoph Zurnieden 5 | * 6 | * Calc is open software; you can redistribute it and/or modify it under 7 | * the terms of the version 2.1 of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation. 9 | * 10 | * Calc is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 13 | * Public License for more details. 14 | * 15 | * A copy of version 2.1 of the GNU Lesser General Public License is 16 | * distributed with calc under the filename COPYING-LGPL. You should have 17 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | */ 20 | 21 | 22 | static resource_debug_level; 23 | resource_debug_level = config("resource_debug", 0); 24 | 25 | define isascii(c){ 26 | c = ord(c); 27 | return (c >= 0 && c< 128); 28 | } 29 | 30 | define isblank(c){ 31 | c = ord(c); 32 | return ( c == 32 || c == 9 ); 33 | } 34 | 35 | 36 | config("resource_debug", resource_debug_level),; 37 | if (config("resource_debug") & 3) { 38 | print "isascii(c)"; 39 | print "isblank(c)"; 40 | } 41 | 42 | -------------------------------------------------------------------------------- /cal/test3100.matobj.cal: -------------------------------------------------------------------------------- 1 | /* 2 | * test3100.matobj - test matrix containing objects for test 31dd 3 | * 4 | * Copyright (C) 1999,2023 Ernest Bowen and Landon Curt Noll 5 | * 6 | * Primary author: Ernest Bowen 7 | * 8 | * Calc is open software; you can redistribute it and/or modify it under 9 | * the terms of the version 2.1 of the GNU Lesser General Public License 10 | * as published by the Free Software Foundation. 11 | * 12 | * Calc is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * A copy of version 2.1 of the GNU Lesser General Public License is 18 | * distributed with calc under the filename COPYING-LGPL. You should have 19 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | * 22 | * Under source code control: 1995/11/28 11:56:57 23 | * File existed as early as: 1995 24 | * 25 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 26 | */ 27 | 28 | 29 | obj res {r}; 30 | global md; 31 | define res_test(a) = !ismult(a.r, md); 32 | define res_sub(a,b) {local obj res v = {(a.r - b.r) % md}; return v;}; 33 | define res_mul(a,b) {local obj res v = {(a.r * b.r) % md}; return v;}; 34 | define res_neg(a) {local obj res v = {(-a.r) % md}; return v;}; 35 | define res_inv(a) {local obj res v = {minv(a.r, md)}; return v;}; 36 | define res(x) {local obj res v = {x % md}; return v;}; 37 | -------------------------------------------------------------------------------- /cal/test5200.globstat.cal: -------------------------------------------------------------------------------- 1 | /* 2 | * test5200.globstat - test the fix of an old global/static bug for test 52dd 3 | * 4 | * Copyright (C) 1999,2023 Ernest Bowen and Landon Curt Noll 5 | * 6 | * Primary author: Ernest Bowen 7 | * 8 | * Calc is open software; you can redistribute it and/or modify it under 9 | * the terms of the version 2.1 of the GNU Lesser General Public License 10 | * as published by the Free Software Foundation. 11 | * 12 | * Calc is distributed in the hope that it will be useful, but WITHOUT 13 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 14 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 15 | * Public License for more details. 16 | * 17 | * A copy of version 2.1 of the GNU Lesser General Public License is 18 | * distributed with calc under the filename COPYING-LGPL. You should have 19 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 20 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 | * 22 | * Under source code control: 1997/02/07 02:48:10 23 | * File existed as early as: 1997 24 | * 25 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 26 | */ 27 | 28 | 29 | defaultverbose = 1; /* default verbose value */ 30 | 31 | /* 32 | * test the fix of a global/static bug 33 | * 34 | * Given the following: 35 | * 36 | * global a = 10; 37 | * static a = 20; 38 | * define f(x) = a + x; 39 | * define g(x) {global a = 30; return a + x;} 40 | * define h(x) = a + x; 41 | * 42 | * Older versions of 43 | */ 44 | global a5200 = 10; 45 | static a5200 = 20; 46 | define f5200(x) = a5200 + x; 47 | define g5200(x) {global a5200 = 30; return a5200 + x;} 48 | define h5200(x) = a5200 + x; 49 | -------------------------------------------------------------------------------- /cal/test8000.read.cal: -------------------------------------------------------------------------------- 1 | /* 2 | * test8000.read - test read operation for test 80dd 3 | * 4 | * Copyright (C) 1999,2023 Landon Curt Noll 5 | * 6 | * Calc is open software; you can redistribute it and/or modify it under 7 | * the terms of the version 2.1 of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation. 9 | * 10 | * Calc is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 13 | * Public License for more details. 14 | * 15 | * A copy of version 2.1 of the GNU Lesser General Public License is 16 | * distributed with calc under the filename COPYING-LGPL. You should have 17 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | * 20 | * Under source code control: 1994/03/14 23:12:51 21 | * File existed as early as: 1994 22 | * 23 | * chongo /\oo/\ http://www.isthe.com/chongo/ 24 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 25 | */ 26 | 27 | 28 | ++value; 29 | -------------------------------------------------------------------------------- /cal/test8400.quit.cal: -------------------------------------------------------------------------------- 1 | /* 2 | * test8400.quit - test quit for test 84dd 3 | * 4 | * Copyright (C) 1999,2023 Landon Curt Noll 5 | * 6 | * Calc is open software; you can redistribute it and/or modify it under 7 | * the terms of the version 2.1 of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation. 9 | * 10 | * Calc is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 13 | * Public License for more details. 14 | * 15 | * A copy of version 2.1 of the GNU Lesser General Public License is 16 | * distributed with calc under the filename COPYING-LGPL. You should have 17 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | * 20 | * Under source code control: 1999/10/31 01:00:03 21 | * File existed as early as: 1999 22 | * 23 | * chongo /\oo/\ http://www.isthe.com/chongo/ 24 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 25 | */ 26 | 27 | 28 | print "8401: in test8400.cal"; 29 | 30 | /* 31 | * test8400 - dummy function to allow a check of quit-based memory leaks 32 | */ 33 | define test8400() 34 | { 35 | local x8401 = 19937; /* watch for lost memory */ 36 | static s8401 = 44497; /* watch for lost memory */ 37 | 38 | return x8401+s8401; 39 | } 40 | print "8402: parsed test8400()"; 41 | vrfy(test8400() == 64434, '8403: test8400() == 64434'); 42 | 43 | quit; 44 | prob('quit did not end test8400.cal'); 45 | -------------------------------------------------------------------------------- /cal/varargs.cal: -------------------------------------------------------------------------------- 1 | /* 2 | * varargs - example of a varargs-like use 3 | * 4 | * Copyright (C) 1999 David I. Bell 5 | * 6 | * Calc is open software; you can redistribute it and/or modify it under 7 | * the terms of the version 2.1 of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation. 9 | * 10 | * Calc is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 13 | * Public License for more details. 14 | * 15 | * A copy of version 2.1 of the GNU Lesser General Public License is 16 | * distributed with calc under the filename COPYING-LGPL. You should have 17 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | * 20 | * Under source code control: 1991/05/22 21:56:34 21 | * File existed as early as: 1991 22 | * 23 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 24 | */ 25 | 26 | /* 27 | * Example program to use 'varargs'. 28 | * 29 | * Program to sum the cubes of all the specified numbers. 30 | */ 31 | 32 | 33 | define sc() 34 | { 35 | local s, i; 36 | 37 | s = 0; 38 | for (i = 1; i <= param(0); i++) { 39 | if (!isnum(param(i))) { 40 | print "parameter",i,"is not a number"; 41 | continue; 42 | } 43 | s += param(i)^3; 44 | } 45 | return s; 46 | } 47 | 48 | if (config("resource_debug") & 3) { 49 | print "sc(a, b, ...) defined"; 50 | } 51 | -------------------------------------------------------------------------------- /cscript/mersenne.calc: -------------------------------------------------------------------------------- 1 | #!/usr/local/src/bin/calc/calc -q -f 2 | /* 3 | * mersenne - print the value of a mersenne number 4 | * 5 | * Copyright (C) 1999-2007,2014,2019,2021 Landon Curt Noll 6 | * 7 | * Calc is open software; you can redistribute it and/or modify it under 8 | * the terms of the version 2.1 of the GNU Lesser General Public License 9 | * as published by the Free Software Foundation. 10 | * 11 | * Calc is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 14 | * Public License for more details. 15 | * 16 | * A copy of version 2.1 of the GNU Lesser General Public License is 17 | * distributed with calc under the filename COPYING-LGPL. You should have 18 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Under source code control: 1999/11/30 00:09:01; 22 | * File existed as early as: 1999 23 | * 24 | * chongo /\oo/\ http://www.isthe.com/chongo/ 25 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 26 | * 27 | * usage: 28 | * mersenne exp 29 | */ 30 | 31 | 32 | /* 33 | * parse args 34 | */ 35 | argc = argv(); 36 | stderr = files(2); 37 | program = argv(0); 38 | if (argc != 2) { 39 | /* we include the name of this script in the error message */ 40 | fprintf(stderr, "usage: %s exp\n", program); 41 | abort "wrong number of args"; 42 | } 43 | 44 | n = eval(argv(1)); 45 | 46 | if (!isint(n) || n <= 0) { 47 | quit "Argument to be a positive integer"; 48 | } 49 | 50 | /* 51 | * print the decimal value of 2^n-1 52 | */ 53 | print "2^": n : "-1 =", 2^n-1; 54 | -------------------------------------------------------------------------------- /cscript/piforever.calc: -------------------------------------------------------------------------------- 1 | #!/usr/local/src/bin/calc/calc -q -f 2 | /* 3 | * piforever - print digits of pi forever (or as long as your mem/CPU allow) 4 | * 5 | * Copyright (C) 1999-2007,2014,2019,2021 Landon Curt Noll 6 | * 7 | * Calc is open software; you can redistribute it and/or modify it under 8 | * the terms of the version 2.1 of the GNU Lesser General Public License 9 | * as published by the Free Software Foundation. 10 | * 11 | * Calc is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 14 | * Public License for more details. 15 | * 16 | * A copy of version 2.1 of the GNU Lesser General Public License is 17 | * distributed with calc under the filename COPYING-LGPL. You should have 18 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Under source code control: 1999/11/30 00:11:36 22 | * File existed as early as: 1999 23 | * 24 | * chongo /\oo/\ http://www.isthe.com/chongo/ 25 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 26 | * 27 | * usage: 28 | * piforever 29 | */ 30 | 31 | 32 | read -once pi.cal 33 | print "pi ~= ":; 34 | piforever(); 35 | -------------------------------------------------------------------------------- /cscript/plus.calc: -------------------------------------------------------------------------------- 1 | #!/usr/local/src/bin/calc/calc -q -f 2 | /* 3 | * plus - add two or more arguments together 4 | * 5 | * Copyright (C) 1999-2007,2014,2019,2021 Landon Curt Noll 6 | * 7 | * Calc is open software; you can redistribute it and/or modify it under 8 | * the terms of the version 2.1 of the GNU Lesser General Public License 9 | * as published by the Free Software Foundation. 10 | * 11 | * Calc is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 14 | * Public License for more details. 15 | * 16 | * A copy of version 2.1 of the GNU Lesser General Public License is 17 | * distributed with calc under the filename COPYING-LGPL. You should have 18 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Under source code control: 1999/11/29 10:22:37 22 | * File existed as early as: 1999 23 | * 24 | * chongo /\oo/\ http://www.isthe.com/chongo/ 25 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 26 | * 27 | * usage: 28 | * plus val ... 29 | */ 30 | 31 | 32 | /* 33 | * parse args 34 | */ 35 | argc = argv(); 36 | stderr = files(2); 37 | program = argv(0); 38 | if (argc < 2) { 39 | /* we include the name of this script in the error message */ 40 | fprintf(stderr, "usage: %s value ...\n", program); 41 | abort "not enough args"; 42 | } 43 | 44 | /* 45 | * print the sum of the args 46 | * 47 | * Since args are strings, we must eval them before using them numerically. 48 | */ 49 | sum = 0; 50 | for (i=1; i < argc; ++i) { 51 | sum += eval(argv(i)); 52 | } 53 | print sum; 54 | -------------------------------------------------------------------------------- /cscript/simple.calc: -------------------------------------------------------------------------------- 1 | #!/usr/local/src/bin/calc/calc -q -f 2 | /* 3 | * simple - an example of a simple calc shell script 4 | * 5 | * Copyright (C) 1999-2007,2014,2019,2021 Landon Curt Noll 6 | * 7 | * Calc is open software; you can redistribute it and/or modify it under 8 | * the terms of the version 2.1 of the GNU Lesser General Public License 9 | * as published by the Free Software Foundation. 10 | * 11 | * Calc is distributed in the hope that it will be useful, but WITHOUT 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 13 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 14 | * Public License for more details. 15 | * 16 | * A copy of version 2.1 of the GNU Lesser General Public License is 17 | * distributed with calc under the filename COPYING-LGPL. You should have 18 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 19 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 20 | * 21 | * Under source code control: 1999/11/29 10:22:37 22 | * File existed as early as: 1999 23 | * 24 | * chongo /\oo/\ http://www.isthe.com/chongo/ 25 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 26 | */ 27 | 28 | 29 | /* 30 | * This is an example of a simple calc shell script. 31 | */ 32 | print "This simple calc shell script works!" 33 | print "config(\"program\")=", config("program"); 34 | print "argv()=", argv(); 35 | argc = argv(); 36 | for (i=0; i < argc; ++i) { 37 | print "argv(":i:")=", argv(i); 38 | } 39 | -------------------------------------------------------------------------------- /custom/devnull: -------------------------------------------------------------------------------- 1 | NAME 2 | devnull - does nothing 3 | 4 | SYNOPSIS 5 | custom("devnull" [, arg ...]) 6 | 7 | TYPES 8 | arg any 9 | 10 | return null 11 | 12 | DESCRIPTION 13 | This custom function does nothing. It is intended for testing 14 | of the general custom interface. 15 | 16 | EXAMPLE 17 | > custom("devnull", foo, bar, baz, 3+4.5i, pi()) 18 | 19 | LIMITS 20 | calc must be built with ALLOW_CUSTOM= -DCUSTOM 21 | calc must be executed with a -C arg. 22 | 23 | LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | custom 28 | 29 | ## Copyright (C) 1999,2021 Landon Curt Noll 30 | ## 31 | ## Calc is open software; you can redistribute it and/or modify it under 32 | ## the terms of the version 2.1 of the GNU Lesser General Public License 33 | ## as published by the Free Software Foundation. 34 | ## 35 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 36 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 37 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 38 | ## Public License for more details. 39 | ## 40 | ## A copy of version 2.1 of the GNU Lesser General Public License is 41 | ## distributed with calc under the filename COPYING-LGPL. You should have 42 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 43 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 44 | ## 45 | ## Under source code control: 1997/03/09 17:49:12 46 | ## File existed as early as: 1997 47 | ## 48 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 49 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 50 | -------------------------------------------------------------------------------- /custom/help: -------------------------------------------------------------------------------- 1 | NAME 2 | help - help for custom functions 3 | 4 | SYNOPSIS 5 | custom("help", name) 6 | 7 | TYPES 8 | name string 9 | 10 | return null 11 | 12 | DESCRIPTION 13 | This custom function will display the help for the builtin function 14 | named by the name argument. 15 | 16 | EXAMPLE 17 | > custom("help", "custom_cal") 18 | ... output the same as is produced by help custhelp/custom_cal ... 19 | 20 | LIMITS 21 | calc must be built with ALLOW_CUSTOM= -DCUSTOM 22 | calc must be executed with a -C arg. 23 | 24 | LIBRARY 25 | none 26 | 27 | SEE ALSO 28 | custom 29 | 30 | ## Copyright (C) 1999 Landon Curt Noll 31 | ## 32 | ## Calc is open software; you can redistribute it and/or modify it under 33 | ## the terms of the version 2.1 of the GNU Lesser General Public License 34 | ## as published by the Free Software Foundation. 35 | ## 36 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 37 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 38 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 39 | ## Public License for more details. 40 | ## 41 | ## A copy of version 2.1 of the GNU Lesser General Public License is 42 | ## distributed with calc under the filename COPYING-LGPL. You should have 43 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 44 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 45 | ## 46 | ## Under source code control: 1997/03/09 06:03:58 47 | ## File existed as early as: 1997 48 | ## 49 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 50 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 51 | -------------------------------------------------------------------------------- /help/archive: -------------------------------------------------------------------------------- 1 | Where to get the latest versions of calc 2 | 3 | Official calc source is maintained on GitHub: 4 | 5 | https://github.com/lcn2/calc 6 | 7 | Calc releases may be found as GitHub tagged releases: 8 | 9 | https://github.com/lcn2/calc/releases?page=2 10 | 11 | At the bottom of a given release is a "> Assets" that may 12 | be opened to reveal down-loadable files such as source 13 | tarballs, source zip files and RPMs. 14 | 15 | Landon Noll also maintains a calc home page at: 16 | 17 | http://www.isthe.com/chongo/tech/comp/calc/ 18 | 19 | Landon Curt Noll 20 | http://www.isthe.com/chongo/ 21 | 22 | chongo /\../\ 23 | 24 | ## Copyright (C) 1999,2021 Landon Curt Noll 25 | ## 26 | ## Calc is open software; you can redistribute it and/or modify it under 27 | ## the terms of the version 2.1 of the GNU Lesser General Public License 28 | ## as published by the Free Software Foundation. 29 | ## 30 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 31 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 32 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 33 | ## Public License for more details. 34 | ## 35 | ## A copy of version 2.1 of the GNU Lesser General Public License is 36 | ## distributed with calc under the filename COPYING-LGPL. You should have 37 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 38 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 39 | ## 40 | ## Under source code control: 1996/06/13 02:51:48 41 | ## File existed as early as: 1996 42 | ## 43 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 44 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 45 | -------------------------------------------------------------------------------- /help/builtin.top: -------------------------------------------------------------------------------- 1 | Builtin functions 2 | 3 | There is a large number of built-in functions. Many of the 4 | functions work on several types of arguments, whereas some only 5 | work for the correct types (e.g., numbers or strings). In the 6 | following description, this is indicated by whether or not the 7 | description refers to values or numbers. This display is generated 8 | by the 'show builtin' command. 9 | 10 | ## Copyright (C) 1999 Landon Curt Noll 11 | ## 12 | ## Calc is open software; you can redistribute it and/or modify it under 13 | ## the terms of the version 2.1 of the GNU Lesser General Public License 14 | ## as published by the Free Software Foundation. 15 | ## 16 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 17 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 18 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 19 | ## Public License for more details. 20 | ## 21 | ## A copy of version 2.1 of the GNU Lesser General Public License is 22 | ## distributed with calc under the filename COPYING-LGPL. You should have 23 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 24 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 25 | ## 26 | ## Under source code control: 1995/07/10 01:17:53 27 | ## File existed as early as: 1995 28 | ## 29 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 30 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 31 | -------------------------------------------------------------------------------- /help/calc_tty: -------------------------------------------------------------------------------- 1 | NAME 2 | calc_tty - restore normal input conditions for interactive use 3 | 4 | SYNOPSIS 5 | calc_tty() 6 | 7 | TYPES 8 | return none if appears to be successful, error-value otherwise 9 | 10 | DESCRIPTION 11 | This may enable a return to normal operation if abnormal activity 12 | results from a change of one or more terminal characteristics, as 13 | may occur when activity is resumed by an fg command after a ctrl-Z 14 | interrupt, or by any of the three commands: 15 | 16 | ; !stty echo 17 | ; !stty -cbreak 18 | ; !stty echo -cbreak 19 | 20 | EXAMPLE 21 | ; calc_tty(); 22 | 23 | LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | none 28 | 29 | ## Copyright (C) 2000-2006 Ernest Bowen 30 | ## 31 | ## Calc is open software; you can redistribute it and/or modify it under 32 | ## the terms of the version 2.1 of the GNU Lesser General Public License 33 | ## as published by the Free Software Foundation. 34 | ## 35 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 36 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 37 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 38 | ## Public License for more details. 39 | ## 40 | ## A copy of version 2.1 of the GNU Lesser General Public License is 41 | ## distributed with calc under the filename COPYING-LGPL. You should have 42 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 43 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 44 | ## 45 | ## Under source code control: 2000/12/14 01:33:00 46 | ## File existed as early as: 2000 47 | ## 48 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 49 | -------------------------------------------------------------------------------- /help/ceil: -------------------------------------------------------------------------------- 1 | NAME 2 | ceil - ceiling 3 | 4 | SYNOPSIS 5 | ceil(x) 6 | 7 | TYPES 8 | x real, complex, list, matrix 9 | 10 | return real or complex, list, matrix 11 | 12 | DESCRIPTION 13 | For real x, ceil(x) is the least integer not less than x. 14 | 15 | For complex, ceil(x) returns the real or complex number v for 16 | which re(v) = ceil(re(x)), im(v) = ceil(im(x)). 17 | 18 | For list or matrix x, ceil(x) returns the list or matrix of the 19 | same structure as x for which each element t of x has been replaced 20 | by ceil(t). 21 | 22 | EXAMPLE 23 | ; print ceil(27), ceil(1.23), ceil(-4.56), ceil(7.8 - 9.1i) 24 | 27 2 -4 8-9i 25 | 26 | LIMITS 27 | none 28 | 29 | LINK LIBRARY 30 | none 31 | 32 | SEE ALSO 33 | floor, int 34 | 35 | ## Copyright (C) 1999 Landon Curt Noll 36 | ## 37 | ## Calc is open software; you can redistribute it and/or modify it under 38 | ## the terms of the version 2.1 of the GNU Lesser General Public License 39 | ## as published by the Free Software Foundation. 40 | ## 41 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 42 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 43 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 44 | ## Public License for more details. 45 | ## 46 | ## A copy of version 2.1 of the GNU Lesser General Public License is 47 | ## distributed with calc under the filename COPYING-LGPL. You should have 48 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 49 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 50 | ## 51 | ## Under source code control: 1994/09/30 01:12:01 52 | ## File existed as early as: 1994 53 | ## 54 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 55 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 56 | -------------------------------------------------------------------------------- /help/char: -------------------------------------------------------------------------------- 1 | NAME 2 | char - character corresponding to a value 3 | 4 | SYNOPSIS 5 | char(j) 6 | 7 | TYPES 8 | j integer, 0 <= j < 256 9 | 10 | return string 11 | 12 | DESCRIPTION 13 | For j > 0, returns a string of length 1 with a character that has 14 | the same value as j. For j = 0, returns the null string "". 15 | 16 | EXAMPLE 17 | ; print char(0102), char(0x6f), char(119), char(0145), char(0x6e) 18 | B o w e n 19 | 20 | LIMITS 21 | none 22 | 23 | LINK LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | ord 28 | 29 | ## Copyright (C) 1999 Landon Curt Noll 30 | ## 31 | ## Calc is open software; you can redistribute it and/or modify it under 32 | ## the terms of the version 2.1 of the GNU Lesser General Public License 33 | ## as published by the Free Software Foundation. 34 | ## 35 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 36 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 37 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 38 | ## Public License for more details. 39 | ## 40 | ## A copy of version 2.1 of the GNU Lesser General Public License is 41 | ## distributed with calc under the filename COPYING-LGPL. You should have 42 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 43 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 44 | ## 45 | ## Under source code control: 1994/09/30 01:45:45 46 | ## File existed as early as: 1994 47 | ## 48 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 49 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 50 | -------------------------------------------------------------------------------- /help/cmdbuf: -------------------------------------------------------------------------------- 1 | NAME 2 | cmdbuf - print the command buffer 3 | 4 | SYNOPSIS 5 | cmdbuf() 6 | 7 | TYPES 8 | return str 9 | 10 | DESCRIPTION 11 | This function returns the command string that was formed by calc based 12 | on its command line arguments. If calc was invoked without arguments, 13 | this function will return an empty string. 14 | 15 | EXAMPLE 16 | # NOTE: The following is intended to a shell command line: 17 | 18 | $ calc "print cmdbuf(); a = 3; print a^2;" 19 | print cmdbuf(); a = 3; print a^2; 20 | 21 | 9 22 | 23 | LIMITS 24 | none 25 | 26 | LINK LIBRARY 27 | none 28 | 29 | SEE ALSO 30 | argv, system 31 | 32 | ## Copyright (C) 1999-2006,2021 Landon Curt Noll 33 | ## 34 | ## Calc is open software; you can redistribute it and/or modify it under 35 | ## the terms of the version 2.1 of the GNU Lesser General Public License 36 | ## as published by the Free Software Foundation. 37 | ## 38 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 39 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 40 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 41 | ## Public License for more details. 42 | ## 43 | ## A copy of version 2.1 of the GNU Lesser General Public License is 44 | ## distributed with calc under the filename COPYING-LGPL. You should have 45 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 46 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 47 | ## 48 | ## Under source code control: 1995/07/09 04:05:58 49 | ## File existed as early as: 1995 50 | ## 51 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 52 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 53 | -------------------------------------------------------------------------------- /help/cosh: -------------------------------------------------------------------------------- 1 | NAME 2 | cosh - hyperbolic cosine 3 | 4 | SYNOPSIS 5 | cosh(x [,eps]) 6 | 7 | TYPES 8 | x real 9 | eps 0 < real < 1, defaults to epsilon() 10 | 11 | return real 12 | 13 | DESCRIPTION 14 | Calculate the cosh of x to the nearest or next to nearest multiple of 15 | epsilon, with absolute error less than .75 * eps. 16 | 17 | cosh(x) = (exp(x) + exp(-x))/2 18 | 19 | EXAMPLE 20 | ; print cosh(1, 1e-5), cosh(1, 1e-10), cosh(1, 1e-15), cosh(1, 1e-20) 21 | 1.54308 1.5430806348 1.543080634815244 1.54308063481524377848 22 | 23 | LIMITS 24 | 0 < eps < 1 25 | 26 | LINK LIBRARY 27 | NUMBER *qcosh(NUMBER *x, NUMBER *eps) 28 | 29 | SEE ALSO 30 | sinh, tanh, coth, sech, csch 31 | asinh, acosh, atanh, acoth, asech, acsch 32 | epsilon 33 | 34 | ## Copyright (C) 1999,2023 Landon Curt Noll 35 | ## 36 | ## Calc is open software; you can redistribute it and/or modify it under 37 | ## the terms of the version 2.1 of the GNU Lesser General Public License 38 | ## as published by the Free Software Foundation. 39 | ## 40 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 41 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 42 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 43 | ## Public License for more details. 44 | ## 45 | ## A copy of version 2.1 of the GNU Lesser General Public License is 46 | ## distributed with calc under the filename COPYING-LGPL. You should have 47 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 48 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 49 | ## 50 | ## Under source code control: 1994/03/19 01:40:28 51 | ## File existed as early as: 1994 52 | ## 53 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 54 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 55 | -------------------------------------------------------------------------------- /help/coth: -------------------------------------------------------------------------------- 1 | NAME 2 | coth - hyperbolic cotangent 3 | 4 | SYNOPSIS 5 | coth(x [,eps]) 6 | 7 | TYPES 8 | x nonzero real 9 | eps 0 < real < 1, defaults to epsilon() 10 | 11 | return real 12 | 13 | DESCRIPTION 14 | Calculate the coth of x to a multiple of eps with error less in 15 | absolute value than .75 * eps. 16 | 17 | coth(x) = (exp(2*x) + 1)/(exp(2*x) - 1) 18 | 19 | EXAMPLE 20 | ; print coth(1, 1e-5), coth(1, 1e-10), coth(1, 1e-15), coth(1, 1e-20) 21 | 1.31304 1.3130352855 1.313035285499331 1.31303528549933130364 22 | 23 | LIMITS 24 | 0 < eps < 1 25 | 26 | LINK LIBRARY 27 | NUMBER *qcoth(NUMBER *x, NUMBER *eps) 28 | 29 | SEE ALSO 30 | sinh, cosh, tanh, sech, csch 31 | asinh, acosh, atanh, acoth, asech, acsch 32 | epsilon 33 | 34 | ## Copyright (C) 1999,2023 Landon Curt Noll 35 | ## 36 | ## Calc is open software; you can redistribute it and/or modify it under 37 | ## the terms of the version 2.1 of the GNU Lesser General Public License 38 | ## as published by the Free Software Foundation. 39 | ## 40 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 41 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 42 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 43 | ## Public License for more details. 44 | ## 45 | ## A copy of version 2.1 of the GNU Lesser General Public License is 46 | ## distributed with calc under the filename COPYING-LGPL. You should have 47 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 48 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 49 | ## 50 | ## Under source code control: 1995/11/13 03:49:00 51 | ## File existed as early as: 1995 52 | ## 53 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 54 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 55 | -------------------------------------------------------------------------------- /help/count: -------------------------------------------------------------------------------- 1 | NAME 2 | count - count elements of list or matrix satisfying a stated condition 3 | 4 | SYNOPSIS 5 | count(x, y) 6 | 7 | TYPES 8 | x list or matrix 9 | y string 10 | 11 | return integer 12 | 13 | DESCRIPTION 14 | For count(x, y), y is to be the name of a user-defined function; 15 | count(x,y) then returns the number of elements of x for which y 16 | tests as "true". 17 | 18 | EXAMPLE 19 | ; define f(a) = (a < 5) 20 | ; A = list(1,2,7,6,4,8) 21 | ; count(A, "f") 22 | 3 23 | 24 | LIMITS 25 | none 26 | 27 | LINK LIBRARY 28 | none 29 | 30 | SEE ALSO 31 | select, modify 32 | 33 | ## Copyright (C) 1999 Landon Curt Noll 34 | ## 35 | ## Calc is open software; you can redistribute it and/or modify it under 36 | ## the terms of the version 2.1 of the GNU Lesser General Public License 37 | ## as published by the Free Software Foundation. 38 | ## 39 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 40 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 41 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 42 | ## Public License for more details. 43 | ## 44 | ## A copy of version 2.1 of the GNU Lesser General Public License is 45 | ## distributed with calc under the filename COPYING-LGPL. You should have 46 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 47 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 48 | ## 49 | ## Under source code control: 1995/07/10 02:09:31 50 | ## File existed as early as: 1995 51 | ## 52 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 53 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 54 | -------------------------------------------------------------------------------- /help/csch: -------------------------------------------------------------------------------- 1 | NAME 2 | csch - hyperbolic cosecant 3 | 4 | SYNOPSIS 5 | csch(x [,eps]) 6 | 7 | TYPES 8 | x nonzero real 9 | eps 0 < real < 1, defaults to epsilon() 10 | 11 | return real 12 | 13 | DESCRIPTION 14 | Calculate the csch of x to a multiple of epsilon, with error less in 15 | absolute value than .75 * eps. 16 | 17 | csch(x) = 2/(exp(x) - exp(-x)) 18 | 19 | EXAMPLE 20 | ; print csch(1, 1e-5), csch(1, 1e-10), csch(1, 1e-15), csch(1, 1e-20) 21 | 0.85092 0.8509181282 0.850918128239322 0.85091812823932154513 22 | 23 | LIMITS 24 | 0 < eps < 1 25 | 26 | LINK LIBRARY 27 | NUMBER *qcsch(NUMBER *x, NUMBER *eps) 28 | 29 | SEE ALSO 30 | sinh, cosh, tanh, coth, sech 31 | asinh, acosh, atanh, acoth, asech, acsch 32 | epsilon 33 | 34 | ## Copyright (C) 1999,2021,2023 Landon Curt Noll 35 | ## 36 | ## Calc is open software; you can redistribute it and/or modify it under 37 | ## the terms of the version 2.1 of the GNU Lesser General Public License 38 | ## as published by the Free Software Foundation. 39 | ## 40 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 41 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 42 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 43 | ## Public License for more details. 44 | ## 45 | ## A copy of version 2.1 of the GNU Lesser General Public License is 46 | ## distributed with calc under the filename COPYING-LGPL. You should have 47 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 48 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 49 | ## 50 | ## Under source code control: 1995/11/13 03:49:00 51 | ## File existed as early as: 1995 52 | ## 53 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 54 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 55 | -------------------------------------------------------------------------------- /help/ctime: -------------------------------------------------------------------------------- 1 | NAME 2 | ctime - current local time 3 | 4 | SYNOPSIS 5 | ctime() 6 | 7 | TYPES 8 | return string 9 | 10 | DESCRIPTION 11 | The ctime() builtin returns the string formed by the 12 | characters returned by the C library function, ctime(): E.g. 13 | 14 | "Mon Oct 28 00:47:00 1996\n" 15 | 16 | EXAMPLE 17 | ; ## NOTE: Your output will likely vary: 18 | 19 | ; printf("The time is now %s.\n", ctime()) 20 | The time is now Mon Apr 15 12:41:44 1996 21 | . 22 | 23 | LIMITS 24 | none 25 | 26 | LINK LIBRARY 27 | none 28 | 29 | SEE ALSO 30 | runtime, time 31 | 32 | ## Copyright (C) 1996,1999,2021 Landon Curt Noll 33 | ## 34 | ## Calc is open software; you can redistribute it and/or modify it under 35 | ## the terms of the version 2.1 of the GNU Lesser General Public License 36 | ## as published by the Free Software Foundation. 37 | ## 38 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 39 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 40 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 41 | ## Public License for more details. 42 | ## 43 | ## A copy of version 2.1 of the GNU Lesser General Public License is 44 | ## distributed with calc under the filename COPYING-LGPL. You should have 45 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 46 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 47 | ## 48 | ## Under source code control: 1996/04/30 03:05:18 49 | ## File existed as early as: 1996 50 | ## 51 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 52 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 53 | -------------------------------------------------------------------------------- /help/d2g: -------------------------------------------------------------------------------- 1 | NAME 2 | d2g - convert degrees to gradians 3 | 4 | SYNOPSIS 5 | d2g(x [,eps]) 6 | 7 | TYPES 8 | x number (real or complex) 9 | eps eps value is ignored 10 | 11 | return number 12 | 13 | DESCRIPTION 14 | Given x degrees, return the equivalent number of gradians. 15 | 16 | The eps argument is ignored. 17 | 18 | EXAMPLE 19 | ; print d2g(45), d2g(180), d2g(30) 20 | 50 200 ~33.33333333333333333333 21 | 22 | ; print d2g(3i+2) 23 | ~2.22222222222222222222+~3.33333333333333333333i 24 | 25 | LIMITS 26 | none 27 | 28 | LINK LIBRARY 29 | none 30 | 31 | SEE ALSO 32 | d2r, r2d, g2r, r2g, g2d, 33 | sin, cos, tan, sec, csc, cot, epsilon 34 | 35 | ## Copyright (C) 2021,2023 Landon Curt Noll 36 | ## 37 | ## Calc is open software; you can redistribute it and/or modify it under 38 | ## the terms of the version 2.1 of the GNU Lesser General Public License 39 | ## as published by the Free Software Foundation. 40 | ## 41 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 42 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 43 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 44 | ## Public License for more details. 45 | ## 46 | ## A copy of version 2.1 of the GNU Lesser General Public License is 47 | ## distributed with calc under the filename COPYING-LGPL. You should have 48 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 49 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 50 | ## 51 | ## Under source code control: 2021/09/07 12:04:28 52 | ## File existed as early as: 2021 53 | ## 54 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 55 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 56 | -------------------------------------------------------------------------------- /help/den: -------------------------------------------------------------------------------- 1 | NAME 2 | den - denominator of a real number 3 | 4 | SYNOPSIS 5 | den(x) 6 | 7 | TYPES 8 | x real 9 | 10 | return integer 11 | 12 | DESCRIPTION 13 | For real x, den(x) returns the denominator of x when x is expressed 14 | in lowest terms with positive denominator. In calc, 15 | real values are actually rational values. Each calc real 16 | value can be uniquely expressed as: 17 | 18 | n / d 19 | 20 | where: 21 | 22 | n and d are integers 23 | gcd(n,d) == 1 24 | d > 0 25 | 26 | The denominator for this n/d is d. 27 | 28 | EXAMPLE 29 | ; print den(7), den(-1.25), den(121/33) 30 | 1 4 3 31 | 32 | LIMITS 33 | none 34 | 35 | LINK LIBRARY 36 | NUMBER *qden(NUMBER *x) 37 | 38 | SEE ALSO 39 | num 40 | 41 | ## Copyright (C) 1999 Landon Curt Noll 42 | ## 43 | ## Calc is open software; you can redistribute it and/or modify it under 44 | ## the terms of the version 2.1 of the GNU Lesser General Public License 45 | ## as published by the Free Software Foundation. 46 | ## 47 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 48 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 49 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 50 | ## Public License for more details. 51 | ## 52 | ## A copy of version 2.1 of the GNU Lesser General Public License is 53 | ## distributed with calc under the filename COPYING-LGPL. You should have 54 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 55 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 56 | ## 57 | ## Under source code control: 1995/10/05 04:52:26 58 | ## File existed as early as: 1995 59 | ## 60 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 61 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 62 | -------------------------------------------------------------------------------- /help/dp: -------------------------------------------------------------------------------- 1 | NAME 2 | dp - dot product of two vectors 3 | 4 | SYNOPSIS 5 | dp(x, y) 6 | 7 | TYPES 8 | x, y 1-dimensional matrices of the same size 9 | 10 | return depends on the nature of the elements of x and y 11 | 12 | DESCRIPTION 13 | Compute the dot product of two 1-dimensional matrices. 14 | 15 | Let: 16 | 17 | x = {x0, x1, ... xn} 18 | y = {y0, y1, ... yn} 19 | 20 | Then dp(x,y) returns the result of the calculation: 21 | 22 | x0*y0 + x1*y1 + ... + xn*yn 23 | 24 | EXAMPLE 25 | ; mat x[3] = {2,3,4} 26 | ; mat y[1:3] = {3,4,5} 27 | ; print dp(x,y) 28 | 38 29 | 30 | LIMITS 31 | none 32 | 33 | LINK LIBRARY 34 | VALUE matdot(MATRIX *x, MATRIX *y) 35 | 36 | SEE ALSO 37 | cp 38 | 39 | ## Copyright (C) 1999 Landon Curt Noll 40 | ## 41 | ## Calc is open software; you can redistribute it and/or modify it under 42 | ## the terms of the version 2.1 of the GNU Lesser General Public License 43 | ## as published by the Free Software Foundation. 44 | ## 45 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 46 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 47 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 48 | ## Public License for more details. 49 | ## 50 | ## A copy of version 2.1 of the GNU Lesser General Public License is 51 | ## distributed with calc under the filename COPYING-LGPL. You should have 52 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 53 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 54 | ## 55 | ## Under source code control: 1995/10/05 04:52:26 56 | ## File existed as early as: 1995 57 | ## 58 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 59 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 60 | -------------------------------------------------------------------------------- /help/fact: -------------------------------------------------------------------------------- 1 | NAME 2 | fact - factorial 3 | 4 | SYNOPSIS 5 | fact(x) 6 | 7 | TYPES 8 | x int 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Return the factorial of a number. Factorial is defined as: 14 | 15 | x! = 1 * 2 * 3 * ... * x-1 * x 16 | 0! = 1 17 | 18 | EXAMPLE 19 | ; print fact(10), fact(5), fact(2), fact(1), fact(0) 20 | 3628800 120 2 1 1 21 | 22 | ; print fact(40) 23 | 815915283247897734345611269596115894272000000000 24 | 25 | LIMITS 26 | 2^24 > x >= 0 27 | y < 2^24 28 | 29 | LINK LIBRARY 30 | void zfact(NUMBER x, *ret) 31 | 32 | SEE ALSO 33 | comb, perm, randperm 34 | 35 | ## Copyright (C) 1999-2006 Landon Curt Noll 36 | ## 37 | ## Calc is open software; you can redistribute it and/or modify it under 38 | ## the terms of the version 2.1 of the GNU Lesser General Public License 39 | ## as published by the Free Software Foundation. 40 | ## 41 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 42 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 43 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 44 | ## Public License for more details. 45 | ## 46 | ## A copy of version 2.1 of the GNU Lesser General Public License is 47 | ## distributed with calc under the filename COPYING-LGPL. You should have 48 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 49 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 50 | ## 51 | ## Under source code control: 1994/10/20 04:03:02 52 | ## File existed as early as: 1994 53 | ## 54 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 55 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 56 | -------------------------------------------------------------------------------- /help/fcnt: -------------------------------------------------------------------------------- 1 | NAME 2 | fcnt - count of number of times a specified integer divides an integer 3 | 4 | SYNOPSIS 5 | fcnt(x,y) 6 | 7 | TYPES 8 | x integer 9 | y integer 10 | 11 | return non-negative integer 12 | 13 | DESCRIPTION 14 | If x is nonzero and abs(y) > 1, fcnt(x,y) returns the greatest 15 | non-negative n for which y^n is a divisor of x. In particular, 16 | zero is returned if x is not divisible by y. 17 | 18 | If x is zero or if y = -1, 0 or 1, fcnt(x,y) is defined to be zero. 19 | 20 | EXAMPLE 21 | ; print fcnt(7,4), fcnt(24,4), fcnt(48,4) 22 | 0 1 2 23 | 24 | LIMITS 25 | none 26 | 27 | LINK LIBRARY 28 | long zfacrem(ZVALUE x, ZVALUE y, ZVALUE *rem) 29 | 30 | SEE ALSO 31 | frem, gcdrem 32 | 33 | ## Copyright (C) 1999 Landon Curt Noll 34 | ## 35 | ## Calc is open software; you can redistribute it and/or modify it under 36 | ## the terms of the version 2.1 of the GNU Lesser General Public License 37 | ## as published by the Free Software Foundation. 38 | ## 39 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 40 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 41 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 42 | ## Public License for more details. 43 | ## 44 | ## A copy of version 2.1 of the GNU Lesser General Public License is 45 | ## distributed with calc under the filename COPYING-LGPL. You should have 46 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 47 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 48 | ## 49 | ## Under source code control: 1995/12/18 12:03:02 50 | ## File existed as early as: 1995 51 | ## 52 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 53 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 54 | -------------------------------------------------------------------------------- /help/fflush: -------------------------------------------------------------------------------- 1 | NAME 2 | fflush - flush output to file 3 | 4 | SYNOPSIS 5 | fflush(fd) 6 | 7 | TYPES 8 | fd file 9 | 10 | return nil 11 | 12 | DESCRIPTION 13 | This function forces a buffered output to the file associated with fd. 14 | 15 | EXAMPLE 16 | ; fd = fopen("/tmp/file", "w") 17 | ; fputc(fd, "@"); 18 | ; fflush(fd) 19 | 20 | LIMITS 21 | fd must be associated with an open file 22 | 23 | LINK LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | errno, fclose, feof, ferror, fflush, fgetc, fgetline, fgets, files, fopen, 28 | fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt 29 | 30 | ## Copyright (C) 1999 Landon Curt Noll 31 | ## 32 | ## Calc is open software; you can redistribute it and/or modify it under 33 | ## the terms of the version 2.1 of the GNU Lesser General Public License 34 | ## as published by the Free Software Foundation. 35 | ## 36 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 37 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 38 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 39 | ## Public License for more details. 40 | ## 41 | ## A copy of version 2.1 of the GNU Lesser General Public License is 42 | ## distributed with calc under the filename COPYING-LGPL. You should have 43 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 44 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 45 | ## 46 | ## Under source code control: 1994/10/27 03:04:17 47 | ## File existed as early as: 1994 48 | ## 49 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 50 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 51 | -------------------------------------------------------------------------------- /help/fib: -------------------------------------------------------------------------------- 1 | NAME 2 | fib - Fibonacci number 3 | 4 | SYNOPSIS 5 | fib(n) 6 | 7 | TYPES 8 | n integer 9 | 10 | return integer 11 | 12 | DESCRIPTION 13 | For any integer n, fib(n) returns the Fibonacci number with index n. 14 | This may be defined by fib(0) = 0, fib(1) = 1 and for any n (positive 15 | or negative) fib(n) = fib(n-1) + fib(n-2). 16 | 17 | EXAMPLE 18 | ; print fib(-2), fib(-1), fib(0), fib(1), fib(2), fib(3), fib(4), fib(5) 19 | -1 1 0 1 1 2 3 5 -8 20 | 21 | LIMITS 22 | none 23 | 24 | LINK LIBRARY 25 | NUMBER *qfib(NUMBER *n) 26 | 27 | SEE ALSO 28 | fact 29 | 30 | ## Copyright (C) 1999-2006 Landon Curt Noll 31 | ## 32 | ## Calc is open software; you can redistribute it and/or modify it under 33 | ## the terms of the version 2.1 of the GNU Lesser General Public License 34 | ## as published by the Free Software Foundation. 35 | ## 36 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 37 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 38 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 39 | ## Public License for more details. 40 | ## 41 | ## A copy of version 2.1 of the GNU Lesser General Public License is 42 | ## distributed with calc under the filename COPYING-LGPL. You should have 43 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 44 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 45 | ## 46 | ## Under source code control: 1995/10/25 04:03:45 47 | ## File existed as early as: 1995 48 | ## 49 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 50 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 51 | -------------------------------------------------------------------------------- /help/floor: -------------------------------------------------------------------------------- 1 | NAME 2 | floor - floor 3 | 4 | SYNOPSIS 5 | floor(x) 6 | 7 | TYPES 8 | x real, complex, list, matrix 9 | 10 | return real or complex, list, matrix 11 | 12 | DESCRIPTION 13 | For real x, floor(x) is the greatest integer not greater than x. 14 | 15 | For complex, floor(x) returns the real or complex number v for 16 | which re(v) = floor(re(x)), im(v) = floor(im(x)). 17 | 18 | For list or matrix x, floor(x) returns the list or matrix of the 19 | same structure as x for which each element t of x has been replaced 20 | by floor(t). 21 | 22 | EXAMPLE 23 | ; print floor(27), floor(1.23), floor(-4.56), floor(7.8 - 9.1i) 24 | 27 1 -5 7-10i 25 | 26 | LIMITS 27 | none 28 | 29 | LINK LIBRARY 30 | none 31 | 32 | SEE ALSO 33 | ceil, int 34 | 35 | ## Copyright (C) 1999 Landon Curt Noll 36 | ## 37 | ## Calc is open software; you can redistribute it and/or modify it under 38 | ## the terms of the version 2.1 of the GNU Lesser General Public License 39 | ## as published by the Free Software Foundation. 40 | ## 41 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 42 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 43 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 44 | ## Public License for more details. 45 | ## 46 | ## A copy of version 2.1 of the GNU Lesser General Public License is 47 | ## distributed with calc under the filename COPYING-LGPL. You should have 48 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 49 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 50 | ## 51 | ## Under source code control: 1994/09/30 01:12:01 52 | ## File existed as early as: 1994 53 | ## 54 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 55 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 56 | -------------------------------------------------------------------------------- /help/forall: -------------------------------------------------------------------------------- 1 | NAME 2 | forall - to evaluate a function for all values of a list or matrix 3 | 4 | SYNOPSIS 5 | forall(x, y) 6 | 7 | TYPES 8 | x list or matrix 9 | y string 10 | 11 | return null value 12 | 13 | DESCRIPTION 14 | In forall(x,y), y is the name of a function; that function 15 | is performed in succession for all elements of x. This is similar 16 | to modify(x, y) but x is not changed. 17 | 18 | EXAMPLE 19 | ; global n = 0 20 | ; define s(a) {n += a;} 21 | ; A = list(1,2,3,4) 22 | ; forall(A, "s") 23 | ; n 24 | 10 25 | 26 | ; define e(a) {if (iseven(a)) print a;} 27 | ; forall(A, "e") 28 | 2 29 | 4 30 | 31 | LIMITS 32 | none 33 | 34 | LINK LIBRARY 35 | none 36 | 37 | SEE ALSO 38 | modify 39 | 40 | ## Copyright (C) 1999 Landon Curt Noll 41 | ## 42 | ## Calc is open software; you can redistribute it and/or modify it under 43 | ## the terms of the version 2.1 of the GNU Lesser General Public License 44 | ## as published by the Free Software Foundation. 45 | ## 46 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 47 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 48 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 49 | ## Public License for more details. 50 | ## 51 | ## A copy of version 2.1 of the GNU Lesser General Public License is 52 | ## distributed with calc under the filename COPYING-LGPL. You should have 53 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 54 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 55 | ## 56 | ## Under source code control: 1995/07/10 02:09:31 57 | ## File existed as early as: 1995 58 | ## 59 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 60 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 61 | -------------------------------------------------------------------------------- /help/fputc: -------------------------------------------------------------------------------- 1 | NAME 2 | fputc - write a character to a file 3 | 4 | SYNOPSIS 5 | fputc(fd, data) 6 | 7 | TYPES 8 | fd file 9 | data str 10 | 11 | return nil 12 | 13 | DESCRIPTION 14 | This function writes the first character in data to the file 15 | associated with fd. 16 | 17 | EXAMPLE 18 | ; fd = fopen("/tmp/newfile", "w") 19 | ; fputc(fd, "c") 20 | ; fd2 = fopen("/tmp/newfile", "r") 21 | ; fgetc(fd2) 22 | "c" 23 | 24 | LIMITS 25 | fd must be associated with an open file 26 | 27 | LINK LIBRARY 28 | none 29 | 30 | SEE ALSO 31 | errno, fclose, feof, ferror, fflush, fgetc, fgetline, fgets, files, fopen, 32 | fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt 33 | 34 | ## Copyright (C) 1999 Landon Curt Noll 35 | ## 36 | ## Calc is open software; you can redistribute it and/or modify it under 37 | ## the terms of the version 2.1 of the GNU Lesser General Public License 38 | ## as published by the Free Software Foundation. 39 | ## 40 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 41 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 42 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 43 | ## Public License for more details. 44 | ## 45 | ## A copy of version 2.1 of the GNU Lesser General Public License is 46 | ## distributed with calc under the filename COPYING-LGPL. You should have 47 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 48 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 49 | ## 50 | ## Under source code control: 1995/03/04 11:33:20 51 | ## File existed as early as: 1995 52 | ## 53 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 54 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 55 | -------------------------------------------------------------------------------- /help/fputs: -------------------------------------------------------------------------------- 1 | NAME 2 | fputs - write a string to a file 3 | 4 | SYNOPSIS 5 | fputs(fd, s1, s2, ...) 6 | 7 | TYPES 8 | fd file stream open for writing 9 | s1, s2, ... strings 10 | 11 | return null value 12 | 13 | DESCRIPTION 14 | This function writes in succession the strings s1, s2, ..., to the 15 | file associated with fd. 16 | 17 | EXAMPLE 18 | ; fd = fopen("/tmp/newfile", "w") 19 | ; fputs(fd, "chongo was", " here\n") 20 | ; fd2 = fopen("/tmp/newfile", "r") 21 | ; fgetline(fd2) 22 | "chongo was here" 23 | 24 | LIMITS 25 | The number of arguments is not to exceed 1024 26 | 27 | LINK LIBRARY 28 | none 29 | 30 | SEE ALSO 31 | errno, fclose, feof, ferror, fflush, fgetc, fgetfile, fgetline, fgets, 32 | files, fopen, fprintf, fputc, fseek, fsize, ftell, isfile 33 | 34 | ## Copyright (C) 1999 Landon Curt Noll 35 | ## 36 | ## Calc is open software; you can redistribute it and/or modify it under 37 | ## the terms of the version 2.1 of the GNU Lesser General Public License 38 | ## as published by the Free Software Foundation. 39 | ## 40 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 41 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 42 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 43 | ## Public License for more details. 44 | ## 45 | ## A copy of version 2.1 of the GNU Lesser General Public License is 46 | ## distributed with calc under the filename COPYING-LGPL. You should have 47 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 48 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 49 | ## 50 | ## Under source code control: 1995/03/04 11:33:20 51 | ## File existed as early as: 1995 52 | ## 53 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 54 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 55 | -------------------------------------------------------------------------------- /help/free: -------------------------------------------------------------------------------- 1 | NAME 2 | free - free the memory used to store values of lvalues 3 | 4 | SYNOPSIS 5 | free(a, b, ...) 6 | 7 | TYPES 8 | a, b, ... any 9 | 10 | return null value 11 | 12 | DESCRIPTION 13 | Those of the arguments a, b, ... that specify lvalues are assigned 14 | the null value, effectively freeing whatever memory is used to 15 | store their current values. Other arguments are ignored. 16 | 17 | free(.) frees the current "old value". 18 | 19 | EXAMPLE 20 | ; a = 7 21 | ; mat M[3] = {1, list(2,3,4), list(5,6)} 22 | ; print memsize(a), memsize(M) 23 | 80 736 24 | 25 | ; free(a, M[1]) 26 | ; print memsize(a), memsize(M) 27 | 16 424 28 | 29 | LIMITS 30 | none 31 | 32 | LINK LIBRARY 33 | none 34 | 35 | SEE ALSO 36 | freeglobals, freestatics, freeredc 37 | 38 | ## Copyright (C) 1999 Landon Curt Noll 39 | ## 40 | ## Calc is open software; you can redistribute it and/or modify it under 41 | ## the terms of the version 2.1 of the GNU Lesser General Public License 42 | ## as published by the Free Software Foundation. 43 | ## 44 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 45 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 46 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 47 | ## Public License for more details. 48 | ## 49 | ## A copy of version 2.1 of the GNU Lesser General Public License is 50 | ## distributed with calc under the filename COPYING-LGPL. You should have 51 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 52 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 53 | ## 54 | ## Under source code control: 1997/09/06 20:03:35 55 | ## File existed as early as: 1997 56 | ## 57 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 58 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 59 | -------------------------------------------------------------------------------- /help/freebernoulli: -------------------------------------------------------------------------------- 1 | NAME 2 | freebernoulli - free stored Bernoulli numbers 3 | 4 | SYNOPSIS 5 | freebernoulli() 6 | 7 | TYPES 8 | return none 9 | 10 | DESCRIPTION 11 | The memory used to store calculated bernoulli numbers is freed by 12 | freebernoulli(). 13 | 14 | EXAMPLE 15 | ; freebernoulli(); 16 | 17 | LIMITS 18 | none 19 | 20 | LINK LIBRARY 21 | void qfreebern(void); 22 | 23 | SEE ALSO 24 | bernoulli 25 | 26 | ## Copyright (C) 2000 Ernest Bowen 27 | ## 28 | ## Calc is open software; you can redistribute it and/or modify it under 29 | ## the terms of the version 2.1 of the GNU Lesser General Public License 30 | ## as published by the Free Software Foundation. 31 | ## 32 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 33 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 34 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 35 | ## Public License for more details. 36 | ## 37 | ## A copy of version 2.1 of the GNU Lesser General Public License is 38 | ## distributed with calc under the filename COPYING-LGPL. You should have 39 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 40 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 41 | ## 42 | ## Under source code control: 2000/07/13 43 | ## File existed as early as: 2000 44 | ## 45 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 46 | -------------------------------------------------------------------------------- /help/freeeuler: -------------------------------------------------------------------------------- 1 | NAME 2 | freeeuler - free stored Euler numbers 3 | 4 | SYNOPSIS 5 | freeeuler() 6 | 7 | TYPES 8 | return none 9 | 10 | DESCRIPTION 11 | The memory used to store calculated Euler numbers is freed by 12 | freeeuler(). 13 | 14 | EXAMPLE 15 | ; freeeuler(); 16 | 17 | LIMITS 18 | none 19 | 20 | LINK LIBRARY 21 | void qfreeeuler(void); 22 | 23 | SEE ALSO 24 | euler, bernoulli, freebernoulli 25 | 26 | ## Copyright (C) 2000 Ernest Bowen 27 | ## 28 | ## Calc is open software; you can redistribute it and/or modify it under 29 | ## the terms of the version 2.1 of the GNU Lesser General Public License 30 | ## as published by the Free Software Foundation. 31 | ## 32 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 33 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 34 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 35 | ## Public License for more details. 36 | ## 37 | ## A copy of version 2.1 of the GNU Lesser General Public License is 38 | ## distributed with calc under the filename COPYING-LGPL. You should have 39 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 40 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 41 | ## 42 | ## Under source code control: 2000/12/14 01:33:00 43 | ## File existed as early as: 2000 44 | ## 45 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 46 | -------------------------------------------------------------------------------- /help/freeredc: -------------------------------------------------------------------------------- 1 | NAME 2 | freeredc - free the memory used to store redc data 3 | 4 | SYNOPSIS 5 | freeredc() 6 | 7 | TYPES 8 | return null value 9 | 10 | DESCRIPTION 11 | This function frees the memory used for any redc data currently stored by 12 | calls to rcin, rcout, etc. 13 | 14 | EXAMPLE 15 | ; a = rcin(10,27) 16 | ; b = rcin(10,15) 17 | ; show redc 18 | 0 1 27 19 | 1 2 15 20 | ; freeredc() 21 | ; show redc 22 | 23 | LIMITS 24 | none 25 | 26 | LINK LIBRARY 27 | none 28 | 29 | SEE ALSO 30 | free, freeglobals, freestatics 31 | 32 | ## Copyright (C) 1999-2006 Landon Curt Noll 33 | ## 34 | ## Calc is open software; you can redistribute it and/or modify it under 35 | ## the terms of the version 2.1 of the GNU Lesser General Public License 36 | ## as published by the Free Software Foundation. 37 | ## 38 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 39 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 40 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 41 | ## Public License for more details. 42 | ## 43 | ## A copy of version 2.1 of the GNU Lesser General Public License is 44 | ## distributed with calc under the filename COPYING-LGPL. You should have 45 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 46 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 47 | ## 48 | ## Under source code control: 1997/09/06 20:03:35 49 | ## File existed as early as: 1997 50 | ## 51 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 52 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 53 | -------------------------------------------------------------------------------- /help/fsize: -------------------------------------------------------------------------------- 1 | NAME 2 | fsize - return the file size 3 | 4 | SYNOPSIS 5 | fsize(fd) 6 | 7 | TYPES 8 | fd file 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | This function returns the number of bytes in a file. When at 14 | the end of file, ftell returns a value which is 1 greater than 15 | the file size as reported by fsize. 16 | 17 | EXAMPLE 18 | ; fd = fopen("/etc/motd", "r") 19 | ; fsize(fd) 20 | 784 21 | 22 | LIMITS 23 | fd must be associated with an open file 24 | 25 | LINK LIBRARY 26 | none 27 | 28 | SEE ALSO 29 | errno, fclose, feof, ferror, fflush, fgetc, fgetline, fgets, files, fopen, 30 | fprintf, fputc, fputs, fseek, fsize, ftell, isfile, printf, prompt 31 | 32 | ## Copyright (C) 1999 Landon Curt Noll 33 | ## 34 | ## Calc is open software; you can redistribute it and/or modify it under 35 | ## the terms of the version 2.1 of the GNU Lesser General Public License 36 | ## as published by the Free Software Foundation. 37 | ## 38 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 39 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 40 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 41 | ## Public License for more details. 42 | ## 43 | ## A copy of version 2.1 of the GNU Lesser General Public License is 44 | ## distributed with calc under the filename COPYING-LGPL. You should have 45 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 46 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 47 | ## 48 | ## Under source code control: 1995/03/04 11:33:20 49 | ## File existed as early as: 1995 50 | ## 51 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 52 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 53 | -------------------------------------------------------------------------------- /help/funclist.sed: -------------------------------------------------------------------------------- 1 | s/VALUE/int/ 2 | s/NUMBER[ ]*\*/int / 3 | s/NUMBER/int/ 4 | s/STRINGHEAD/int/ 5 | s/\(".*",.*,.*\),.*,.*,.*,.*,/\1, 0, 0, {.null = NULL}, {.null = NULL},/ 6 | s/[ ][ ]*$// 7 | p 8 | 9 | ## Copyright (C) 1999,2023 Landon Curt Noll 10 | ## 11 | ## Calc is open software; you can redistribute it and/or modify it under 12 | ## the terms of the version 2.1 of the GNU Lesser General Public License 13 | ## as published by the Free Software Foundation. 14 | ## 15 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 16 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 17 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 18 | ## Public License for more details. 19 | ## 20 | ## A copy of version 2.1 of the GNU Lesser General Public License is 21 | ## distributed with calc under the filename COPYING-LGPL. You should have 22 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 23 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 24 | ## 25 | ## Under source code control: 1995/07/10 01:33:06 26 | ## File existed as early as: 1995 27 | ## 28 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 29 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 30 | -------------------------------------------------------------------------------- /help/g2d: -------------------------------------------------------------------------------- 1 | NAME 2 | g2d - convert gradians to degrees 3 | 4 | SYNOPSIS 5 | g2d(x [,eps]) 6 | 7 | TYPES 8 | x number (real or complex) 9 | eps eps value is ignored 10 | 11 | return number 12 | 13 | DESCRIPTION 14 | Given x gradians, return the equivalent number of degrees. 15 | 16 | The eps argument is ignored. 17 | 18 | EXAMPLE 19 | ; print g2d(50), g2d(200), g2d(30) 20 | 45 180 27 21 | 22 | ; print g2d(3i+2) 23 | 1.8+2.7i 24 | 25 | LIMITS 26 | none 27 | 28 | LINK LIBRARY 29 | none 30 | 31 | SEE ALSO 32 | d2r, r2d, g2r, r2g, d2g, 33 | sin, cos, tan, sec, csc, cot, epsilon 34 | 35 | ## Copyright (C) 2021,2023 Landon Curt Noll 36 | ## 37 | ## Calc is open software; you can redistribute it and/or modify it under 38 | ## the terms of the version 2.1 of the GNU Lesser General Public License 39 | ## as published by the Free Software Foundation. 40 | ## 41 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 42 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 43 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 44 | ## Public License for more details. 45 | ## 46 | ## A copy of version 2.1 of the GNU Lesser General Public License is 47 | ## distributed with calc under the filename COPYING-LGPL. You should have 48 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 49 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 50 | ## 51 | ## Under source code control: 2021/09/07 12:04:28 52 | ## File existed as early as: 2021 53 | ## 54 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 55 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 56 | -------------------------------------------------------------------------------- /help/gcd: -------------------------------------------------------------------------------- 1 | NAME 2 | gcd - greatest common divisor of a set of rational numbers 3 | 4 | SYNOPSIS 5 | gcd(x1, x2, ...) 6 | 7 | TYPES 8 | x1, x2, ... rational number 9 | 10 | return rational number 11 | 12 | DESCRIPTION 13 | If at least one xi is nonzero, gcd(x1, x2, ...) is the 14 | greatest positive number g for which each xi is a multiple of g. 15 | If all xi are zero, the gcd is zero. 16 | 17 | EXAMPLE 18 | ; print gcd(12, -24, 30), gcd(9/10, 11/5, 4/25), gcd(0,0,0,0,0) 19 | 6 0.02 0 20 | 21 | LIMITS 22 | The number of arguments may not to exceed 1024. 23 | 24 | LINK LIBRARY 25 | NUMBER *qgcd(NUMBER *x1, NUMBER *x2) 26 | 27 | SEE ALSO 28 | lcm 29 | 30 | ## Copyright (C) 1999-2006,2021 Landon Curt Noll 31 | ## 32 | ## Calc is open software; you can redistribute it and/or modify it under 33 | ## the terms of the version 2.1 of the GNU Lesser General Public License 34 | ## as published by the Free Software Foundation. 35 | ## 36 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 37 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 38 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 39 | ## Public License for more details. 40 | ## 41 | ## A copy of version 2.1 of the GNU Lesser General Public License is 42 | ## distributed with calc under the filename COPYING-LGPL. You should have 43 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 44 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 45 | ## 46 | ## Under source code control: 1995/10/05 04:52:26 47 | ## File existed as early as: 1995 48 | ## 49 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 50 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 51 | -------------------------------------------------------------------------------- /help/getenv: -------------------------------------------------------------------------------- 1 | NAME 2 | getenv - get an environment variable 3 | 4 | SYNOPSIS 5 | getenv(env) 6 | 7 | TYPES 8 | env str 9 | 10 | return str or nil 11 | 12 | DESCRIPTION 13 | This function returns the value of the environment variable named by 14 | the string env. If no such environment variable exists, nil is returned. 15 | 16 | EXAMPLE 17 | ; putenv("name", "value") 18 | 0 19 | ; getenv("name") 20 | "value" 21 | ; putenv("name=val2") 22 | 0 23 | ; getenv("name") 24 | "val2" 25 | ; isnull(getenv("unknown")) 26 | 1 27 | 28 | LIMITS 29 | none 30 | 31 | LINK LIBRARY 32 | none 33 | 34 | SEE ALSO 35 | putenv 36 | 37 | ## Copyright (C) 1999 Landon Curt Noll 38 | ## 39 | ## Calc is open software; you can redistribute it and/or modify it under 40 | ## the terms of the version 2.1 of the GNU Lesser General Public License 41 | ## as published by the Free Software Foundation. 42 | ## 43 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 44 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 45 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 46 | ## Public License for more details. 47 | ## 48 | ## A copy of version 2.1 of the GNU Lesser General Public License is 49 | ## distributed with calc under the filename COPYING-LGPL. You should have 50 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 51 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 52 | ## 53 | ## Under source code control: 1995/07/09 03:48:57 54 | ## File existed as early as: 1995 55 | ## 56 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 57 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 58 | -------------------------------------------------------------------------------- /help/highbit: -------------------------------------------------------------------------------- 1 | NAME 2 | highbit - index of highest bit in binary representation of integer 3 | 4 | SYNOPSIS 5 | highbit(x) 6 | 7 | TYPES 8 | x nonzero integer 9 | 10 | return integer 11 | 12 | DESCRIPTION 13 | If x is a nonzero integer, highbit(x) returns the index of the 14 | highest bit in the binary representation of abs(x). Equivalently, 15 | highbit(x) = n if 2^n <= abs(x) < 2^(n + 1); the binary 16 | representation of x then has n + 1 digits. 17 | 18 | EXAMPLE 19 | ; print highbit(2), highbit(3), highbit(4), highbit(-15), highbit(2^27) 20 | 1 1 2 3 27 21 | 22 | LIMITS 23 | none 24 | 25 | LINK LIBRARY 26 | LEN zhighbit(ZVALUE x); 27 | 28 | SEE ALSO 29 | lowbit, digits 30 | 31 | ## Copyright (C) 1999 Landon Curt Noll 32 | ## 33 | ## Calc is open software; you can redistribute it and/or modify it under 34 | ## the terms of the version 2.1 of the GNU Lesser General Public License 35 | ## as published by the Free Software Foundation. 36 | ## 37 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 38 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 39 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 40 | ## Public License for more details. 41 | ## 42 | ## A copy of version 2.1 of the GNU Lesser General Public License is 43 | ## distributed with calc under the filename COPYING-LGPL. You should have 44 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 45 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 46 | ## 47 | ## Under source code control: 1995/10/03 10:40:02 48 | ## File existed as early as: 1995 49 | ## 50 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 51 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 52 | -------------------------------------------------------------------------------- /help/hypot: -------------------------------------------------------------------------------- 1 | NAME 2 | hypot - hypotenuse of a right-angled triangle given the other sides 3 | 4 | SYNOPSIS 5 | hypot(x, y [,eps]) 6 | 7 | TYPES 8 | x, y real 9 | eps nonzero real, defaults to epsilon() 10 | 11 | return real 12 | 13 | DESCRIPTION 14 | Returns sqrt(x^2 + y^2) to the nearest multiple of eps. 15 | The default value for eps is epsilon(). 16 | 17 | EXAMPLE 18 | ; print hypot(3, 4, 1e-6), hypot(2, -3, 1e-6) 19 | 5 3.605551 20 | 21 | LIMITS 22 | eps != 0 23 | 24 | LINK LIBRARY 25 | NUMBER *qhypot(NUMBER *q1, *q2, *epsilon) 26 | 27 | SEE ALSO 28 | ltol 29 | 30 | ## Copyright (C) 1999,2023 Landon Curt Noll 31 | ## 32 | ## Calc is open software; you can redistribute it and/or modify it under 33 | ## the terms of the version 2.1 of the GNU Lesser General Public License 34 | ## as published by the Free Software Foundation. 35 | ## 36 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 37 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 38 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 39 | ## Public License for more details. 40 | ## 41 | ## A copy of version 2.1 of the GNU Lesser General Public License is 42 | ## distributed with calc under the filename COPYING-LGPL. You should have 43 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 44 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 45 | ## 46 | ## Under source code control: 1995/10/05 04:52:26 47 | ## File existed as early as: 1995 48 | ## 49 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 50 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 51 | -------------------------------------------------------------------------------- /help/ilog: -------------------------------------------------------------------------------- 1 | NAME 2 | ilog - floor of logarithm to specified integer base 3 | ilogn - floor of logarithm to specified integer base 4 | 5 | SYNOPSIS 6 | ilog(x, b) 7 | ilogn(x, b) 8 | 9 | TYPES 10 | x nonzero real 11 | b integer greater than 1 12 | 13 | return integer 14 | 15 | DESCRIPTION 16 | Returns the greatest integer n for which b^n <= abs(x). 17 | 18 | The ilogn function is an alias for ilog. 19 | 20 | EXAMPLE 21 | ; print ilog(2, 3), ilog(8, 3), ilog(8.9, 3), ilog(1/8, 3) 22 | 0 1 1 -2 23 | 24 | ; print ilogn(2, 3), ilogn(8, 3), ilogn(8.9, 3), ilogn(1/8, 3) 25 | 0 1 1 -2 26 | 27 | LIMITS 28 | x > 0 29 | b > 1 30 | 31 | LINK LIBRARY 32 | long zlog(ZVALUE x, ZVALUE b) 33 | 34 | SEE ALSO 35 | ilog10, ilog2, ln, log, log2, logn 36 | 37 | ## Copyright (C) 1999,2023 Landon Curt Noll 38 | ## 39 | ## Calc is open software; you can redistribute it and/or modify it under 40 | ## the terms of the version 2.1 of the GNU Lesser General Public License 41 | ## as published by the Free Software Foundation. 42 | ## 43 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 44 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 45 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 46 | ## Public License for more details. 47 | ## 48 | ## A copy of version 2.1 of the GNU Lesser General Public License is 49 | ## distributed with calc under the filename COPYING-LGPL. You should have 50 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 51 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 52 | ## 53 | ## Under source code control: 1995/10/25 04:03:45 54 | ## File existed as early as: 1995 55 | ## 56 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 57 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 58 | -------------------------------------------------------------------------------- /help/ilog10: -------------------------------------------------------------------------------- 1 | NAME 2 | ilog10 - floor of logarithm to base 10 3 | 4 | SYNOPSIS 5 | ilog10(x) 6 | 7 | TYPES 8 | x nonzero real 9 | 10 | return integer 11 | 12 | DESCRIPTION 13 | Returns the greatest integer n for which 10^n <= x. 14 | 15 | EXAMPLE 16 | ; print ilog10(7), ilog10(77.7), ilog10(777), ilog10(.00777), ilog10(-1e27) 17 | 0 1 2 -3 27 18 | 19 | LIMITS 20 | none 21 | 22 | LINK LIBRARY 23 | long qilog10(NUMBER *q) 24 | 25 | SEE ALSO 26 | ilog, ilogn, ilog2, ln, log, log2, logn 27 | 28 | ## Copyright (C) 1999,2023 Landon Curt Noll 29 | ## 30 | ## Calc is open software; you can redistribute it and/or modify it under 31 | ## the terms of the version 2.1 of the GNU Lesser General Public License 32 | ## as published by the Free Software Foundation. 33 | ## 34 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 35 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 36 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 37 | ## Public License for more details. 38 | ## 39 | ## A copy of version 2.1 of the GNU Lesser General Public License is 40 | ## distributed with calc under the filename COPYING-LGPL. You should have 41 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 42 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 43 | ## 44 | ## Under source code control: 1995/10/03 10:40:02 45 | ## File existed as early as: 1995 46 | ## 47 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 48 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 49 | -------------------------------------------------------------------------------- /help/ilog2: -------------------------------------------------------------------------------- 1 | NAME 2 | ilog2 - floor of logarithm to base 2 3 | 4 | SYNOPSIS 5 | ilog2(x) 6 | 7 | TYPES 8 | x nonzero real 9 | 10 | return integer 11 | 12 | DESCRIPTION 13 | Returns the greatest integer n for which 2^n <= abs(x). 14 | 15 | EXAMPLE 16 | ; print ilog2(1), ilog2(2), ilog2(3), ilog2(4), ilog(1/15) 17 | 0 1 1 2 -4 18 | 19 | LIMITS 20 | none 21 | 22 | LINK LIBRARY 23 | long qilog2(NUMBER *q) 24 | 25 | SEE ALSO 26 | ilog, ilogn, ilog10, ln, log, log2, logn 27 | 28 | ## Copyright (C) 1999,2023 Landon Curt Noll 29 | ## 30 | ## Calc is open software; you can redistribute it and/or modify it under 31 | ## the terms of the version 2.1 of the GNU Lesser General Public License 32 | ## as published by the Free Software Foundation. 33 | ## 34 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 35 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 36 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 37 | ## Public License for more details. 38 | ## 39 | ## A copy of version 2.1 of the GNU Lesser General Public License is 40 | ## distributed with calc under the filename COPYING-LGPL. You should have 41 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 42 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 43 | ## 44 | ## Under source code control: 1995/10/03 10:40:02 45 | ## File existed as early as: 1995 46 | ## 47 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 48 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 49 | -------------------------------------------------------------------------------- /help/im: -------------------------------------------------------------------------------- 1 | NAME 2 | im - imaginary part of a real or complex number 3 | 4 | SYNOPSIS 5 | im(x) 6 | 7 | TYPES 8 | x real or complex 9 | 10 | return real 11 | 12 | DESCRIPTION 13 | If x = u + v * 1i where u and v are real, im(x) returns v. 14 | 15 | EXAMPLE 16 | ; print im(2), im(2 + 3i), im(-4.25 - 7i) 17 | 0 3 -7 18 | 19 | LIMITS 20 | none 21 | 22 | LINK LIBRARY 23 | COMPLEX *c_imag(COMPLEX *x) 24 | 25 | SEE ALSO 26 | re 27 | 28 | ## Copyright (C) 1999 Landon Curt Noll 29 | ## 30 | ## Calc is open software; you can redistribute it and/or modify it under 31 | ## the terms of the version 2.1 of the GNU Lesser General Public License 32 | ## as published by the Free Software Foundation. 33 | ## 34 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 35 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 36 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 37 | ## Public License for more details. 38 | ## 39 | ## A copy of version 2.1 of the GNU Lesser General Public License is 40 | ## distributed with calc under the filename COPYING-LGPL. You should have 41 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 42 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 43 | ## 44 | ## Under source code control: 1995/10/05 04:52:26 45 | ## File existed as early as: 1995 46 | ## 47 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 48 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 49 | -------------------------------------------------------------------------------- /help/iroot: -------------------------------------------------------------------------------- 1 | NAME 2 | iroot - integer part of specified root 3 | 4 | SYNOPSIS 5 | iroot(x, n) 6 | 7 | TYPES 8 | x nonnegative real 9 | n positive integer 10 | 11 | return nonnegative real 12 | 13 | DESCRIPTION 14 | Return the greatest integer v for which v^n <= x. 15 | 16 | EXAMPLE 17 | ; print iroot(100,3), iroot(274,3), iroot(1,9), iroot(pi()^8,5) 18 | 4 6 1 6 19 | 20 | LIMITS 21 | n > 0 22 | 23 | LINK LIBRARY 24 | NUMBER *qiroot(NUMBER *x, NUMBER* n) 25 | 26 | SEE ALSO 27 | isqrt, sqrt 28 | 29 | ## Copyright (C) 1999 Landon Curt Noll 30 | ## 31 | ## Calc is open software; you can redistribute it and/or modify it under 32 | ## the terms of the version 2.1 of the GNU Lesser General Public License 33 | ## as published by the Free Software Foundation. 34 | ## 35 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 36 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 37 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 38 | ## Public License for more details. 39 | ## 40 | ## A copy of version 2.1 of the GNU Lesser General Public License is 41 | ## distributed with calc under the filename COPYING-LGPL. You should have 42 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 43 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 44 | ## 45 | ## Under source code control: 1995/10/25 04:03:45 46 | ## File existed as early as: 1995 47 | ## 48 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 49 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 50 | -------------------------------------------------------------------------------- /help/isalnum: -------------------------------------------------------------------------------- 1 | NAME 2 | isalnum - whether character is alpha-numeric 3 | 4 | SYNOPSIS 5 | isalnum(c) 6 | 7 | TYPES 8 | c string 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if c is alpha-numeric. This function will return 1 if c is 14 | alpha-numeric, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; print isalnum("A"), isalnum("a"), isalnum("2"), isalnum("\t") 18 | 1 1 1 0 19 | 20 | LIMITS 21 | none 22 | 23 | LINK LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | islower, isupper, isalpha, iscntrl, isdigit, isgraph, isprint, 28 | ispunct, isspace, isxdigit 29 | 30 | ## Copyright (C) 2013 Christoph Zurnieden 31 | ## 32 | ## Calc is open software; you can redistribute it and/or modify it under 33 | ## the terms of the version 2.1 of the GNU Lesser General Public License 34 | ## as published by the Free Software Foundation. 35 | ## 36 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 37 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 38 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 39 | ## Public License for more details. 40 | ## 41 | ## A copy of version 2.1 of the GNU Lesser General Public License is 42 | ## distributed with calc under the filename COPYING-LGPL. You should have 43 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 44 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 45 | ## 46 | ## Under source code control: 2013/09/01 18:10:53 47 | ## File existed as early as: 2013 48 | ## 49 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 50 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 51 | -------------------------------------------------------------------------------- /help/isalpha: -------------------------------------------------------------------------------- 1 | NAME 2 | isalpha - whether character is alphabetic 3 | 4 | SYNOPSIS 5 | isalpha(c) 6 | 7 | TYPES 8 | c string 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if c is alphabetic. This function will return 1 if c is 14 | alphabetic, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; print isalpha("A"), isalpha("a"), isalpha("1"), isalpha("\t") 18 | 1 1 0 0 19 | 20 | LIMITS 21 | none 22 | 23 | LINK LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | islower, isupper, isalnum, iscntrl, isdigit, isgraph, isprint, 28 | ispunct, isspace, isxdigit 29 | 30 | ## Copyright (C) 2013 Christoph Zurnieden 31 | ## 32 | ## Calc is open software; you can redistribute it and/or modify it under 33 | ## the terms of the version 2.1 of the GNU Lesser General Public License 34 | ## as published by the Free Software Foundation. 35 | ## 36 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 37 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 38 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 39 | ## Public License for more details. 40 | ## 41 | ## A copy of version 2.1 of the GNU Lesser General Public License is 42 | ## distributed with calc under the filename COPYING-LGPL. You should have 43 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 44 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 45 | ## 46 | ## Under source code control: 2013/09/01 18:10:53 47 | ## File existed as early as: 2013 48 | ## 49 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 50 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 51 | -------------------------------------------------------------------------------- /help/isassoc: -------------------------------------------------------------------------------- 1 | NAME 2 | isassoc - whether a value is an association. 3 | 4 | SYNOPSIS 5 | isassoc(x) 6 | 7 | TYPES 8 | x any, &any 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if x is an association. This function will return 1 if x is 14 | an association, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; a = assoc() 18 | ; print isassoc(a), isassoc(1) 19 | 1 0 20 | 21 | LIMITS 22 | none 23 | 24 | LINK LIBRARY 25 | none 26 | 27 | SEE ALSO 28 | assoc, 29 | isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, 30 | ishash, isident, isint, islist, ismat, ismult, isnull, isnum, isobj, 31 | isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, 32 | issimple, issq, isstr, istype 33 | 34 | ## Copyright (C) 1999 Landon Curt Noll 35 | ## 36 | ## Calc is open software; you can redistribute it and/or modify it under 37 | ## the terms of the version 2.1 of the GNU Lesser General Public License 38 | ## as published by the Free Software Foundation. 39 | ## 40 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 41 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 42 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 43 | ## Public License for more details. 44 | ## 45 | ## A copy of version 2.1 of the GNU Lesser General Public License is 46 | ## distributed with calc under the filename COPYING-LGPL. You should have 47 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 48 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 49 | ## 50 | ## Under source code control: 1994/10/21 02:21:27 51 | ## File existed as early as: 1994 52 | ## 53 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 54 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 55 | -------------------------------------------------------------------------------- /help/iscntrl: -------------------------------------------------------------------------------- 1 | NAME 2 | iscntrl - whether character is a control character 3 | 4 | SYNOPSIS 5 | iscntrl(c) 6 | 7 | TYPES 8 | c string 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if c is a control character. This function will return 1 if c is 14 | alphabetic, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; print iscntrl("A"), iscntrl("a"), iscntrl("1"), iscntrl("\t") 18 | 0 0 0 1 19 | 20 | LIMITS 21 | none 22 | 23 | LINK LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | islower, isupper, isalnum, isalpha, isdigit, isgraph, isprint, 28 | ispunct, isspace, isxdigit 29 | 30 | ## Copyright (C) 2013 Christoph Zurnieden 31 | ## 32 | ## Calc is open software; you can redistribute it and/or modify it under 33 | ## the terms of the version 2.1 of the GNU Lesser General Public License 34 | ## as published by the Free Software Foundation. 35 | ## 36 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 37 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 38 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 39 | ## Public License for more details. 40 | ## 41 | ## A copy of version 2.1 of the GNU Lesser General Public License is 42 | ## distributed with calc under the filename COPYING-LGPL. You should have 43 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 44 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 45 | ## 46 | ## Under source code control: 2013/09/01 18:10:53 47 | ## File existed as early as: 2013 48 | ## 49 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 50 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 51 | -------------------------------------------------------------------------------- /help/isconfig: -------------------------------------------------------------------------------- 1 | NAME 2 | isconfig - whether a value is a configuration state 3 | 4 | SYNOPSIS 5 | isconfig(x) 6 | 7 | TYPES 8 | x any, &any 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if x is a configuration state. This function will return 14 | 1 if x is a file, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; a = config("all") 18 | ; print isconfig(a), isconfig(0); 19 | 1 0 20 | 21 | LIMITS 22 | none 23 | 24 | LINK LIBRARY 25 | none 26 | 27 | SEE ALSO 28 | config, 29 | isassoc, isatty, isblk, isdefined, iserror, iseven, isfile, 30 | ishash, isident, isint, islist, ismat, ismult, isnull, isnum, isobj, 31 | isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, 32 | issimple, issq, isstr, istype 33 | 34 | ## Copyright (C) 1999 Landon Curt Noll 35 | ## 36 | ## Calc is open software; you can redistribute it and/or modify it under 37 | ## the terms of the version 2.1 of the GNU Lesser General Public License 38 | ## as published by the Free Software Foundation. 39 | ## 40 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 41 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 42 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 43 | ## Public License for more details. 44 | ## 45 | ## A copy of version 2.1 of the GNU Lesser General Public License is 46 | ## distributed with calc under the filename COPYING-LGPL. You should have 47 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 48 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 49 | ## 50 | ## Under source code control: 1995/11/11 05:09:41 51 | ## File existed as early as: 1995 52 | ## 53 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 54 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 55 | -------------------------------------------------------------------------------- /help/isdigit: -------------------------------------------------------------------------------- 1 | NAME 2 | isdigit - whether character is a digit character 3 | 4 | SYNOPSIS 5 | isdigit(c) 6 | 7 | TYPES 8 | c string 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if c is a digit character. This function will return 1 if c is 14 | a digit character, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; print isdigit("A"), isdigit("a"), isdigit("1"), isdigit("\t") 18 | 0 0 1 0 19 | 20 | LIMITS 21 | none 22 | 23 | LINK LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | islower, isupper, isalnum, isalpha, iscntrl, isgraph, isprint, 28 | ispunct, isspace, isxdigit 29 | 30 | ## Copyright (C) 2013 Christoph Zurnieden 31 | ## 32 | ## Calc is open software; you can redistribute it and/or modify it under 33 | ## the terms of the version 2.1 of the GNU Lesser General Public License 34 | ## as published by the Free Software Foundation. 35 | ## 36 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 37 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 38 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 39 | ## Public License for more details. 40 | ## 41 | ## A copy of version 2.1 of the GNU Lesser General Public License is 42 | ## distributed with calc under the filename COPYING-LGPL. You should have 43 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 44 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 45 | ## 46 | ## Under source code control: 2013/09/01 18:10:53 47 | ## File existed as early as: 2013 48 | ## 49 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 50 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 51 | -------------------------------------------------------------------------------- /help/iseven: -------------------------------------------------------------------------------- 1 | NAME 2 | iseven - whether a value is an even integer 3 | 4 | SYNOPSIS 5 | iseven(x) 6 | 7 | TYPES 8 | x any, &any 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if x is an even integer. This function will return 1 if x is 14 | even integer, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; print iseven(2.0), iseven(1), iseven("0") 18 | 1 0 0 19 | 20 | ; print iseven(2i), iseven(1e20), iseven(1/3) 21 | 0 1 0 22 | 23 | LIMITS 24 | none 25 | 26 | LINK LIBRARY 27 | none 28 | 29 | SEE ALSO 30 | isassoc, isatty, isblk, isconfig, isdefined, iserror, isfile, 31 | ishash, isident, isint, islist, ismat, ismult, isnull, isnum, isobj, 32 | isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, 33 | issimple, issq, isstr, istype 34 | 35 | ## Copyright (C) 1999 Landon Curt Noll 36 | ## 37 | ## Calc is open software; you can redistribute it and/or modify it under 38 | ## the terms of the version 2.1 of the GNU Lesser General Public License 39 | ## as published by the Free Software Foundation. 40 | ## 41 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 42 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 43 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 44 | ## Public License for more details. 45 | ## 46 | ## A copy of version 2.1 of the GNU Lesser General Public License is 47 | ## distributed with calc under the filename COPYING-LGPL. You should have 48 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 49 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 50 | ## 51 | ## Under source code control: 1994/10/21 02:21:27 52 | ## File existed as early as: 1994 53 | ## 54 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 55 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 56 | -------------------------------------------------------------------------------- /help/isfile: -------------------------------------------------------------------------------- 1 | NAME 2 | isfile - whether a value is a file 3 | 4 | SYNOPSIS 5 | isfile(x) 6 | 7 | TYPES 8 | x any 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if x is a file. This function will return 1 if x is 14 | a file, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; a = files(0) 18 | ; print isfile(a), isfile(files(1)), isfile(1) 19 | 1 1 0 20 | 21 | LIMITS 22 | none 23 | 24 | LINK LIBRARY 25 | none 26 | 27 | SEE ALSO 28 | isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, 29 | ishash, isident, isint, islist, ismat, ismult, isnull, isnum, isobj, 30 | isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, 31 | issimple, issq, isstr, istype 32 | 33 | ## Copyright (C) 1999 Landon Curt Noll 34 | ## 35 | ## Calc is open software; you can redistribute it and/or modify it under 36 | ## the terms of the version 2.1 of the GNU Lesser General Public License 37 | ## as published by the Free Software Foundation. 38 | ## 39 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 40 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 41 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 42 | ## Public License for more details. 43 | ## 44 | ## A copy of version 2.1 of the GNU Lesser General Public License is 45 | ## distributed with calc under the filename COPYING-LGPL. You should have 46 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 47 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 48 | ## 49 | ## Under source code control: 1994/10/21 02:21:27 50 | ## File existed as early as: 1994 51 | ## 52 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 53 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 54 | -------------------------------------------------------------------------------- /help/isgraph: -------------------------------------------------------------------------------- 1 | NAME 2 | isgraph - whether character is a graphical character 3 | 4 | SYNOPSIS 5 | isgraph(c) 6 | 7 | TYPES 8 | c string 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if c is a graphical character. This function will return 1 if c 14 | is graphical, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; print isgraph("A"), isgraph("a"), isgraph("1"), isgraph(" ") 18 | 1 1 1 0 19 | 20 | LIMITS 21 | none 22 | 23 | LINK LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | islower, isupper, isalnum, isalpha, iscntrl, isdigit, isprint, 28 | ispunct, isspace, isxdigit 29 | 30 | ## Copyright (C) 2013 Christoph Zurnieden 31 | ## 32 | ## Calc is open software; you can redistribute it and/or modify it under 33 | ## the terms of the version 2.1 of the GNU Lesser General Public License 34 | ## as published by the Free Software Foundation. 35 | ## 36 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 37 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 38 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 39 | ## Public License for more details. 40 | ## 41 | ## A copy of version 2.1 of the GNU Lesser General Public License is 42 | ## distributed with calc under the filename COPYING-LGPL. You should have 43 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 44 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 45 | ## 46 | ## Under source code control: 2013/09/01 18:10:53 47 | ## File existed as early as: 2013 48 | ## 49 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 50 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 51 | -------------------------------------------------------------------------------- /help/ishash: -------------------------------------------------------------------------------- 1 | NAME 2 | ishash - whether a value is a hash state 3 | 4 | SYNOPSIS 5 | ishash(x) 6 | 7 | TYPES 8 | x any 9 | 10 | return integer 11 | 12 | DESCRIPTION 13 | The value returned by ishash(x) is: 14 | 15 | 0 if x is not a hash state, 16 | 2 if x is a sha1 hash state, 17 | 18 | EXAMPLE 19 | ; a = 1; b = sha1(0); c = sha1(a) 20 | ; print ishash(0), ishash(a), ishash(b), ishash(c), ishash(sha1(a)) 21 | 0 0 2 2 2 22 | 23 | LIMITS 24 | none 25 | 26 | LINK LIBRARY 27 | none 28 | 29 | SEE ALSO 30 | isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, 31 | isident, isint, islist, ismat, ismult, isnull, isnum, isobj, 32 | isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, 33 | issimple, issq, isstr, istype, sha1 34 | 35 | ## Copyright (C) 1999-2007 Landon Curt Noll 36 | ## 37 | ## Calc is open software; you can redistribute it and/or modify it under 38 | ## the terms of the version 2.1 of the GNU Lesser General Public License 39 | ## as published by the Free Software Foundation. 40 | ## 41 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 42 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 43 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 44 | ## Public License for more details. 45 | ## 46 | ## A copy of version 2.1 of the GNU Lesser General Public License is 47 | ## distributed with calc under the filename COPYING-LGPL. You should have 48 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 49 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 50 | ## 51 | ## Under source code control: 1995/11/11 05:09:41 52 | ## File existed as early as: 1995 53 | ## 54 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 55 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 56 | -------------------------------------------------------------------------------- /help/isident: -------------------------------------------------------------------------------- 1 | NAME 2 | isident - returns 1 if matrix is an identity matrix 3 | 4 | SYNOPSIS 5 | isident(m) 6 | 7 | TYPES 8 | m any 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | This function returns 1 if m is an 2 dimensional identity matrix, 14 | 0 otherwise. 15 | 16 | EXAMPLE 17 | ; mat x[3,3] = {1,0,0,0,1,0,0,0,1}; 18 | ; isident(x) 19 | 1 20 | 21 | LIMITS 22 | none 23 | 24 | LINK LIBRARY 25 | none 26 | 27 | SEE ALSO 28 | mat, matdim, matfill, matmax, matmin, matsum, mattrans, 29 | isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, 30 | ishash, isint, islist, ismat, ismult, isnull, isnum, isobj, 31 | isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, 32 | issimple, issq, isstr, istype 33 | 34 | ## Copyright (C) 1999 Landon Curt Noll 35 | ## 36 | ## Calc is open software; you can redistribute it and/or modify it under 37 | ## the terms of the version 2.1 of the GNU Lesser General Public License 38 | ## as published by the Free Software Foundation. 39 | ## 40 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 41 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 42 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 43 | ## Public License for more details. 44 | ## 45 | ## A copy of version 2.1 of the GNU Lesser General Public License is 46 | ## distributed with calc under the filename COPYING-LGPL. You should have 47 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 48 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 49 | ## 50 | ## Under source code control: 1995/07/09 18:25:36 51 | ## File existed as early as: 1995 52 | ## 53 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 54 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 55 | -------------------------------------------------------------------------------- /help/isint: -------------------------------------------------------------------------------- 1 | NAME 2 | isint - whether a value is an integer 3 | 4 | SYNOPSIS 5 | isint(x) 6 | 7 | TYPES 8 | x any, &any 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if x is an integer. This function will return 1 if x is 14 | integer, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; print isint(2.0), isint(1), isint("0") 18 | 1 1 0 19 | 20 | ; print isint(2i), isint(1e20), isint(1/3) 21 | 0 1 0 22 | 23 | LIMITS 24 | none 25 | 26 | LINK LIBRARY 27 | none 28 | 29 | SEE ALSO 30 | int, 31 | isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, 32 | ishash, isident, islist, ismat, ismult, isnull, isnum, isobj, 33 | isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, 34 | issimple, issq, isstr, istype 35 | 36 | ## Copyright (C) 1999 Landon Curt Noll 37 | ## 38 | ## Calc is open software; you can redistribute it and/or modify it under 39 | ## the terms of the version 2.1 of the GNU Lesser General Public License 40 | ## as published by the Free Software Foundation. 41 | ## 42 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 43 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 44 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 45 | ## Public License for more details. 46 | ## 47 | ## A copy of version 2.1 of the GNU Lesser General Public License is 48 | ## distributed with calc under the filename COPYING-LGPL. You should have 49 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 50 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 51 | ## 52 | ## Under source code control: 1994/10/21 02:21:27 53 | ## File existed as early as: 1994 54 | ## 55 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 56 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 57 | -------------------------------------------------------------------------------- /help/islist: -------------------------------------------------------------------------------- 1 | NAME 2 | islist - whether a value is a list 3 | 4 | SYNOPSIS 5 | islist(x) 6 | 7 | TYPES 8 | x any, &any 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if x is a list. This function will return 1 if x is 14 | a list, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; lst = list(2,3,4) 18 | ; print islist(lst), islist(1) 19 | 1 0 20 | 21 | LIMITS 22 | none 23 | 24 | LINK LIBRARY 25 | none 26 | 27 | SEE ALSO 28 | append, delete, insert, pop, push, remove, rsearch, search, 29 | select, size, 30 | 31 | isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, 32 | ishash, isident, isint, ismat, ismult, isnull, isnum, isobj, 33 | isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, 34 | issimple, issq, isstr, istype 35 | 36 | ## Copyright (C) 1999-2006 Landon Curt Noll 37 | ## 38 | ## Calc is open software; you can redistribute it and/or modify it under 39 | ## the terms of the version 2.1 of the GNU Lesser General Public License 40 | ## as published by the Free Software Foundation. 41 | ## 42 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 43 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 44 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 45 | ## Public License for more details. 46 | ## 47 | ## A copy of version 2.1 of the GNU Lesser General Public License is 48 | ## distributed with calc under the filename COPYING-LGPL. You should have 49 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 50 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 51 | ## 52 | ## Under source code control: 1994/03/19 03:13:19 53 | ## File existed as early as: 1994 54 | ## 55 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 56 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 57 | -------------------------------------------------------------------------------- /help/islower: -------------------------------------------------------------------------------- 1 | NAME 2 | islower - whether character is lower case 3 | 4 | SYNOPSIS 5 | islower(c) 6 | 7 | TYPES 8 | c string 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if c is lower case. This function will return 1 if c is 14 | lower case, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; print islower("A"), islower("a"), islower("1") 18 | 0 1 0 19 | 20 | LIMITS 21 | none 22 | 23 | LINK LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | isupper, isalnum, isalpha, iscntrl, isdigit, isgraph, isprint, 28 | ispunct, isspace, isxdigit 29 | 30 | ## Copyright (C) 2013 Christoph Zurnieden 31 | ## 32 | ## Calc is open software; you can redistribute it and/or modify it under 33 | ## the terms of the version 2.1 of the GNU Lesser General Public License 34 | ## as published by the Free Software Foundation. 35 | ## 36 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 37 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 38 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 39 | ## Public License for more details. 40 | ## 41 | ## A copy of version 2.1 of the GNU Lesser General Public License is 42 | ## distributed with calc under the filename COPYING-LGPL. You should have 43 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 44 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 45 | ## 46 | ## Under source code control: 2013/09/01 18:10:53 47 | ## File existed as early as: 2013 48 | ## 49 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 50 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 51 | -------------------------------------------------------------------------------- /help/ismat: -------------------------------------------------------------------------------- 1 | NAME 2 | ismat - whether a value is a matrix 3 | 4 | SYNOPSIS 5 | ismat(x) 6 | 7 | TYPES 8 | x any, &any 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if x is a matrix. This function will return 1 if x is 14 | a matrix, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; mat a[2] 18 | ; print ismat(a), ismat(1) 19 | 1 0 20 | 21 | LIMITS 22 | none 23 | 24 | LINK LIBRARY 25 | none 26 | 27 | SEE ALSO 28 | mat, matdim, matfill, matmax, matmin, matsum, mattrans, 29 | isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, 30 | ishash, isident, isint, islist, ismult, isnull, isnum, isobj, 31 | isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, 32 | issimple, issq, isstr, istype 33 | 34 | ## Copyright (C) 1999 Landon Curt Noll 35 | ## 36 | ## Calc is open software; you can redistribute it and/or modify it under 37 | ## the terms of the version 2.1 of the GNU Lesser General Public License 38 | ## as published by the Free Software Foundation. 39 | ## 40 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 41 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 42 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 43 | ## Public License for more details. 44 | ## 45 | ## A copy of version 2.1 of the GNU Lesser General Public License is 46 | ## distributed with calc under the filename COPYING-LGPL. You should have 47 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 48 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 49 | ## 50 | ## Under source code control: 1994/10/21 02:21:28 51 | ## File existed as early as: 1994 52 | ## 53 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 54 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 55 | -------------------------------------------------------------------------------- /help/isnull: -------------------------------------------------------------------------------- 1 | NAME 2 | isnull - whether a value is a null value 3 | 4 | SYNOPSIS 5 | isnull(x) 6 | 7 | TYPES 8 | x any, &any 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if x is a null value. This function will return 1 if x is 14 | a null value, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; mat a[2] 18 | ; print isnull(a), isnull(1) 19 | 1 0 20 | 21 | LIMITS 22 | none 23 | 24 | LINK LIBRARY 25 | none 26 | 27 | SEE ALSO 28 | isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, 29 | ishash, isident, isint, islist, ismat, ismult, isnum, isobj, 30 | isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, 31 | issimple, issq, isstr, istype 32 | 33 | ## Copyright (C) 1999 Landon Curt Noll 34 | ## 35 | ## Calc is open software; you can redistribute it and/or modify it under 36 | ## the terms of the version 2.1 of the GNU Lesser General Public License 37 | ## as published by the Free Software Foundation. 38 | ## 39 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 40 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 41 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 42 | ## Public License for more details. 43 | ## 44 | ## A copy of version 2.1 of the GNU Lesser General Public License is 45 | ## distributed with calc under the filename COPYING-LGPL. You should have 46 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 47 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 48 | ## 49 | ## Under source code control: 1994/10/21 02:21:28 50 | ## File existed as early as: 1994 51 | ## 52 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 53 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 54 | -------------------------------------------------------------------------------- /help/isnum: -------------------------------------------------------------------------------- 1 | NAME 2 | isnum - whether a value is a numeric value 3 | 4 | SYNOPSIS 5 | isnum(x) 6 | 7 | TYPES 8 | x any, &any 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if x is a numeric value. This function will return 1 if x 14 | is a a numeric value, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; print isnum(2.0), isnum(1), isnum("0") 18 | 1 1 0 19 | 20 | ; print isnum(2i), isnum(1e20), isnum(1/3) 21 | 1 1 1 22 | 23 | LIMITS 24 | none 25 | 26 | LINK LIBRARY 27 | none 28 | 29 | SEE ALSO 30 | isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, 31 | ishash, isident, isint, islist, ismat, ismult, isnull, isobj, 32 | isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, 33 | issimple, issq, isstr, istype 34 | 35 | ## Copyright (C) 1999 Landon Curt Noll 36 | ## 37 | ## Calc is open software; you can redistribute it and/or modify it under 38 | ## the terms of the version 2.1 of the GNU Lesser General Public License 39 | ## as published by the Free Software Foundation. 40 | ## 41 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 42 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 43 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 44 | ## Public License for more details. 45 | ## 46 | ## A copy of version 2.1 of the GNU Lesser General Public License is 47 | ## distributed with calc under the filename COPYING-LGPL. You should have 48 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 49 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 50 | ## 51 | ## Under source code control: 1994/10/21 02:21:28 52 | ## File existed as early as: 1994 53 | ## 54 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 55 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 56 | -------------------------------------------------------------------------------- /help/isobj: -------------------------------------------------------------------------------- 1 | NAME 2 | isobj - whether a value is an object 3 | 4 | SYNOPSIS 5 | isobj(x) 6 | 7 | TYPES 8 | x any, &any 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if x is an object. This function will return 1 if x is 14 | an object, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; obj surd {a, b} a; 18 | ; print isobj(a), isobj(1) 19 | 1 0 20 | 21 | LIMITS 22 | none 23 | 24 | LINK LIBRARY 25 | none 26 | 27 | SEE ALSO 28 | obj, 29 | isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, 30 | ishash, isident, isint, islist, ismat, ismult, isnull, isnum, 31 | isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, 32 | issimple, issq, isstr, istype 33 | 34 | ## Copyright (C) 1999 Landon Curt Noll 35 | ## 36 | ## Calc is open software; you can redistribute it and/or modify it under 37 | ## the terms of the version 2.1 of the GNU Lesser General Public License 38 | ## as published by the Free Software Foundation. 39 | ## 40 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 41 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 42 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 43 | ## Public License for more details. 44 | ## 45 | ## A copy of version 2.1 of the GNU Lesser General Public License is 46 | ## distributed with calc under the filename COPYING-LGPL. You should have 47 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 48 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 49 | ## 50 | ## Under source code control: 1994/10/21 02:21:29 51 | ## File existed as early as: 1994 52 | ## 53 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 54 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 55 | -------------------------------------------------------------------------------- /help/isobjtype: -------------------------------------------------------------------------------- 1 | NAME 2 | isobjtype - whether a string names an object type 3 | 4 | SYNOPSIS 5 | isobjtype(str) 6 | 7 | TYPES 8 | str string 9 | 10 | return 0 or 1 11 | 12 | DESCRIPTION 13 | isobjtype(str) returns 1 or 0 according as an object type with name 14 | str has been defined or not defined. 15 | 16 | EXAMPLE 17 | ; isobjtype("xy") 18 | 0 19 | 20 | ; obj xy {x, y} 21 | ; isobjtype("xy") 22 | 1 23 | 24 | LIMITS 25 | none 26 | 27 | LINK LIBRARY 28 | none 29 | 30 | SEE ALSO 31 | obj, 32 | isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, 33 | ishash, isident, isint, islist, ismat, ismult, isnull, isnum, isobj, 34 | isodd, isprime, isrand, israndom, isreal, isrel, 35 | issimple, issq, isstr, istype 36 | 37 | ## Copyright (C) 1999-2006 Landon Curt Noll 38 | ## 39 | ## Calc is open software; you can redistribute it and/or modify it under 40 | ## the terms of the version 2.1 of the GNU Lesser General Public License 41 | ## as published by the Free Software Foundation. 42 | ## 43 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 44 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 45 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 46 | ## Public License for more details. 47 | ## 48 | ## A copy of version 2.1 of the GNU Lesser General Public License is 49 | ## distributed with calc under the filename COPYING-LGPL. You should have 50 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 51 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 52 | ## 53 | ## Under source code control: 1997/04/05 14:10:17 54 | ## File existed as early as: 1997 55 | ## 56 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 57 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 58 | -------------------------------------------------------------------------------- /help/isodd: -------------------------------------------------------------------------------- 1 | NAME 2 | isodd - whether a value is an odd integer 3 | 4 | SYNOPSIS 5 | isodd(x) 6 | 7 | TYPES 8 | x any, &any 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if x is an odd integer. This function will return 1 if x is 14 | odd integer, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; print isodd(2.0), isodd(1), isodd("1") 18 | 0 1 0 19 | 20 | ; print isodd(2i), isodd(1e20+1), isodd(1/3) 21 | 0 1 0 22 | 23 | LIMITS 24 | none 25 | 26 | LINK LIBRARY 27 | none 28 | 29 | SEE ALSO 30 | isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, 31 | ishash, isident, isint, islist, ismat, ismult, isnull, isnum, isobj, 32 | isobjtype, isprime, isrand, israndom, isreal, isrel, 33 | issimple, issq, isstr, istype 34 | 35 | ## Copyright (C) 1999 Landon Curt Noll 36 | ## 37 | ## Calc is open software; you can redistribute it and/or modify it under 38 | ## the terms of the version 2.1 of the GNU Lesser General Public License 39 | ## as published by the Free Software Foundation. 40 | ## 41 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 42 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 43 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 44 | ## Public License for more details. 45 | ## 46 | ## A copy of version 2.1 of the GNU Lesser General Public License is 47 | ## distributed with calc under the filename COPYING-LGPL. You should have 48 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 49 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 50 | ## 51 | ## Under source code control: 1994/10/21 02:21:29 52 | ## File existed as early as: 1994 53 | ## 54 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 55 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 56 | -------------------------------------------------------------------------------- /help/isprint: -------------------------------------------------------------------------------- 1 | NAME 2 | isprint - whether character is a printable 3 | 4 | SYNOPSIS 5 | isprint(c) 6 | 7 | TYPES 8 | c string 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if c is printable. This function will return 1 if c is 14 | printable, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; print isprint("A"), ispint("a"), isprint(" "), isprint("\t") 18 | 1 1 1 0 19 | 20 | LIMITS 21 | none 22 | 23 | LINK LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | islower, isupper, isalnum, isalpha, iscntrl, isdigit, isgraph, 28 | ispunct, isspace, isxdigit 29 | 30 | ## Copyright (C) 2013 Christoph Zurnieden 31 | ## 32 | ## Calc is open software; you can redistribute it and/or modify it under 33 | ## the terms of the version 2.1 of the GNU Lesser General Public License 34 | ## as published by the Free Software Foundation. 35 | ## 36 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 37 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 38 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 39 | ## Public License for more details. 40 | ## 41 | ## A copy of version 2.1 of the GNU Lesser General Public License is 42 | ## distributed with calc under the filename COPYING-LGPL. You should have 43 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 44 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 45 | ## 46 | ## Under source code control: 2013/09/01 18:10:53 47 | ## File existed as early as: 2013 48 | ## 49 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 50 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 51 | -------------------------------------------------------------------------------- /help/ispunct: -------------------------------------------------------------------------------- 1 | NAME 2 | ispunct - whether character is a punctuation 3 | 4 | SYNOPSIS 5 | ispunct(c) 6 | 7 | TYPES 8 | c string 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if c is a punctuation. This function will return 1 if c is 14 | a punctuation, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; print ispunct("A"), ispunct("a"), ispunct(" "), ispunct("?") 18 | 0 0 0 1 19 | 20 | LIMITS 21 | none 22 | 23 | LINK LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | islower, isupper, isalnum, isalpha, iscntrl, isdigit, isgraph, isprint 28 | isspace, isxdigit 29 | 30 | ## Copyright (C) 2013 Christoph Zurnieden 31 | ## 32 | ## Calc is open software; you can redistribute it and/or modify it under 33 | ## the terms of the version 2.1 of the GNU Lesser General Public License 34 | ## as published by the Free Software Foundation. 35 | ## 36 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 37 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 38 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 39 | ## Public License for more details. 40 | ## 41 | ## A copy of version 2.1 of the GNU Lesser General Public License is 42 | ## distributed with calc under the filename COPYING-LGPL. You should have 43 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 44 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 45 | ## 46 | ## Under source code control: 2013/09/01 18:10:53 47 | ## File existed as early as: 2013 48 | ## 49 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 50 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 51 | -------------------------------------------------------------------------------- /help/isqrt: -------------------------------------------------------------------------------- 1 | NAME 2 | isqrt - integer part of square root 3 | 4 | SYNOPSIS 5 | isqrt(x) 6 | 7 | TYPES 8 | x nonnegative real 9 | 10 | return nonnegative real 11 | 12 | DESCRIPTION 13 | Return the greatest integer n for which n^2 <= x. 14 | 15 | EXAMPLE 16 | ; print isqrt(8.5), isqrt(200), isqrt(2e6), isqrt(2e56) 17 | 2 14 1414 14142135623730950488016887242 18 | 19 | LIMITS 20 | x > 0 21 | 22 | LINK LIBRARY 23 | NUMBER *qisqrt(NUMBER *x) 24 | 25 | SEE ALSO 26 | sqrt, iroot 27 | 28 | ## Copyright (C) 1999 Landon Curt Noll 29 | ## 30 | ## Calc is open software; you can redistribute it and/or modify it under 31 | ## the terms of the version 2.1 of the GNU Lesser General Public License 32 | ## as published by the Free Software Foundation. 33 | ## 34 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 35 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 36 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 37 | ## Public License for more details. 38 | ## 39 | ## A copy of version 2.1 of the GNU Lesser General Public License is 40 | ## distributed with calc under the filename COPYING-LGPL. You should have 41 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 42 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 43 | ## 44 | ## Under source code control: 1995/10/25 04:03:45 45 | ## File existed as early as: 1995 46 | ## 47 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 48 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 49 | -------------------------------------------------------------------------------- /help/isrand: -------------------------------------------------------------------------------- 1 | NAME 2 | isrand - whether a value is an subtractive 100 state 3 | 4 | SYNOPSIS 5 | isrand(x) 6 | 7 | TYPES 8 | x any, &any 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if x is an subtractive 100 pseudo-random number 14 | generator state. This function will return 1 if x is a file, 15 | 0 otherwise. 16 | 17 | EXAMPLE 18 | ; a = srand(0) 19 | ; print isrand(a), isrand(0); 20 | 1 0 21 | 22 | LIMITS 23 | none 24 | 25 | LINK LIBRARY 26 | none 27 | 28 | SEE ALSO 29 | seed, rand, srand, randbit, 30 | isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, 31 | ishash, isident, isint, islist, ismat, ismult, isnull, isnum, isobj, 32 | isobjtype, isodd, isprime, israndom, isreal, isrel, 33 | issimple, issq, isstr, istype 34 | 35 | ## Copyright (C) 1999,2021 Landon Curt Noll 36 | ## 37 | ## Calc is open software; you can redistribute it and/or modify it under 38 | ## the terms of the version 2.1 of the GNU Lesser General Public License 39 | ## as published by the Free Software Foundation. 40 | ## 41 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 42 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 43 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 44 | ## Public License for more details. 45 | ## 46 | ## A copy of version 2.1 of the GNU Lesser General Public License is 47 | ## distributed with calc under the filename COPYING-LGPL. You should have 48 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 49 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 50 | ## 51 | ## Under source code control: 1995/11/11 05:09:41 52 | ## File existed as early as: 1995 53 | ## 54 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 55 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 56 | -------------------------------------------------------------------------------- /help/israndom: -------------------------------------------------------------------------------- 1 | NAME 2 | israndom - whether a value is a Blum generator state 3 | 4 | SYNOPSIS 5 | israndom(x) 6 | 7 | TYPES 8 | x any, &any 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if x is a Blum-Blum-Shub pseudo-random number generator state. 14 | This function will return 1 if x is a file, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; a = srandom(0) 18 | ; print israndom(a), israndom(0); 19 | 1 0 20 | 21 | LIMITS 22 | none 23 | 24 | LINK LIBRARY 25 | none 26 | 27 | SEE ALSO 28 | seed, random, srandom, randombit, 29 | isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, 30 | ishash, isident, isint, islist, ismat, ismult, isnull, isnum, isobj, 31 | isobjtype, isodd, isprime, isrand, isreal, isrel, 32 | issimple, issq, isstr, istype 33 | 34 | ## Copyright (C) 1999-2006 Landon Curt Noll 35 | ## 36 | ## Calc is open software; you can redistribute it and/or modify it under 37 | ## the terms of the version 2.1 of the GNU Lesser General Public License 38 | ## as published by the Free Software Foundation. 39 | ## 40 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 41 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 42 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 43 | ## Public License for more details. 44 | ## 45 | ## A copy of version 2.1 of the GNU Lesser General Public License is 46 | ## distributed with calc under the filename COPYING-LGPL. You should have 47 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 48 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 49 | ## 50 | ## Under source code control: 1995/11/11 05:09:41 51 | ## File existed as early as: 1995 52 | ## 53 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 54 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 55 | -------------------------------------------------------------------------------- /help/isreal: -------------------------------------------------------------------------------- 1 | NAME 2 | isreal - whether a value is a real value 3 | 4 | SYNOPSIS 5 | isreal(x) 6 | 7 | TYPES 8 | x any, &any 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if x is a real value. This function will return 1 if x 14 | is a real value, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; print isreal(2.0), isreal(1), isreal("0") 18 | 1 1 0 19 | 20 | ; print isreal(2i), isreal(1e20), isreal(1/3) 21 | 0 1 1 22 | 23 | LIMITS 24 | none 25 | 26 | LINK LIBRARY 27 | none 28 | 29 | SEE ALSO 30 | isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, 31 | ishash, isident, isint, islist, ismat, ismult, isnull, isnum, isobj, 32 | isobjtype, isodd, isprime, isrand, israndom, isrel, 33 | issimple, issq, isstr, istype 34 | 35 | ## Copyright (C) 1999 Landon Curt Noll 36 | ## 37 | ## Calc is open software; you can redistribute it and/or modify it under 38 | ## the terms of the version 2.1 of the GNU Lesser General Public License 39 | ## as published by the Free Software Foundation. 40 | ## 41 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 42 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 43 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 44 | ## Public License for more details. 45 | ## 46 | ## A copy of version 2.1 of the GNU Lesser General Public License is 47 | ## distributed with calc under the filename COPYING-LGPL. You should have 48 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 49 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 50 | ## 51 | ## Under source code control: 1994/10/21 02:21:30 52 | ## File existed as early as: 1994 53 | ## 54 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 55 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 56 | -------------------------------------------------------------------------------- /help/isspace: -------------------------------------------------------------------------------- 1 | NAME 2 | isspace - whether character is a space character 3 | 4 | SYNOPSIS 5 | isspace(c) 6 | 7 | TYPES 8 | c string 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if c is a space character. This function will return 1 if c is 14 | a space character, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; print isspace("A"), isspace("Kirk"), isspace(" "), isspace("?") 18 | 0 0 1 0 19 | 20 | LIMITS 21 | none 22 | 23 | LINK LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | islower, isupper, isalnum, isalpha, iscntrl, isdigit, isgraph, isprint 28 | ispunct, isxdigit 29 | 30 | ## Copyright (C) 2013 Christoph Zurnieden 31 | ## 32 | ## Calc is open software; you can redistribute it and/or modify it under 33 | ## the terms of the version 2.1 of the GNU Lesser General Public License 34 | ## as published by the Free Software Foundation. 35 | ## 36 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 37 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 38 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 39 | ## Public License for more details. 40 | ## 41 | ## A copy of version 2.1 of the GNU Lesser General Public License is 42 | ## distributed with calc under the filename COPYING-LGPL. You should have 43 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 44 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 45 | ## 46 | ## Under source code control: 2013/09/01 18:10:53 47 | ## File existed as early as: 2013 48 | ## 49 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 50 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 51 | -------------------------------------------------------------------------------- /help/isstr: -------------------------------------------------------------------------------- 1 | NAME 2 | isstr - whether a value is a string 3 | 4 | SYNOPSIS 5 | isstr(x) 6 | 7 | TYPES 8 | x any, &any 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if x is a string. This function will return 1 if x is 14 | a string, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; print isstr("1"), isstr(1), isstr("") 18 | 1 0 1 19 | 20 | LIMITS 21 | none 22 | 23 | LINK LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | isassoc, isatty, isblk, isconfig, isdefined, iserror, iseven, isfile, 28 | ishash, isident, isint, islist, ismat, ismult, isnull, isnum, isobj, 29 | isobjtype, isodd, isprime, isrand, israndom, isreal, isrel, 30 | issimple, issq, istype 31 | 32 | ## Copyright (C) 1999 Landon Curt Noll 33 | ## 34 | ## Calc is open software; you can redistribute it and/or modify it under 35 | ## the terms of the version 2.1 of the GNU Lesser General Public License 36 | ## as published by the Free Software Foundation. 37 | ## 38 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 39 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 40 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 41 | ## Public License for more details. 42 | ## 43 | ## A copy of version 2.1 of the GNU Lesser General Public License is 44 | ## distributed with calc under the filename COPYING-LGPL. You should have 45 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 46 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 47 | ## 48 | ## Under source code control: 1994/10/21 02:21:31 49 | ## File existed as early as: 1994 50 | ## 51 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 52 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 53 | -------------------------------------------------------------------------------- /help/isupper: -------------------------------------------------------------------------------- 1 | NAME 2 | isupper - whether character is upper case 3 | 4 | SYNOPSIS 5 | isupper(c) 6 | 7 | TYPES 8 | c string 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if c is upper case. This function will return 1 if c is 14 | upper case, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; print isupper("A"), isupper("a"), isupper("1") 18 | 1 0 0 19 | 20 | LIMITS 21 | none 22 | 23 | LINK LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | islower, isalnum, isalpha, iscntrl, isdigit, isgraph, isprint, 28 | ispunct, isspace, isxdigit 29 | 30 | ## Copyright (C) 2013 Christoph Zurnieden 31 | ## 32 | ## Calc is open software; you can redistribute it and/or modify it under 33 | ## the terms of the version 2.1 of the GNU Lesser General Public License 34 | ## as published by the Free Software Foundation. 35 | ## 36 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 37 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 38 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 39 | ## Public License for more details. 40 | ## 41 | ## A copy of version 2.1 of the GNU Lesser General Public License is 42 | ## distributed with calc under the filename COPYING-LGPL. You should have 43 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 44 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 45 | ## 46 | ## Under source code control: 2013/09/01 18:10:53 47 | ## File existed as early as: 2013 48 | ## 49 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 50 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 51 | -------------------------------------------------------------------------------- /help/isxdigit: -------------------------------------------------------------------------------- 1 | NAME 2 | isxdigit - whether character a hexadecimal digit 3 | 4 | SYNOPSIS 5 | isxdigit(c) 6 | 7 | TYPES 8 | c string 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Determine if c is a hexadecimal digit. This function will return 1 if c is 14 | a hexadecimal digit, 0 otherwise. 15 | 16 | EXAMPLE 17 | ; print isxdigit("A"), isxdigit("f"), isxdigit("2"), isxdigit("x") 18 | 1 1 1 0 19 | 20 | LIMITS 21 | none 22 | 23 | LINK LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | islower, isupper, isalnum, isalpha, iscntrl, isdigit, isgraph, isprint 28 | ispunct, isspace 29 | 30 | ## Copyright (C) 2013 Christoph Zurnieden 31 | ## 32 | ## Calc is open software; you can redistribute it and/or modify it under 33 | ## the terms of the version 2.1 of the GNU Lesser General Public License 34 | ## as published by the Free Software Foundation. 35 | ## 36 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 37 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 38 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 39 | ## Public License for more details. 40 | ## 41 | ## A copy of version 2.1 of the GNU Lesser General Public License is 42 | ## distributed with calc under the filename COPYING-LGPL. You should have 43 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 44 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 45 | ## 46 | ## Under source code control: 2013/09/01 18:10:53 47 | ## File existed as early as: 2013 48 | ## 49 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 50 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 51 | -------------------------------------------------------------------------------- /help/lcm: -------------------------------------------------------------------------------- 1 | NAME 2 | lcm - least common multiple of a set of rational numbers 3 | 4 | SYNOPSIS 5 | lcm(x1, x2, ...) 6 | 7 | TYPES 8 | x1, x2, ... rational number 9 | 10 | return rational number 11 | 12 | DESCRIPTION 13 | Compute the least common multiple of one or more rational numbers. 14 | 15 | If no xi is zero, lcm(x1, x2, ...) is the least positive number v 16 | for which v is a multiple of each xi. If at least one xi is zero, 17 | the lcm is zero. 18 | 19 | EXAMPLE 20 | ; print lcm(12, -24, 30), lcm(9/10, 11/5, 4/25), lcm(2) 21 | -120 79.2 2 22 | 23 | LIMITS 24 | The number of arguments is not to exceed 1024. 25 | 26 | LINK LIBRARY 27 | NUMBER *qlcm(NUMBER *x1, NUMBER *x2) 28 | 29 | SEE ALSO 30 | gcd 31 | 32 | ## Copyright (C) 1999-2006 Landon Curt Noll 33 | ## 34 | ## Calc is open software; you can redistribute it and/or modify it under 35 | ## the terms of the version 2.1 of the GNU Lesser General Public License 36 | ## as published by the Free Software Foundation. 37 | ## 38 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 39 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 40 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 41 | ## Public License for more details. 42 | ## 43 | ## A copy of version 2.1 of the GNU Lesser General Public License is 44 | ## distributed with calc under the filename COPYING-LGPL. You should have 45 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 46 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 47 | ## 48 | ## Under source code control: 1995/10/05 04:52:26 49 | ## File existed as early as: 1995 50 | ## 51 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 52 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 53 | -------------------------------------------------------------------------------- /help/lcmfact: -------------------------------------------------------------------------------- 1 | NAME 2 | lcmfact - lcm of positive integers up to specified integer 3 | 4 | SYNOPSIS 5 | lcmfact(n) 6 | 7 | TYPES 8 | n positive integer 9 | 10 | return positive integer 11 | 12 | DESCRIPTION 13 | Returns the lcm of the integers 1, 2, ..., n. 14 | 15 | EXAMPLE 16 | ; for (i = 1; i <= 15; i++) print lcmfact(i),:; 17 | 1 2 6 12 60 60 420 840 2520 2520 27720 27720 360360 360360 360360 18 | 19 | LIMITS 20 | n < 2^24 21 | 22 | LINK LIBRARY 23 | NUMBER *qlcmfact(NUMBER *n) 24 | void zlcmfact(ZVALUE z, ZVALUE *dest) 25 | 26 | SEE ALSO 27 | lcm, fact 28 | 29 | ## Copyright (C) 1999 Landon Curt Noll 30 | ## 31 | ## Calc is open software; you can redistribute it and/or modify it under 32 | ## the terms of the version 2.1 of the GNU Lesser General Public License 33 | ## as published by the Free Software Foundation. 34 | ## 35 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 36 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 37 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 38 | ## Public License for more details. 39 | ## 40 | ## A copy of version 2.1 of the GNU Lesser General Public License is 41 | ## distributed with calc under the filename COPYING-LGPL. You should have 42 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 43 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 44 | ## 45 | ## Under source code control: 1995/12/18 12:34:57 46 | ## File existed as early as: 1995 47 | ## 48 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 49 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 50 | -------------------------------------------------------------------------------- /help/lowbit: -------------------------------------------------------------------------------- 1 | NAME 2 | lowbit - index of lowest nonzero bit in binary representation of integer 3 | 4 | SYNOPSIS 5 | lowbit(x) 6 | 7 | TYPES 8 | x nonzero integer 9 | 10 | return integer 11 | 12 | DESCRIPTION 13 | If x is a nonzero integer, lowbit(x) returns the index of the 14 | lowest nonzero bit in the binary representation of abs(x). Equivalently, 15 | lowbit(x) is the greatest integer for which x/2^n is an integer; 16 | the binary representation of x then ends with n zero bits. 17 | 18 | EXAMPLE 19 | ; print lowbit(2), lowbit(3), lowbit(4), lowbit(-15), lowbit(2^27) 20 | 1 0 2 0 27 21 | 22 | LIMITS 23 | none 24 | 25 | LINK LIBRARY 26 | long zlowbit(ZVALUE x); 27 | 28 | SEE ALSO 29 | highbit, digits 30 | 31 | ## Copyright (C) 1999 Landon Curt Noll 32 | ## 33 | ## Calc is open software; you can redistribute it and/or modify it under 34 | ## the terms of the version 2.1 of the GNU Lesser General Public License 35 | ## as published by the Free Software Foundation. 36 | ## 37 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 38 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 39 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 40 | ## Public License for more details. 41 | ## 42 | ## A copy of version 2.1 of the GNU Lesser General Public License is 43 | ## distributed with calc under the filename COPYING-LGPL. You should have 44 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 45 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 46 | ## 47 | ## Under source code control: 1995/10/03 10:40:02 48 | ## File existed as early as: 1995 49 | ## 50 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 51 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 52 | -------------------------------------------------------------------------------- /help/ltol: -------------------------------------------------------------------------------- 1 | NAME 2 | ltol - "leg to leg", third side of a right-angled triangle with 3 | unit hypotenuse, given one other side 4 | 5 | SYNOPSIS 6 | ltol(x, [,eps]) 7 | 8 | TYPES 9 | x real 10 | eps nonzero real, defaults to epsilon() 11 | 12 | return real 13 | 14 | DESCRIPTION 15 | Returns sqrt(1 - x^2) to the nearest multiple of eps. 16 | The default value for eps is epsilon(). 17 | 18 | EXAMPLE 19 | ; print ltol(0.4, 1e-6), hypot(0.5, 1e-6) 20 | 0.6 0.866025 21 | 22 | LIMITS 23 | abs(x) <= 1 24 | eps != 0 25 | 26 | LINK LIBRARY 27 | NUMBER *qlegtoleg(NUMBER *q1, *epsilon, BOOL wantneg) 28 | 29 | SEE ALSO 30 | hypot 31 | 32 | ## Copyright (C) 1999,2021,2023 Landon Curt Noll 33 | ## 34 | ## Calc is open software; you can redistribute it and/or modify it under 35 | ## the terms of the version 2.1 of the GNU Lesser General Public License 36 | ## as published by the Free Software Foundation. 37 | ## 38 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 39 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 40 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 41 | ## Public License for more details. 42 | ## 43 | ## A copy of version 2.1 of the GNU Lesser General Public License is 44 | ## distributed with calc under the filename COPYING-LGPL. You should have 45 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 46 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 47 | ## 48 | ## Under source code control: 1995/10/05 04:52:27 49 | ## File existed as early as: 1995 50 | ## 51 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 52 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 53 | -------------------------------------------------------------------------------- /help/makelist: -------------------------------------------------------------------------------- 1 | NAME 2 | makelist - create a list with a specified number of null members 3 | 4 | SYNOPSIS 5 | makelist(x) 6 | 7 | TYPES 8 | x int 9 | 10 | return list 11 | 12 | DESCRIPTION 13 | For non-negative integer x, makelist(x) returns a list of size x 14 | all members of which have null value. 15 | 16 | EXAMPLE 17 | ; A = makelist(4) 18 | ; A 19 | 20 | list (4 members, 4 nonzero): 21 | [[0]] = NULL 22 | [[1]] = NULL 23 | [[2]] = NULL 24 | [[3]] = NULL 25 | 26 | LIMITS 27 | 0 <= x < 2^31 28 | 29 | LINK LIBRARY 30 | none 31 | 32 | SEE ALSO 33 | modify 34 | 35 | ## Copyright (C) 1999 Landon Curt Noll 36 | ## 37 | ## Calc is open software; you can redistribute it and/or modify it under 38 | ## the terms of the version 2.1 of the GNU Lesser General Public License 39 | ## as published by the Free Software Foundation. 40 | ## 41 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 42 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 43 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 44 | ## Public License for more details. 45 | ## 46 | ## A copy of version 2.1 of the GNU Lesser General Public License is 47 | ## distributed with calc under the filename COPYING-LGPL. You should have 48 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 49 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 50 | ## 51 | ## Under source code control: 1995/07/10 02:09:31 52 | ## File existed as early as: 1995 53 | ## 54 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 55 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 56 | -------------------------------------------------------------------------------- /help/matdim: -------------------------------------------------------------------------------- 1 | NAME 2 | matdim - matrix dimension 3 | 4 | SYNOPSIS 5 | matdim(m) 6 | 7 | TYPES 8 | m matrix 9 | 10 | return 1, 2, 3, or 4 11 | 12 | DESCRIPTION 13 | Returns the number of indices required to specify elements of the matrix. 14 | 15 | EXAMPLE 16 | ; mat A[3]; mat B[2,3]; mat C[1, 2:3, 4]; mat D[2, 3, 4, 5] 17 | ; print matdim(A), matdim(B), matdim(C), matdim(D) 18 | 1 2 3 4 19 | 20 | LIMITS 21 | none 22 | 23 | LINK LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | mat, ismat, matmax, matmin, mattrans, mattrace, matsum, matfill, 28 | det, inverse, isident, test, config, search, rsearch, reverse, copy, 29 | blkcpy, dp, cp, randperm, sort 30 | 31 | ## Copyright (C) 1999-2006 Landon Curt Noll 32 | ## 33 | ## Calc is open software; you can redistribute it and/or modify it under 34 | ## the terms of the version 2.1 of the GNU Lesser General Public License 35 | ## as published by the Free Software Foundation. 36 | ## 37 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 38 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 39 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 40 | ## Public License for more details. 41 | ## 42 | ## A copy of version 2.1 of the GNU Lesser General Public License is 43 | ## distributed with calc under the filename COPYING-LGPL. You should have 44 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 45 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 46 | ## 47 | ## Under source code control: 1995/10/25 04:03:45 48 | ## File existed as early as: 1995 49 | ## 50 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 51 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 52 | -------------------------------------------------------------------------------- /help/matmax: -------------------------------------------------------------------------------- 1 | NAME 2 | matmax - maximum value for specified index of matrix 3 | 4 | SYNOPSIS 5 | matmax(m, i) 6 | 7 | TYPES 8 | m matrix 9 | i 0, 1, 2, 3 10 | 11 | return integer 12 | 13 | DESCRIPTION 14 | Returns the maximum value for i-th index (i counting from zero) 15 | for the matrix m. 16 | 17 | EXAMPLE 18 | ; mat A[3]; mat B[1:3, -4:4, 5] 19 | ; print matmax(A,0), matmax(B,0), matmax(B,1), matmax(B,2) 20 | 2 3 4 4 21 | 22 | LIMITS 23 | i < matdim(m) 24 | 25 | LINK LIBRARY 26 | none 27 | 28 | SEE ALSO 29 | mat, ismat, matdim, matmin, mattrans, mattrace, matsum, matfill, 30 | det, inverse, isident, test, config, search, rsearch, reverse, copy, 31 | blkcpy, dp, cp, randperm, sort 32 | 33 | ## Copyright (C) 1999-2006 Landon Curt Noll 34 | ## 35 | ## Calc is open software; you can redistribute it and/or modify it under 36 | ## the terms of the version 2.1 of the GNU Lesser General Public License 37 | ## as published by the Free Software Foundation. 38 | ## 39 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 40 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 41 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 42 | ## Public License for more details. 43 | ## 44 | ## A copy of version 2.1 of the GNU Lesser General Public License is 45 | ## distributed with calc under the filename COPYING-LGPL. You should have 46 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 47 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 48 | ## 49 | ## Under source code control: 1995/10/25 04:03:45 50 | ## File existed as early as: 1995 51 | ## 52 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 53 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 54 | -------------------------------------------------------------------------------- /help/matmin: -------------------------------------------------------------------------------- 1 | NAME 2 | matmin - minimum value for specified index of matrix 3 | 4 | SYNOPSIS 5 | matmin(m, i) 6 | 7 | TYPES 8 | m matrix 9 | i 0, 1, 2, 3 10 | 11 | return integer 12 | 13 | DESCRIPTION 14 | Returns the minimum value for i-th index (i counting from zero) 15 | for the matrix m. 16 | 17 | EXAMPLE 18 | ; mat A[3]; mat B[1:3, -4:4, 5] 19 | ; print matmin(A,0), matmin(B,0), matmin(B,1), matmin(B,2) 20 | 0 1 -4 0 21 | 22 | LIMITS 23 | i < matdim(m) 24 | 25 | LINK LIBRARY 26 | none 27 | 28 | SEE ALSO 29 | mat, ismat, matdim, matmax, mattrans, mattrace, matsum, matfill, 30 | det, inverse, isident, test, config, search, rsearch, reverse, copy, 31 | blkcpy, dp, cp, randperm, sort 32 | 33 | ## Copyright (C) 1999-2006 Landon Curt Noll 34 | ## 35 | ## Calc is open software; you can redistribute it and/or modify it under 36 | ## the terms of the version 2.1 of the GNU Lesser General Public License 37 | ## as published by the Free Software Foundation. 38 | ## 39 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 40 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 41 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 42 | ## Public License for more details. 43 | ## 44 | ## A copy of version 2.1 of the GNU Lesser General Public License is 45 | ## distributed with calc under the filename COPYING-LGPL. You should have 46 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 47 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 48 | ## 49 | ## Under source code control: 1995/10/25 04:03:45 50 | ## File existed as early as: 1995 51 | ## 52 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 53 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 54 | -------------------------------------------------------------------------------- /help/matsum: -------------------------------------------------------------------------------- 1 | NAME 2 | matsum - sum the elements of a matrix 3 | 4 | SYNOPSIS 5 | matsum(m) 6 | 7 | TYPES 8 | m matrix with any types of elements 9 | 10 | return number 11 | 12 | DESCRIPTION 13 | Returns the sum of the numeric (real or complex) elements of m. 14 | Non-numeric elements are ignored. 15 | 16 | EXAMPLE 17 | ; mat A[2,2] = {1, 2, 3, list(1,2,3)} 18 | print matsum(A) 19 | 6 20 | 21 | LIMITS 22 | none 23 | 24 | LINK LIBRARY 25 | void matsum(MATRIX *m, VALUE *vres); 26 | 27 | SEE ALSO 28 | mat, ismat, matdim, matmax, matmin, mattrans, mattrace, matfill, 29 | det, inverse, isident, test, config, search, rsearch, reverse, copy, 30 | blkcpy, dp, cp, randperm, sort 31 | 32 | ## Copyright (C) 1999-2006 Landon Curt Noll 33 | ## 34 | ## Calc is open software; you can redistribute it and/or modify it under 35 | ## the terms of the version 2.1 of the GNU Lesser General Public License 36 | ## as published by the Free Software Foundation. 37 | ## 38 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 39 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 40 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 41 | ## Public License for more details. 42 | ## 43 | ## A copy of version 2.1 of the GNU Lesser General Public License is 44 | ## distributed with calc under the filename COPYING-LGPL. You should have 45 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 46 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 47 | ## 48 | ## Under source code control: 1995/10/25 04:03:46 49 | ## File existed as early as: 1995 50 | ## 51 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 52 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 53 | -------------------------------------------------------------------------------- /help/mattrace: -------------------------------------------------------------------------------- 1 | NAME 2 | mattrace - trace of a square matrix 3 | 4 | SYNOPSIS 5 | mattrace(m) 6 | 7 | TYPES 8 | m square matrix with summable diagonal elements 9 | 10 | return determined by addition of elements 11 | 12 | DESCRIPTION 13 | For a two-dimensional square matrix, mattrace(m) returns the sum of 14 | the elements on the principal diagonal. In particular, if m 15 | has been created by mat m[N,N] where N > 0, mattrace(m) returns 16 | 17 | m[0,0] + m{1,1] + ... + m[N-1,N-1] 18 | 19 | EXAMPLE 20 | ; mat m[2,2] = {1,2,3,4} 21 | ; print mattrace(m), mattrace(m^2) 22 | 5 29 23 | 24 | LIMITS 25 | none 26 | 27 | LINK LIBRARY 28 | none 29 | 30 | SEE ALSO 31 | mat, mattrans 32 | 33 | ## Copyright (C) 1999 Landon Curt Noll 34 | ## 35 | ## Calc is open software; you can redistribute it and/or modify it under 36 | ## the terms of the version 2.1 of the GNU Lesser General Public License 37 | ## as published by the Free Software Foundation. 38 | ## 39 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 40 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 41 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 42 | ## Public License for more details. 43 | ## 44 | ## A copy of version 2.1 of the GNU Lesser General Public License is 45 | ## distributed with calc under the filename COPYING-LGPL. You should have 46 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 47 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 48 | ## 49 | ## Under source code control: 1997/09/06 20:03:35 50 | ## File existed as early as: 1997 51 | ## 52 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 53 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 54 | -------------------------------------------------------------------------------- /help/mattrans: -------------------------------------------------------------------------------- 1 | NAME 2 | mattrans - matrix transpose 3 | 4 | SYNOPSIS 5 | mattrans(m) 6 | 7 | TYPES 8 | m 2-dimensional matrix 9 | 10 | return 2-dimensional matrix 11 | 12 | DESCRIPTION 13 | Returns the matrix whose [i,j] element is the [j,1] element of m. 14 | 15 | EXAMPLE 16 | ; mat A[2, 1:3] = {1,2,3,4,5,6} 17 | ; print mattrans(A) 18 | 19 | mat [1:3,2] (6 elements, 6 nonzero): 20 | [1,0] = 1 21 | [1,1] = 4 22 | [2,0] = 2 23 | [2,1] = 5 24 | [3,0] = 3 25 | [3,1] = 6 26 | 27 | LIMITS 28 | none 29 | 30 | LINK LIBRARY 31 | MATRIX *mattrans(MATRIX *m) 32 | 33 | SEE ALSO 34 | mat, ismat, matdim, matmax, matmin, mattrace, matsum, matfill, 35 | det, inverse, isident, test, config, search, rsearch, reverse, copy, 36 | blkcpy, dp, cp, randperm, sort 37 | 38 | ## Copyright (C) 1999-2006 Landon Curt Noll 39 | ## 40 | ## Calc is open software; you can redistribute it and/or modify it under 41 | ## the terms of the version 2.1 of the GNU Lesser General Public License 42 | ## as published by the Free Software Foundation. 43 | ## 44 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 45 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 46 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 47 | ## Public License for more details. 48 | ## 49 | ## A copy of version 2.1 of the GNU Lesser General Public License is 50 | ## distributed with calc under the filename COPYING-LGPL. You should have 51 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 52 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 53 | ## 54 | ## Under source code control: 1995/10/25 04:03:46 55 | ## File existed as early as: 1995 56 | ## 57 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 58 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 59 | -------------------------------------------------------------------------------- /help/meq: -------------------------------------------------------------------------------- 1 | NAME 2 | meq - test for equality modulo a specified number 3 | 4 | SYNOPSIS 5 | meq(x, y, md) 6 | 7 | TYPES 8 | x real 9 | y real 10 | md real 11 | 12 | return 0 or 1 13 | 14 | DESCRIPTION 15 | Returns 1 if and only if for some integer n, x - y = n * md, i.e. 16 | x is congruent to y modulo md. 17 | 18 | If md = 0, this is equivalent to x == y. 19 | 20 | For any x, y, md, meq(x, y, md) = ismult(x - y, md). 21 | 22 | EXAMPLE 23 | ; print meq(5, 33, 7), meq(.05, .33, -.07), meq(5, 32, 7) 24 | 1 1 0 25 | 26 | LIMITS 27 | none 28 | 29 | LINK LIBRARY 30 | none 31 | 32 | SEE ALSO 33 | mne, ismult 34 | 35 | ## Copyright (C) 1999,2021 Landon Curt Noll 36 | ## 37 | ## Calc is open software; you can redistribute it and/or modify it under 38 | ## the terms of the version 2.1 of the GNU Lesser General Public License 39 | ## as published by the Free Software Foundation. 40 | ## 41 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 42 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 43 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 44 | ## Public License for more details. 45 | ## 46 | ## A copy of version 2.1 of the GNU Lesser General Public License is 47 | ## distributed with calc under the filename COPYING-LGPL. You should have 48 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 49 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 50 | ## 51 | ## Under source code control: 1995/11/09 03:27:51 52 | ## File existed as early as: 1995 53 | ## 54 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 55 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 56 | -------------------------------------------------------------------------------- /help/mne: -------------------------------------------------------------------------------- 1 | NAME 2 | mne - test for inequality of real numbers modulo a specified number 3 | 4 | SYNOPSIS 5 | mne(x, y, md) 6 | 7 | TYPES 8 | x real number 9 | y real number 10 | md real number 11 | 12 | return 0 or 1 13 | 14 | DESCRIPTION 15 | Returns 1 if and only if x is not congruent to y modulo md, i.e. 16 | for every integer n, x - y != n * md. 17 | 18 | EXAMPLE 19 | print mne(5, 33, 7), mne(5, -23, 7), mne(5, 15, 7), mne(5, 7, 0) 20 | 0 0 1 1 21 | 22 | LIMITS 23 | none 24 | 25 | LINK LIBRARY 26 | none 27 | 28 | SEE ALSO 29 | meq 30 | 31 | ## Copyright (C) 1999,2021 Landon Curt Noll 32 | ## 33 | ## Calc is open software; you can redistribute it and/or modify it under 34 | ## the terms of the version 2.1 of the GNU Lesser General Public License 35 | ## as published by the Free Software Foundation. 36 | ## 37 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 38 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 39 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 40 | ## Public License for more details. 41 | ## 42 | ## A copy of version 2.1 of the GNU Lesser General Public License is 43 | ## distributed with calc under the filename COPYING-LGPL. You should have 44 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 45 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 46 | ## 47 | ## Under source code control: 1995/11/09 03:27:51 48 | ## File existed as early as: 1995 49 | ## 50 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 51 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 52 | -------------------------------------------------------------------------------- /help/near: -------------------------------------------------------------------------------- 1 | NAME 2 | near - compare nearness of two numbers with a standard 3 | 4 | SYNOPSIS 5 | near(x, y [,eps]) 6 | 7 | TYPES 8 | x real 9 | y real 10 | eps 0 < real < 1, defaults to epsilon() 11 | 12 | return -1, 0 or 1 13 | 14 | DESCRIPTION 15 | Returns: 16 | -1 if abs(x - y) < abs(eps) 17 | 0 if abs(x - y) = abs(eps) 18 | 1 if abs(x - y) > abs(eps) 19 | 20 | EXAMPLE 21 | ; print near(22/7, 3.15, .01), near(22/7, 3.15, .005) 22 | -1 1 23 | 24 | LIMITS 25 | 0 < eps < 1 26 | 27 | LINK LIBRARY 28 | FLAG qnear(NUMBER *x, NUMBER *y, NUMBER *eps) 29 | 30 | SEE ALSO 31 | epsilon, abs 32 | 33 | ## Copyright (C) 1999,2023 Landon Curt Noll 34 | ## 35 | ## Calc is open software; you can redistribute it and/or modify it under 36 | ## the terms of the version 2.1 of the GNU Lesser General Public License 37 | ## as published by the Free Software Foundation. 38 | ## 39 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 40 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 41 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 42 | ## Public License for more details. 43 | ## 44 | ## A copy of version 2.1 of the GNU Lesser General Public License is 45 | ## distributed with calc under the filename COPYING-LGPL. You should have 46 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 47 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 48 | ## 49 | ## Under source code control: 1995/10/25 04:03:46 50 | ## File existed as early as: 1995 51 | ## 52 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 53 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 54 | -------------------------------------------------------------------------------- /help/norm: -------------------------------------------------------------------------------- 1 | NAME 2 | norm - calculate a norm of a value 3 | 4 | SYNOPSIS 5 | norm(x) 6 | 7 | TYPES 8 | If x is an object of type xx, the function xx_norm has to have been 9 | defined; what this does will be determined by the definition. 10 | 11 | For non-object x: 12 | 13 | x number (real or complex) 14 | 15 | return real 16 | 17 | DESCRIPTION 18 | For real x, norm(x) returns: 19 | 20 | x^2. 21 | 22 | For complex x, norm(x) returns: 23 | 24 | re(x)^2 + im(x)^2. 25 | 26 | EXAMPLE 27 | ; print norm(3.4), norm(-3.4), norm(3 + 4i), norm(4 - 5i) 28 | 11.56 11.56 25 41 29 | 30 | LIMITS 31 | none 32 | 33 | LINK LIBRARY 34 | void normvalue(VALUE *x, VALUE *result) 35 | 36 | SEE ALSO 37 | cmp, epsilon, hypot, abs, near, obj 38 | 39 | ## Copyright (C) 1999 Landon Curt Noll 40 | ## 41 | ## Calc is open software; you can redistribute it and/or modify it under 42 | ## the terms of the version 2.1 of the GNU Lesser General Public License 43 | ## as published by the Free Software Foundation. 44 | ## 45 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 46 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 47 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 48 | ## Public License for more details. 49 | ## 50 | ## A copy of version 2.1 of the GNU Lesser General Public License is 51 | ## distributed with calc under the filename COPYING-LGPL. You should have 52 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 53 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 54 | ## 55 | ## Under source code control: 1995/10/25 04:03:46 56 | ## File existed as early as: 1995 57 | ## 58 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 59 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 60 | -------------------------------------------------------------------------------- /help/num: -------------------------------------------------------------------------------- 1 | NAME 2 | num - numerator of a real number 3 | 4 | SYNOPSIS 5 | num(x) 6 | 7 | TYPES 8 | x real 9 | 10 | return integer 11 | 12 | DESCRIPTION 13 | For real x, den(x) returns the denominator of x. In calc, 14 | real values are actually rational values. Each calc real 15 | value can be uniquely expressed as: 16 | 17 | n / d 18 | 19 | where: 20 | 21 | n and d are integers 22 | gcd(n,d) == 1 23 | d > 0 24 | 25 | If x = n/x, then den(x) == n. 26 | 27 | EXAMPLE 28 | ; print num(7), num(-1.25), num(121/33) 29 | 7 -5 11 30 | 31 | LIMITS 32 | none 33 | 34 | LINK LIBRARY 35 | NUMBER *qnum(NUMBER *x) 36 | 37 | SEE ALSO 38 | den 39 | 40 | ## Copyright (C) 1999 Landon Curt Noll 41 | ## 42 | ## Calc is open software; you can redistribute it and/or modify it under 43 | ## the terms of the version 2.1 of the GNU Lesser General Public License 44 | ## as published by the Free Software Foundation. 45 | ## 46 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 47 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 48 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 49 | ## Public License for more details. 50 | ## 51 | ## A copy of version 2.1 of the GNU Lesser General Public License is 52 | ## distributed with calc under the filename COPYING-LGPL. You should have 53 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 54 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 55 | ## 56 | ## Under source code control: 1995/10/05 04:52:27 57 | ## File existed as early as: 1995 58 | ## 59 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 60 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 61 | -------------------------------------------------------------------------------- /help/ord: -------------------------------------------------------------------------------- 1 | NAME 2 | ord - return integer corresponding to character value 3 | 4 | SYNOPSIS 5 | ord(c) 6 | 7 | TYPES 8 | c string 9 | 10 | return int 11 | 12 | DESCRIPTION 13 | Return the integer value of the first character of a string. 14 | 15 | EXAMPLE 16 | ; print ord("DBell"), ord("chongo"), ord("/\../\"), ord("!") 17 | 68 99 47 33 18 | 19 | LIMITS 20 | none 21 | 22 | LINK LIBRARY 23 | none 24 | 25 | SEE ALSO 26 | char 27 | 28 | ## Copyright (C) 1999 Landon Curt Noll 29 | ## 30 | ## Calc is open software; you can redistribute it and/or modify it under 31 | ## the terms of the version 2.1 of the GNU Lesser General Public License 32 | ## as published by the Free Software Foundation. 33 | ## 34 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 35 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 36 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 37 | ## Public License for more details. 38 | ## 39 | ## A copy of version 2.1 of the GNU Lesser General Public License is 40 | ## distributed with calc under the filename COPYING-LGPL. You should have 41 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 42 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 43 | ## 44 | ## Under source code control: 1994/09/30 01:45:46 45 | ## File existed as early as: 1994 46 | ## 47 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 48 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 49 | -------------------------------------------------------------------------------- /help/perm: -------------------------------------------------------------------------------- 1 | NAME 2 | perm - permutation number 3 | 4 | SYNOPSIS 5 | perm(x, y) 6 | 7 | TYPES 8 | x int 9 | y int 10 | 11 | return int 12 | 13 | DESCRIPTION 14 | Return the permutation number P(x,y) which is defined as: 15 | 16 | x! 17 | -------- 18 | (x-y)! 19 | 20 | This function computes the number of permutations in which y things 21 | may be chosen from x items where order in which they are chosen matters. 22 | 23 | EXAMPLE 24 | ; print perm(7,3), perm(7,4), perm(7,5), perm(3,0), perm(0,0) 25 | 210 840 2520 3 0 26 | 27 | ; print perm(2^31+1,3) 28 | 9903520314283042197045510144 29 | 30 | LIMITS 31 | x >= y >= 0 32 | y < 2^24 33 | 34 | LINK LIBRARY 35 | void zperm(NUMBER x, y, *ret) 36 | 37 | SEE ALSO 38 | comb, fact, randperm 39 | 40 | ## Copyright (C) 1999-2006 Landon Curt Noll 41 | ## 42 | ## Calc is open software; you can redistribute it and/or modify it under 43 | ## the terms of the version 2.1 of the GNU Lesser General Public License 44 | ## as published by the Free Software Foundation. 45 | ## 46 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 47 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 48 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 49 | ## Public License for more details. 50 | ## 51 | ## A copy of version 2.1 of the GNU Lesser General Public License is 52 | ## distributed with calc under the filename COPYING-LGPL. You should have 53 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 54 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 55 | ## 56 | ## Under source code control: 1994/10/20 04:03:02 57 | ## File existed as early as: 1994 58 | ## 59 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 60 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 61 | -------------------------------------------------------------------------------- /help/pfact: -------------------------------------------------------------------------------- 1 | NAME 2 | pfact - product of primes up to specified integer 3 | 4 | SYNOPSIS 5 | pfact(n) 6 | 7 | TYPES 8 | n nonnegative integer 9 | 10 | return positive integer 11 | 12 | DESCRIPTION 13 | Returns the product of primes p_i for which p_i <= n. 14 | 15 | EXAMPLE 16 | ; for (i = 0; i <= 16; i++) print pfact(i),:; 17 | 1 1 2 6 6 30 30 210 210 210 210 2310 2310 30030 30030 30030 30030 18 | 19 | LIMITS 20 | n < 2^24 21 | 22 | LINK LIBRARY 23 | NUMBER *qpfact(NUMBER *n) 24 | void zpfact(ZVALUE z, ZVALUE *dest) 25 | 26 | SEE ALSO 27 | factor, isprime, lfactor, nextcand, nextprime, prevcand, prevprime, 28 | pix, ptest, fact, lcmfact 29 | 30 | ## Copyright (C) 1999-2006 Landon Curt Noll 31 | ## 32 | ## Calc is open software; you can redistribute it and/or modify it under 33 | ## the terms of the version 2.1 of the GNU Lesser General Public License 34 | ## as published by the Free Software Foundation. 35 | ## 36 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 37 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 38 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 39 | ## Public License for more details. 40 | ## 41 | ## A copy of version 2.1 of the GNU Lesser General Public License is 42 | ## distributed with calc under the filename COPYING-LGPL. You should have 43 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 44 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 45 | ## 46 | ## Under source code control: 1995/12/18 12:34:57 47 | ## File existed as early as: 1995 48 | ## 49 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 50 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 51 | -------------------------------------------------------------------------------- /help/pi: -------------------------------------------------------------------------------- 1 | NAME 2 | pi - evaluate pi to specified accuracy 3 | 4 | SYNOPSIS 5 | pi([eps]) 6 | 7 | TYPES 8 | eps 0 < real < 1, defaults to epsilon() 9 | 10 | return real 11 | 12 | DESCRIPTION 13 | Returns a multiple of eps differing from the true value of pi by 14 | less than 0.75 eps, and in nearly all cases by less than 0.5 eps. 15 | 16 | EXAMPLE 17 | ; print pi(1e-5), pi(1e-10), pi(1e-15), pi(1e-20) 18 | 3.14159 3.1415926536 3.141592653589793 3.14159265358979323846 19 | 20 | LIMITS 21 | 0 < eps < 1 22 | 23 | LINK LIBRARY 24 | NUMBER *qpi(NUMBER *eps) 25 | 26 | SEE ALSO 27 | atan2 28 | 29 | ## Copyright (C) 1999-2006,2023 Landon Curt Noll 30 | ## 31 | ## Calc is open software; you can redistribute it and/or modify it under 32 | ## the terms of the version 2.1 of the GNU Lesser General Public License 33 | ## as published by the Free Software Foundation. 34 | ## 35 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 36 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 37 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 38 | ## Public License for more details. 39 | ## 40 | ## A copy of version 2.1 of the GNU Lesser General Public License is 41 | ## distributed with calc under the filename COPYING-LGPL. You should have 42 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 43 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 44 | ## 45 | ## Under source code control: 1995/10/25 04:03:46 46 | ## File existed as early as: 1995 47 | ## 48 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 49 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 50 | -------------------------------------------------------------------------------- /help/popcnt: -------------------------------------------------------------------------------- 1 | NAME 2 | popcnt - number of bit that match a given value 3 | 4 | SYNOPSIS 5 | popcnt(x [,bitval]) 6 | 7 | TYPES 8 | x number (real or integer) 9 | bitval 0 or 1 10 | 11 | return number 12 | 13 | DESCRIPTION 14 | Count the number of bits in abs(x) that match bitval. The default 15 | bitval is 1 which counts the number of 1 bits. 16 | 17 | The popcnt function is equivalent to #x when x is an integer. 18 | 19 | EXAMPLE 20 | ; print popcnt(32767), popcnt(3/2), popcnt(pi(),0), popcnt(pi(),1) 21 | 15 3 69 65 22 | 23 | ; print popcnt(randombit(128), 0), popcnt(randombit(128), 1) 24 | 61 64 25 | 26 | LIMITS 27 | none 28 | 29 | LINK LIBRARY 30 | long zpopcnt(ZVALUE z, int bitval) 31 | 32 | SEE ALSO 33 | none 34 | 35 | ## Copyright (C) 1999 Landon Curt Noll 36 | ## 37 | ## Calc is open software; you can redistribute it and/or modify it under 38 | ## the terms of the version 2.1 of the GNU Lesser General Public License 39 | ## as published by the Free Software Foundation. 40 | ## 41 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 42 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 43 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 44 | ## Public License for more details. 45 | ## 46 | ## A copy of version 2.1 of the GNU Lesser General Public License is 47 | ## distributed with calc under the filename COPYING-LGPL. You should have 48 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 49 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 50 | ## 51 | ## Under source code control: 1997/09/11 04:20:02 52 | ## File existed as early as: 1997 53 | ## 54 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 55 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 56 | -------------------------------------------------------------------------------- /help/r2d: -------------------------------------------------------------------------------- 1 | NAME 2 | r2d - convert radians to degrees 3 | 4 | SYNOPSIS 5 | r2d(x [,eps]) 6 | 7 | TYPES 8 | x number (real or complex) 9 | eps 0 < real < 1, defaults to epsilon() 10 | 11 | return number 12 | 13 | DESCRIPTION 14 | Given x radians, return the equivalent number of degrees. 15 | 16 | The eps controls the precision of the calculated internal 17 | constant pi / 180. 18 | 19 | EXAMPLE 20 | ; pi = pi(1e-20) 21 | ; print r2d(pi), r2d(pi/3), r2d(2*pi) 22 | 180 60 360 23 | 24 | ; print r2d(pi+4i), r2d(pi/3 + 1i*pi), r2d(pi/5 + 5i*pi) 25 | 180+~229.18311805232928350739i 60+180, 36+900i 26 | 27 | LIMITS 28 | 0 < eps < 1 29 | 30 | LINK LIBRARY 31 | NUMBER *qpidiv180(NUMBER *eps) 32 | 33 | SEE ALSO 34 | d2r, g2r, r2g, d2g, g2d, 35 | sin, cos, tan, sec, csc, cot, epsilon 36 | 37 | ## Copyright (C) 2021,2023 Landon Curt Noll 38 | ## 39 | ## Calc is open software; you can redistribute it and/or modify it under 40 | ## the terms of the version 2.1 of the GNU Lesser General Public License 41 | ## as published by the Free Software Foundation. 42 | ## 43 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 44 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 45 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 46 | ## Public License for more details. 47 | ## 48 | ## A copy of version 2.1 of the GNU Lesser General Public License is 49 | ## distributed with calc under the filename COPYING-LGPL. You should have 50 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 51 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 52 | ## 53 | ## Under source code control: 2021/09/07 12:04:28 54 | ## File existed as early as: 2021 55 | ## 56 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 57 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 58 | -------------------------------------------------------------------------------- /help/re: -------------------------------------------------------------------------------- 1 | NAME 2 | re - real part of a real or complex number 3 | 4 | SYNOPSIS 5 | re(x) 6 | 7 | TYPES 8 | x real or complex 9 | 10 | return real 11 | 12 | DESCRIPTION 13 | If x = u + v * 1i where u and v are real, re(x) returns u. 14 | 15 | EXAMPLE 16 | ; print re(2), re(2 + 3i), re(-4.25 - 7i) 17 | 2 2 -4.25 18 | 19 | LIMITS 20 | none 21 | 22 | LINK LIBRARY 23 | COMPLEX *c_imag(COMPLEX *x) 24 | 25 | SEE ALSO 26 | im 27 | 28 | ## Copyright (C) 1999 Landon Curt Noll 29 | ## 30 | ## Calc is open software; you can redistribute it and/or modify it under 31 | ## the terms of the version 2.1 of the GNU Lesser General Public License 32 | ## as published by the Free Software Foundation. 33 | ## 34 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 35 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 36 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 37 | ## Public License for more details. 38 | ## 39 | ## A copy of version 2.1 of the GNU Lesser General Public License is 40 | ## distributed with calc under the filename COPYING-LGPL. You should have 41 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 42 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 43 | ## 44 | ## Under source code control: 1995/10/05 04:52:27 45 | ## File existed as early as: 1995 46 | ## 47 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 48 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 49 | -------------------------------------------------------------------------------- /help/rm: -------------------------------------------------------------------------------- 1 | NAME 2 | rm - remove file(s) 3 | 4 | SYNOPSIS 5 | rm(["-f",] name, ...) 6 | 7 | TYPES 8 | name name of a file(s) 9 | 10 | return nil 11 | 12 | DESCRIPTION 13 | Removes one or more files. If the first arg is "-f", then a forced 14 | removal is performed and "no such file" errors are ignored. 15 | 16 | EXAMPLE 17 | ; rm("junk") 18 | ; rm("-f", "more/junk.cal", "curds", "whey") 19 | 20 | LIMITS 21 | name must be a non-zero length string 22 | 23 | LINK LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | rmdir 28 | 29 | ## Copyright (C) 1999 Landon Curt Noll 30 | ## 31 | ## Calc is open software; you can redistribute it and/or modify it under 32 | ## the terms of the version 2.1 of the GNU Lesser General Public License 33 | ## as published by the Free Software Foundation. 34 | ## 35 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 36 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 37 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 38 | ## Public License for more details. 39 | ## 40 | ## A copy of version 2.1 of the GNU Lesser General Public License is 41 | ## distributed with calc under the filename COPYING-LGPL. You should have 42 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 43 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 44 | ## 45 | ## Under source code control: 1996/06/30 22:02:58 46 | ## File existed as early as: 1996 47 | ## 48 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 49 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 50 | -------------------------------------------------------------------------------- /help/scanf: -------------------------------------------------------------------------------- 1 | NAME 2 | scanf - formatted scan of characters read from standard input 3 | 4 | SYNOPSIS 5 | scanf(fmt, x_1, x_2, ...) 6 | 7 | TYPES 8 | fmt string 9 | x_1, x_2, ... lvalues 10 | 11 | return null, nonnegative integer, or error value 12 | 13 | DESCRIPTION 14 | This does the same as fscanf(files(0), fmt, x_1, x_2, ...). 15 | For details see fscanf. 16 | 17 | EXAMPLE 18 | ; global a, b, c 19 | ; scanf("%5c", a) 20 | 1 21 | ; a 22 | "Alpha" 23 | 24 | LIMITS 25 | The number of arguments is not to exceed 1024. 26 | 27 | LINK LIBRARY 28 | int scanfstr(char *str, char *fmt, int count, VALUE **vals); 29 | 30 | SEE ALSO 31 | scan, strscan, fscanf, strscanf, scanf, printf, fprintf 32 | 33 | ## Copyright (C) 1999-2006 Landon Curt Noll 34 | ## 35 | ## Calc is open software; you can redistribute it and/or modify it under 36 | ## the terms of the version 2.1 of the GNU Lesser General Public License 37 | ## as published by the Free Software Foundation. 38 | ## 39 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 40 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 41 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 42 | ## Public License for more details. 43 | ## 44 | ## A copy of version 2.1 of the GNU Lesser General Public License is 45 | ## distributed with calc under the filename COPYING-LGPL. You should have 46 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 47 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 48 | ## 49 | ## Under source code control: 1996/04/30 03:05:18 50 | ## File existed as early as: 1996 51 | ## 52 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 53 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 54 | -------------------------------------------------------------------------------- /help/sech: -------------------------------------------------------------------------------- 1 | NAME 2 | sech - hyperbolic secant 3 | 4 | SYNOPSIS 5 | sech(x [,eps]) 6 | 7 | TYPES 8 | x real 9 | eps 0 < real < 1, defaults to epsilon() 10 | 11 | return real 12 | 13 | DESCRIPTION 14 | Calculate the sech of x to the nearest or next to nearest multiple of 15 | epsilon, with absolute error less than .75 * abs(eps). 16 | 17 | sech(x) = 2/(exp(x) + exp(-x)) 18 | 19 | EXAMPLE 20 | ; print sech(1, 1e-5), sech(1, 1e-10), sech(1, 1e-15), sech(1, 1e-20) 21 | 0.64805 0.6480542737 0.648054273663885 0.64805427366388539958 22 | 23 | LIMITS 24 | unlike sin and cos, x must be real 25 | 0 < eps < 1 26 | 27 | LINK LIBRARY 28 | NUMBER *qsech(NUMBER *x, NUMBER *eps) 29 | 30 | SEE ALSO 31 | sinh, cosh, tanh, coth, csch 32 | asinh, acosh, atanh, acoth, asech, acsch 33 | epsilon 34 | 35 | ## Copyright (C) 1999,2021,2023 Landon Curt Noll 36 | ## 37 | ## Calc is open software; you can redistribute it and/or modify it under 38 | ## the terms of the version 2.1 of the GNU Lesser General Public License 39 | ## as published by the Free Software Foundation. 40 | ## 41 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 42 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 43 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 44 | ## Public License for more details. 45 | ## 46 | ## A copy of version 2.1 of the GNU Lesser General Public License is 47 | ## distributed with calc under the filename COPYING-LGPL. You should have 48 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 49 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 50 | ## 51 | ## Under source code control: 1995/11/13 03:49:00 52 | ## File existed as early as: 1995 53 | ## 54 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 55 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 56 | -------------------------------------------------------------------------------- /help/sinh: -------------------------------------------------------------------------------- 1 | NAME 2 | sinh - hyperbolic sine 3 | 4 | SYNOPSIS 5 | sinh(x [,eps]) 6 | 7 | TYPES 8 | x real 9 | eps 0 < real < 1, defaults to epsilon() 10 | 11 | return real 12 | 13 | DESCRIPTION 14 | Calculate the sinh of x to the nearest or next to nearest multiple of 15 | epsilon, with absolute error less than .75 * abs(eps). 16 | 17 | sinh(x) = (exp(x) - exp(-x))/2 18 | 19 | EXAMPLE 20 | ; print sinh(1, 1e-5), sinh(1, 1e-10), sinh(1, 1e-15), sinh(1, 1e-20) 21 | 1.1752 1.1752011936 1.175201193643801 1.17520119364380145688 22 | 23 | LIMITS 24 | unlike sin and cos, x must be real 25 | 0 < eps < 1 26 | 27 | LINK LIBRARY 28 | NUMBER *qsinh(NUMBER *x, NUMBER *eps) 29 | 30 | SEE ALSO 31 | cosh, tanh, coth, sech, csch 32 | asinh, acosh, atanh, acoth, asech, acsch 33 | epsilon 34 | 35 | ## Copyright (C) 1999,2023 Landon Curt Noll 36 | ## 37 | ## Calc is open software; you can redistribute it and/or modify it under 38 | ## the terms of the version 2.1 of the GNU Lesser General Public License 39 | ## as published by the Free Software Foundation. 40 | ## 41 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 42 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 43 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 44 | ## Public License for more details. 45 | ## 46 | ## A copy of version 2.1 of the GNU Lesser General Public License is 47 | ## distributed with calc under the filename COPYING-LGPL. You should have 48 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 49 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 50 | ## 51 | ## Under source code control: 1994/03/19 01:40:29 52 | ## File existed as early as: 1994 53 | ## 54 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 55 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 56 | -------------------------------------------------------------------------------- /help/strlen: -------------------------------------------------------------------------------- 1 | NAME 2 | strlen - number of characters in a string 3 | 4 | SYNOPSIS 5 | strlen(x) 6 | 7 | TYPES 8 | x string 9 | 10 | return integer 11 | 12 | DESCRIPTION 13 | strlen(x) returns the number of characters in x 14 | 15 | EXAMPLE 16 | ; print strlen(""), strlen("abc"), strlen("a b\tc\\d") 17 | 0 3 7 18 | 19 | LIMITS 20 | none 21 | 22 | LINK LIBRARY 23 | none 24 | 25 | SEE ALSO 26 | strcat, strcpy, strerror, strncmp, strncpy, strpos, 27 | strprintf, strscan, strscanf, substr 28 | 29 | ## Copyright (C) 1999-2006 Ernest Bowen 30 | ## 31 | ## Calc is open software; you can redistribute it and/or modify it under 32 | ## the terms of the version 2.1 of the GNU Lesser General Public License 33 | ## as published by the Free Software Foundation. 34 | ## 35 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 36 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 37 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 38 | ## Public License for more details. 39 | ## 40 | ## A copy of version 2.1 of the GNU Lesser General Public License is 41 | ## distributed with calc under the filename COPYING-LGPL. You should have 42 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 43 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 44 | ## 45 | ## Under source code control: 1995/10/05 04:52:27 46 | ## File existed as early as: 1995 47 | ## 48 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 49 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 50 | -------------------------------------------------------------------------------- /help/strtolower: -------------------------------------------------------------------------------- 1 | NAME 2 | strtolower - transform an ASCII string to lower case 3 | 4 | SYNOPSIS 5 | strtolower(x_1) 6 | 7 | TYPES 8 | str string 9 | x_1 any 10 | 11 | return string 12 | 13 | DESCRIPTION 14 | All ASCII upper case letters get transformed into lower case letters. This 15 | function can be locale dependent. 16 | 17 | The function returns the lowercased string. 18 | 19 | EXAMPLE 20 | ; strtolower(" GNU Lesser General Public License"); 21 | " gnu lesser general public license" 22 | 23 | LIMITS 24 | none. 25 | 26 | LINK LIBRARY 27 | none 28 | 29 | SEE ALSO 30 | strcat, strcpy, strerror, strlen, strncmp, strncpy, strpos, 31 | strprintf, strscanf, substr 32 | 33 | ## Copyright (C) 2013,2021 Christoph Zurnieden 34 | ## 35 | ## Calc is open software; you can redistribute it and/or modify it under 36 | ## the terms of the version 2.1 of the GNU Lesser General Public License 37 | ## as published by the Free Software Foundation. 38 | ## 39 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 40 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 41 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 42 | ## Public License for more details. 43 | ## 44 | ## A copy of version 2.1 of the GNU Lesser General Public License is 45 | ## distributed with calc under the filename COPYING-LGPL. You should have 46 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 47 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 48 | -------------------------------------------------------------------------------- /help/strtoupper: -------------------------------------------------------------------------------- 1 | NAME 2 | strtoupper - transform an ASCII string to upper case 3 | 4 | SYNOPSIS 5 | strtoupper(x_1) 6 | 7 | TYPES 8 | str string 9 | x_1 any 10 | 11 | return string 12 | 13 | DESCRIPTION 14 | All ASCII lower case letters get transformed into upper case letters. This 15 | function can be locale dependent. 16 | 17 | The function returns the lowercased string. 18 | 19 | EXAMPLE 20 | ; strtoupper(" GNU Lesser General Public License"); 21 | " GNU LESSER GENERAL PUBLIC LICENSE" 22 | 23 | LIMITS 24 | none. 25 | 26 | LINK LIBRARY 27 | none 28 | 29 | SEE ALSO 30 | strcat, strcpy, strerror, strlen, strncmp, strncpy, strpos, 31 | strprintf, strscanf, substr, strtoupper 32 | 33 | ## Copyright (C) 2013,2021 Christoph Zurnieden 34 | ## 35 | ## Calc is open software; you can redistribute it and/or modify it under 36 | ## the terms of the version 2.1 of the GNU Lesser General Public License 37 | ## as published by the Free Software Foundation. 38 | ## 39 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 40 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 41 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 42 | ## Public License for more details. 43 | ## 44 | ## A copy of version 2.1 of the GNU Lesser General Public License is 45 | ## distributed with calc under the filename COPYING-LGPL. You should have 46 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 47 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 48 | -------------------------------------------------------------------------------- /help/time: -------------------------------------------------------------------------------- 1 | NAME 2 | time - number of seconds since the Epoch 3 | 4 | SYNOPSIS 5 | time() 6 | 7 | TYPES 8 | return int 9 | 10 | DESCRIPTION 11 | The time() builtin returns the number of seconds since the Epoch, 12 | which according to POSIX is: 13 | 14 | Thr Jan 1 00:00:00 UTC 1970 15 | 16 | EXAMPLE 17 | ; print time(); 18 | 831081380 19 | 20 | LIMITS 21 | none 22 | 23 | LINK LIBRARY 24 | none 25 | 26 | SEE ALSO 27 | ctime, runtime 28 | 29 | ## Copyright (C) 1999,2021 Landon Curt Noll 30 | ## 31 | ## Calc is open software; you can redistribute it and/or modify it under 32 | ## the terms of the version 2.1 of the GNU Lesser General Public License 33 | ## as published by the Free Software Foundation. 34 | ## 35 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 36 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 37 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 38 | ## Public License for more details. 39 | ## 40 | ## A copy of version 2.1 of the GNU Lesser General Public License is 41 | ## distributed with calc under the filename COPYING-LGPL. You should have 42 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 43 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 44 | ## 45 | ## Under source code control: 1996/05/01 16:57:20 46 | ## File existed as early as: 1996 47 | ## 48 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 49 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 50 | -------------------------------------------------------------------------------- /help/version: -------------------------------------------------------------------------------- 1 | NAME 2 | version - return the calc version string 3 | 4 | SYNOPSIS 5 | version() 6 | 7 | TYPES 8 | return string 9 | 10 | DESCRIPTION 11 | Returns the calc version string. 12 | 13 | Calc version strings can be of the form: 14 | 15 | x.y.z.w 16 | x.y.z 17 | x.y 18 | 19 | where x, y, z, w, v are integers (without leading 0's) and, 20 | t is the literal character 't'. 21 | 22 | EXAMPLE 23 | ; ## NOTE: Your version will likely vary: 24 | 25 | ; version() 26 | "2.14.0.10" 27 | 28 | LIMITS 29 | none 30 | 31 | LINK LIBRARY 32 | none 33 | 34 | SEE ALSO 35 | calclevel, calcpath, inputlevel 36 | 37 | ## Copyright (C) 2001,2021 Landon Curt Noll 38 | ## 39 | ## Calc is open software; you can redistribute it and/or modify it under 40 | ## the terms of the version 2.1 of the GNU Lesser General Public License 41 | ## as published by the Free Software Foundation. 42 | ## 43 | ## Calc is distributed in the hope that it will be useful, but WITHOUT 44 | ## ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 45 | ## or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 46 | ## Public License for more details. 47 | ## 48 | ## A copy of version 2.1 of the GNU Lesser General Public License is 49 | ## distributed with calc under the filename COPYING-LGPL. You should have 50 | ## received a copy with calc; if not, write to Free Software Foundation, Inc. 51 | ## 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 52 | ## 53 | ## Under source code control: 2001/05/28 17:38:01 54 | ## File existed as early as: 2001 55 | ## 56 | ## chongo /\oo/\ http://www.isthe.com/chongo/ 57 | ## Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 58 | -------------------------------------------------------------------------------- /lib_util.h: -------------------------------------------------------------------------------- 1 | /* 2 | * lib_util - calc link library utility routines 3 | * 4 | * Copyright (C) 1999-2007,2014 Landon Curt Noll 5 | * 6 | * Calc is open software; you can redistribute it and/or modify it under 7 | * the terms of the version 2.1 of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation. 9 | * 10 | * Calc is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 13 | * Public License for more details. 14 | * 15 | * A copy of version 2.1 of the GNU Lesser General Public License is 16 | * distributed with calc under the filename COPYING-LGPL. You should have 17 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | * 20 | * Under source code control: 1997/04/19 21:38:30 21 | * File existed as early as: 1997 22 | * 23 | * chongo /\oo/\ http://www.isthe.com/chongo/ 24 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 25 | */ 26 | 27 | /* 28 | * These routines are here to support users of libcalc.a. These routines 29 | * are not directly used by calc itself, however. 30 | */ 31 | 32 | 33 | #if !defined(INCLUDE_LIB_UTIL_H) 34 | #define INCLUDE_LIB_UTIL_H 35 | 36 | /* external functions in lib_util.c */ 37 | EXTERN int lowhex2bin[256]; 38 | EXTERN char lowbin2hex[256]; 39 | E_FUNC ZVALUE convstr2z(char*); 40 | E_FUNC ZVALUE convhex2z(char *hex); 41 | E_FUNC char *convz2hex(ZVALUE z); 42 | 43 | #endif /* INCLUDE_LIB_UTIL_H */ 44 | -------------------------------------------------------------------------------- /nametype.h: -------------------------------------------------------------------------------- 1 | /* 2 | * nametype - associate names with values 3 | * 4 | * Copyright (C) 1999,2014 Landon Curt Noll 5 | * 6 | * Calc is open software; you can redistribute it and/or modify it under 7 | * the terms of the version 2.1 of the GNU Lesser General Public License 8 | * as published by the Free Software Foundation. 9 | * 10 | * Calc is distributed in the hope that it will be useful, but WITHOUT 11 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 | * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General 13 | * Public License for more details. 14 | * 15 | * A copy of version 2.1 of the GNU Lesser General Public License is 16 | * distributed with calc under the filename COPYING-LGPL. You should have 17 | * received a copy with calc; if not, write to Free Software Foundation, Inc. 18 | * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 19 | * 20 | * Under source code control: 1997/03/08 13:44:55 21 | * File existed as early as: 1997 22 | * 23 | * chongo /\oo/\ http://www.isthe.com/chongo/ 24 | * Share and enjoy! :-) http://www.isthe.com/chongo/tech/comp/calc/ 25 | */ 26 | 27 | 28 | #if !defined(INCLUDE_NAMETYPE_H) 29 | #define INCLUDE_NAMETYPE_H 30 | 31 | 32 | /* 33 | * Configuration parameter name and type. 34 | */ 35 | typedef struct { 36 | char *name; /* name of configuration string */ 37 | long type; /* type for configuration */ 38 | } NAMETYPE; 39 | 40 | 41 | #endif /* !INCLUDE_NAMETYPE_H */ 42 | --------------------------------------------------------------------------------