What is the ans of floor of log2(288230376151711743) ??? Run a code with builtin log2() function, ans is 58 !!! Even google gives the ans 58 !!! Now write a code yourself to find the log2(x), and put x = 288230376151711743 . The actual answer is 57 !!!
couldn't get it !!!
It uses double precision and it is 57.99999999999999999499464608778919110696411496790292147213... Check: [WolframAlpha](https://www.wolframalpha.com/input/?i=log2(288230376151711743))
thank you
but why my code is giving me ans 58?
double
can only handle about 15-17 digits of precision. So C++ rounds the number to 58.00000000000000.try to output log2(x) + 1e-9