- 43 definitions of BC. Definition of BC in Slang/Internet Slang. What does BC stand for?
- What does BC Stand For in Internet Slang, Chat Texting & Subculture? For BC we have found 500 definitions.; What does BC mean? We know 500 definitions for BC abbreviation or acronym in 8 categories.
- Texting slang involves sending shortened messages between mobile devices. This texting slang dictionary helps you quickly find all the most common abbreviations.
Developer(s) | Robert Morris and Lorinda Cherry of Bell Labs, Philip A. Nelson |
---|---|
Initial release | 1975, 45–46 years ago |
Operating system | Unix, Unix-like, Plan 9, FreeDOS |
Platform | Cross-platform |
Type | Command |
The terms anno Domini (AD) and before Christ (BC) are used to label or number years in the Julian and Gregorian calendars.The term anno Domini is Medieval Latin and means 'in the year of the Lord' but is often presented using 'our Lord' instead of 'the Lord', taken from the full original phrase 'anno Domini nostri Jesu Christi', which translates to 'in the year of our Lord Jesus Christ'.
bc, for basic calculator (often referred to as bench calculator), is 'an arbitrary-precision calculator language' with syntax similar to the C programming language. bc is typically used as either a mathematical scripting language or as an interactive mathematical shell.
Overview[edit]
A typical interactive usage is typing the command
bc
on a Unixcommand prompt and entering a mathematical expression, such as (1 + 3) * 2
, whereupon 8 will be output. While bc can work with arbitrary precision, it actually defaults to zero digits after the decimal point, so the expression 2/3
yields 0. This can surprise new bc users unaware of this fact. The -l
option to bc sets the default scale (digits after the decimal point) to 20 and adds several additional mathematical functions to the language.![Bc definition Bc definition](https://i.pinimg.com/736x/df/bc/58/dfbc58720a9891c0f801e4c5b00b55a6.jpg)
History[edit]
bc first appeared in Version 6 Unix in 1975 and was written by Robert Morris and Lorinda Cherry of Bell Labs. bc was preceded by dc, an earlier arbitrary-precision calculator written by the same authors. dc could do arbitrary-precision calculations, but its reverse Polish notation (RPN) syntax—much loved by many for evaluating algebraic formulas—proved inconvenient to its users when expressing flow control, and therefore bc was written as a front-end to dc. bc was a very simple compiler (a single yacc source file with a few hundred lines), which converted the new, C-like, bc syntax into dc's postfix notation and piped the results through dc.
In 1991, POSIX rigorously defined and standardized bc. Three implementations of this standard survive today: The first is the traditional Unix implementation, a front-end to dc, which survives in Unix and Plan 9 systems. The second is the free softwareGNU bc, first released in 1991 by Philip A. Nelson. The GNU implementation has numerous extensions beyond the POSIX standard and is no longer a front-end to dc (it is a bytecode interpreter). The third is a re-implementation by OpenBSD in 2003.
Implementations[edit]
POSIX bc[edit]
The POSIX standardized bc language is traditionally written as a program in the dc programming language to provide a higher level of access to the features of the dc language without the complexities of dc's terse syntax.
In this form, the bc language contains single-letter variable, array and function names and most standard arithmetic operators, as well as the familiar control-flow constructs (
if(cond)..
, while(cond)..
and for(init;cond;inc)..
) from C. Unlike C, an if
clause may not be followed by an else
.Functions are defined using a
define
keyword, and values are returned from them using a return
followed by the return value in parentheses. The auto
keyword (optional in C) is used to declare a variable as local to a function.All numbers and variable contents are arbitrary-precision numbers whose precision (in decimal places) is determined by the global
scale
variable.The numeric base of input (in interactive mode), output and program constants may be specified by setting the reserved
ibase
(input base) and obase
(output base) variables.Output is generated by deliberately not assigning the result of a calculation to a variable.
Comments may be added to bc code by use of the C
/*
and */
(start and end comment) symbols.Mathematical operators[edit]
Exactly as C[edit]
What Does BC Stand For? - Acronym Finder
The following POSIX bc operators behave exactly like their C counterparts:
Similar to C[edit]
The modulus operators,
%
and %=
behave exactly like their C counterparts only when the global scale
variable is set to 0, i.e. all calculations are integer-only. Otherwise the computation is done with the appropriate scale. a%b
is defined as a-(a/b)*b
. Examples:Conflicting with C[edit]
The operators
superficially resemble the C bitwise exclusive-or operators, but are in fact the bc integer exponentiation operators.
Of particular note, the use of the
^
operator with negative numbers does not follow the C operator precedence. -2^2
gives the answer of 4 under bc rather than −4.'Missing' operators relative to C[edit]
The bitwise, boolean and conditional operators:
are not available in POSIX bc.
Built-in functions[edit]
The
sqrt()
function for calculating square roots is POSIX bc's only built-in mathematical function. Other functions are available in an external standard library.The
scale()
function for determining the precision (as with the scale
variable) of its argument and the length()
function for determining the number of significant decimal digits in its argument are also built-in. Casinos on native american reservations.Standard library functions[edit]
bc's standard math library (defined with the -l option) contains functions for calculating sine, cosine, arctangent, natural logarithm, the exponential function and the two parameter Bessel functionJ. Most standard mathematical functions (including the other inverse trigonometric functions) can be constructed using these. See external links for implementations of many other functions.
bc command | Function | Description |
---|---|---|
s(x) | Sine | Takes x, an angle in radians |
c(x) | Cosine | Takes x, an angle in radians |
a(x) | Arctangent | Returns radians |
l(x) | Natural logarithm | |
e(x) | Exponential function | |
j(n,x) | Bessel function | Returns the order-n Bessel function of x. |
The -l option changes the scale to 20,[1] so things such as modulo may work unexpectedly. For example, writing
bc -l
and then the command print 3%2
outputs 0. But writing scale=0
after bc -l
and then the command print 3%2
will output 1.Plan 9 bc[edit]
Plan 9 bc is identical to POSIX bc but for an additional
print
statement.GNU bc[edit]
GNU bc derives from the POSIX standard and includes many enhancements. It is entirely separate from dc-based implementations of the POSIX standard and is instead written in C. Nevertheless, it is fully backwards compatible as all POSIX bc programs will run unmodified as GNU bc programs.
GNU bc variables, arrays and function names may contain more than one character, some more operators have been included from C, and notably, an
if
clause may be followed by an else
.Output is achieved either by deliberately not assigning a result of a calculation to a variable (the POSIX way) or by using the added
print
statement. Casumo casino bonus.Furthermore, a
read
statement allows the interactive input of a number into a running calculation.In addition to C-style comments, a
#
character will cause everything after it until the next new-line to be ignored.The value of the last calculation is always stored within the additional built-in
last
variable.Extra operators[edit]
The following logical operators are additional to those in POSIX bc:
They are available for use in conditional statements (such as within an
if
statement). Note, however, that there are still no equivalent bitwise or assignment operations.Functions[edit]
All functions available in GNU bc are inherited from POSIX. No further functions are provided as standard with the GNU distribution.
Example code[edit]
Since the bc
^
operator only allows an integer power to its right, one of the first functions a bc user might write is a power function with a floating-point exponent. Both of the below assume the standard library has been included: How to get lucky at the casino.A 'power' function in POSIX bc[edit]
Calculating π to 10000 digits[edit]
Calculate pi using the builtin arctangent function, a():
A translated C function[edit]
Because the syntax of bc is similar to that of C, published numerical functions written in C can often be translated into bc quite easily, which immediately provides the arbitrary precision of bc. For example, in the Journal of Statistical Software (July 2004, Volume 11, Issue 5), George Marsaglia published the following C code for the cumulative normal distribution:
With some necessary changes to accommodate bc's different syntax, and realizing that the constant '0.9189..' is actually log(2*PI)/2, this can be translated to the following GNU bc code:
What Does Bc Mean In Texting
Using bc in shell scripts[edit]
Bc Definition
bc can be used non-interactively, with input through a pipe. This is useful inside shell scripts. For example:
In contrast, note that the bash shell only performs integer arithmetic, e.g.:
One can also use the here-string idiom (in bash, ksh, csh):
See also[edit]
References[edit]
- ^ abNelson, Philip A. (20 March 2001). 'bc Command Manual'. Free Software Foundation. Retrieved 2017-04-20.
bc
: arbitrary-precision arithmetic language – Commands & Utilities Reference, The Single UNIX Specification, Issue 7 from The Open Groupbc(1)
– Plan 9 Programmer's Manual, Volume 1- 6th Edition Unix bc source code, the first release of bc, from May 1975, compiling bc syntax into dc syntax
External links[edit]
Bc Real Meaning
The Wikibook Guide to Unix has a page on the topic of: Commands |
- GNU bc (and an alpha version) from the Free Software Foundation
- bc for Windows from GnuWin32
- X-bc - A Graphical User Interface to bc
- extensions.bc - contains functions of trigonometry, exponential functions, functions of number theory and some mathematical constants
- scientific_constants.bc - contains particle masses, basic constants, such as speed of light in the vacuum and the gravitational constant
Retrieved from 'https://en.wikipedia.org/w/index.php?title=Bc_(programming_language)&oldid=993963030'