1
0
Fork 0
mirror of https://github.com/tldr-pages/tldr.git synced 2025-07-10 14:45:25 +02:00
tldr/pages/osx/bc.md

30 lines
620 B
Markdown
Raw Normal View History

2022-01-21 22:00:09 -08:00
# bc
> An arbitrary precision calculator language.
> See also: `dc`.
> More information: <https://keith.github.io/xcode-man-pages/bc.1.html>.
2022-01-21 22:00:09 -08:00
- Start an interactive session:
`bc`
- Start an interactive session with the standard math library enabled:
`bc --mathlib`
- Calculate an expression:
`bc --expression '{{5 / 3}}'`
2022-01-21 22:00:09 -08:00
- Execute a script:
`bc {{path/to/script.bc}}`
- Calculate an expression with the specified scale:
`bc --expression '{{scale = 10; 5 / 3}}'`
2022-01-21 22:00:09 -08:00
- Calculate a sine/cosine/arctangent/natural logarithm/exponential function using `mathlib`:
`bc --mathlib --expression '{{s|c|a|l|e}}({{1}})'`