bc -l
loads trig functions and sets scale to 20echo 3+4 | bc
.mbc () { echo $@ | bc -l -q ~/bin/extensions.bc } alias bc="bc -l -q ~/bin/extensions.bc"
So now mbc '(3+5)/6'
works as expected
last
- The value of the last printed numberscale
- number of decimal places to displayibase
- base to be used for input valuesobase
- base to be used for output valueslast
variable.define log(x,y) { auto retval = l(y)/l(x) return retval }
Note that the auto
keyword is used to declare a local variable.
if(cond) else
, while(cond)
and for(init;cond;inc)
control flow structures are all supported. break
and continue
are also supported.read()
is used to read a value from standard input. print()
prints to standard output.[subscript]
after the array name.quit
, limits
and warranty
.