e+pi

e+pi

In this challenge, you will be given a result, and your task is to find an arithmetic expression that uses only the numbers pi and e to yield that result. You can use addition, subtraction, multiplication, division, and exponentiation operations, and each number (pi and e) can appear at most two times. Parentheses are not allowed. If there are multiple solutions, return the one that requires fewer operations. If there are still multiple solutions, return the one that comes first alphabetically (without spaces). The calculated result must be equal with an error smaller than 1 x 10-10. If there is no solution for the input, return null. Non negative/positive symbol at the beginning is allowed.

Input: Floating point number (number).

Output: String (string).

Examples:

assert.strictEqual(checkio(5.85987448205), "e+pi");
assert.strictEqual(checkio(18.2958548951), "e**e+pi");
assert.strictEqual(checkio(47.6085189284), "e**e*pi");
assert.strictEqual(checkio(-0.42331082513), "e-pi");

How it is used: In challenges that require finding arithmetic expressions, we can intuit interesting mathematical relationships. For example, one such relationship is the fact that 1/12 + 1/22 + 1/32 + ... = 1.64493406685... = π2/6.