diff --git a/searx/plugins/calculator.py b/searx/plugins/calculator.py index aa7a8b5c0d4d1f0202fcea67eeb610a62d88b71f..f8a7eefa631fbf3955595d1918fb0288d320b284 100644 --- a/searx/plugins/calculator.py +++ b/searx/plugins/calculator.py @@ -26,7 +26,9 @@ def post_search(request, search): return try: query = search.search_query.query.lower() + unmodified_query = query query = query.replace("x", "*") + query = query.replace("^", "**") # Not going to compute if only one number is present try: @@ -50,7 +52,7 @@ def post_search(request, search): value = evaluate(query).item() if type(value) in (int, float): search.result_container.answers.clear() - answer = "{} = {}".format(query, value) + answer = "{} = {}".format(unmodified_query, value) search.result_container.answers[answer] = {'answer': answer, 'calculator': True} except (ZeroDivisionError, ValueError, FloatingPointError, MemoryError, OverflowError) as e: answer = gettext('Error')