#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int m, n, sign, i;
  double result;
  scanf("%d", &m);
  while (m--) {
    scanf("%d", &n);
    sign = 1;
    result = i = 0;
    while (i++ < n) {
      if (sign == 1)
        result += 1.0 / i;
      else
        result -= 1.0 / i;
      sign = -sign;
    }
    printf("%.2lf\n", result);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11f9 <main+0xd9>
lea    0xeae(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
cmp    -0xc(%rbp),%eax
jge    11e3 <main+0xc3>
cmpl   $0x1,-0x10(%rbp)
jne    11b7 <main+0x97>
cvtsi2sdl -0x14(%rbp),%xmm1
movsd  0xe5c(%rip),%xmm0
divsd  %xmm1,%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    11d6 <main+0xb6>
cvtsi2sdl -0x14(%rbp),%xmm0
movsd  0xe3c(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
xor    %eax,%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1179 <main+0x59>
movsd  -0x20(%rbp),%xmm0
lea    0xe1c(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xee0(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
subl   $0x1,0x8(%rsp)
jae    114d <main+0x2d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0xebc(%rip),%r14
lea    0xc(%rsp),%r15
lea    0xeb3(%rip),%rbx
jmp    1183 <main+0x63>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xorpd  %xmm0,%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
subl   $0x1,0x8(%rsp)
jb     1141 <main+0x21>
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1170 <main+0x50>
cmp    $0x1,%eax
jne    11b0 <main+0x90>
xorpd  %xmm0,%xmm0
mov    $0x1,%ecx
jmp    1200 <main+0xe0>
cs nopw 0x0(%rax,%rax,1)
mov    %eax,%edx
and    $0xfffffffe,%edx
xorpd  %xmm0,%xmm0
mov    $0x1,%ecx
movsd  0xe3a(%rip),%xmm3
movsd  0xe3a(%rip),%xmm4
xchg   %ax,%ax
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
movapd %xmm3,%xmm2
divsd  %xmm1,%xmm2
addsd  %xmm0,%xmm2
lea    0x1(%rcx),%esi
xorps  %xmm1,%xmm1
cvtsi2sd %esi,%xmm1
movapd %xmm4,%xmm0
divsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
add    $0x2,%ecx
cmp    %edx,%esi
jne    11d0 <main+0xb0>
test   $0x1,%al
je     1174 <main+0x54>
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
movsd  0xde9(%rip),%xmm2
divsd  %xmm1,%xmm2
addsd  %xmm2,%xmm0
jmp    1174 <main+0x54>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%.2lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double
store i32 0, i32* %1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %8
8: ; preds = %37, %0
%9 = load i32, i32* %2
%10 = add nsw i32 %9, -1
store i32 %10, i32* %2
%11 = icmp ne i32 %9, 0
br i1 %11, label %12, label %40
12: ; preds = %8
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 1, i32* %4
store i32 0, i32* %5
store double 0.000000e+00, double* %6
br label %14
14: ; preds = %34, %12
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
%17 = load i32, i32* %3
%18 = icmp slt i32 %15, %17
br i1 %18, label %19, label %37
19: ; preds = %14
%20 = load i32, i32* %4
%21 = icmp eq i32 %20, 1
br i1 %21, label %22, label %28
22: ; preds = %19
%23 = load i32, i32* %5
%24 = sitofp i32 %23 to double
%25 = fdiv double 1.000000e+00, %24
%26 = load double, double* %6
%27 = fadd double %26, %25
store double %27, double* %6
br label %34
28: ; preds = %19
%29 = load i32, i32* %5
%30 = sitofp i32 %29 to double
%31 = fdiv double 1.000000e+00, %30
%32 = load double, double* %6
%33 = fsub double %32, %31
store double %33, double* %6
br label %34
34: ; preds = %28, %22
%35 = load i32, i32* %4
%36 = sub nsw i32 0, %35
store i32 %36, i32* %4
br label %14
37: ; preds = %14
%38 = load double, double* %6
%39 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %38)
br label %8
40: ; preds = %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"%.2lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = add nsw i32 %6, -1
store i32 %7, i32* %1
%8 = icmp eq i32 %6, 0
br i1 %8, label %47, label %9
9: ; preds = %0, %41
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %41
13: ; preds = %9
%14 = and i32 %11, 1
%15 = icmp eq i32 %11, 1
br i1 %15, label %32, label %16
16: ; preds = %13
%17 = and i32 %11, -2
br label %18
18: ; preds = %18, %16
%19 = phi i32 [ 1, %16 ], [ %29, %18 ]
%20 = phi double [ 0.000000e+00, %16 ], [ %28, %18 ]
%21 = phi i32 [ 0, %16 ], [ %30, %18 ]
%22 = sitofp i32 %19 to double
%23 = fdiv double 1.000000e+00, %22
%24 = fadd double %20, %23
%25 = add nuw i32 %19, 1
%26 = sitofp i32 %25 to double
%27 = fdiv double -1.000000e+00, %26
%28 = fadd double %24, %27
%29 = add nuw i32 %19, 2
%30 = add i32 %21, 2
%31 = icmp eq i32 %30, %17
br i1 %31, label %32, label %18
32: ; preds = %18, %13
%33 = phi double [ undef, %13 ], [ %28, %18 ]
%34 = phi i32 [ 1, %13 ], [ %29, %18 ]
%35 = phi double [ 0.000000e+00, %13 ], [ %28, %18 ]
%36 = icmp eq i32 %14, 0
br i1 %36, label %41, label %37
37: ; preds = %32
%38 = sitofp i32 %34 to double
%39 = fdiv double 1.000000e+00, %38
%40 = fadd double %35, %39
br label %41
41: ; preds = %37, %32, %9
%42 = phi double [ 0.000000e+00, %9 ], [ %33, %32 ], [ %40, %37 ]
%43 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %42)
%44 = load i32, i32* %1
%45 = add nsw i32 %44, -1
store i32 %45, i32* %1
%46 = icmp eq i32 %44, 0
br i1 %46, label %47, label %9
47: ; preds = %41, %0
ret i32 0
}