2015-12-12 20:37:45 +00:00
|
|
|
# bc
|
|
|
|
|
2021-03-31 11:16:18 +01:00
|
|
|
> An arbitrary precision calculator language.
|
|
|
|
> More information: <https://man.archlinux.org/man/bc.1>.
|
2015-12-12 20:37:45 +00:00
|
|
|
|
2021-03-31 11:16:18 +01:00
|
|
|
- Start `bc` in interactive mode using the standard math library:
|
2016-10-31 23:37:05 +00:00
|
|
|
|
|
|
|
`bc -l`
|
|
|
|
|
2016-01-07 17:31:27 +00:00
|
|
|
- Calculate the result of an expression:
|
2015-12-12 20:37:45 +00:00
|
|
|
|
|
|
|
`bc <<< "(1 + 2) * 2 ^ 2"`
|
|
|
|
|
2021-03-31 11:16:18 +01:00
|
|
|
- Calculate the result of an expression and force the number of decimal places to 10:
|
2015-12-12 20:37:45 +00:00
|
|
|
|
|
|
|
`bc <<< "scale=10; 5 / 3"`
|
|
|
|
|
2021-03-31 11:16:18 +01:00
|
|
|
- Calculate the result of an expression with sine and cosine using `mathlib`:
|
2015-12-12 20:37:45 +00:00
|
|
|
|
|
|
|
`bc -l <<< "s(1) + c(1)"`
|