Here is my solution to problem CHEFSEG of november long challenge. My solution is giving wrong answer for subtask 3. I guess it has something to do with precision. can anyone help me? here is link to my solution

```
public static void main(String[] args) {
// TODO Auto-generated method stub
MyScanner scan = new MyScanner();
int test = scan.nextint();
for(int t=0; t<test; t++)
{
int x=scan.nextint();
long k = scan.nextLong();
int level = ((int)(Math.log(k)/Math.log(2)+1e-10))+1;
int finished = (int) Math.pow(2, level-1)-1;
double div = Math.pow(2, level);
double res=x/div;
res=(2*(k-finished)-1)*res;
NumberFormat formatter = new DecimalFormat("###.###############");
String f = formatter.format(res);
System.out.println(f);
}
}
```