code: public static ExprDouble toExprDouble(Expression expr) {
  	if (expr instanceof ExprDouble) return (ExprDouble) expr;
  	if (expr instanceof Literal) {
  	    Double dbl = ((Literal) expr).getDouble(null);
  	    if (dbl != null) return expr.getFactory().createLitDouble(dbl.doubleValue(), expr.getStart(), expr.getEnd());
  	}
  	return new CastDouble(expr);
      }
docs: Create a String expression from a Expression
  
  @param expr
  @return String expression
  @throws TemplateException