Apologies for the horrible title. I spent 10 minutes trying to explain this in one sentence and failed.
Although the application prompting this question is in Java (And
so far...
public static void getZoom(int currentLevel, double userScale){ double ns = (1 << (currentLevel - 1)) * userScale; int newLevel = 1; int ts = 1; while(ts < ns){ ts <<= 1; newLevel++; } double newScale = ns / ts; System.out.println(newLevel + ", " + newScale); }