A bidmas calculator in swift
First cd into the directory
cd PATH/TO/YOUR/DIRECTORY
then run the command
./bidmas "YOUR CALCULATION"
For example, the command:
./bidmas "7 + (4*s(0.5*3.13159))/2"
Returns:
8.999975
The supported operations include:
- +:
NUM_1 + NUM_2
- -
NUM_1 - NUM_2
- *
NUM_1 * NUM_2
- /
NUM_1 / NUM_2
- ^ - For Power operations
BASE ^ (POWER)
- Sin:
s(YOUR CALCULATION)
- Cos:
c(YOUR CALCULATION)
- Tan:
t(YOUR CALCULATION)