double calcPifloat() {
  double lasts = 0.0;
  double t = 3.0;
  double s = 3.0;
  double n = 1.0;
  double na = 0.0;
  double d = 0.0;
  double da = 24.0;
  while (s != lasts) {
    lasts = s;
    n += na;
    na += 8;
    d += da;
    da += 32;
    t = (t * n) / d;
    s = t;
  }
  return s;
}


x86 assembly (clang, -O0):
<calcPifloat>:
push   %rbp
mov    %rsp,%rbp
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xefc(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xeef(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeda(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xeb5(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
ucomisd -0x8(%rbp),%xmm0
jne    116b <calcPifloat+0x6b>
jp     116b <calcPifloat+0x6b>
jmp    11da <calcPifloat+0xda>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe94(%rip),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x38(%rbp),%xmm0
addsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe6b(%rip),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1150 <calcPifloat+0x50>
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcPifloat>:
xorpd  %xmm1,%xmm1
movhpd 0xef4(%rip),%xmm1
movsd  0xef4(%rip),%xmm2
movsd  0xef4(%rip),%xmm0
movapd 0xefc(%rip),%xmm3
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movapd %xmm0,%xmm4
addpd  %xmm1,%xmm2
addpd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
movapd %xmm2,%xmm5
unpckhpd %xmm2,%xmm5
divsd  %xmm5,%xmm0
ucomisd %xmm4,%xmm0
jne    1130 <calcPifloat+0x30>
jp     1130 <calcPifloat+0x30>
ret

LLVM IR (-O0):
define double @calcPifloat() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double 0.000000e+00, double* %1
store double 3.000000e+00, double* %2
store double 3.000000e+00, double* %3
store double 1.000000e+00, double* %4
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
store double 2.400000e+01, double* %7
br label %8
8: ; preds = %12, %0
%9 = load double, double* %3
%10 = load double, double* %1
%11 = fcmp une double %9, %10
br i1 %11, label %12, label %30
12: ; preds = %8
%13 = load double, double* %3
store double %13, double* %1
%14 = load double, double* %5
%15 = load double, double* %4
%16 = fadd double %15, %14
store double %16, double* %4
%17 = load double, double* %5
%18 = fadd double %17, 8.000000e+00
store double %18, double* %5
%19 = load double, double* %7
%20 = load double, double* %6
%21 = fadd double %20, %19
store double %21, double* %6
%22 = load double, double* %7
%23 = fadd double %22, 3.200000e+01
store double %23, double* %7
%24 = load double, double* %2
%25 = load double, double* %4
%26 = fmul double %24, %25
%27 = load double, double* %6
%28 = fdiv double %26, %27
store double %28, double* %2
%29 = load double, double* %2
store double %29, double* %3
br label %8
30: ; preds = %8
%31 = load double, double* %3
ret double %31
}

LLVM IR (-O2):
define double @calcPifloat() {
br label %1
1: ; preds = %0, %1
%2 = phi double [ 3.000000e+00, %0 ], [ %10, %1 ]
%3 = phi <2 x double> [ <double 1.000000e+00, double 0.000000e+00>, %0 ], [ %5, %1 ]
%4 = phi <2 x double> [ <double 0.000000e+00, double 2.400000e+01>, %0 ], [ %6, %1 ]
%5 = fadd <2 x double> %3, %4
%6 = fadd <2 x double> %4, <double 8.000000e+00, double 3.200000e+01>
%7 = extractelement <2 x double> %5, i64 0
%8 = fmul double %2, %7
%9 = extractelement <2 x double> %5, i64 1
%10 = fdiv double %8, %9
%11 = fcmp une double %10, %2
br i1 %11, label %1, label %12
12: ; preds = %1
ret double %10
}