final public String evaluate(String expression) throws InvalidInputException, RuntimeException
	{
		resetStructures();
		tokenizeExpression(expression);
		insertImplicitMultiplication();
		convertToPostfix();
		int previousFunctionMode = Function.outputMode;
		int previousOperatorMode = Operator.outputMode;
		if (this.OUTPUT_MODE == Calculate.OUTPUT_APPROXIMATE_MODE && Function.outputMode == Calculate.OUTPUT_EXACT_MODE)
		{
			Function.outputMode = Calculate.OUTPUT_APPROXIMATE_MODE;
			Operator.outputMode = Calculate.OUTPUT_APPROXIMATE_MODE;
		}
		Expression result = evaluatePostfix();
		Function.outputMode = previousFunctionMode;
		Operator.outputMode = previousOperatorMode;
		if (this.OUTPUT_MODE == Calculate.OUTPUT_EXACT_MODE)
		{
			if (result instanceof Number)
			{
				if (result instanceof Fraction)
				{
					return ((Fraction) result).getExactFractionalValue();
				} else
				{
					return trimZeroes(( (Number) result ).getRepresentation());
				}
			} else
			{
				return trimZeroes(result.getRepresentation());
			}
		} else
		{
			if (result instanceof Number)
			{
				 BigDecimal rtn = (( (Number) result ).getValue().round(new MathContext(this.FLOATING_POINT)));
				 //if the result is less than 10^(-floating point), then round it to zero
				 rtn = rtn.setScale(this.FLOATING_POINT, RoundingMode.HALF_UP);
				 return	trimZeroes(rtn.stripTrailingZeros().toPlainString());
			} else
			{
				return result.getRepresentation();
			}
		}
	}