Snuke has a fair N-sided die that shows the integers from 1 to N with equal probability and a fair coin. He will play the following game with them:
 - Throw the die. The current score is the result of the die.
 - As long as the score is between 1 and K-1 (inclusive), keep flipping the coin. The score is doubled each time the coin lands heads up, and the score becomes 0 if the coin lands tails up.
 - The game ends when the score becomes 0 or becomes K or above. Snuke wins if the score is K or above, and loses if the score is 0.
You are given N and K. Find the probability that Snuke wins the game.

-----Constraints-----
 - 1 ≤ N ≤ 10^5
 - 1 ≤ K ≤ 10^5
 - All values in input are integers.

-----Input-----
Input is given from Standard Input in the following format:
N K

-----Output-----
Print the probability that Snuke wins the game. The output is considered correct when the absolute or relative error is at most 10^{-9}.

-----Sample Input-----
3 10

-----Sample Output-----
0.145833333333

 - If the die shows 1, Snuke needs to get four consecutive heads from four coin flips to obtain a score of 10 or above. The probability of this happening is \frac{1}{3} \times (\frac{1}{2})^4 = \frac{1}{48}.
 - If the die shows 2, Snuke needs to get three consecutive heads from three coin flips to obtain a score of 10 or above. The probability of this happening is \frac{1}{3} \times (\frac{1}{2})^3 = \frac{1}{24}.
 - If the die shows 3, Snuke needs to get two consecutive heads from two coin flips to obtain a score of 10 or above. The probability of this happening is \frac{1}{3} \times (\frac{1}{2})^2 = \frac{1}{12}.
Thus, the probability that Snuke wins is \frac{1}{48} + \frac{1}{24} + \frac{1}{12} = \frac{7}{48} \simeq 0.1458333333.

Difficulty: introductory

Starter code:

Solutions:
n,k = map(int,input().split())

ans = 0

for i in range(1,n+1):
    if i>=k:
        ans += (1/n)
        continue
    x = 1
    while 1:
        i *= 2
        if i>=k:
            break
        else:x+=1
    ans += (1/n)*(1/2)**x
print(ans)

import math

N, K = map(int, input().split())

res = max(0, N - K + 1)

for i in range(1, min(N + 1, K)):
    res += 0.5**math.ceil(math.log2(K / i))

print(res / N)

n,k=map(int,input().split())

ans = 0

for i in range(1,n+1):
  p = i
  r = 1
  while p < k:
    p*=2
    r/=2
  ans+=r

ans/=n

print(ans)

# -*- coding: utf-8 -*-
"""
Created on Sat Sep 12 23:11:33 2020

@author: liang
"""

N, K = map(int, input().split())
ans = 0
for i in range(1,N+1):
    tmp = i
    count = 0
    while tmp< K:
        count += 1
        tmp *= 2
    ans += 1/2**count
ans /= N
print(ans)

def p(n, k):
    if n >= k:
        return 1
    num = 0
    while n < k:
        n *= 2
        num += 1
    return 1 / 2 ** num

N, K = map(int, input().split())

ans = 0
for n in range(1, N + 1):
    ans += p(n, K)

ans /= N

print(ans)

N,K=list(map(int,input().split()))
ans=0
for i in range(N):
    temp=K/(i+1)
    for j in range(100):
        if 2**(j)>=temp:
            break
    ans+=(1/N)*(1/2)**j
print(ans)


import math

n, k = map(int, input().split())

ans = 0
for i in range(1, n+1):
    a = max(math.ceil(math.log2(k/i)), 0)
    ans += 0.5**a
print(ans/n)

import sys
input = sys.stdin.readline
n,k = list(map(int,input().split()))
#a = list(map(int,input().split()))

import math
par = 0

for i in range(1,n+1):
    tmp = i
    cnt = 0
    while True:
        if tmp >= k:
            break
        tmp *= 2
        cnt += 1
    if cnt == 0:par += 1/n
    else       :par += 1/(2**cnt*n)

print(f'{par:.12f}')


N, K = map(int, input().split())

ans = 0
for i in range(1, N+1):
    cnt = 0
    num = i
    while num < K:
        num *= 2
        cnt += 1
    ans += 1 / N * (1 / 2)**cnt
print(ans)

n,k=list(map(int,input().split()))

ans=0
for i in range(1,n+1):
  num=i
  p=1/n
  if num>=k:
    ans+=p
    continue
  while num<k:
    num=num*2
    p=p*(1/2)
  ans+=p
  
print(ans)


n, k = list(map(int, input().split()))
rate = 0
for i in range(1,n+1):
    score = i
    prob = 1 / n
    while score < k:
        score *= 2
        prob /= 2
    rate += prob
print(rate)


import math

n, k = map(int, input().split())
log2 = math.log10( 2)
ans = 0
for i in range(1,n+1):
    temp = i
    num = 1/n
    while temp < k:
        num /= 2
        temp *= 2
    ans += num

print(ans)

N, K=map(int,input().split())
ans = 0
for i in range(1,N+1):
    cnt = 0
    while i < K:
        i *= 2
        cnt += 1
    ans += (1/2)**cnt
print(ans/N)

n,k=map(int,input().split())
ans=0
for i in range(1,n+1):
  cnt=0
  while i<k:
    i*=2
    cnt+=1
  ans+=(1/2)**cnt
print(ans/n)

#Answer
N, K = input().split()
N = int(N)
K = int(K)

import math
M = math.log(K,2)
P = sum([1/(2**max(math.ceil(M - math.log(i,2)), 0)) for i in range (1, N+1)])/N
print(P)

N,K = map(int, input().split())

ans = 0

for i in range(1, N+1):
    j = 1/N
    while i < K:
        i *= 2
        j /= 2
    ans += j

print(ans)

n, K = map(int, input().split())

p = 1/n

ans = 0
for result in range(1, n+1):
    # result = 1,2,3
    k = K
    k /= result
    cnt = 0
    while k > 1:
        k /= 2
        cnt += 1
    ans += p * (0.5)**cnt
print(ans)

from math import ceil as c
from math import log2 as l

n, k = map(int,input().split())
ans, m = 0, 1 / n

for i in range(1, n+1):
  if i < k:
    ans += (0.5 ** c(l(k/i))) * m
  else:
    ans += m

print(ans)

n,k = map(int,input().split())

num = 0

for i in range(1,n+1):
    j = 0
    while True:
        if i*(2**j) >=k:
            break
        j +=1
    
    
    num += 1/(n*(2**j))

print(num)

n,k=map(int,input().split())

a=[]
for i in range(1,n+1):
    x=i
    b=0
    while x<k:
        x=x*2
        b+=1
    a.append((float(1/n)*(0.5)**b))


print(sum(a))

def main():
    N,K = list(map(int,input().split()))
    ans = 0
    dict = {}
    cnt = 0
    tmp = 1/N
    for i in range(N,0,-1):
        i = float(i)
        if K <= i:
            ans += tmp*(0.5**cnt)
        else:
            while True:
                K = K/2
                cnt += 1
                if K <= i:
                    break
            ans += tmp*(0.5**cnt)
    return ans

print((main()))


n, k = map(int, input().split())
ans = 0
for i in range(1, n+1):
    cnt = 0
    while i < k:
        i *= 2
        cnt += 1
    ans += 1 / n / (2 ** cnt)
print(ans)

import math
n,k = map(int, input().split())
c = 0
for i in range(1,n+1):
  if k//i == 0:
    c += 1/n
  else:
    t = math.ceil(math.log2(k/i))
    c += 0.5**t/n
print(c)

N, K = map(int, input().split())

# 何回2をかけると超えるか。
def func1(i, k):
    ans = 0
    num = i
    end = False
    if num >= k:
        return 0
    while(not end):
        ans += 1
        num *= 2
        if num >= k:
            end = True
            break
    return ans


ans = 0
for initial_score in range(1, N+1):
    ans += (1/N) * (1/2) ** func1(initial_score, K)
print(ans)

n,k=list(map(int,input().split()))

ans= 0
from math import ceil,log2

for i in range(1,n+1):
    if i<k:
        a = ceil(log2(k/i))
        ans +=(1/n)*(1/2)**a
    else:
        ans += (1/n)

print(ans)


import math
n,k = map(int,input().split())
num = 0
for i in range(1,n + 1):#サイコロの出た目
    if i >= k:
        num += 1 / n
    else:
        num += (1 / (n * (2 ** math.ceil(math.log(k / i,2)))))
print(num)

n,k=map(int,input().split())
ans=0
for i in range(1,n+1):
  res=0
  while i<k:
    i*=2
    res+=1
  ans+=(1/2)**res
print(ans/n)

#ABC126 C

import math
N,K = map(int,input().split())
P = 0
for i in range(1,N+1):
    if i >= K:
        P += 1/N
    else:
        P += (1/N)*(0.5)**(math.ceil(math.log(K/i,2)))
        
print(P)

import sys

N, K = map(int, sys.stdin.readline().split())
ans = 0
for i in range(1, N+1):
    if K <= i:
        ans += 1 / N
    else:
        count = 0
        while i < K:
            count += 1
            i *= 2
        ans += (1 / N) * 0.5 ** count

print(ans)

n, k = map(int,input().split())

per = 0

for i in range(1,n+1):
    a = 0
    while i<k:
        a += 1
        i *= 2
    per += (1/n) * (0.5**a)

print(per)

n, k = map(int, input().split())

ans = 0
for i in range(1, n + 1):
    cnt = 0
    while i * 2**cnt < k:
        cnt += 1
    ans += 1 / (n * 2**cnt)

print(ans)

D, P = map(int, input().split())    
ans = 0.0
def func(i):
    t = 0
    while(i < P):
        i *= 2
        t += 1
    return t

for i in range(1, D + 1):
    ans += float((1/D)) * float(((1 / 2) ** func(i)))

print(ans)

#import math
#import itertools
#from collections import deque

INT = lambda: int(input())
INTM = lambda: map(int,input().split())
STRM = lambda: map(str,input().split())
STR = lambda: str(input())
LIST = lambda: list(map(int,input().split()))
LISTS = lambda: list(map(str,input().split()))

def do():
    n,k=INTM()
    ans=0
    for i in range(1,n+1):
        temp=i
        ct=0
        while temp<k:
            ct+=1
            temp*=2
        ans+=(1/(n*(2**ct)))
    
    print(ans)


def __starting_point():
    do()
__starting_point()

N,K = map(int,input().split())
result = 0
for i in range(1,N+1):
    prob = 1
    count = i 
    while count < K:
        prob *= 0.5
        count *= 2
    result += prob /N
print(result)

N,K = map(int,input().split())
ans = 0
for i in range(1,N+1):
    if i >= K:
        ans += 1/N
    else:
        x = 0
        while i < K:
            i *= 2
            x += 1
        ans += (1/N) * (1/2)**x
print(ans)

import math
n,k = map(int,input().split())

ans = 0
if n < k:
    for j in range(1,n+1):
        a = math.ceil(math.log(k/j,2))
        ans += 1/n * (1/2 ** a)
    print(ans)

else:
    for j in range(1,k):
        a = a = math.ceil(math.log(k/j,2))
        ans += 1/n * (1/2 ** a)
    ans += (n-k+1)/n 
    print(ans)

def LI():
    return list(map(int, input().split()))


N, K = LI()
ans = 0
for i in range(1, N+1):
    x = 1
    count = i
    while count < K:
        count *= 2
        x /= 2
    ans += x/N
print(ans)


N, K = map(int,input().split())
ans = 0
for n in range(1,N+1):
    score = n
    coin = 0
    while(score < K):
        coin += 1
        score *= 2
    ans += 1/(N*2**coin)

print(ans)

from math import log2
import decimal

N, K = map(int, input().split())

decimal.getcontext().prec = 28

ans = decimal.Decimal(0)

for i in range(1, N+1):
    if i < K:
        power = -(-(log2(K) - log2(i))//1)
        prob = decimal.Decimal(1/((2**power) * N))
    else:
        prob = decimal.Decimal(1/N)

    #print(prob)
    ans = decimal.Decimal(ans + prob)
    #print(ans)

print(ans)

import math

N, K = [int(x) for x in input().split()]

S = 0
for i in range(1, N + 1):
    a = 0
    while i < K:
        a += 1
        i *= 2
    S += 0.5 ** a

ans = S / N
print(ans)

N, K = map(int, input().split())

ans = 0
for i in range(1, N+1):
    p = 1
    while i < K:
        p *= 0.5
        i *= 2
    ans += p/N
        
print(ans)

r=input().split()
N=int(r[0])
K=int(r[1])
ans=0
for i in range(1,N+1):
    x=i
    n=0
    while x<=K-1:
        x=x*2
        n+=1
    ans+=(1/N)*((1/2)**n)
print(ans)

N, K = map(int, input().split())
pro=0.0
for i in range(1,N+1):
    n=i
    j=0
    while(True):
        if n >= K:
            break
        n=n*2
        j=j+1
    pro=pro+(1/N)*(0.5)**(j)
print(pro)

from math import log2, ceil
N, K = list(map(int, input().split()))

ans = 0
j = 1.0
for x in range(N, 0, -1):
    if x >= K:
        ans += 1.0 * (1 / N)
    else:
        while x * j < K:
            j *= 2.0
        ans += (1.0 / j) * (1 / N)
print(ans)


N,K=map(int,input().split())
ans=max(0,(N-K+1)/N)
for dice in range(1,min(N,K-1)+1):
    for time in range(1,len(bin(K))+2):
        dice*=2
        if dice>=K:
            ans+=1/(N*(2**time))
            break
print(ans)

from math import ceil as c
from math import log2 as l

n, k = map(int,input().split())
ans = 0

for i in range(1, n+1):
  if i < k:
    ans += (0.5 ** c(l(k/i))) / n
  else:
    ans += 1 / n

print(ans)

n,k = map(int,input().split())
ans = 0
for i in range(1,n+1):
    prob = 1
    now = i
    while now < k:
        now = 2 * now
        prob = prob / 2
    ans += prob / n
print(ans)

import math
N, K = map(int, input().split())
if K == 1:
  print(1)
  return

ans = 0

for i in range(1, N + 1):
  if i >= K:
    ans += (1 / N)
  else:
    temp = math.log(K / i, 2)
    nu = pow(2, math.ceil(temp))
    ans += (1 / (nu * N))
print(ans)

N,K=map(int,input().split())
ans=0
for i in range(N):
    x=i+1
    ave=1/N
    while x<K:
        x*=2
        ave/=2
    ans+=ave
print(ans)

n,k = map(int,input().split())
ans = 0
for i in range(1,n+1):
    t = 1
    x = i
    while x<k:
        t*=0.5
        x*=2
    ans+=t/n
print(ans)

n, k = map(int, input().split())
ans = 0
for tmp in range(1,n+1):
    cnt = 0
    while tmp < k:
        tmp *= 2
        cnt += 1
    ss = n*2**cnt
    ans += 1/ss
print(ans)

import math

n, k = map(int, input().split())
ans = 0
x = [max(0, math.ceil(math.log2(k / i))) for i in range(1, n + 1)]
for i in x:
    ans += ((2 ** i) * n) ** -1 
print(ans)

n,k=map(int,input().split())
ans=0
for i in range(1,n+1):
    for j in range(10**5):
        if i*2**j>=k:
            ans+=(0.5)**j/n
            break
print(ans)

N, K = map(int, input().split())
 
ans = 0

for i in range(1, N+1):
  # コインを投げる回数tを求める
  t = 0
  while True:
    if i*(2**t) >= K: break
    t += 1
  # 確率を足す
  ans += (1/N)*((1/2)**t)
  
print(ans)

N,K = map(int, input().split())
 
ans = 0
 
for i in range(1, N+1):
    j = 1/N
    while i < K:
        i *= 2
        j /= 2
    ans += j
 
print(ans)

N, K = map(int, input().split())
pro=0.0
for i in range(1,N+1):
    n=i
    j=0
    while(True):
        if n >= K:
            break
        n=n*2
        j=j+1
    pro=pro+(1/N)*(0.5)**(j)
print(pro)

n,k = map(int,input().split())

sum : float = 0.0
for i in range(1,n+1):
    ret : float = 1/n
    tmp = i
    while(tmp < k):
        tmp *= 2
        ret /= 2
    if(tmp != 0):
        sum += ret 
print(sum)

N,K=map(int,input().split())
ans=0
for i in range(N):
    prob=1/N
    temp=i+1
    while temp<K:
        temp*=2
        prob*=0.5
    ans+=prob

print(ans)

n,k = map(int,input().split())
ans = 0
for i in range(1,n+1):
    tokuten = i
    tmp = 1/n
    while tokuten<k:
        tokuten *= 2
        tmp = tmp/2
    #print(tmp)
    ans += tmp
print(ans)

import math
N,K = map(int,input().split())
prob = 0
for i in range(1,N+1):
    win_seq = max(math.ceil(math.log2(K/i)),0)
    prob += (1/2)**win_seq
print(prob/N)

N, K = list(map(int, input().split()))
A = 1
ans = 0



while (A <= N):
  count = 0
  T = A
  while (T<K):
    T = T*2
    count += 1
  ans += float((1/N)*(1/2)**count)
  A += 1
  
print(ans)


import math
N, K = map(int, input().split())
 
ans = 0

# 目がK-1以下 => コインが ceil(log2(K/i)) 回連続で表で勝ち
# 目がK以上 => 勝ち確定
for i in range(1, N+1):
  if i <= K-1: ans += (1/N)*(1/2)**math.ceil(math.log2(K/i))
  else: ans += 1/N
print(ans)

n, k = list(map(int, input().split()))
ans = 0
for i in range(1, n+1):
    cnt = 0
    while True:
        if 2**cnt >= k/i:
            break
        cnt += 1
    ans += (1/n)*(1/2)**cnt
print(ans)


N,K=list(map(int,input().split()))
ans=0
for i in range(1,N+1):
    x=i
    p=1
    while x<K:
        p/=2
        x<<=1
    ans+=p
print((ans/N))


N, K = map(int, input().split())

ans = 0.0
for i in range(1, N + 1):
    x = 0
    while i * (2 ** x) < K:
        x += 1

    ans += 1 / (N * 2 ** x)

print(ans)


N, K = list(map(int, input().split()))
answer = 0
for i in range(1, N+1):
    cnt = 0
    while i < K:
        i *= 2
        cnt += 1
    answer += (1/2)**cnt

print((answer/N))


N,K=map(int,input().split())
ans=0
for i in range(1,N+1):
  j=0
  while True:
    if K<=i*2**j:
      ans+=(1/N)*(1/2)**j
      break
    j+=1
print(ans)

N,K = map(int,input().split())
tmp = 1
num_cnt = 0
while K > tmp :
  tmp *= 2
  num_cnt +=1
nums_list = []
for i in range(1,N+1):
  for j in range(num_cnt+1):
    if i*(2**j) >= K:
      nums_list.append(((1/2)**j))
      break
print(sum(nums_list)*(1/N))

import math
N, K  =map(int, input().split())
ans = 0
for i in range(1,N+1):
    success_num = max(0,(math.ceil(math.log2(K/i))))
    ans += (1/2)**success_num
print(ans/N)

n, k = list(map(int, input().split()))

ans = 0

for i in range(1, n+1):
    count = 0
    p = i
    while p<k:
        p = p*2
        count +=1
    ans += (1/n)*((1/2)**count)

print(ans)

from math import ceil as c
from math import log2 as l
import sys
input = sys.stdin.readline

n, k = map(int,input().split())
ans = 0

for i in range(1, n+1):
  if i < k:
    ans += (0.5 ** c(l(k/i))) / n
  else:
    ans += 1 / n

print(ans)

N, K = map(int, input().split())
from math import log2, ceil

p = 0

for i in range(1, N+1):
    if K >= i:
        p += 2**-(ceil(log2(K / i))) / N
    else:
        p += 1 / N

print(p)



def main():
    n, k = list(map(int, input().split()))
    ans = 0.0
    for t in range(1, n + 1):
        cnt = 0
        now = t
        per = 1.0
        while now < k:
            per /= 2
            now *= 2
        ans += per / n
    print(('{:.20}'.format(ans)))
    pass


def __starting_point():
    main()

__starting_point()

import math
answer = 0
n,k = map(int,input().split())
for i in range(1,n+1):
  if(i>=k):
    answer +=1/n
  else:
    answer += 1/(2**math.ceil(math.log2(k/i)))/n
print(answer)

import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
    
input = sys.stdin.readline
def RD(): return input().rstrip()
def F(): return float(input().rstrip())
def I(): return int(input().rstrip())
def MI(): return map(int, input().split())
def MF(): return map(float,input().split())
def LI(): return list(map(int, input().split()))
def TI(): return tuple(map(int, input().split()))
def LF(): return list(map(float,input().split()))
def Init(H, W, num): return [[num for i in range(W)] for j in range(H)]
    
    
def main():
    N, K = MI()
    D = deque()
    D.append(1)
    num = 1
    index = 0
    while num <= K:
        num*=2
        index+=1
        D.append(num)
    ans = 0
    for i in range(1, N+1):
        temp = K / i
        index2 = bisect_left(D, temp)
        ans += D[index-index2]
        
    print(ans / (N * D[index]))

        
def __starting_point():
    main()
__starting_point()

n, k = map(int, input().split())
ans = 0
for i in range(1, n+1):
  cnt = 1
  while i < k:
    i *= 2
    cnt /= 2
  ans += cnt
ans /= n
print(ans)

import math
N, K = map(int, input().split())

ans = 0

for i in range(1,N+1):
  if i <= K:
    ans+=1/N*0.5**(math.ceil(math.log2(K/i)))
  else:
    ans+=1/N
    
print(ans)

from math import ceil as c
from math import log2 as l

n, k = map(int,input().split())
ans = 0

for i in range(1, n+1):
  if i < k:
    ans += (0.5 ** c(l(k/i))) / n
  else:
    ans += 1 / n

print(ans)

n, k = map(int, input().split()) 

import math

ans = 0
for i in range(1, n+1):
    if i < k:
        power = math.ceil(math.log2(k/i))
    else:
        power = 0
    ans += pow(0.5, power)
print(ans / n)

N, M = map(int, input().split())

if M == 1:
	print(1)
	return

import math

prob = 0
for i in range (1, N+1):
	if i>=M:
		prob+=1/N
	else:
		prob+=((1/N)*1/2**math.ceil(math.log(M/i, 2)))

print(prob)

n,k = map(int,input().split())

sum1 = 0
for i in range(1,n+1):
    p = 0
    while True:
        if (2**p)*i >= k:
            break
        p +=1
    sum1 += 1/(n*2**p)
print(sum1)

N,K = map(int,input().split())
ls = [0]
for i in range(1,N+1):
    if i >= K:
        ls.append(1)
    else:
        p = 1
        f = K//i
        if K%i == 0:
            f -= 1
        while f != 0:
            f = f//2
            p = p/2
        ls.append(p)
ans = sum(ls)/N
print(ans)

# coding: utf-8


def main():
    N, K = list(map(int, input().split()))
    ans = 0.0
    for i in range(1, N + 1):
        j, k = i, 0
        while j < K:
            j *= 2
            k += 1
        ans += pow(0.5, k) / N

    print(ans)

def __starting_point():
    main()

__starting_point()

import math
n,k=map(int,input().split())
ans=0
for i in range(1,n+1):
    tmp=1/n
    while i<k:
        i=i*2
        tmp/=2
    ans+=tmp
print(ans)

n, k = map(int, input().split())
prob = [0]*n
for i in range(1, n+1):
  j = 0
  while i*(2**j) < k:
    j += 1
  prob[i-1] = (1/n)*(1/2)**j

print(sum(prob))

import math
N, K = map(int, input().split())
ans = 0
for i in range(1, N+1):
    a = math.log2(K/i)
    if a > 0:
        ans += 0.5**math.ceil(math.log2(K/i))/N
    else:
        ans += 1/N
print(ans)

N, K = map(int, input().split())

ans = 0

for i in range(1, N+1):
    count = 0
    while i < K:
        i *= 2
        count += 1
    ans += 1 / (N * (2 ** count))

print(ans)

import math

N, K = list(map(int, input().split()))

ans = 0
for n in range(1, N+1):
    if n >= K:
        ans += 1/N
        continue
    x = math.ceil(math.log2(K/n))
    ans += (0.5**x)/N

print(ans)


#!/usr/bin/env python3
import sys


def solve(N: int, K: int):
    ans = 0
    for n in range(1, N+1):
        b = 1
        while n * b < K:
            b <<= 1
        ans += 1 / (b * N)
    return ans

# Generated by 1.1.7.1 https://github.com/kyuridenamida/atcoder-tools
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    print((solve(N, K)))

def test():
    import doctest
    doctest.testmod()

def __starting_point():
    #test()
    main()

__starting_point()

import math
n,k=map(int,input().split())
if n>=k:
    a=0
    for i in range(1,k):
        a+=0.5**(math.ceil(math.log2(k/i)))
    print((a+n-k+1)/n)
else:
    a=0
    for i in range(1,n+1):
        a+=0.5**(math.ceil(math.log2(k/i)))
    print(a/n)

#21 C - Dice and Coin
import math
N,K = map(int,input().split())

ans = 0
for i in range(1,N+1):
    if K//i != 0:
        a = math.log2(K/i)
        if a.is_integer():
            x = int(a)
        else:
            x = int(a) + 1
        ans += (1/N)*(1/2)**x
    else:
        ans += (1/N)
print(ans)

n, k = map(int, input().split())
prob = [0]*n
for i in range(1, n+1):
  j = 0
  while i*(2**j) < k:
    j += 1
  prob[i-1] = (1/n)*(1/2)**j

print(sum(prob))

def mapt(fn, *args):
    return tuple(map(fn, *args))


def Input():
    return mapt(int, input().split(" "))


def func(i, k):
    count = 0
    while i < k:
        i *= 2
        count += 1
    return count


def main():
    n, k = Input()
    ans = 0
    for i in range(1, n+1):
        ans += 1/n * (1/2 ** func(i, k))
    print(ans)


main()

n, k = map(int, input().split())

ans = 0
for i in range(1, n + 1):
    j = i
    cnt = 1
    while j < k:
        j <<= 1
        cnt /= 2
    ans += cnt / n
print('{:10}'.format(ans))

N,K = map(int,input().split())

ans = 0
for n in range(1,N+1):
    k = 0
    m = n
    while m < K:
        m *= 2
        k += 1
    ans += 2**(-k)
print(ans / N)

N, K = [int(n) for n in input().split()]
ans = 0
for n in range(1, N+1):
    tmp = 1.0/N
    now = n
    while now < K:
        now *=2
        tmp /=2
    ans += tmp
print(('{:.12}'.format(ans)))


n, k = map(int, input().split())
prob = [0]*(n+1)
for i in range(1, n+1):
  j = 0
  while i*(2**j) < k:
    j += 1
  prob[i] = (1/n)*(1/2)**j

print(sum(prob))

from math import *

n, k = map(int, input().split())

ans = 0
for i in range(1, n+1):
  tmp = 1 / n
  if i < k:
    tmp *= 0.5 ** ceil(log2(k/i))
  ans += tmp

print(ans)

import math
n,k = map(int, input().split())
s = 0
ans = 0
for x in range(1,n+1):
  if x >= k:
    a = 0
  else:
    a = math.ceil(math.log2(k/x))
  b = (1 / n) * ((0.5) ** a)  
  ans += b
  
   
print(ans)