js/calc.js
/**
 * @private
 * Solves simple expressions with one operator, one operand on the left, and one operand on the right.
 * @return A numerical string that is a solution to passed expression.
 * @param: arguments is automatically passed from String.replace() function in solveParen() method.
 * */
@private
Solves simple expressions with one operator, one operand on the left, and one operand on the right.
@return A numerical string that is a solution to passed expression.
@param: arguments is automatically passed from String.replace() function in solveParen() method.
@private Solves simple expressions with one operator one operand on the left and one operand on the right . @return A numerical string that is a solution to passed expression . @param : arguments is automatically passed from String . replace () function in solveParen () method .
function solveSimple()
{
	var op = arguments[2];
	var sLeft = arguments[1];
	sLeft = sLeft.replace("~", "-");
	var left = getValueFromOperand(sLeft);
	var sRight = arguments[3];
	sRight = sRight.replace("~", "-");
	var right = getValueFromOperand(sRight);
	var res;
	switch (op)
	{
		case "+":
			res = left + right;
			break;
		case "-":
			res = left - right;
			break;
		case "*":
			res = left * right;
			break;
		case "/":
			res = left / right;
			break;
		case "^":
			res = Math.pow(left, right);
			break;
	}
	var sRes = res.toString();
	sRes = sRes.replace("-", "~");
	return sRes;
}
function solveSimple ( ) { var op = arguments [ 2 ] ; var sLeft = arguments [ 1 ] ; sLeft = sLeft . replace ( "~" , "-" ) ; var left = getValueFromOperand ( sLeft ) ; var sRight = arguments [ 3 ] ; sRight = sRight . replace ( "~" , "-" ) ; var right = getValueFromOperand ( sRight ) ; var res ; switch ( op ) { case "+" : res = left + right ; break ; case "-" : res = left - right ; break ; case "*" : res = left * right ; break ; case "/" : res = left / right ; break ; case "^" : res = Math . pow ( left , right ) ; break ; } var sRes = res . toString ( ) ; sRes = sRes . replace ( "-" , "~" ) ; return sRes ; }
@private
 Solves simple expressions with one operator, one operand on the left, and one operand on the right.
@private Solves simple expressions with one operator one operand on the left and one operand on the right .
// convert negative values from - to !. E.g. -2, into !2