master |
---|
A simple mathematical expressions evaluator written in Scala.
The calculator converts an input infix expression into the Reverse Polish notation (RPN) form using the Shunting-yard algorithm and then evaluates the postfix expression using the Postfix algorithm. Input expressions are processed case-insensitively.
- integer and floating-point numbers;
- positive and negative numbers;
- algebraic operators:
+
addition;-
subtraction;/
division;*
multiplication;
()
parentheses (with no limits for nesting).
- algebraic operators;
%
modulo;^
power;
- constants:
pi
;e
;
- bug fixes.
- improve error handling (handle all types of invalid expressions with providing meaningful messages);
- extend number of operators (bit operations, ...);
- predefined mathematical functions (trigonometric:
sin(x)
,tan(x)
, ...; roots:sqrt(x)
,root(x,y)
; ...); - variables.