I am dealing with points on a 2d space $(x, y)$ where $x$ and $y$ are always positive integers.
In an algorithm, I have pre-computed $\log_2(x)$ and $\log_2(y)$ for given points of interest.
I now need to compute $\log_2(x+y)$ and $\log_2(x-y)$ but don't have the luxury to do so from a computational perspective so I started looking for some sort of correlation.
I wasn't sure if there was a relationship between $\ln(x\pm y)$ and $\ln(x)\pm\ln(y)$ so I charted some numbers in Excel and came across the following:
- The ratio of $(Log(X+Y) / (Log(X)+Log(Y)))$ seems to mostly lie between 0.5 and 0.7.
- For a large set of numbers the average ratio and median ratio seem to be ALWAYS between 0.56 and 0.58.
- Of course, there are corner cases in subtraction where x-y turns out negative. How can I avoid that by the way?
So the question is:
- Am I missing some fundamental concepts to have to find this relationship this way?
- If the answer to the above is no, how reliable would this correlation be for all integers x and y? The magnitude I am dealing with is around 2 to the power 10,000,000.
SOME EXTRA CONTEXT:
Some have suggested more context may bring about a different approach altogether so here it is. In 2D space, I have a starting point $(x, y)$ and need to move around following some rules. Allowed directions are $\pm (horizontal$, $vertical$, $diagonal$ and $anti-diagonal)$. Some other restrictions include not moving along the diagonal of $(x, y)$ where $(x*y)$ is a power of 2. The target is to get to the top left of the grid where the concentration of power of 2 numbers is high. Lastly, we can only change direction after encountering the diagonal of a power of 2.
So we start looping at the starting point, find neighboring power of 2 coordinates and filter out all diagonal intersections between our current position and power of 2 neighbors (which become potential turning points). Once we have this list, we need to determine optimal direction so we land closest to (1, 1) in euclidean distance. This is where we cannot afford any more multiplication, division, logarithms, etc.