Content deleted Content added
PuppyMonkey (talk | contribs) Importing Wikidata short description: "UNIX utility which implements an arbitrary-precision arithmetic language" |
Stevebroshar (talk | contribs) there is a language, but's primarily a program, a tool, software |
||
(13 intermediate revisions by 12 users not shown) | |||
Line 1:
{{Short description|Arbitrary-precision calculator supporting interactive and scripted use}}{{Not to be confused with|B programming language|C programming language}}{{more footnotes|date=June 2013}}
{{lowercase|title=bc programming language}}
{{Infobox software
Line 18 ⟶ 17:
| website =
}}
'''bc''', for ''basic calculator''
==Overview==
Line 26 ⟶ 25:
bc first appeared in [[Version 6 Unix]] in 1975. It was written by [[Lorinda Cherry]] of [[Bell Labs]] as a front end to [[dc (computer program)|dc]], an arbitrary-precision calculator written by [[Robert Morris (cryptographer)|Robert Morris]] and Cherry. dc performed arbitrary-precision computations specified in [[reverse Polish notation]]. bc provided a conventional programming-language interface to the same capability via a simple [[compiler]] (a single [[yacc]] source file comprising a few hundred lines of code), which converted a [[C (programming language)|C]]-like syntax into dc notation and [[Pipeline (Unix)|piped]] the results through dc.
In 1991, [[POSIX]] rigorously defined and standardized bc.
==Implementations==
Line 38 ⟶ 37:
All numbers and variable contents are [[arbitrary-precision]] numbers whose precision (in decimal places) is determined by the global '''<code>scale</code>''' variable.
The [[
Output is generated by deliberately not assigning the result of a calculation to a variable.
Line 81 ⟶ 80:
====="Missing" operators relative to C=====
The [[bitwise operation|bitwise]], [[Boolean logic|
& | ^ && ||
Line 135 ⟶ 134:
===GNU bc===
GNU bc derives from the POSIX standard and includes many
GNU bc variables, arrays and function names may contain more than one character, some more operators have been included from C, and notably, an '''<code>if</code>''' clause may be followed by an '''<code>else</code>'''.
Line 203 ⟶ 202:
</syntaxhighlight>
With some necessary changes to accommodate bc's different syntax, and
<syntaxhighlight lang="bc">
Line 259 ⟶ 258:
* [https://www.gnu.org/software/bc/ GNU bc] (and an [http://alpha.gnu.org/gnu/bc/ alpha version]) from the Free Software Foundation
* [https://web.archive.org/web/20160222234922/http://gnuwin32.sourceforge.net/packages/bc.htm bc for Windows] from [[GnuWin32]]
* [https://
* [https://web.archive.org/web/20160304084708/http://x-bc.sourceforge.net/ X-bc] - A Graphical User Interface to bc
** [https://web.archive.org/web/20160304092132/http://x-bc.sourceforge.net/extensions_bc.html extensions.bc] - contains functions of trigonometry, exponential functions, functions of number theory and some mathematical constants
|