This question is weird and it's not a homework question. I couldn't come up with anything substantial, so sorry if you think that I should have posted my tried methods (I have tried but most of them were fails).
So, suppose I have a number $n$. Its parity doesn't matter(whether it is even or odd is to no interest to us). Just by having $n$ is there a way to find $2^m$ where when $2$ raised to the power of $m$, it is the value that is closest to $n$?
Like for example, if $n = 7$ then the closest power of $2$ is $2^3$ which is $8$.
But my question is:
Is there a function with which I can calculate this?
If there was something that I failed to represent and as a result, you didn't understand, please comment. Also, I don't know the tag to put this in, somebody please help me.