tCal
Infix calculator
versione italiana
tCal is a simple scientific calculator for infix expressions developed mainly as C programming example
Uses Shunting-Yard algorithm to convert infix to postfix
Can be used inside shell scripts to manage expressions in a more readable format
It allows the use of numerical constants (pi, e) trigonometric, logarithmic and exponential operations
Accept expressions and nested parenthesis of arbitrary length
Can solve simple linear equations

Notes

  • expression must be quoted
  • to avoid bash-related problems with expression starting with minus use '--' before the argument. Ex:
    tcal -- "-1*3"
  • Compile with "make"
  • "test" folder contains some regression tests:
      #cd test
      #make
  • without args run in loop mode (interactive mode)

Download

tCal v0.8

Examples

#tcal "(3+(4-1))*5"
#30

#tcal "2 * x + 0.5 = 1"
#x=0.25

#tcal "2x + 1 = 2(1-x)"
x=0.25

#tcal "sin(90)"
#1

#tcal "ln(e)"
#1

#tcal "asin(sin(1))"
#1

matteolucarelli.altervista.org