This question already has an answer here:
- Calculate e^x and ln(x) 4 answers
Your goal is to calculate the exponential of a float (e**x) up to 2 decimal places for any float within 1 to 10. The accepted error range is 0.01.
However, you must not use the built-in exponential function or the logarithm function.
In fact, attempts to circumvent this by
(2**x)**(1/ln(2)) are prohibited, even if you hardcode the ln(2).
Basically, the power function is fine, as long as the index is not derived from the input.
Shortest solution in bytes wins.
(You may include an extra solution which uses the built-in, but which does not affect the score in any way.)
- Program or function
- Any reasonable input/output format
1 -> 2.71 or 2.72 or 2.73