https://github.com/arzzen/calc
The simplest bash calculator.
https://github.com/arzzen/calc
bash calc calculator shell
Last synced: 7 months ago
JSON representation
The simplest bash calculator.
- Host: GitHub
- URL: https://github.com/arzzen/calc
- Owner: arzzen
- License: mit
- Created: 2016-04-15T19:26:13.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2018-01-13T15:08:22.000Z (almost 8 years ago)
- Last Synced: 2025-03-09T23:03:34.489Z (8 months ago)
- Topics: bash, calc, calculator, shell
- Language: Makefile
- Size: 2.93 KB
- Stars: 10
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple bash calculator
### Demo

### Installation
```bash
git clone https://github.com/arzzen/calc.git && cd calc
sudo make install
```
For uninstalling, open up the cloned directory and run
```bash
sudo make uninstall
```
### Usage
```bash
# addition
root@pc:~$ = 5+3
8
# multiplication
root@pc:~$ = '4*2'
8
# subtraction
root@pc:~$ = -4-2
-6
# division
root@pc:~$ = 4/2
2.00000000000000000000
# square root
root@pc:~$ = "scale=30; sqrt(2)"
1.414213562373095048801688724209
# power
root@pc:~$ = "6^6"
46656
# parentheses
root@pc:~$ = "(6^6)^6"
10314424798490535546171949056
# convert from decimal to hexadecimal
root@pc:~$ = "obase=16; 255"
FF
# convert from decimal to binary
root@pc:~$ = "obase=2; 12"
1100
# convert from binary to decimal
root@pc:~$ = "ibase=2; obase=A;1100"
12
# convert from hexadecimal to decimal
root@pc:~$ = "ibase=16; obase=A;FF"
255
# arctangent
root@pc:~$ = "a(1)"
.78539816339744830961
# PI value
root@pc:~$ = "scale=10; 4*a(1)"
3.1415926532
# more complex
root@pc:~$ = "scale=2; 3.4+7/8-(5.94*(4*a(1)))"
-14.26
```