Content deleted Content added
Add information about a fourth implementation of bc: an independent implementation by Gavin Howard which is included in Android, FreeBSD, and macOS. |
Stevebroshar (talk | contribs) there is a language, but's primarily a program, a tool, software |
||
(9 intermediate revisions by 8 users not shown) | |||
Line 1:
{{Short description|
{{lowercase|title=bc programming language}}
{{Infobox software
Line 17:
| website =
}}
'''bc''', for ''basic calculator'', is
==Overview==
Line 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. Four 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 from Bell Labs|Plan 9]] systems. The second is the [[free software]] [[GNU]] 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. The fourth is an independent implementation by Gavin Howard<ref name=":1">[https://git.gavinhoward.com/gavin/bc An implementation of Unix dc and POSIX bc with GNU and BSD extensions]</ref> that is included in [[Android (operating system)]],<ref name=":2">{{Cite web|url=https://android.googlesource.com/platform/system/core/+/master/shell_and_utilities/README.md|title=Android's shell and utilities|website=android.googlesource.com}}</ref><ref name=":3">{{cite web | url=https://android.googlesource.com/platform/external/bc/ | title=Platform/External/Bc - Git at Google }}</ref>
==Implementations==
Line 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 80:
====="Missing" operators relative to C=====
The [[bitwise operation|bitwise]], [[Boolean logic|
& | ^ && ||
Line 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 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
|