code incognito - INVENTON

in the event CODE INCOGNITO there was a question of INVENTON, i compared many test cases from successful submission with my submission all outputs were same but still giving me a wrong answer

can any one help me to figure out where the testcases are failing and why , below is the link of my answer

https://www.codechef.com/viewsolution/20245447

how about

3
576460752303423487
576460752303423488
576460752303423489

should give

59
60
60

@joffan can you explain why is the approach “log2(n) + 1” not giving correct answer?

can you please help me to figure out why the expected result is not coming in the 1st one

You probably don’t have enough precision on log2() to distinguish nearly-59 from 59. Which is why I chose this example.

Precision on the log result. There can be 18 digits in the source number and you probably aren’t getting that many signficant figures for the log.

//