Wouldn't it be neat if programming functions could be inverted, just like the mathematical function they implement?
Write a function (or program) that takes one input x
in any form, that outputs ln(x)
.
When the bytes of the program are reordered/reversed so that the first byte now is the last byte, it should take one input x
in any form and output e^x
instead.
- Your answer must have at least 3 correct significant figures.
- Approximations are fine, as long as they have at least 3 correct significant figures.
- Your code must be in the same programming language both forwards and backwards.
Let's say this program implements ln(x)
:
abc你好
Then this program has to implement e^x
:
\xBD\xA5\xE5\xA0\xBD\xE4cba
Gold star if you use a language without float support.
This is a weird form of code-golf, so the shortest program wins.
?
, which used the secant method. \$\endgroup\$