Compound Interest

Percentage Accurate: 28.1% → 99.4%
Time: 21.3s
Alternatives: 18
Speedup: 38.0×

Specification

?
\[\begin{array}{l} \\ 100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \end{array} \]
(FPCore (i n)
 :precision binary64
 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
	return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
	return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n):
	return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n)
	return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n)))
end
function tmp = code(i, n)
	tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n));
end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 18 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 28.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ 100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \end{array} \]
(FPCore (i n)
 :precision binary64
 (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))
double code(double i, double n) {
	return 100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    code = 100.0d0 * ((((1.0d0 + (i / n)) ** n) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
	return 100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n));
}
def code(i, n):
	return 100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))
function code(i, n)
	return Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n)))
end
function tmp = code(i, n)
	tmp = 100.0 * ((((1.0 + (i / n)) ^ n) - 1.0) / (i / n));
end
code[i_, n_] := N[(100.0 * N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\end{array}

Alternative 1: 99.4% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\ t_1 := \frac{t_0}{\frac{i}{n}}\\ t_2 := 100 \cdot \left(\frac{n}{i} \cdot t_0\right)\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;\frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0))
        (t_1 (/ t_0 (/ i n)))
        (t_2 (* 100.0 (* (/ n i) t_0))))
   (if (<= t_1 (- INFINITY))
     t_2
     (if (<= t_1 0.0)
       (/ (* 100.0 (expm1 (* n (log1p (/ i n))))) (/ i n))
       (if (<= t_1 INFINITY)
         t_2
         (*
          100.0
          (/ n (+ (fma i -0.5 1.0) (* i (* i 0.08333333333333333))))))))))
double code(double i, double n) {
	double t_0 = pow((1.0 + (i / n)), n) + -1.0;
	double t_1 = t_0 / (i / n);
	double t_2 = 100.0 * ((n / i) * t_0);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = t_2;
	} else if (t_1 <= 0.0) {
		tmp = (100.0 * expm1((n * log1p((i / n))))) / (i / n);
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_2;
	} else {
		tmp = 100.0 * (n / (fma(i, -0.5, 1.0) + (i * (i * 0.08333333333333333))));
	}
	return tmp;
}
function code(i, n)
	t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0)
	t_1 = Float64(t_0 / Float64(i / n))
	t_2 = Float64(100.0 * Float64(Float64(n / i) * t_0))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = t_2;
	elseif (t_1 <= 0.0)
		tmp = Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / Float64(i / n));
	elseif (t_1 <= Inf)
		tmp = t_2;
	else
		tmp = Float64(100.0 * Float64(n / Float64(fma(i, -0.5, 1.0) + Float64(i * Float64(i * 0.08333333333333333)))));
	end
	return tmp
end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(100.0 * N[(N[(n / i), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$2, If[LessEqual[t$95$1, 0.0], N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(100.0 * N[(n / N[(N[(i * -0.5 + 1.0), $MachinePrecision] + N[(i * N[(i * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t_0}{\frac{i}{n}}\\
t_2 := 100 \cdot \left(\frac{n}{i} \cdot t_0\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -inf.0 or -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0

    1. Initial program 99.9%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. div-sub99.9%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \frac{1}{\frac{i}{n}}\right)} \]
      2. clear-num99.9%

        \[\leadsto 100 \cdot \left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \color{blue}{\frac{n}{i}}\right) \]
      3. sub-neg99.9%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} + \left(-\frac{n}{i}\right)\right)} \]
      4. div-inv99.9%

        \[\leadsto 100 \cdot \left(\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n} \cdot \frac{1}{\frac{i}{n}}} + \left(-\frac{n}{i}\right)\right) \]
      5. clear-num99.9%

        \[\leadsto 100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} \cdot \color{blue}{\frac{n}{i}} + \left(-\frac{n}{i}\right)\right) \]
    3. Applied egg-rr99.9%

      \[\leadsto 100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} \cdot \frac{n}{i} + \left(-\frac{n}{i}\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto 100 \cdot \color{blue}{\left(\left(-\frac{n}{i}\right) + {\left(1 + \frac{i}{n}\right)}^{n} \cdot \frac{n}{i}\right)} \]
      2. neg-mul-199.9%

        \[\leadsto 100 \cdot \left(\color{blue}{-1 \cdot \frac{n}{i}} + {\left(1 + \frac{i}{n}\right)}^{n} \cdot \frac{n}{i}\right) \]
      3. distribute-rgt-out99.9%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{n}{i} \cdot \left(-1 + {\left(1 + \frac{i}{n}\right)}^{n}\right)\right)} \]
    5. Simplified99.9%

      \[\leadsto 100 \cdot \color{blue}{\left(\frac{n}{i} \cdot \left(-1 + {\left(1 + \frac{i}{n}\right)}^{n}\right)\right)} \]

    if -inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0

    1. Initial program 25.3%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-*r/25.3%

        \[\leadsto \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{\frac{i}{n}}} \]
      2. *-commutative25.3%

        \[\leadsto \frac{\color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right) \cdot 100}}{\frac{i}{n}} \]
      3. pow-to-exp25.3%

        \[\leadsto \frac{\left(\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1\right) \cdot 100}{\frac{i}{n}} \]
      4. expm1-def35.9%

        \[\leadsto \frac{\color{blue}{\mathsf{expm1}\left(\log \left(1 + \frac{i}{n}\right) \cdot n\right)} \cdot 100}{\frac{i}{n}} \]
      5. add-log-exp25.3%

        \[\leadsto \frac{\mathsf{expm1}\left(\color{blue}{\log \left(e^{\log \left(1 + \frac{i}{n}\right) \cdot n}\right)}\right) \cdot 100}{\frac{i}{n}} \]
      6. pow-to-exp25.3%

        \[\leadsto \frac{\mathsf{expm1}\left(\log \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n}\right)}\right) \cdot 100}{\frac{i}{n}} \]
      7. log-pow35.9%

        \[\leadsto \frac{\mathsf{expm1}\left(\color{blue}{n \cdot \log \left(1 + \frac{i}{n}\right)}\right) \cdot 100}{\frac{i}{n}} \]
      8. log1p-udef99.6%

        \[\leadsto \frac{\mathsf{expm1}\left(n \cdot \color{blue}{\mathsf{log1p}\left(\frac{i}{n}\right)}\right) \cdot 100}{\frac{i}{n}} \]
    3. Applied egg-rr99.6%

      \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{\frac{i}{n}}} \]

    if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n))

    1. Initial program 0.0%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 1.8%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative1.8%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*1.8%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def75.8%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified75.8%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 100.0%

      \[\leadsto \frac{n}{\color{blue}{1 + \left(0.08333333333333333 \cdot {i}^{2} + -0.5 \cdot i\right)}} \cdot 100 \]
    6. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{n}{1 + \color{blue}{\left(-0.5 \cdot i + 0.08333333333333333 \cdot {i}^{2}\right)}} \cdot 100 \]
      2. associate-+r+100.0%

        \[\leadsto \frac{n}{\color{blue}{\left(1 + -0.5 \cdot i\right) + 0.08333333333333333 \cdot {i}^{2}}} \cdot 100 \]
      3. +-commutative100.0%

        \[\leadsto \frac{n}{\color{blue}{\left(-0.5 \cdot i + 1\right)} + 0.08333333333333333 \cdot {i}^{2}} \cdot 100 \]
      4. *-commutative100.0%

        \[\leadsto \frac{n}{\left(\color{blue}{i \cdot -0.5} + 1\right) + 0.08333333333333333 \cdot {i}^{2}} \cdot 100 \]
      5. fma-def100.0%

        \[\leadsto \frac{n}{\color{blue}{\mathsf{fma}\left(i, -0.5, 1\right)} + 0.08333333333333333 \cdot {i}^{2}} \cdot 100 \]
      6. *-commutative100.0%

        \[\leadsto \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + \color{blue}{{i}^{2} \cdot 0.08333333333333333}} \cdot 100 \]
      7. unpow2100.0%

        \[\leadsto \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + \color{blue}{\left(i \cdot i\right)} \cdot 0.08333333333333333} \cdot 100 \]
      8. associate-*l*100.0%

        \[\leadsto \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + \color{blue}{i \cdot \left(i \cdot 0.08333333333333333\right)}} \cdot 100 \]
    7. Simplified100.0%

      \[\leadsto \frac{n}{\color{blue}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}} \cdot 100 \]
  3. Recombined 3 regimes into one program.
  4. Final simplification99.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq -\infty:\\ \;\;\;\;100 \cdot \left(\frac{n}{i} \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} + -1\right)\right)\\ \mathbf{elif}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq 0:\\ \;\;\;\;\frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\ \mathbf{elif}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq \infty:\\ \;\;\;\;100 \cdot \left(\frac{n}{i} \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\ \end{array} \]

Alternative 2: 84.9% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\ t_1 := \frac{t_0}{\frac{i}{n}}\\ t_2 := 100 \cdot \left(\frac{n}{i} \cdot t_0\right)\\ \mathbf{if}\;t_1 \leq -5 \cdot 10^{-17}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0))
        (t_1 (/ t_0 (/ i n)))
        (t_2 (* 100.0 (* (/ n i) t_0))))
   (if (<= t_1 -5e-17)
     t_2
     (if (<= t_1 0.0)
       (* 100.0 (/ n (/ i (expm1 i))))
       (if (<= t_1 INFINITY)
         t_2
         (*
          100.0
          (/ n (+ (fma i -0.5 1.0) (* i (* i 0.08333333333333333))))))))))
double code(double i, double n) {
	double t_0 = pow((1.0 + (i / n)), n) + -1.0;
	double t_1 = t_0 / (i / n);
	double t_2 = 100.0 * ((n / i) * t_0);
	double tmp;
	if (t_1 <= -5e-17) {
		tmp = t_2;
	} else if (t_1 <= 0.0) {
		tmp = 100.0 * (n / (i / expm1(i)));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_2;
	} else {
		tmp = 100.0 * (n / (fma(i, -0.5, 1.0) + (i * (i * 0.08333333333333333))));
	}
	return tmp;
}
function code(i, n)
	t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0)
	t_1 = Float64(t_0 / Float64(i / n))
	t_2 = Float64(100.0 * Float64(Float64(n / i) * t_0))
	tmp = 0.0
	if (t_1 <= -5e-17)
		tmp = t_2;
	elseif (t_1 <= 0.0)
		tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i))));
	elseif (t_1 <= Inf)
		tmp = t_2;
	else
		tmp = Float64(100.0 * Float64(n / Float64(fma(i, -0.5, 1.0) + Float64(i * Float64(i * 0.08333333333333333)))));
	end
	return tmp
end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(100.0 * N[(N[(n / i), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5e-17], t$95$2, If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(100.0 * N[(n / N[(N[(i * -0.5 + 1.0), $MachinePrecision] + N[(i * N[(i * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t_0}{\frac{i}{n}}\\
t_2 := 100 \cdot \left(\frac{n}{i} \cdot t_0\right)\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{-17}:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -4.9999999999999999e-17 or -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0

    1. Initial program 98.5%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. div-sub98.4%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \frac{1}{\frac{i}{n}}\right)} \]
      2. clear-num98.4%

        \[\leadsto 100 \cdot \left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \color{blue}{\frac{n}{i}}\right) \]
      3. sub-neg98.4%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} + \left(-\frac{n}{i}\right)\right)} \]
      4. div-inv98.4%

        \[\leadsto 100 \cdot \left(\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n} \cdot \frac{1}{\frac{i}{n}}} + \left(-\frac{n}{i}\right)\right) \]
      5. clear-num98.4%

        \[\leadsto 100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} \cdot \color{blue}{\frac{n}{i}} + \left(-\frac{n}{i}\right)\right) \]
    3. Applied egg-rr98.4%

      \[\leadsto 100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} \cdot \frac{n}{i} + \left(-\frac{n}{i}\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutative98.4%

        \[\leadsto 100 \cdot \color{blue}{\left(\left(-\frac{n}{i}\right) + {\left(1 + \frac{i}{n}\right)}^{n} \cdot \frac{n}{i}\right)} \]
      2. neg-mul-198.4%

        \[\leadsto 100 \cdot \left(\color{blue}{-1 \cdot \frac{n}{i}} + {\left(1 + \frac{i}{n}\right)}^{n} \cdot \frac{n}{i}\right) \]
      3. distribute-rgt-out98.5%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{n}{i} \cdot \left(-1 + {\left(1 + \frac{i}{n}\right)}^{n}\right)\right)} \]
    5. Simplified98.5%

      \[\leadsto 100 \cdot \color{blue}{\left(\frac{n}{i} \cdot \left(-1 + {\left(1 + \frac{i}{n}\right)}^{n}\right)\right)} \]

    if -4.9999999999999999e-17 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0

    1. Initial program 24.7%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 41.6%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative41.6%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*41.6%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def79.7%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified79.7%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]

    if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n))

    1. Initial program 0.0%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 1.8%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative1.8%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*1.8%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def75.8%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified75.8%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 100.0%

      \[\leadsto \frac{n}{\color{blue}{1 + \left(0.08333333333333333 \cdot {i}^{2} + -0.5 \cdot i\right)}} \cdot 100 \]
    6. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{n}{1 + \color{blue}{\left(-0.5 \cdot i + 0.08333333333333333 \cdot {i}^{2}\right)}} \cdot 100 \]
      2. associate-+r+100.0%

        \[\leadsto \frac{n}{\color{blue}{\left(1 + -0.5 \cdot i\right) + 0.08333333333333333 \cdot {i}^{2}}} \cdot 100 \]
      3. +-commutative100.0%

        \[\leadsto \frac{n}{\color{blue}{\left(-0.5 \cdot i + 1\right)} + 0.08333333333333333 \cdot {i}^{2}} \cdot 100 \]
      4. *-commutative100.0%

        \[\leadsto \frac{n}{\left(\color{blue}{i \cdot -0.5} + 1\right) + 0.08333333333333333 \cdot {i}^{2}} \cdot 100 \]
      5. fma-def100.0%

        \[\leadsto \frac{n}{\color{blue}{\mathsf{fma}\left(i, -0.5, 1\right)} + 0.08333333333333333 \cdot {i}^{2}} \cdot 100 \]
      6. *-commutative100.0%

        \[\leadsto \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + \color{blue}{{i}^{2} \cdot 0.08333333333333333}} \cdot 100 \]
      7. unpow2100.0%

        \[\leadsto \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + \color{blue}{\left(i \cdot i\right)} \cdot 0.08333333333333333} \cdot 100 \]
      8. associate-*l*100.0%

        \[\leadsto \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + \color{blue}{i \cdot \left(i \cdot 0.08333333333333333\right)}} \cdot 100 \]
    7. Simplified100.0%

      \[\leadsto \frac{n}{\color{blue}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}} \cdot 100 \]
  3. Recombined 3 regimes into one program.
  4. Final simplification86.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq -5 \cdot 10^{-17}:\\ \;\;\;\;100 \cdot \left(\frac{n}{i} \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} + -1\right)\right)\\ \mathbf{elif}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq 0:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \mathbf{elif}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq \infty:\\ \;\;\;\;100 \cdot \left(\frac{n}{i} \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\ \end{array} \]

Alternative 3: 97.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\ t_1 := \frac{t_0}{\frac{i}{n}}\\ t_2 := 100 \cdot \left(\frac{n}{i} \cdot t_0\right)\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;100 \cdot \left(\frac{n}{i} \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)\right)\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0))
        (t_1 (/ t_0 (/ i n)))
        (t_2 (* 100.0 (* (/ n i) t_0))))
   (if (<= t_1 (- INFINITY))
     t_2
     (if (<= t_1 0.0)
       (* 100.0 (* (/ n i) (expm1 (* n (log1p (/ i n))))))
       (if (<= t_1 INFINITY)
         t_2
         (*
          100.0
          (/ n (+ (fma i -0.5 1.0) (* i (* i 0.08333333333333333))))))))))
double code(double i, double n) {
	double t_0 = pow((1.0 + (i / n)), n) + -1.0;
	double t_1 = t_0 / (i / n);
	double t_2 = 100.0 * ((n / i) * t_0);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = t_2;
	} else if (t_1 <= 0.0) {
		tmp = 100.0 * ((n / i) * expm1((n * log1p((i / n)))));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_2;
	} else {
		tmp = 100.0 * (n / (fma(i, -0.5, 1.0) + (i * (i * 0.08333333333333333))));
	}
	return tmp;
}
function code(i, n)
	t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0)
	t_1 = Float64(t_0 / Float64(i / n))
	t_2 = Float64(100.0 * Float64(Float64(n / i) * t_0))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = t_2;
	elseif (t_1 <= 0.0)
		tmp = Float64(100.0 * Float64(Float64(n / i) * expm1(Float64(n * log1p(Float64(i / n))))));
	elseif (t_1 <= Inf)
		tmp = t_2;
	else
		tmp = Float64(100.0 * Float64(n / Float64(fma(i, -0.5, 1.0) + Float64(i * Float64(i * 0.08333333333333333)))));
	end
	return tmp
end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(100.0 * N[(N[(n / i), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$2, If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(N[(n / i), $MachinePrecision] * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(100.0 * N[(n / N[(N[(i * -0.5 + 1.0), $MachinePrecision] + N[(i * N[(i * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t_0}{\frac{i}{n}}\\
t_2 := 100 \cdot \left(\frac{n}{i} \cdot t_0\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;100 \cdot \left(\frac{n}{i} \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)\right)\\

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -inf.0 or -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0

    1. Initial program 99.9%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. div-sub99.9%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \frac{1}{\frac{i}{n}}\right)} \]
      2. clear-num99.9%

        \[\leadsto 100 \cdot \left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \color{blue}{\frac{n}{i}}\right) \]
      3. sub-neg99.9%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} + \left(-\frac{n}{i}\right)\right)} \]
      4. div-inv99.9%

        \[\leadsto 100 \cdot \left(\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n} \cdot \frac{1}{\frac{i}{n}}} + \left(-\frac{n}{i}\right)\right) \]
      5. clear-num99.9%

        \[\leadsto 100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} \cdot \color{blue}{\frac{n}{i}} + \left(-\frac{n}{i}\right)\right) \]
    3. Applied egg-rr99.9%

      \[\leadsto 100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} \cdot \frac{n}{i} + \left(-\frac{n}{i}\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto 100 \cdot \color{blue}{\left(\left(-\frac{n}{i}\right) + {\left(1 + \frac{i}{n}\right)}^{n} \cdot \frac{n}{i}\right)} \]
      2. neg-mul-199.9%

        \[\leadsto 100 \cdot \left(\color{blue}{-1 \cdot \frac{n}{i}} + {\left(1 + \frac{i}{n}\right)}^{n} \cdot \frac{n}{i}\right) \]
      3. distribute-rgt-out99.9%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{n}{i} \cdot \left(-1 + {\left(1 + \frac{i}{n}\right)}^{n}\right)\right)} \]
    5. Simplified99.9%

      \[\leadsto 100 \cdot \color{blue}{\left(\frac{n}{i} \cdot \left(-1 + {\left(1 + \frac{i}{n}\right)}^{n}\right)\right)} \]

    if -inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0

    1. Initial program 25.3%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. clear-num25.3%

        \[\leadsto 100 \cdot \color{blue}{\frac{1}{\frac{\frac{i}{n}}{{\left(1 + \frac{i}{n}\right)}^{n} - 1}}} \]
      2. associate-/r/25.2%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{1}{\frac{i}{n}} \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)\right)} \]
      3. clear-num25.2%

        \[\leadsto 100 \cdot \left(\color{blue}{\frac{n}{i}} \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)\right) \]
      4. pow-to-exp25.2%

        \[\leadsto 100 \cdot \left(\frac{n}{i} \cdot \left(\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1\right)\right) \]
      5. expm1-def35.7%

        \[\leadsto 100 \cdot \left(\frac{n}{i} \cdot \color{blue}{\mathsf{expm1}\left(\log \left(1 + \frac{i}{n}\right) \cdot n\right)}\right) \]
      6. add-log-exp25.2%

        \[\leadsto 100 \cdot \left(\frac{n}{i} \cdot \mathsf{expm1}\left(\color{blue}{\log \left(e^{\log \left(1 + \frac{i}{n}\right) \cdot n}\right)}\right)\right) \]
      7. pow-to-exp25.2%

        \[\leadsto 100 \cdot \left(\frac{n}{i} \cdot \mathsf{expm1}\left(\log \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n}\right)}\right)\right) \]
      8. log-pow35.7%

        \[\leadsto 100 \cdot \left(\frac{n}{i} \cdot \mathsf{expm1}\left(\color{blue}{n \cdot \log \left(1 + \frac{i}{n}\right)}\right)\right) \]
      9. log1p-udef95.4%

        \[\leadsto 100 \cdot \left(\frac{n}{i} \cdot \mathsf{expm1}\left(n \cdot \color{blue}{\mathsf{log1p}\left(\frac{i}{n}\right)}\right)\right) \]
    3. Applied egg-rr95.4%

      \[\leadsto 100 \cdot \color{blue}{\left(\frac{n}{i} \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)\right)} \]

    if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n))

    1. Initial program 0.0%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 1.8%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative1.8%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*1.8%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def75.8%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified75.8%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 100.0%

      \[\leadsto \frac{n}{\color{blue}{1 + \left(0.08333333333333333 \cdot {i}^{2} + -0.5 \cdot i\right)}} \cdot 100 \]
    6. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{n}{1 + \color{blue}{\left(-0.5 \cdot i + 0.08333333333333333 \cdot {i}^{2}\right)}} \cdot 100 \]
      2. associate-+r+100.0%

        \[\leadsto \frac{n}{\color{blue}{\left(1 + -0.5 \cdot i\right) + 0.08333333333333333 \cdot {i}^{2}}} \cdot 100 \]
      3. +-commutative100.0%

        \[\leadsto \frac{n}{\color{blue}{\left(-0.5 \cdot i + 1\right)} + 0.08333333333333333 \cdot {i}^{2}} \cdot 100 \]
      4. *-commutative100.0%

        \[\leadsto \frac{n}{\left(\color{blue}{i \cdot -0.5} + 1\right) + 0.08333333333333333 \cdot {i}^{2}} \cdot 100 \]
      5. fma-def100.0%

        \[\leadsto \frac{n}{\color{blue}{\mathsf{fma}\left(i, -0.5, 1\right)} + 0.08333333333333333 \cdot {i}^{2}} \cdot 100 \]
      6. *-commutative100.0%

        \[\leadsto \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + \color{blue}{{i}^{2} \cdot 0.08333333333333333}} \cdot 100 \]
      7. unpow2100.0%

        \[\leadsto \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + \color{blue}{\left(i \cdot i\right)} \cdot 0.08333333333333333} \cdot 100 \]
      8. associate-*l*100.0%

        \[\leadsto \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + \color{blue}{i \cdot \left(i \cdot 0.08333333333333333\right)}} \cdot 100 \]
    7. Simplified100.0%

      \[\leadsto \frac{n}{\color{blue}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}} \cdot 100 \]
  3. Recombined 3 regimes into one program.
  4. Final simplification96.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq -\infty:\\ \;\;\;\;100 \cdot \left(\frac{n}{i} \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} + -1\right)\right)\\ \mathbf{elif}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq 0:\\ \;\;\;\;100 \cdot \left(\frac{n}{i} \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)\right)\\ \mathbf{elif}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq \infty:\\ \;\;\;\;100 \cdot \left(\frac{n}{i} \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\ \end{array} \]

Alternative 4: 98.5% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\ t_1 := \frac{t_0}{\frac{i}{n}}\\ t_2 := 100 \cdot \left(\frac{n}{i} \cdot t_0\right)\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;t_2\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{100}}\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;t_2\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (+ (pow (+ 1.0 (/ i n)) n) -1.0))
        (t_1 (/ t_0 (/ i n)))
        (t_2 (* 100.0 (* (/ n i) t_0))))
   (if (<= t_1 (- INFINITY))
     t_2
     (if (<= t_1 0.0)
       (* n (/ (expm1 (* n (log1p (/ i n)))) (/ i 100.0)))
       (if (<= t_1 INFINITY)
         t_2
         (*
          100.0
          (/ n (+ (fma i -0.5 1.0) (* i (* i 0.08333333333333333))))))))))
double code(double i, double n) {
	double t_0 = pow((1.0 + (i / n)), n) + -1.0;
	double t_1 = t_0 / (i / n);
	double t_2 = 100.0 * ((n / i) * t_0);
	double tmp;
	if (t_1 <= -((double) INFINITY)) {
		tmp = t_2;
	} else if (t_1 <= 0.0) {
		tmp = n * (expm1((n * log1p((i / n)))) / (i / 100.0));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_2;
	} else {
		tmp = 100.0 * (n / (fma(i, -0.5, 1.0) + (i * (i * 0.08333333333333333))));
	}
	return tmp;
}
function code(i, n)
	t_0 = Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0)
	t_1 = Float64(t_0 / Float64(i / n))
	t_2 = Float64(100.0 * Float64(Float64(n / i) * t_0))
	tmp = 0.0
	if (t_1 <= Float64(-Inf))
		tmp = t_2;
	elseif (t_1 <= 0.0)
		tmp = Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / 100.0)));
	elseif (t_1 <= Inf)
		tmp = t_2;
	else
		tmp = Float64(100.0 * Float64(n / Float64(fma(i, -0.5, 1.0) + Float64(i * Float64(i * 0.08333333333333333)))));
	end
	return tmp
end
code[i_, n_] := Block[{t$95$0 = N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 / N[(i / n), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(100.0 * N[(N[(n / i), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$2, If[LessEqual[t$95$1, 0.0], N[(n * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / N[(i / 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], t$95$2, N[(100.0 * N[(n / N[(N[(i * -0.5 + 1.0), $MachinePrecision] + N[(i * N[(i * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n} + -1\\
t_1 := \frac{t_0}{\frac{i}{n}}\\
t_2 := 100 \cdot \left(\frac{n}{i} \cdot t_0\right)\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;t_2\\

\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{100}}\\

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_2\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -inf.0 or -0.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < +inf.0

    1. Initial program 99.9%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. div-sub99.9%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \frac{1}{\frac{i}{n}}\right)} \]
      2. clear-num99.9%

        \[\leadsto 100 \cdot \left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \color{blue}{\frac{n}{i}}\right) \]
      3. sub-neg99.9%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} + \left(-\frac{n}{i}\right)\right)} \]
      4. div-inv99.9%

        \[\leadsto 100 \cdot \left(\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n} \cdot \frac{1}{\frac{i}{n}}} + \left(-\frac{n}{i}\right)\right) \]
      5. clear-num99.9%

        \[\leadsto 100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} \cdot \color{blue}{\frac{n}{i}} + \left(-\frac{n}{i}\right)\right) \]
    3. Applied egg-rr99.9%

      \[\leadsto 100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} \cdot \frac{n}{i} + \left(-\frac{n}{i}\right)\right)} \]
    4. Step-by-step derivation
      1. +-commutative99.9%

        \[\leadsto 100 \cdot \color{blue}{\left(\left(-\frac{n}{i}\right) + {\left(1 + \frac{i}{n}\right)}^{n} \cdot \frac{n}{i}\right)} \]
      2. neg-mul-199.9%

        \[\leadsto 100 \cdot \left(\color{blue}{-1 \cdot \frac{n}{i}} + {\left(1 + \frac{i}{n}\right)}^{n} \cdot \frac{n}{i}\right) \]
      3. distribute-rgt-out99.9%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{n}{i} \cdot \left(-1 + {\left(1 + \frac{i}{n}\right)}^{n}\right)\right)} \]
    5. Simplified99.9%

      \[\leadsto 100 \cdot \color{blue}{\left(\frac{n}{i} \cdot \left(-1 + {\left(1 + \frac{i}{n}\right)}^{n}\right)\right)} \]

    if -inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0

    1. Initial program 25.3%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-*r/25.3%

        \[\leadsto \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{\frac{i}{n}}} \]
      2. *-commutative25.3%

        \[\leadsto \frac{\color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right) \cdot 100}}{\frac{i}{n}} \]
      3. pow-to-exp25.3%

        \[\leadsto \frac{\left(\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1\right) \cdot 100}{\frac{i}{n}} \]
      4. expm1-def35.9%

        \[\leadsto \frac{\color{blue}{\mathsf{expm1}\left(\log \left(1 + \frac{i}{n}\right) \cdot n\right)} \cdot 100}{\frac{i}{n}} \]
      5. add-log-exp25.3%

        \[\leadsto \frac{\mathsf{expm1}\left(\color{blue}{\log \left(e^{\log \left(1 + \frac{i}{n}\right) \cdot n}\right)}\right) \cdot 100}{\frac{i}{n}} \]
      6. pow-to-exp25.3%

        \[\leadsto \frac{\mathsf{expm1}\left(\log \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n}\right)}\right) \cdot 100}{\frac{i}{n}} \]
      7. log-pow35.9%

        \[\leadsto \frac{\mathsf{expm1}\left(\color{blue}{n \cdot \log \left(1 + \frac{i}{n}\right)}\right) \cdot 100}{\frac{i}{n}} \]
      8. log1p-udef99.6%

        \[\leadsto \frac{\mathsf{expm1}\left(n \cdot \color{blue}{\mathsf{log1p}\left(\frac{i}{n}\right)}\right) \cdot 100}{\frac{i}{n}} \]
    3. Applied egg-rr99.6%

      \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{\frac{i}{n}}} \]
    4. Step-by-step derivation
      1. associate-/r/97.8%

        \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{i} \cdot n} \]
    5. Applied egg-rr97.8%

      \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{i} \cdot n} \]
    6. Step-by-step derivation
      1. *-commutative97.8%

        \[\leadsto \color{blue}{n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{i}} \]
      2. associate-/l*97.8%

        \[\leadsto n \cdot \color{blue}{\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{100}}} \]
    7. Simplified97.8%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{100}}} \]

    if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n))

    1. Initial program 0.0%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 1.8%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative1.8%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*1.8%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def75.8%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified75.8%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 100.0%

      \[\leadsto \frac{n}{\color{blue}{1 + \left(0.08333333333333333 \cdot {i}^{2} + -0.5 \cdot i\right)}} \cdot 100 \]
    6. Step-by-step derivation
      1. +-commutative100.0%

        \[\leadsto \frac{n}{1 + \color{blue}{\left(-0.5 \cdot i + 0.08333333333333333 \cdot {i}^{2}\right)}} \cdot 100 \]
      2. associate-+r+100.0%

        \[\leadsto \frac{n}{\color{blue}{\left(1 + -0.5 \cdot i\right) + 0.08333333333333333 \cdot {i}^{2}}} \cdot 100 \]
      3. +-commutative100.0%

        \[\leadsto \frac{n}{\color{blue}{\left(-0.5 \cdot i + 1\right)} + 0.08333333333333333 \cdot {i}^{2}} \cdot 100 \]
      4. *-commutative100.0%

        \[\leadsto \frac{n}{\left(\color{blue}{i \cdot -0.5} + 1\right) + 0.08333333333333333 \cdot {i}^{2}} \cdot 100 \]
      5. fma-def100.0%

        \[\leadsto \frac{n}{\color{blue}{\mathsf{fma}\left(i, -0.5, 1\right)} + 0.08333333333333333 \cdot {i}^{2}} \cdot 100 \]
      6. *-commutative100.0%

        \[\leadsto \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + \color{blue}{{i}^{2} \cdot 0.08333333333333333}} \cdot 100 \]
      7. unpow2100.0%

        \[\leadsto \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + \color{blue}{\left(i \cdot i\right)} \cdot 0.08333333333333333} \cdot 100 \]
      8. associate-*l*100.0%

        \[\leadsto \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + \color{blue}{i \cdot \left(i \cdot 0.08333333333333333\right)}} \cdot 100 \]
    7. Simplified100.0%

      \[\leadsto \frac{n}{\color{blue}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}} \cdot 100 \]
  3. Recombined 3 regimes into one program.
  4. Final simplification98.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq -\infty:\\ \;\;\;\;100 \cdot \left(\frac{n}{i} \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} + -1\right)\right)\\ \mathbf{elif}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq 0:\\ \;\;\;\;n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{100}}\\ \mathbf{elif}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq \infty:\\ \;\;\;\;100 \cdot \left(\frac{n}{i} \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} + -1\right)\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\ \end{array} \]

Alternative 5: 74.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\ \mathbf{if}\;i \leq -8.6 \cdot 10^{-32}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;i \leq 6.8 \cdot 10^{-45}:\\ \;\;\;\;n \cdot \left(100 + \frac{i \cdot -50}{n}\right)\\ \mathbf{elif}\;i \leq 3.1 \cdot 10^{+155}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;i \leq 7.8 \cdot 10^{+222}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{i \cdot i}{n} \cdot 33.333333333333336\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (* 100.0 (/ (expm1 i) (/ i n)))))
   (if (<= i -8.6e-32)
     t_0
     (if (<= i 6.8e-45)
       (* n (+ 100.0 (/ (* i -50.0) n)))
       (if (<= i 3.1e+155)
         t_0
         (if (<= i 7.8e+222)
           (* 100.0 (/ n (+ 1.0 (* i -0.5))))
           (* (/ (* i i) n) 33.333333333333336)))))))
double code(double i, double n) {
	double t_0 = 100.0 * (expm1(i) / (i / n));
	double tmp;
	if (i <= -8.6e-32) {
		tmp = t_0;
	} else if (i <= 6.8e-45) {
		tmp = n * (100.0 + ((i * -50.0) / n));
	} else if (i <= 3.1e+155) {
		tmp = t_0;
	} else if (i <= 7.8e+222) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else {
		tmp = ((i * i) / n) * 33.333333333333336;
	}
	return tmp;
}
public static double code(double i, double n) {
	double t_0 = 100.0 * (Math.expm1(i) / (i / n));
	double tmp;
	if (i <= -8.6e-32) {
		tmp = t_0;
	} else if (i <= 6.8e-45) {
		tmp = n * (100.0 + ((i * -50.0) / n));
	} else if (i <= 3.1e+155) {
		tmp = t_0;
	} else if (i <= 7.8e+222) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else {
		tmp = ((i * i) / n) * 33.333333333333336;
	}
	return tmp;
}
def code(i, n):
	t_0 = 100.0 * (math.expm1(i) / (i / n))
	tmp = 0
	if i <= -8.6e-32:
		tmp = t_0
	elif i <= 6.8e-45:
		tmp = n * (100.0 + ((i * -50.0) / n))
	elif i <= 3.1e+155:
		tmp = t_0
	elif i <= 7.8e+222:
		tmp = 100.0 * (n / (1.0 + (i * -0.5)))
	else:
		tmp = ((i * i) / n) * 33.333333333333336
	return tmp
function code(i, n)
	t_0 = Float64(100.0 * Float64(expm1(i) / Float64(i / n)))
	tmp = 0.0
	if (i <= -8.6e-32)
		tmp = t_0;
	elseif (i <= 6.8e-45)
		tmp = Float64(n * Float64(100.0 + Float64(Float64(i * -50.0) / n)));
	elseif (i <= 3.1e+155)
		tmp = t_0;
	elseif (i <= 7.8e+222)
		tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5))));
	else
		tmp = Float64(Float64(Float64(i * i) / n) * 33.333333333333336);
	end
	return tmp
end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -8.6e-32], t$95$0, If[LessEqual[i, 6.8e-45], N[(n * N[(100.0 + N[(N[(i * -50.0), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.1e+155], t$95$0, If[LessEqual[i, 7.8e+222], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(i * i), $MachinePrecision] / n), $MachinePrecision] * 33.333333333333336), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\
\mathbf{if}\;i \leq -8.6 \cdot 10^{-32}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;i \leq 6.8 \cdot 10^{-45}:\\
\;\;\;\;n \cdot \left(100 + \frac{i \cdot -50}{n}\right)\\

\mathbf{elif}\;i \leq 3.1 \cdot 10^{+155}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;i \leq 7.8 \cdot 10^{+222}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\

\mathbf{else}:\\
\;\;\;\;\frac{i \cdot i}{n} \cdot 33.333333333333336\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if i < -8.5999999999999998e-32 or 6.80000000000000008e-45 < i < 3.09999999999999989e155

    1. Initial program 45.9%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 65.1%

      \[\leadsto 100 \cdot \frac{\color{blue}{e^{i} - 1}}{\frac{i}{n}} \]
    3. Step-by-step derivation
      1. expm1-def68.3%

        \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
    4. Simplified68.3%

      \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]

    if -8.5999999999999998e-32 < i < 6.80000000000000008e-45

    1. Initial program 5.7%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/6.4%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*6.4%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative6.4%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/6.4%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg6.4%

        \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
      6. distribute-lft-in6.4%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. fma-def6.4%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \left(-1\right)\right)}}{i} \]
      8. metadata-eval6.4%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \color{blue}{-1}\right)}{i} \]
      9. metadata-eval6.4%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified6.4%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Taylor expanded in i around 0 92.2%

      \[\leadsto n \cdot \color{blue}{\left(100 + 100 \cdot \left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-*r*92.2%

        \[\leadsto n \cdot \left(100 + \color{blue}{\left(100 \cdot i\right) \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)}\right) \]
      2. *-commutative92.2%

        \[\leadsto n \cdot \left(100 + \color{blue}{\left(i \cdot 100\right)} \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right) \]
      3. associate-*r/92.2%

        \[\leadsto n \cdot \left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)\right) \]
      4. metadata-eval92.2%

        \[\leadsto n \cdot \left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \frac{\color{blue}{0.5}}{n}\right)\right) \]
    6. Simplified92.2%

      \[\leadsto n \cdot \color{blue}{\left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)} \]
    7. Taylor expanded in n around 0 92.2%

      \[\leadsto n \cdot \left(100 + \color{blue}{-50 \cdot \frac{i}{n}}\right) \]
    8. Step-by-step derivation
      1. associate-*r/92.2%

        \[\leadsto n \cdot \left(100 + \color{blue}{\frac{-50 \cdot i}{n}}\right) \]
      2. *-commutative92.2%

        \[\leadsto n \cdot \left(100 + \frac{\color{blue}{i \cdot -50}}{n}\right) \]
    9. Simplified92.2%

      \[\leadsto n \cdot \left(100 + \color{blue}{\frac{i \cdot -50}{n}}\right) \]

    if 3.09999999999999989e155 < i < 7.7999999999999997e222

    1. Initial program 32.3%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 16.9%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative16.9%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*16.9%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def16.9%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified16.9%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 52.9%

      \[\leadsto \frac{n}{\color{blue}{1 + -0.5 \cdot i}} \cdot 100 \]
    6. Step-by-step derivation
      1. *-commutative52.9%

        \[\leadsto \frac{n}{1 + \color{blue}{i \cdot -0.5}} \cdot 100 \]
    7. Simplified52.9%

      \[\leadsto \frac{n}{\color{blue}{1 + i \cdot -0.5}} \cdot 100 \]

    if 7.7999999999999997e222 < i

    1. Initial program 82.0%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/82.0%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*82.0%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative82.0%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/82.0%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg82.0%

        \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
      6. distribute-lft-in82.0%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. fma-def82.0%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \left(-1\right)\right)}}{i} \]
      8. metadata-eval82.0%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \color{blue}{-1}\right)}{i} \]
      9. metadata-eval82.0%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified82.0%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Taylor expanded in i around 0 54.8%

      \[\leadsto n \cdot \color{blue}{\left(100 + \left(100 \cdot \left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right) + 100 \cdot \left({i}^{2} \cdot \left(\left(0.3333333333333333 \cdot \frac{1}{{n}^{2}} + 0.16666666666666666\right) - 0.5 \cdot \frac{1}{n}\right)\right)\right)\right)} \]
    5. Step-by-step derivation
      1. +-commutative54.8%

        \[\leadsto n \cdot \left(100 + \color{blue}{\left(100 \cdot \left({i}^{2} \cdot \left(\left(0.3333333333333333 \cdot \frac{1}{{n}^{2}} + 0.16666666666666666\right) - 0.5 \cdot \frac{1}{n}\right)\right) + 100 \cdot \left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)\right)}\right) \]
      2. distribute-lft-out54.8%

        \[\leadsto n \cdot \left(100 + \color{blue}{100 \cdot \left({i}^{2} \cdot \left(\left(0.3333333333333333 \cdot \frac{1}{{n}^{2}} + 0.16666666666666666\right) - 0.5 \cdot \frac{1}{n}\right) + i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)}\right) \]
    6. Simplified54.8%

      \[\leadsto n \cdot \color{blue}{\left(100 + 100 \cdot \left(\left(i \cdot i\right) \cdot \left(\frac{0.3333333333333333}{n \cdot n} + \left(0.16666666666666666 + \frac{-0.5}{n}\right)\right) + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)} \]
    7. Taylor expanded in n around 0 55.0%

      \[\leadsto \color{blue}{33.333333333333336 \cdot \frac{{i}^{2}}{n}} \]
    8. Step-by-step derivation
      1. *-commutative55.0%

        \[\leadsto \color{blue}{\frac{{i}^{2}}{n} \cdot 33.333333333333336} \]
      2. unpow255.0%

        \[\leadsto \frac{\color{blue}{i \cdot i}}{n} \cdot 33.333333333333336 \]
    9. Simplified55.0%

      \[\leadsto \color{blue}{\frac{i \cdot i}{n} \cdot 33.333333333333336} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification77.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -8.6 \cdot 10^{-32}:\\ \;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\ \mathbf{elif}\;i \leq 6.8 \cdot 10^{-45}:\\ \;\;\;\;n \cdot \left(100 + \frac{i \cdot -50}{n}\right)\\ \mathbf{elif}\;i \leq 3.1 \cdot 10^{+155}:\\ \;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\ \mathbf{elif}\;i \leq 7.8 \cdot 10^{+222}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{i \cdot i}{n} \cdot 33.333333333333336\\ \end{array} \]

Alternative 6: 74.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -5.8 \cdot 10^{-18}:\\ \;\;\;\;\mathsf{expm1}\left(i\right) \cdot \frac{n}{\frac{i}{100}}\\ \mathbf{elif}\;i \leq 7 \cdot 10^{-45}:\\ \;\;\;\;n \cdot \left(100 + \frac{i \cdot -50}{n}\right)\\ \mathbf{elif}\;i \leq 3.1 \cdot 10^{+155}:\\ \;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\ \mathbf{elif}\;i \leq 4.8 \cdot 10^{+223}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{i \cdot i}{n} \cdot 33.333333333333336\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= i -5.8e-18)
   (* (expm1 i) (/ n (/ i 100.0)))
   (if (<= i 7e-45)
     (* n (+ 100.0 (/ (* i -50.0) n)))
     (if (<= i 3.1e+155)
       (* 100.0 (/ (expm1 i) (/ i n)))
       (if (<= i 4.8e+223)
         (* 100.0 (/ n (+ 1.0 (* i -0.5))))
         (* (/ (* i i) n) 33.333333333333336))))))
double code(double i, double n) {
	double tmp;
	if (i <= -5.8e-18) {
		tmp = expm1(i) * (n / (i / 100.0));
	} else if (i <= 7e-45) {
		tmp = n * (100.0 + ((i * -50.0) / n));
	} else if (i <= 3.1e+155) {
		tmp = 100.0 * (expm1(i) / (i / n));
	} else if (i <= 4.8e+223) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else {
		tmp = ((i * i) / n) * 33.333333333333336;
	}
	return tmp;
}
public static double code(double i, double n) {
	double tmp;
	if (i <= -5.8e-18) {
		tmp = Math.expm1(i) * (n / (i / 100.0));
	} else if (i <= 7e-45) {
		tmp = n * (100.0 + ((i * -50.0) / n));
	} else if (i <= 3.1e+155) {
		tmp = 100.0 * (Math.expm1(i) / (i / n));
	} else if (i <= 4.8e+223) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else {
		tmp = ((i * i) / n) * 33.333333333333336;
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if i <= -5.8e-18:
		tmp = math.expm1(i) * (n / (i / 100.0))
	elif i <= 7e-45:
		tmp = n * (100.0 + ((i * -50.0) / n))
	elif i <= 3.1e+155:
		tmp = 100.0 * (math.expm1(i) / (i / n))
	elif i <= 4.8e+223:
		tmp = 100.0 * (n / (1.0 + (i * -0.5)))
	else:
		tmp = ((i * i) / n) * 33.333333333333336
	return tmp
function code(i, n)
	tmp = 0.0
	if (i <= -5.8e-18)
		tmp = Float64(expm1(i) * Float64(n / Float64(i / 100.0)));
	elseif (i <= 7e-45)
		tmp = Float64(n * Float64(100.0 + Float64(Float64(i * -50.0) / n)));
	elseif (i <= 3.1e+155)
		tmp = Float64(100.0 * Float64(expm1(i) / Float64(i / n)));
	elseif (i <= 4.8e+223)
		tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5))));
	else
		tmp = Float64(Float64(Float64(i * i) / n) * 33.333333333333336);
	end
	return tmp
end
code[i_, n_] := If[LessEqual[i, -5.8e-18], N[(N[(Exp[i] - 1), $MachinePrecision] * N[(n / N[(i / 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 7e-45], N[(n * N[(100.0 + N[(N[(i * -50.0), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.1e+155], N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 4.8e+223], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(i * i), $MachinePrecision] / n), $MachinePrecision] * 33.333333333333336), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq -5.8 \cdot 10^{-18}:\\
\;\;\;\;\mathsf{expm1}\left(i\right) \cdot \frac{n}{\frac{i}{100}}\\

\mathbf{elif}\;i \leq 7 \cdot 10^{-45}:\\
\;\;\;\;n \cdot \left(100 + \frac{i \cdot -50}{n}\right)\\

\mathbf{elif}\;i \leq 3.1 \cdot 10^{+155}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\

\mathbf{elif}\;i \leq 4.8 \cdot 10^{+223}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\

\mathbf{else}:\\
\;\;\;\;\frac{i \cdot i}{n} \cdot 33.333333333333336\\


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if i < -5.8e-18

    1. Initial program 61.7%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 72.4%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative72.4%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*72.4%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def73.6%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified73.6%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Step-by-step derivation
      1. associate-*l/70.0%

        \[\leadsto \color{blue}{\frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(i\right)}}} \]
    6. Applied egg-rr70.0%

      \[\leadsto \color{blue}{\frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(i\right)}}} \]
    7. Step-by-step derivation
      1. *-un-lft-identity70.0%

        \[\leadsto \color{blue}{1 \cdot \frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(i\right)}}} \]
      2. associate-/r/70.0%

        \[\leadsto 1 \cdot \color{blue}{\left(\frac{n \cdot 100}{i} \cdot \mathsf{expm1}\left(i\right)\right)} \]
    8. Applied egg-rr70.0%

      \[\leadsto \color{blue}{1 \cdot \left(\frac{n \cdot 100}{i} \cdot \mathsf{expm1}\left(i\right)\right)} \]
    9. Step-by-step derivation
      1. *-lft-identity70.0%

        \[\leadsto \color{blue}{\frac{n \cdot 100}{i} \cdot \mathsf{expm1}\left(i\right)} \]
      2. *-commutative70.0%

        \[\leadsto \color{blue}{\mathsf{expm1}\left(i\right) \cdot \frac{n \cdot 100}{i}} \]
      3. associate-/l*73.6%

        \[\leadsto \mathsf{expm1}\left(i\right) \cdot \color{blue}{\frac{n}{\frac{i}{100}}} \]
    10. Simplified73.6%

      \[\leadsto \color{blue}{\mathsf{expm1}\left(i\right) \cdot \frac{n}{\frac{i}{100}}} \]

    if -5.8e-18 < i < 7e-45

    1. Initial program 5.6%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/6.2%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*6.2%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative6.2%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/6.2%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg6.2%

        \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
      6. distribute-lft-in6.2%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. fma-def6.2%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \left(-1\right)\right)}}{i} \]
      8. metadata-eval6.2%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \color{blue}{-1}\right)}{i} \]
      9. metadata-eval6.2%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified6.2%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Taylor expanded in i around 0 91.7%

      \[\leadsto n \cdot \color{blue}{\left(100 + 100 \cdot \left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-*r*91.7%

        \[\leadsto n \cdot \left(100 + \color{blue}{\left(100 \cdot i\right) \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)}\right) \]
      2. *-commutative91.7%

        \[\leadsto n \cdot \left(100 + \color{blue}{\left(i \cdot 100\right)} \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right) \]
      3. associate-*r/91.7%

        \[\leadsto n \cdot \left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)\right) \]
      4. metadata-eval91.7%

        \[\leadsto n \cdot \left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \frac{\color{blue}{0.5}}{n}\right)\right) \]
    6. Simplified91.7%

      \[\leadsto n \cdot \color{blue}{\left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)} \]
    7. Taylor expanded in n around 0 91.7%

      \[\leadsto n \cdot \left(100 + \color{blue}{-50 \cdot \frac{i}{n}}\right) \]
    8. Step-by-step derivation
      1. associate-*r/91.7%

        \[\leadsto n \cdot \left(100 + \color{blue}{\frac{-50 \cdot i}{n}}\right) \]
      2. *-commutative91.7%

        \[\leadsto n \cdot \left(100 + \frac{\color{blue}{i \cdot -50}}{n}\right) \]
    9. Simplified91.7%

      \[\leadsto n \cdot \left(100 + \color{blue}{\frac{i \cdot -50}{n}}\right) \]

    if 7e-45 < i < 3.09999999999999989e155

    1. Initial program 32.4%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 63.4%

      \[\leadsto 100 \cdot \frac{\color{blue}{e^{i} - 1}}{\frac{i}{n}} \]
    3. Step-by-step derivation
      1. expm1-def61.1%

        \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
    4. Simplified61.1%

      \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]

    if 3.09999999999999989e155 < i < 4.80000000000000022e223

    1. Initial program 32.3%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 16.9%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative16.9%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*16.9%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def16.9%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified16.9%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 52.9%

      \[\leadsto \frac{n}{\color{blue}{1 + -0.5 \cdot i}} \cdot 100 \]
    6. Step-by-step derivation
      1. *-commutative52.9%

        \[\leadsto \frac{n}{1 + \color{blue}{i \cdot -0.5}} \cdot 100 \]
    7. Simplified52.9%

      \[\leadsto \frac{n}{\color{blue}{1 + i \cdot -0.5}} \cdot 100 \]

    if 4.80000000000000022e223 < i

    1. Initial program 82.0%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/82.0%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*82.0%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative82.0%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/82.0%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg82.0%

        \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
      6. distribute-lft-in82.0%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. fma-def82.0%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \left(-1\right)\right)}}{i} \]
      8. metadata-eval82.0%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \color{blue}{-1}\right)}{i} \]
      9. metadata-eval82.0%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified82.0%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Taylor expanded in i around 0 54.8%

      \[\leadsto n \cdot \color{blue}{\left(100 + \left(100 \cdot \left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right) + 100 \cdot \left({i}^{2} \cdot \left(\left(0.3333333333333333 \cdot \frac{1}{{n}^{2}} + 0.16666666666666666\right) - 0.5 \cdot \frac{1}{n}\right)\right)\right)\right)} \]
    5. Step-by-step derivation
      1. +-commutative54.8%

        \[\leadsto n \cdot \left(100 + \color{blue}{\left(100 \cdot \left({i}^{2} \cdot \left(\left(0.3333333333333333 \cdot \frac{1}{{n}^{2}} + 0.16666666666666666\right) - 0.5 \cdot \frac{1}{n}\right)\right) + 100 \cdot \left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)\right)}\right) \]
      2. distribute-lft-out54.8%

        \[\leadsto n \cdot \left(100 + \color{blue}{100 \cdot \left({i}^{2} \cdot \left(\left(0.3333333333333333 \cdot \frac{1}{{n}^{2}} + 0.16666666666666666\right) - 0.5 \cdot \frac{1}{n}\right) + i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)}\right) \]
    6. Simplified54.8%

      \[\leadsto n \cdot \color{blue}{\left(100 + 100 \cdot \left(\left(i \cdot i\right) \cdot \left(\frac{0.3333333333333333}{n \cdot n} + \left(0.16666666666666666 + \frac{-0.5}{n}\right)\right) + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)} \]
    7. Taylor expanded in n around 0 55.0%

      \[\leadsto \color{blue}{33.333333333333336 \cdot \frac{{i}^{2}}{n}} \]
    8. Step-by-step derivation
      1. *-commutative55.0%

        \[\leadsto \color{blue}{\frac{{i}^{2}}{n} \cdot 33.333333333333336} \]
      2. unpow255.0%

        \[\leadsto \frac{\color{blue}{i \cdot i}}{n} \cdot 33.333333333333336 \]
    9. Simplified55.0%

      \[\leadsto \color{blue}{\frac{i \cdot i}{n} \cdot 33.333333333333336} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification77.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -5.8 \cdot 10^{-18}:\\ \;\;\;\;\mathsf{expm1}\left(i\right) \cdot \frac{n}{\frac{i}{100}}\\ \mathbf{elif}\;i \leq 7 \cdot 10^{-45}:\\ \;\;\;\;n \cdot \left(100 + \frac{i \cdot -50}{n}\right)\\ \mathbf{elif}\;i \leq 3.1 \cdot 10^{+155}:\\ \;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\ \mathbf{elif}\;i \leq 4.8 \cdot 10^{+223}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{else}:\\ \;\;\;\;\frac{i \cdot i}{n} \cdot 33.333333333333336\\ \end{array} \]

Alternative 7: 81.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -3.2 \cdot 10^{-268} \lor \neg \left(n \leq 5.1 \cdot 10^{-28}\right):\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (or (<= n -3.2e-268) (not (<= n 5.1e-28)))
   (* 100.0 (/ n (/ i (expm1 i))))
   (/ (* n (* n -10000.0)) (- (* i (* n 50.0)) (* n 100.0)))))
double code(double i, double n) {
	double tmp;
	if ((n <= -3.2e-268) || !(n <= 5.1e-28)) {
		tmp = 100.0 * (n / (i / expm1(i)));
	} else {
		tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
	}
	return tmp;
}
public static double code(double i, double n) {
	double tmp;
	if ((n <= -3.2e-268) || !(n <= 5.1e-28)) {
		tmp = 100.0 * (n / (i / Math.expm1(i)));
	} else {
		tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if (n <= -3.2e-268) or not (n <= 5.1e-28):
		tmp = 100.0 * (n / (i / math.expm1(i)))
	else:
		tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0))
	return tmp
function code(i, n)
	tmp = 0.0
	if ((n <= -3.2e-268) || !(n <= 5.1e-28))
		tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i))));
	else
		tmp = Float64(Float64(n * Float64(n * -10000.0)) / Float64(Float64(i * Float64(n * 50.0)) - Float64(n * 100.0)));
	end
	return tmp
end
code[i_, n_] := If[Or[LessEqual[n, -3.2e-268], N[Not[LessEqual[n, 5.1e-28]], $MachinePrecision]], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * N[(n * -10000.0), $MachinePrecision]), $MachinePrecision] / N[(N[(i * N[(n * 50.0), $MachinePrecision]), $MachinePrecision] - N[(n * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.2 \cdot 10^{-268} \lor \neg \left(n \leq 5.1 \cdot 10^{-28}\right):\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\

\mathbf{else}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -3.1999999999999999e-268 or 5.10000000000000009e-28 < n

    1. Initial program 26.8%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 36.2%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative36.2%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*36.2%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def86.0%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified86.0%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]

    if -3.1999999999999999e-268 < n < 5.10000000000000009e-28

    1. Initial program 31.0%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 23.2%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative23.2%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*23.2%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def30.6%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified30.6%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 29.6%

      \[\leadsto \color{blue}{50 \cdot \left(n \cdot i\right) + 100 \cdot n} \]
    6. Step-by-step derivation
      1. flip-+49.2%

        \[\leadsto \color{blue}{\frac{\left(50 \cdot \left(n \cdot i\right)\right) \cdot \left(50 \cdot \left(n \cdot i\right)\right) - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n}} \]
      2. associate-*r*49.2%

        \[\leadsto \frac{\color{blue}{\left(\left(50 \cdot n\right) \cdot i\right)} \cdot \left(50 \cdot \left(n \cdot i\right)\right) - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      3. associate-*r*49.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \color{blue}{\left(\left(50 \cdot n\right) \cdot i\right)} - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      4. *-commutative49.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \color{blue}{\left(n \cdot 100\right)} \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      5. *-commutative49.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \color{blue}{\left(n \cdot 100\right)}}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      6. associate-*r*49.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\color{blue}{\left(50 \cdot n\right) \cdot i} - 100 \cdot n} \]
      7. *-commutative49.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - \color{blue}{n \cdot 100}} \]
    7. Applied egg-rr49.2%

      \[\leadsto \color{blue}{\frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100}} \]
    8. Step-by-step derivation
      1. associate-*l*49.2%

        \[\leadsto \frac{\color{blue}{\left(50 \cdot n\right) \cdot \left(i \cdot \left(\left(50 \cdot n\right) \cdot i\right)\right)} - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      2. *-commutative49.2%

        \[\leadsto \frac{\color{blue}{\left(n \cdot 50\right)} \cdot \left(i \cdot \left(\left(50 \cdot n\right) \cdot i\right)\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      3. *-commutative49.2%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \color{blue}{\left(i \cdot \left(50 \cdot n\right)\right)}\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      4. *-commutative49.2%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \color{blue}{\left(n \cdot 50\right)}\right)\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      5. swap-sqr48.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \color{blue}{\left(n \cdot n\right) \cdot \left(100 \cdot 100\right)}}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      6. metadata-eval48.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot \color{blue}{10000}}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      7. *-commutative48.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{\color{blue}{i \cdot \left(50 \cdot n\right)} - n \cdot 100} \]
      8. *-commutative48.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \color{blue}{\left(n \cdot 50\right)} - n \cdot 100} \]
      9. *-commutative48.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \left(n \cdot 50\right) - \color{blue}{100 \cdot n}} \]
    9. Simplified48.9%

      \[\leadsto \color{blue}{\frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \left(n \cdot 50\right) - 100 \cdot n}} \]
    10. Taylor expanded in i around 0 73.7%

      \[\leadsto \frac{\color{blue}{-10000 \cdot {n}^{2}}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
    11. Step-by-step derivation
      1. *-commutative73.7%

        \[\leadsto \frac{\color{blue}{{n}^{2} \cdot -10000}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
      2. unpow273.7%

        \[\leadsto \frac{\color{blue}{\left(n \cdot n\right)} \cdot -10000}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
      3. associate-*r*73.8%

        \[\leadsto \frac{\color{blue}{n \cdot \left(n \cdot -10000\right)}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
    12. Simplified73.8%

      \[\leadsto \frac{\color{blue}{n \cdot \left(n \cdot -10000\right)}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification83.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -3.2 \cdot 10^{-268} \lor \neg \left(n \leq 5.1 \cdot 10^{-28}\right):\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \mathbf{else}:\\ \;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\ \end{array} \]

Alternative 8: 65.8% accurate, 3.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := i \cdot \left(n \cdot 50\right)\\ t_1 := t_0 - n \cdot 100\\ \mathbf{if}\;n \leq -2.35 \cdot 10^{-268}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{elif}\;n \leq 1.55 \cdot 10^{-15}:\\ \;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{t_1}\\ \mathbf{elif}\;n \leq 1.5 \cdot 10^{+151}:\\ \;\;\;\;\frac{\left(n \cdot 50\right) \cdot \left(i \cdot t_0\right) - \left(n \cdot n\right) \cdot 10000}{t_1}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + 100 \cdot \left(i \cdot \left(i \cdot 0.16666666666666666\right) + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (* i (* n 50.0))) (t_1 (- t_0 (* n 100.0))))
   (if (<= n -2.35e-268)
     (* 100.0 (/ n (+ 1.0 (* i -0.5))))
     (if (<= n 1.55e-15)
       (/ (* n (* n -10000.0)) t_1)
       (if (<= n 1.5e+151)
         (/ (- (* (* n 50.0) (* i t_0)) (* (* n n) 10000.0)) t_1)
         (*
          n
          (+
           100.0
           (*
            100.0
            (+ (* i (* i 0.16666666666666666)) (* i (- 0.5 (/ 0.5 n))))))))))))
double code(double i, double n) {
	double t_0 = i * (n * 50.0);
	double t_1 = t_0 - (n * 100.0);
	double tmp;
	if (n <= -2.35e-268) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else if (n <= 1.55e-15) {
		tmp = (n * (n * -10000.0)) / t_1;
	} else if (n <= 1.5e+151) {
		tmp = (((n * 50.0) * (i * t_0)) - ((n * n) * 10000.0)) / t_1;
	} else {
		tmp = n * (100.0 + (100.0 * ((i * (i * 0.16666666666666666)) + (i * (0.5 - (0.5 / n))))));
	}
	return tmp;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = i * (n * 50.0d0)
    t_1 = t_0 - (n * 100.0d0)
    if (n <= (-2.35d-268)) then
        tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
    else if (n <= 1.55d-15) then
        tmp = (n * (n * (-10000.0d0))) / t_1
    else if (n <= 1.5d+151) then
        tmp = (((n * 50.0d0) * (i * t_0)) - ((n * n) * 10000.0d0)) / t_1
    else
        tmp = n * (100.0d0 + (100.0d0 * ((i * (i * 0.16666666666666666d0)) + (i * (0.5d0 - (0.5d0 / n))))))
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double t_0 = i * (n * 50.0);
	double t_1 = t_0 - (n * 100.0);
	double tmp;
	if (n <= -2.35e-268) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else if (n <= 1.55e-15) {
		tmp = (n * (n * -10000.0)) / t_1;
	} else if (n <= 1.5e+151) {
		tmp = (((n * 50.0) * (i * t_0)) - ((n * n) * 10000.0)) / t_1;
	} else {
		tmp = n * (100.0 + (100.0 * ((i * (i * 0.16666666666666666)) + (i * (0.5 - (0.5 / n))))));
	}
	return tmp;
}
def code(i, n):
	t_0 = i * (n * 50.0)
	t_1 = t_0 - (n * 100.0)
	tmp = 0
	if n <= -2.35e-268:
		tmp = 100.0 * (n / (1.0 + (i * -0.5)))
	elif n <= 1.55e-15:
		tmp = (n * (n * -10000.0)) / t_1
	elif n <= 1.5e+151:
		tmp = (((n * 50.0) * (i * t_0)) - ((n * n) * 10000.0)) / t_1
	else:
		tmp = n * (100.0 + (100.0 * ((i * (i * 0.16666666666666666)) + (i * (0.5 - (0.5 / n))))))
	return tmp
function code(i, n)
	t_0 = Float64(i * Float64(n * 50.0))
	t_1 = Float64(t_0 - Float64(n * 100.0))
	tmp = 0.0
	if (n <= -2.35e-268)
		tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5))));
	elseif (n <= 1.55e-15)
		tmp = Float64(Float64(n * Float64(n * -10000.0)) / t_1);
	elseif (n <= 1.5e+151)
		tmp = Float64(Float64(Float64(Float64(n * 50.0) * Float64(i * t_0)) - Float64(Float64(n * n) * 10000.0)) / t_1);
	else
		tmp = Float64(n * Float64(100.0 + Float64(100.0 * Float64(Float64(i * Float64(i * 0.16666666666666666)) + Float64(i * Float64(0.5 - Float64(0.5 / n)))))));
	end
	return tmp
end
function tmp_2 = code(i, n)
	t_0 = i * (n * 50.0);
	t_1 = t_0 - (n * 100.0);
	tmp = 0.0;
	if (n <= -2.35e-268)
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	elseif (n <= 1.55e-15)
		tmp = (n * (n * -10000.0)) / t_1;
	elseif (n <= 1.5e+151)
		tmp = (((n * 50.0) * (i * t_0)) - ((n * n) * 10000.0)) / t_1;
	else
		tmp = n * (100.0 + (100.0 * ((i * (i * 0.16666666666666666)) + (i * (0.5 - (0.5 / n))))));
	end
	tmp_2 = tmp;
end
code[i_, n_] := Block[{t$95$0 = N[(i * N[(n * 50.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - N[(n * 100.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -2.35e-268], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.55e-15], N[(N[(n * N[(n * -10000.0), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[n, 1.5e+151], N[(N[(N[(N[(n * 50.0), $MachinePrecision] * N[(i * t$95$0), $MachinePrecision]), $MachinePrecision] - N[(N[(n * n), $MachinePrecision] * 10000.0), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], N[(n * N[(100.0 + N[(100.0 * N[(N[(i * N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + N[(i * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := i \cdot \left(n \cdot 50\right)\\
t_1 := t_0 - n \cdot 100\\
\mathbf{if}\;n \leq -2.35 \cdot 10^{-268}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\

\mathbf{elif}\;n \leq 1.55 \cdot 10^{-15}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{t_1}\\

\mathbf{elif}\;n \leq 1.5 \cdot 10^{+151}:\\
\;\;\;\;\frac{\left(n \cdot 50\right) \cdot \left(i \cdot t_0\right) - \left(n \cdot n\right) \cdot 10000}{t_1}\\

\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + 100 \cdot \left(i \cdot \left(i \cdot 0.16666666666666666\right) + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if n < -2.34999999999999987e-268

    1. Initial program 30.1%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 33.5%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative33.5%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*33.5%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def81.3%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified81.3%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 63.0%

      \[\leadsto \frac{n}{\color{blue}{1 + -0.5 \cdot i}} \cdot 100 \]
    6. Step-by-step derivation
      1. *-commutative63.0%

        \[\leadsto \frac{n}{1 + \color{blue}{i \cdot -0.5}} \cdot 100 \]
    7. Simplified63.0%

      \[\leadsto \frac{n}{\color{blue}{1 + i \cdot -0.5}} \cdot 100 \]

    if -2.34999999999999987e-268 < n < 1.5499999999999999e-15

    1. Initial program 30.5%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 22.8%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative22.8%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*22.8%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def31.9%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified31.9%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 31.0%

      \[\leadsto \color{blue}{50 \cdot \left(n \cdot i\right) + 100 \cdot n} \]
    6. Step-by-step derivation
      1. flip-+50.2%

        \[\leadsto \color{blue}{\frac{\left(50 \cdot \left(n \cdot i\right)\right) \cdot \left(50 \cdot \left(n \cdot i\right)\right) - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n}} \]
      2. associate-*r*50.2%

        \[\leadsto \frac{\color{blue}{\left(\left(50 \cdot n\right) \cdot i\right)} \cdot \left(50 \cdot \left(n \cdot i\right)\right) - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      3. associate-*r*50.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \color{blue}{\left(\left(50 \cdot n\right) \cdot i\right)} - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      4. *-commutative50.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \color{blue}{\left(n \cdot 100\right)} \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      5. *-commutative50.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \color{blue}{\left(n \cdot 100\right)}}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      6. associate-*r*50.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\color{blue}{\left(50 \cdot n\right) \cdot i} - 100 \cdot n} \]
      7. *-commutative50.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - \color{blue}{n \cdot 100}} \]
    7. Applied egg-rr50.2%

      \[\leadsto \color{blue}{\frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100}} \]
    8. Step-by-step derivation
      1. associate-*l*50.2%

        \[\leadsto \frac{\color{blue}{\left(50 \cdot n\right) \cdot \left(i \cdot \left(\left(50 \cdot n\right) \cdot i\right)\right)} - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      2. *-commutative50.2%

        \[\leadsto \frac{\color{blue}{\left(n \cdot 50\right)} \cdot \left(i \cdot \left(\left(50 \cdot n\right) \cdot i\right)\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      3. *-commutative50.2%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \color{blue}{\left(i \cdot \left(50 \cdot n\right)\right)}\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      4. *-commutative50.2%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \color{blue}{\left(n \cdot 50\right)}\right)\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      5. swap-sqr49.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \color{blue}{\left(n \cdot n\right) \cdot \left(100 \cdot 100\right)}}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      6. metadata-eval49.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot \color{blue}{10000}}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      7. *-commutative49.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{\color{blue}{i \cdot \left(50 \cdot n\right)} - n \cdot 100} \]
      8. *-commutative49.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \color{blue}{\left(n \cdot 50\right)} - n \cdot 100} \]
      9. *-commutative49.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \left(n \cdot 50\right) - \color{blue}{100 \cdot n}} \]
    9. Simplified49.9%

      \[\leadsto \color{blue}{\frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \left(n \cdot 50\right) - 100 \cdot n}} \]
    10. Taylor expanded in i around 0 74.2%

      \[\leadsto \frac{\color{blue}{-10000 \cdot {n}^{2}}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
    11. Step-by-step derivation
      1. *-commutative74.2%

        \[\leadsto \frac{\color{blue}{{n}^{2} \cdot -10000}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
      2. unpow274.2%

        \[\leadsto \frac{\color{blue}{\left(n \cdot n\right)} \cdot -10000}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
      3. associate-*r*74.3%

        \[\leadsto \frac{\color{blue}{n \cdot \left(n \cdot -10000\right)}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
    12. Simplified74.3%

      \[\leadsto \frac{\color{blue}{n \cdot \left(n \cdot -10000\right)}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]

    if 1.5499999999999999e-15 < n < 1.5e151

    1. Initial program 27.6%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 33.1%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative33.1%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*33.1%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def91.5%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified91.5%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 62.0%

      \[\leadsto \color{blue}{50 \cdot \left(n \cdot i\right) + 100 \cdot n} \]
    6. Step-by-step derivation
      1. flip-+85.9%

        \[\leadsto \color{blue}{\frac{\left(50 \cdot \left(n \cdot i\right)\right) \cdot \left(50 \cdot \left(n \cdot i\right)\right) - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n}} \]
      2. associate-*r*85.9%

        \[\leadsto \frac{\color{blue}{\left(\left(50 \cdot n\right) \cdot i\right)} \cdot \left(50 \cdot \left(n \cdot i\right)\right) - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      3. associate-*r*85.9%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \color{blue}{\left(\left(50 \cdot n\right) \cdot i\right)} - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      4. *-commutative85.9%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \color{blue}{\left(n \cdot 100\right)} \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      5. *-commutative85.9%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \color{blue}{\left(n \cdot 100\right)}}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      6. associate-*r*85.9%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\color{blue}{\left(50 \cdot n\right) \cdot i} - 100 \cdot n} \]
      7. *-commutative85.9%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - \color{blue}{n \cdot 100}} \]
    7. Applied egg-rr85.9%

      \[\leadsto \color{blue}{\frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100}} \]
    8. Step-by-step derivation
      1. associate-*l*85.9%

        \[\leadsto \frac{\color{blue}{\left(50 \cdot n\right) \cdot \left(i \cdot \left(\left(50 \cdot n\right) \cdot i\right)\right)} - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      2. *-commutative85.9%

        \[\leadsto \frac{\color{blue}{\left(n \cdot 50\right)} \cdot \left(i \cdot \left(\left(50 \cdot n\right) \cdot i\right)\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      3. *-commutative85.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \color{blue}{\left(i \cdot \left(50 \cdot n\right)\right)}\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      4. *-commutative85.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \color{blue}{\left(n \cdot 50\right)}\right)\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      5. swap-sqr85.5%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \color{blue}{\left(n \cdot n\right) \cdot \left(100 \cdot 100\right)}}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      6. metadata-eval85.5%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot \color{blue}{10000}}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      7. *-commutative85.5%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{\color{blue}{i \cdot \left(50 \cdot n\right)} - n \cdot 100} \]
      8. *-commutative85.5%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \color{blue}{\left(n \cdot 50\right)} - n \cdot 100} \]
      9. *-commutative85.5%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \left(n \cdot 50\right) - \color{blue}{100 \cdot n}} \]
    9. Simplified85.5%

      \[\leadsto \color{blue}{\frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \left(n \cdot 50\right) - 100 \cdot n}} \]

    if 1.5e151 < n

    1. Initial program 17.2%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/17.8%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*17.8%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative17.8%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/17.8%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg17.8%

        \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
      6. distribute-lft-in17.8%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. fma-def17.8%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \left(-1\right)\right)}}{i} \]
      8. metadata-eval17.8%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \color{blue}{-1}\right)}{i} \]
      9. metadata-eval17.8%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified17.8%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Taylor expanded in i around 0 82.1%

      \[\leadsto n \cdot \color{blue}{\left(100 + \left(100 \cdot \left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right) + 100 \cdot \left({i}^{2} \cdot \left(\left(0.3333333333333333 \cdot \frac{1}{{n}^{2}} + 0.16666666666666666\right) - 0.5 \cdot \frac{1}{n}\right)\right)\right)\right)} \]
    5. Step-by-step derivation
      1. +-commutative82.1%

        \[\leadsto n \cdot \left(100 + \color{blue}{\left(100 \cdot \left({i}^{2} \cdot \left(\left(0.3333333333333333 \cdot \frac{1}{{n}^{2}} + 0.16666666666666666\right) - 0.5 \cdot \frac{1}{n}\right)\right) + 100 \cdot \left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)\right)}\right) \]
      2. distribute-lft-out82.1%

        \[\leadsto n \cdot \left(100 + \color{blue}{100 \cdot \left({i}^{2} \cdot \left(\left(0.3333333333333333 \cdot \frac{1}{{n}^{2}} + 0.16666666666666666\right) - 0.5 \cdot \frac{1}{n}\right) + i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)}\right) \]
    6. Simplified82.1%

      \[\leadsto n \cdot \color{blue}{\left(100 + 100 \cdot \left(\left(i \cdot i\right) \cdot \left(\frac{0.3333333333333333}{n \cdot n} + \left(0.16666666666666666 + \frac{-0.5}{n}\right)\right) + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)} \]
    7. Taylor expanded in n around inf 82.1%

      \[\leadsto n \cdot \left(100 + 100 \cdot \left(\color{blue}{0.16666666666666666 \cdot {i}^{2}} + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right) \]
    8. Step-by-step derivation
      1. *-commutative82.1%

        \[\leadsto n \cdot \left(100 + 100 \cdot \left(\color{blue}{{i}^{2} \cdot 0.16666666666666666} + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right) \]
      2. unpow282.1%

        \[\leadsto n \cdot \left(100 + 100 \cdot \left(\color{blue}{\left(i \cdot i\right)} \cdot 0.16666666666666666 + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right) \]
      3. associate-*l*82.1%

        \[\leadsto n \cdot \left(100 + 100 \cdot \left(\color{blue}{i \cdot \left(i \cdot 0.16666666666666666\right)} + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right) \]
    9. Simplified82.1%

      \[\leadsto n \cdot \left(100 + 100 \cdot \left(\color{blue}{i \cdot \left(i \cdot 0.16666666666666666\right)} + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right) \]
  3. Recombined 4 regimes into one program.
  4. Final simplification71.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.35 \cdot 10^{-268}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{elif}\;n \leq 1.55 \cdot 10^{-15}:\\ \;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\ \mathbf{elif}\;n \leq 1.5 \cdot 10^{+151}:\\ \;\;\;\;\frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + 100 \cdot \left(i \cdot \left(i \cdot 0.16666666666666666\right) + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)\\ \end{array} \]

Alternative 9: 66.1% accurate, 4.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -4.1 \cdot 10^{-268}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{elif}\;n \leq 3.45 \cdot 10^{-28}:\\ \;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + 100 \cdot \left(i \cdot \left(i \cdot 0.16666666666666666\right) + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= n -4.1e-268)
   (* 100.0 (/ n (+ 1.0 (* i -0.5))))
   (if (<= n 3.45e-28)
     (/ (* n (* n -10000.0)) (- (* i (* n 50.0)) (* n 100.0)))
     (*
      n
      (+
       100.0
       (*
        100.0
        (+ (* i (* i 0.16666666666666666)) (* i (- 0.5 (/ 0.5 n))))))))))
double code(double i, double n) {
	double tmp;
	if (n <= -4.1e-268) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else if (n <= 3.45e-28) {
		tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
	} else {
		tmp = n * (100.0 + (100.0 * ((i * (i * 0.16666666666666666)) + (i * (0.5 - (0.5 / n))))));
	}
	return tmp;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: tmp
    if (n <= (-4.1d-268)) then
        tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
    else if (n <= 3.45d-28) then
        tmp = (n * (n * (-10000.0d0))) / ((i * (n * 50.0d0)) - (n * 100.0d0))
    else
        tmp = n * (100.0d0 + (100.0d0 * ((i * (i * 0.16666666666666666d0)) + (i * (0.5d0 - (0.5d0 / n))))))
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double tmp;
	if (n <= -4.1e-268) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else if (n <= 3.45e-28) {
		tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
	} else {
		tmp = n * (100.0 + (100.0 * ((i * (i * 0.16666666666666666)) + (i * (0.5 - (0.5 / n))))));
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if n <= -4.1e-268:
		tmp = 100.0 * (n / (1.0 + (i * -0.5)))
	elif n <= 3.45e-28:
		tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0))
	else:
		tmp = n * (100.0 + (100.0 * ((i * (i * 0.16666666666666666)) + (i * (0.5 - (0.5 / n))))))
	return tmp
function code(i, n)
	tmp = 0.0
	if (n <= -4.1e-268)
		tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5))));
	elseif (n <= 3.45e-28)
		tmp = Float64(Float64(n * Float64(n * -10000.0)) / Float64(Float64(i * Float64(n * 50.0)) - Float64(n * 100.0)));
	else
		tmp = Float64(n * Float64(100.0 + Float64(100.0 * Float64(Float64(i * Float64(i * 0.16666666666666666)) + Float64(i * Float64(0.5 - Float64(0.5 / n)))))));
	end
	return tmp
end
function tmp_2 = code(i, n)
	tmp = 0.0;
	if (n <= -4.1e-268)
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	elseif (n <= 3.45e-28)
		tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
	else
		tmp = n * (100.0 + (100.0 * ((i * (i * 0.16666666666666666)) + (i * (0.5 - (0.5 / n))))));
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[LessEqual[n, -4.1e-268], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.45e-28], N[(N[(n * N[(n * -10000.0), $MachinePrecision]), $MachinePrecision] / N[(N[(i * N[(n * 50.0), $MachinePrecision]), $MachinePrecision] - N[(n * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(100.0 * N[(N[(i * N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision] + N[(i * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.1 \cdot 10^{-268}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\

\mathbf{elif}\;n \leq 3.45 \cdot 10^{-28}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\

\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + 100 \cdot \left(i \cdot \left(i \cdot 0.16666666666666666\right) + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -4.0999999999999999e-268

    1. Initial program 30.1%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 33.5%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative33.5%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*33.5%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def81.3%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified81.3%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 63.0%

      \[\leadsto \frac{n}{\color{blue}{1 + -0.5 \cdot i}} \cdot 100 \]
    6. Step-by-step derivation
      1. *-commutative63.0%

        \[\leadsto \frac{n}{1 + \color{blue}{i \cdot -0.5}} \cdot 100 \]
    7. Simplified63.0%

      \[\leadsto \frac{n}{\color{blue}{1 + i \cdot -0.5}} \cdot 100 \]

    if -4.0999999999999999e-268 < n < 3.45000000000000001e-28

    1. Initial program 31.0%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 23.2%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative23.2%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*23.2%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def30.6%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified30.6%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 29.6%

      \[\leadsto \color{blue}{50 \cdot \left(n \cdot i\right) + 100 \cdot n} \]
    6. Step-by-step derivation
      1. flip-+49.2%

        \[\leadsto \color{blue}{\frac{\left(50 \cdot \left(n \cdot i\right)\right) \cdot \left(50 \cdot \left(n \cdot i\right)\right) - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n}} \]
      2. associate-*r*49.2%

        \[\leadsto \frac{\color{blue}{\left(\left(50 \cdot n\right) \cdot i\right)} \cdot \left(50 \cdot \left(n \cdot i\right)\right) - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      3. associate-*r*49.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \color{blue}{\left(\left(50 \cdot n\right) \cdot i\right)} - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      4. *-commutative49.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \color{blue}{\left(n \cdot 100\right)} \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      5. *-commutative49.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \color{blue}{\left(n \cdot 100\right)}}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      6. associate-*r*49.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\color{blue}{\left(50 \cdot n\right) \cdot i} - 100 \cdot n} \]
      7. *-commutative49.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - \color{blue}{n \cdot 100}} \]
    7. Applied egg-rr49.2%

      \[\leadsto \color{blue}{\frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100}} \]
    8. Step-by-step derivation
      1. associate-*l*49.2%

        \[\leadsto \frac{\color{blue}{\left(50 \cdot n\right) \cdot \left(i \cdot \left(\left(50 \cdot n\right) \cdot i\right)\right)} - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      2. *-commutative49.2%

        \[\leadsto \frac{\color{blue}{\left(n \cdot 50\right)} \cdot \left(i \cdot \left(\left(50 \cdot n\right) \cdot i\right)\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      3. *-commutative49.2%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \color{blue}{\left(i \cdot \left(50 \cdot n\right)\right)}\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      4. *-commutative49.2%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \color{blue}{\left(n \cdot 50\right)}\right)\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      5. swap-sqr48.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \color{blue}{\left(n \cdot n\right) \cdot \left(100 \cdot 100\right)}}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      6. metadata-eval48.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot \color{blue}{10000}}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      7. *-commutative48.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{\color{blue}{i \cdot \left(50 \cdot n\right)} - n \cdot 100} \]
      8. *-commutative48.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \color{blue}{\left(n \cdot 50\right)} - n \cdot 100} \]
      9. *-commutative48.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \left(n \cdot 50\right) - \color{blue}{100 \cdot n}} \]
    9. Simplified48.9%

      \[\leadsto \color{blue}{\frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \left(n \cdot 50\right) - 100 \cdot n}} \]
    10. Taylor expanded in i around 0 73.7%

      \[\leadsto \frac{\color{blue}{-10000 \cdot {n}^{2}}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
    11. Step-by-step derivation
      1. *-commutative73.7%

        \[\leadsto \frac{\color{blue}{{n}^{2} \cdot -10000}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
      2. unpow273.7%

        \[\leadsto \frac{\color{blue}{\left(n \cdot n\right)} \cdot -10000}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
      3. associate-*r*73.8%

        \[\leadsto \frac{\color{blue}{n \cdot \left(n \cdot -10000\right)}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
    12. Simplified73.8%

      \[\leadsto \frac{\color{blue}{n \cdot \left(n \cdot -10000\right)}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]

    if 3.45000000000000001e-28 < n

    1. Initial program 21.6%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/22.0%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*22.0%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative22.0%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/22.0%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg22.0%

        \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
      6. distribute-lft-in22.0%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. fma-def22.0%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \left(-1\right)\right)}}{i} \]
      8. metadata-eval22.0%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \color{blue}{-1}\right)}{i} \]
      9. metadata-eval22.0%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified22.0%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Taylor expanded in i around 0 78.2%

      \[\leadsto n \cdot \color{blue}{\left(100 + \left(100 \cdot \left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right) + 100 \cdot \left({i}^{2} \cdot \left(\left(0.3333333333333333 \cdot \frac{1}{{n}^{2}} + 0.16666666666666666\right) - 0.5 \cdot \frac{1}{n}\right)\right)\right)\right)} \]
    5. Step-by-step derivation
      1. +-commutative78.2%

        \[\leadsto n \cdot \left(100 + \color{blue}{\left(100 \cdot \left({i}^{2} \cdot \left(\left(0.3333333333333333 \cdot \frac{1}{{n}^{2}} + 0.16666666666666666\right) - 0.5 \cdot \frac{1}{n}\right)\right) + 100 \cdot \left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)\right)}\right) \]
      2. distribute-lft-out78.2%

        \[\leadsto n \cdot \left(100 + \color{blue}{100 \cdot \left({i}^{2} \cdot \left(\left(0.3333333333333333 \cdot \frac{1}{{n}^{2}} + 0.16666666666666666\right) - 0.5 \cdot \frac{1}{n}\right) + i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)}\right) \]
    6. Simplified78.2%

      \[\leadsto n \cdot \color{blue}{\left(100 + 100 \cdot \left(\left(i \cdot i\right) \cdot \left(\frac{0.3333333333333333}{n \cdot n} + \left(0.16666666666666666 + \frac{-0.5}{n}\right)\right) + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)} \]
    7. Taylor expanded in n around inf 78.2%

      \[\leadsto n \cdot \left(100 + 100 \cdot \left(\color{blue}{0.16666666666666666 \cdot {i}^{2}} + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right) \]
    8. Step-by-step derivation
      1. *-commutative78.2%

        \[\leadsto n \cdot \left(100 + 100 \cdot \left(\color{blue}{{i}^{2} \cdot 0.16666666666666666} + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right) \]
      2. unpow278.2%

        \[\leadsto n \cdot \left(100 + 100 \cdot \left(\color{blue}{\left(i \cdot i\right)} \cdot 0.16666666666666666 + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right) \]
      3. associate-*l*78.2%

        \[\leadsto n \cdot \left(100 + 100 \cdot \left(\color{blue}{i \cdot \left(i \cdot 0.16666666666666666\right)} + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right) \]
    9. Simplified78.2%

      \[\leadsto n \cdot \left(100 + 100 \cdot \left(\color{blue}{i \cdot \left(i \cdot 0.16666666666666666\right)} + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification69.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4.1 \cdot 10^{-268}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{elif}\;n \leq 3.45 \cdot 10^{-28}:\\ \;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + 100 \cdot \left(i \cdot \left(i \cdot 0.16666666666666666\right) + i \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)\\ \end{array} \]

Alternative 10: 66.1% accurate, 5.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -4.1 \cdot 10^{-268}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{elif}\;n \leq 1.6 \cdot 10^{-23}:\\ \;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \frac{100 \cdot \left(i + \left(i \cdot i\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)}{i}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= n -4.1e-268)
   (* 100.0 (/ n (+ 1.0 (* i -0.5))))
   (if (<= n 1.6e-23)
     (/ (* n (* n -10000.0)) (- (* i (* n 50.0)) (* n 100.0)))
     (* n (/ (* 100.0 (+ i (* (* i i) (- 0.5 (/ 0.5 n))))) i)))))
double code(double i, double n) {
	double tmp;
	if (n <= -4.1e-268) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else if (n <= 1.6e-23) {
		tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
	} else {
		tmp = n * ((100.0 * (i + ((i * i) * (0.5 - (0.5 / n))))) / i);
	}
	return tmp;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: tmp
    if (n <= (-4.1d-268)) then
        tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
    else if (n <= 1.6d-23) then
        tmp = (n * (n * (-10000.0d0))) / ((i * (n * 50.0d0)) - (n * 100.0d0))
    else
        tmp = n * ((100.0d0 * (i + ((i * i) * (0.5d0 - (0.5d0 / n))))) / i)
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double tmp;
	if (n <= -4.1e-268) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else if (n <= 1.6e-23) {
		tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
	} else {
		tmp = n * ((100.0 * (i + ((i * i) * (0.5 - (0.5 / n))))) / i);
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if n <= -4.1e-268:
		tmp = 100.0 * (n / (1.0 + (i * -0.5)))
	elif n <= 1.6e-23:
		tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0))
	else:
		tmp = n * ((100.0 * (i + ((i * i) * (0.5 - (0.5 / n))))) / i)
	return tmp
function code(i, n)
	tmp = 0.0
	if (n <= -4.1e-268)
		tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5))));
	elseif (n <= 1.6e-23)
		tmp = Float64(Float64(n * Float64(n * -10000.0)) / Float64(Float64(i * Float64(n * 50.0)) - Float64(n * 100.0)));
	else
		tmp = Float64(n * Float64(Float64(100.0 * Float64(i + Float64(Float64(i * i) * Float64(0.5 - Float64(0.5 / n))))) / i));
	end
	return tmp
end
function tmp_2 = code(i, n)
	tmp = 0.0;
	if (n <= -4.1e-268)
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	elseif (n <= 1.6e-23)
		tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
	else
		tmp = n * ((100.0 * (i + ((i * i) * (0.5 - (0.5 / n))))) / i);
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[LessEqual[n, -4.1e-268], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.6e-23], N[(N[(n * N[(n * -10000.0), $MachinePrecision]), $MachinePrecision] / N[(N[(i * N[(n * 50.0), $MachinePrecision]), $MachinePrecision] - N[(n * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(N[(100.0 * N[(i + N[(N[(i * i), $MachinePrecision] * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.1 \cdot 10^{-268}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\

\mathbf{elif}\;n \leq 1.6 \cdot 10^{-23}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\

\mathbf{else}:\\
\;\;\;\;n \cdot \frac{100 \cdot \left(i + \left(i \cdot i\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)}{i}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -4.0999999999999999e-268

    1. Initial program 30.1%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 33.5%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative33.5%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*33.5%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def81.3%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified81.3%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 63.0%

      \[\leadsto \frac{n}{\color{blue}{1 + -0.5 \cdot i}} \cdot 100 \]
    6. Step-by-step derivation
      1. *-commutative63.0%

        \[\leadsto \frac{n}{1 + \color{blue}{i \cdot -0.5}} \cdot 100 \]
    7. Simplified63.0%

      \[\leadsto \frac{n}{\color{blue}{1 + i \cdot -0.5}} \cdot 100 \]

    if -4.0999999999999999e-268 < n < 1.59999999999999988e-23

    1. Initial program 31.0%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 23.2%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative23.2%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*23.2%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def30.6%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified30.6%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 29.6%

      \[\leadsto \color{blue}{50 \cdot \left(n \cdot i\right) + 100 \cdot n} \]
    6. Step-by-step derivation
      1. flip-+49.2%

        \[\leadsto \color{blue}{\frac{\left(50 \cdot \left(n \cdot i\right)\right) \cdot \left(50 \cdot \left(n \cdot i\right)\right) - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n}} \]
      2. associate-*r*49.2%

        \[\leadsto \frac{\color{blue}{\left(\left(50 \cdot n\right) \cdot i\right)} \cdot \left(50 \cdot \left(n \cdot i\right)\right) - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      3. associate-*r*49.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \color{blue}{\left(\left(50 \cdot n\right) \cdot i\right)} - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      4. *-commutative49.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \color{blue}{\left(n \cdot 100\right)} \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      5. *-commutative49.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \color{blue}{\left(n \cdot 100\right)}}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      6. associate-*r*49.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\color{blue}{\left(50 \cdot n\right) \cdot i} - 100 \cdot n} \]
      7. *-commutative49.2%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - \color{blue}{n \cdot 100}} \]
    7. Applied egg-rr49.2%

      \[\leadsto \color{blue}{\frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100}} \]
    8. Step-by-step derivation
      1. associate-*l*49.2%

        \[\leadsto \frac{\color{blue}{\left(50 \cdot n\right) \cdot \left(i \cdot \left(\left(50 \cdot n\right) \cdot i\right)\right)} - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      2. *-commutative49.2%

        \[\leadsto \frac{\color{blue}{\left(n \cdot 50\right)} \cdot \left(i \cdot \left(\left(50 \cdot n\right) \cdot i\right)\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      3. *-commutative49.2%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \color{blue}{\left(i \cdot \left(50 \cdot n\right)\right)}\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      4. *-commutative49.2%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \color{blue}{\left(n \cdot 50\right)}\right)\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      5. swap-sqr48.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \color{blue}{\left(n \cdot n\right) \cdot \left(100 \cdot 100\right)}}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      6. metadata-eval48.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot \color{blue}{10000}}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      7. *-commutative48.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{\color{blue}{i \cdot \left(50 \cdot n\right)} - n \cdot 100} \]
      8. *-commutative48.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \color{blue}{\left(n \cdot 50\right)} - n \cdot 100} \]
      9. *-commutative48.9%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \left(n \cdot 50\right) - \color{blue}{100 \cdot n}} \]
    9. Simplified48.9%

      \[\leadsto \color{blue}{\frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \left(n \cdot 50\right) - 100 \cdot n}} \]
    10. Taylor expanded in i around 0 73.7%

      \[\leadsto \frac{\color{blue}{-10000 \cdot {n}^{2}}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
    11. Step-by-step derivation
      1. *-commutative73.7%

        \[\leadsto \frac{\color{blue}{{n}^{2} \cdot -10000}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
      2. unpow273.7%

        \[\leadsto \frac{\color{blue}{\left(n \cdot n\right)} \cdot -10000}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
      3. associate-*r*73.8%

        \[\leadsto \frac{\color{blue}{n \cdot \left(n \cdot -10000\right)}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
    12. Simplified73.8%

      \[\leadsto \frac{\color{blue}{n \cdot \left(n \cdot -10000\right)}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]

    if 1.59999999999999988e-23 < n

    1. Initial program 21.6%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/22.0%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*22.0%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative22.0%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/22.0%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg22.0%

        \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
      6. distribute-lft-in22.0%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. fma-def22.0%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \left(-1\right)\right)}}{i} \]
      8. metadata-eval22.0%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \color{blue}{-1}\right)}{i} \]
      9. metadata-eval22.0%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified22.0%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Taylor expanded in i around 0 75.5%

      \[\leadsto n \cdot \frac{\color{blue}{100 \cdot i + 100 \cdot \left({i}^{2} \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)}}{i} \]
    5. Step-by-step derivation
      1. distribute-lft-out75.5%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot \left(i + {i}^{2} \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)}}{i} \]
      2. unpow275.5%

        \[\leadsto n \cdot \frac{100 \cdot \left(i + \color{blue}{\left(i \cdot i\right)} \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)}{i} \]
      3. associate-*r/75.5%

        \[\leadsto n \cdot \frac{100 \cdot \left(i + \left(i \cdot i\right) \cdot \left(0.5 - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)\right)}{i} \]
      4. metadata-eval75.5%

        \[\leadsto n \cdot \frac{100 \cdot \left(i + \left(i \cdot i\right) \cdot \left(0.5 - \frac{\color{blue}{0.5}}{n}\right)\right)}{i} \]
    6. Simplified75.5%

      \[\leadsto n \cdot \frac{\color{blue}{100 \cdot \left(i + \left(i \cdot i\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)}}{i} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification69.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4.1 \cdot 10^{-268}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{elif}\;n \leq 1.6 \cdot 10^{-23}:\\ \;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \frac{100 \cdot \left(i + \left(i \cdot i\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)}{i}\\ \end{array} \]

Alternative 11: 64.7% accurate, 6.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -4 \cdot 10^{-268}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{elif}\;n \leq 7.8 \cdot 10^{+45}:\\ \;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= n -4e-268)
   (* 100.0 (/ n (+ 1.0 (* i -0.5))))
   (if (<= n 7.8e+45)
     (/ (* n (* n -10000.0)) (- (* i (* n 50.0)) (* n 100.0)))
     (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
	double tmp;
	if (n <= -4e-268) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else if (n <= 7.8e+45) {
		tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
	} else {
		tmp = n * (100.0 + (i * 50.0));
	}
	return tmp;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: tmp
    if (n <= (-4d-268)) then
        tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
    else if (n <= 7.8d+45) then
        tmp = (n * (n * (-10000.0d0))) / ((i * (n * 50.0d0)) - (n * 100.0d0))
    else
        tmp = n * (100.0d0 + (i * 50.0d0))
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double tmp;
	if (n <= -4e-268) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else if (n <= 7.8e+45) {
		tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
	} else {
		tmp = n * (100.0 + (i * 50.0));
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if n <= -4e-268:
		tmp = 100.0 * (n / (1.0 + (i * -0.5)))
	elif n <= 7.8e+45:
		tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0))
	else:
		tmp = n * (100.0 + (i * 50.0))
	return tmp
function code(i, n)
	tmp = 0.0
	if (n <= -4e-268)
		tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5))));
	elseif (n <= 7.8e+45)
		tmp = Float64(Float64(n * Float64(n * -10000.0)) / Float64(Float64(i * Float64(n * 50.0)) - Float64(n * 100.0)));
	else
		tmp = Float64(n * Float64(100.0 + Float64(i * 50.0)));
	end
	return tmp
end
function tmp_2 = code(i, n)
	tmp = 0.0;
	if (n <= -4e-268)
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	elseif (n <= 7.8e+45)
		tmp = (n * (n * -10000.0)) / ((i * (n * 50.0)) - (n * 100.0));
	else
		tmp = n * (100.0 + (i * 50.0));
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[LessEqual[n, -4e-268], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7.8e+45], N[(N[(n * N[(n * -10000.0), $MachinePrecision]), $MachinePrecision] / N[(N[(i * N[(n * 50.0), $MachinePrecision]), $MachinePrecision] - N[(n * 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -4 \cdot 10^{-268}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\

\mathbf{elif}\;n \leq 7.8 \cdot 10^{+45}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\

\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -3.99999999999999983e-268

    1. Initial program 30.1%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 33.5%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative33.5%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*33.5%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def81.3%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified81.3%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 63.0%

      \[\leadsto \frac{n}{\color{blue}{1 + -0.5 \cdot i}} \cdot 100 \]
    6. Step-by-step derivation
      1. *-commutative63.0%

        \[\leadsto \frac{n}{1 + \color{blue}{i \cdot -0.5}} \cdot 100 \]
    7. Simplified63.0%

      \[\leadsto \frac{n}{\color{blue}{1 + i \cdot -0.5}} \cdot 100 \]

    if -3.99999999999999983e-268 < n < 7.7999999999999999e45

    1. Initial program 33.0%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 24.0%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative24.0%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*24.0%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def42.7%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified42.7%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 36.4%

      \[\leadsto \color{blue}{50 \cdot \left(n \cdot i\right) + 100 \cdot n} \]
    6. Step-by-step derivation
      1. flip-+55.5%

        \[\leadsto \color{blue}{\frac{\left(50 \cdot \left(n \cdot i\right)\right) \cdot \left(50 \cdot \left(n \cdot i\right)\right) - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n}} \]
      2. associate-*r*55.5%

        \[\leadsto \frac{\color{blue}{\left(\left(50 \cdot n\right) \cdot i\right)} \cdot \left(50 \cdot \left(n \cdot i\right)\right) - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      3. associate-*r*55.5%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \color{blue}{\left(\left(50 \cdot n\right) \cdot i\right)} - \left(100 \cdot n\right) \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      4. *-commutative55.5%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \color{blue}{\left(n \cdot 100\right)} \cdot \left(100 \cdot n\right)}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      5. *-commutative55.5%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \color{blue}{\left(n \cdot 100\right)}}{50 \cdot \left(n \cdot i\right) - 100 \cdot n} \]
      6. associate-*r*55.5%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\color{blue}{\left(50 \cdot n\right) \cdot i} - 100 \cdot n} \]
      7. *-commutative55.5%

        \[\leadsto \frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - \color{blue}{n \cdot 100}} \]
    7. Applied egg-rr55.5%

      \[\leadsto \color{blue}{\frac{\left(\left(50 \cdot n\right) \cdot i\right) \cdot \left(\left(50 \cdot n\right) \cdot i\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100}} \]
    8. Step-by-step derivation
      1. associate-*l*55.5%

        \[\leadsto \frac{\color{blue}{\left(50 \cdot n\right) \cdot \left(i \cdot \left(\left(50 \cdot n\right) \cdot i\right)\right)} - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      2. *-commutative55.5%

        \[\leadsto \frac{\color{blue}{\left(n \cdot 50\right)} \cdot \left(i \cdot \left(\left(50 \cdot n\right) \cdot i\right)\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      3. *-commutative55.5%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \color{blue}{\left(i \cdot \left(50 \cdot n\right)\right)}\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      4. *-commutative55.5%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \color{blue}{\left(n \cdot 50\right)}\right)\right) - \left(n \cdot 100\right) \cdot \left(n \cdot 100\right)}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      5. swap-sqr55.2%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \color{blue}{\left(n \cdot n\right) \cdot \left(100 \cdot 100\right)}}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      6. metadata-eval55.2%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot \color{blue}{10000}}{\left(50 \cdot n\right) \cdot i - n \cdot 100} \]
      7. *-commutative55.2%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{\color{blue}{i \cdot \left(50 \cdot n\right)} - n \cdot 100} \]
      8. *-commutative55.2%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \color{blue}{\left(n \cdot 50\right)} - n \cdot 100} \]
      9. *-commutative55.2%

        \[\leadsto \frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \left(n \cdot 50\right) - \color{blue}{100 \cdot n}} \]
    9. Simplified55.2%

      \[\leadsto \color{blue}{\frac{\left(n \cdot 50\right) \cdot \left(i \cdot \left(i \cdot \left(n \cdot 50\right)\right)\right) - \left(n \cdot n\right) \cdot 10000}{i \cdot \left(n \cdot 50\right) - 100 \cdot n}} \]
    10. Taylor expanded in i around 0 70.0%

      \[\leadsto \frac{\color{blue}{-10000 \cdot {n}^{2}}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
    11. Step-by-step derivation
      1. *-commutative70.0%

        \[\leadsto \frac{\color{blue}{{n}^{2} \cdot -10000}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
      2. unpow270.0%

        \[\leadsto \frac{\color{blue}{\left(n \cdot n\right)} \cdot -10000}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
      3. associate-*r*70.1%

        \[\leadsto \frac{\color{blue}{n \cdot \left(n \cdot -10000\right)}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]
    12. Simplified70.1%

      \[\leadsto \frac{\color{blue}{n \cdot \left(n \cdot -10000\right)}}{i \cdot \left(n \cdot 50\right) - 100 \cdot n} \]

    if 7.7999999999999999e45 < n

    1. Initial program 17.1%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/17.6%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*17.6%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative17.6%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/17.6%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg17.6%

        \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
      6. distribute-lft-in17.6%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. fma-def17.6%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \left(-1\right)\right)}}{i} \]
      8. metadata-eval17.6%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \color{blue}{-1}\right)}{i} \]
      9. metadata-eval17.6%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified17.6%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Taylor expanded in i around 0 77.2%

      \[\leadsto n \cdot \color{blue}{\left(100 + 100 \cdot \left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-*r*77.2%

        \[\leadsto n \cdot \left(100 + \color{blue}{\left(100 \cdot i\right) \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)}\right) \]
      2. *-commutative77.2%

        \[\leadsto n \cdot \left(100 + \color{blue}{\left(i \cdot 100\right)} \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right) \]
      3. associate-*r/77.2%

        \[\leadsto n \cdot \left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)\right) \]
      4. metadata-eval77.2%

        \[\leadsto n \cdot \left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \frac{\color{blue}{0.5}}{n}\right)\right) \]
    6. Simplified77.2%

      \[\leadsto n \cdot \color{blue}{\left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)} \]
    7. Taylor expanded in n around inf 77.2%

      \[\leadsto n \cdot \left(100 + \color{blue}{50 \cdot i}\right) \]
    8. Step-by-step derivation
      1. *-commutative77.2%

        \[\leadsto n \cdot \left(100 + \color{blue}{i \cdot 50}\right) \]
    9. Simplified77.2%

      \[\leadsto n \cdot \left(100 + \color{blue}{i \cdot 50}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification68.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4 \cdot 10^{-268}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{elif}\;n \leq 7.8 \cdot 10^{+45}:\\ \;\;\;\;\frac{n \cdot \left(n \cdot -10000\right)}{i \cdot \left(n \cdot 50\right) - n \cdot 100}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \]

Alternative 12: 60.0% accurate, 8.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{n}{i} \cdot -200\\ \mathbf{if}\;i \leq -2:\\ \;\;\;\;t_0\\ \mathbf{elif}\;i \leq 2.2 \cdot 10^{+49}:\\ \;\;\;\;n \cdot 100\\ \mathbf{elif}\;i \leq 3.1 \cdot 10^{+155} \lor \neg \left(i \leq 1.45 \cdot 10^{+238}\right):\\ \;\;\;\;50 \cdot \left(i \cdot n\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (* (/ n i) -200.0)))
   (if (<= i -2.0)
     t_0
     (if (<= i 2.2e+49)
       (* n 100.0)
       (if (or (<= i 3.1e+155) (not (<= i 1.45e+238)))
         (* 50.0 (* i n))
         t_0)))))
double code(double i, double n) {
	double t_0 = (n / i) * -200.0;
	double tmp;
	if (i <= -2.0) {
		tmp = t_0;
	} else if (i <= 2.2e+49) {
		tmp = n * 100.0;
	} else if ((i <= 3.1e+155) || !(i <= 1.45e+238)) {
		tmp = 50.0 * (i * n);
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: tmp
    t_0 = (n / i) * (-200.0d0)
    if (i <= (-2.0d0)) then
        tmp = t_0
    else if (i <= 2.2d+49) then
        tmp = n * 100.0d0
    else if ((i <= 3.1d+155) .or. (.not. (i <= 1.45d+238))) then
        tmp = 50.0d0 * (i * n)
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double t_0 = (n / i) * -200.0;
	double tmp;
	if (i <= -2.0) {
		tmp = t_0;
	} else if (i <= 2.2e+49) {
		tmp = n * 100.0;
	} else if ((i <= 3.1e+155) || !(i <= 1.45e+238)) {
		tmp = 50.0 * (i * n);
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(i, n):
	t_0 = (n / i) * -200.0
	tmp = 0
	if i <= -2.0:
		tmp = t_0
	elif i <= 2.2e+49:
		tmp = n * 100.0
	elif (i <= 3.1e+155) or not (i <= 1.45e+238):
		tmp = 50.0 * (i * n)
	else:
		tmp = t_0
	return tmp
function code(i, n)
	t_0 = Float64(Float64(n / i) * -200.0)
	tmp = 0.0
	if (i <= -2.0)
		tmp = t_0;
	elseif (i <= 2.2e+49)
		tmp = Float64(n * 100.0);
	elseif ((i <= 3.1e+155) || !(i <= 1.45e+238))
		tmp = Float64(50.0 * Float64(i * n));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(i, n)
	t_0 = (n / i) * -200.0;
	tmp = 0.0;
	if (i <= -2.0)
		tmp = t_0;
	elseif (i <= 2.2e+49)
		tmp = n * 100.0;
	elseif ((i <= 3.1e+155) || ~((i <= 1.45e+238)))
		tmp = 50.0 * (i * n);
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[i_, n_] := Block[{t$95$0 = N[(N[(n / i), $MachinePrecision] * -200.0), $MachinePrecision]}, If[LessEqual[i, -2.0], t$95$0, If[LessEqual[i, 2.2e+49], N[(n * 100.0), $MachinePrecision], If[Or[LessEqual[i, 3.1e+155], N[Not[LessEqual[i, 1.45e+238]], $MachinePrecision]], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{n}{i} \cdot -200\\
\mathbf{if}\;i \leq -2:\\
\;\;\;\;t_0\\

\mathbf{elif}\;i \leq 2.2 \cdot 10^{+49}:\\
\;\;\;\;n \cdot 100\\

\mathbf{elif}\;i \leq 3.1 \cdot 10^{+155} \lor \neg \left(i \leq 1.45 \cdot 10^{+238}\right):\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if i < -2 or 3.09999999999999989e155 < i < 1.4500000000000001e238

    1. Initial program 56.6%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 59.4%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative59.4%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*59.4%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def59.4%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified59.4%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 36.3%

      \[\leadsto \frac{n}{\color{blue}{1 + -0.5 \cdot i}} \cdot 100 \]
    6. Step-by-step derivation
      1. *-commutative36.3%

        \[\leadsto \frac{n}{1 + \color{blue}{i \cdot -0.5}} \cdot 100 \]
    7. Simplified36.3%

      \[\leadsto \frac{n}{\color{blue}{1 + i \cdot -0.5}} \cdot 100 \]
    8. Taylor expanded in i around inf 36.3%

      \[\leadsto \color{blue}{-200 \cdot \frac{n}{i}} \]

    if -2 < i < 2.2000000000000001e49

    1. Initial program 11.6%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in i around 0 79.2%

      \[\leadsto \color{blue}{100 \cdot n} \]
    3. Step-by-step derivation
      1. *-commutative79.2%

        \[\leadsto \color{blue}{n \cdot 100} \]
    4. Simplified79.2%

      \[\leadsto \color{blue}{n \cdot 100} \]

    if 2.2000000000000001e49 < i < 3.09999999999999989e155 or 1.4500000000000001e238 < i

    1. Initial program 39.6%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 68.2%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative68.2%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*68.2%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def68.2%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified68.2%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 41.5%

      \[\leadsto \color{blue}{50 \cdot \left(n \cdot i\right) + 100 \cdot n} \]
    6. Taylor expanded in i around inf 41.5%

      \[\leadsto \color{blue}{50 \cdot \left(n \cdot i\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification62.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -2:\\ \;\;\;\;\frac{n}{i} \cdot -200\\ \mathbf{elif}\;i \leq 2.2 \cdot 10^{+49}:\\ \;\;\;\;n \cdot 100\\ \mathbf{elif}\;i \leq 3.1 \cdot 10^{+155} \lor \neg \left(i \leq 1.45 \cdot 10^{+238}\right):\\ \;\;\;\;50 \cdot \left(i \cdot n\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{n}{i} \cdot -200\\ \end{array} \]

Alternative 13: 63.8% accurate, 8.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := n \cdot \left(100 + i \cdot 50\right)\\ \mathbf{if}\;n \leq -1.55 \cdot 10^{+55}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;n \leq -4.1 \cdot 10^{-268}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 9.5 \cdot 10^{-136}:\\ \;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (* n (+ 100.0 (* i 50.0)))))
   (if (<= n -1.55e+55)
     t_0
     (if (<= n -4.1e-268)
       (* 100.0 (/ i (/ i n)))
       (if (<= n 9.5e-136) (* 100.0 (/ 0.0 (/ i n))) t_0)))))
double code(double i, double n) {
	double t_0 = n * (100.0 + (i * 50.0));
	double tmp;
	if (n <= -1.55e+55) {
		tmp = t_0;
	} else if (n <= -4.1e-268) {
		tmp = 100.0 * (i / (i / n));
	} else if (n <= 9.5e-136) {
		tmp = 100.0 * (0.0 / (i / n));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: tmp
    t_0 = n * (100.0d0 + (i * 50.0d0))
    if (n <= (-1.55d+55)) then
        tmp = t_0
    else if (n <= (-4.1d-268)) then
        tmp = 100.0d0 * (i / (i / n))
    else if (n <= 9.5d-136) then
        tmp = 100.0d0 * (0.0d0 / (i / n))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double t_0 = n * (100.0 + (i * 50.0));
	double tmp;
	if (n <= -1.55e+55) {
		tmp = t_0;
	} else if (n <= -4.1e-268) {
		tmp = 100.0 * (i / (i / n));
	} else if (n <= 9.5e-136) {
		tmp = 100.0 * (0.0 / (i / n));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(i, n):
	t_0 = n * (100.0 + (i * 50.0))
	tmp = 0
	if n <= -1.55e+55:
		tmp = t_0
	elif n <= -4.1e-268:
		tmp = 100.0 * (i / (i / n))
	elif n <= 9.5e-136:
		tmp = 100.0 * (0.0 / (i / n))
	else:
		tmp = t_0
	return tmp
function code(i, n)
	t_0 = Float64(n * Float64(100.0 + Float64(i * 50.0)))
	tmp = 0.0
	if (n <= -1.55e+55)
		tmp = t_0;
	elseif (n <= -4.1e-268)
		tmp = Float64(100.0 * Float64(i / Float64(i / n)));
	elseif (n <= 9.5e-136)
		tmp = Float64(100.0 * Float64(0.0 / Float64(i / n)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(i, n)
	t_0 = n * (100.0 + (i * 50.0));
	tmp = 0.0;
	if (n <= -1.55e+55)
		tmp = t_0;
	elseif (n <= -4.1e-268)
		tmp = 100.0 * (i / (i / n));
	elseif (n <= 9.5e-136)
		tmp = 100.0 * (0.0 / (i / n));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.55e+55], t$95$0, If[LessEqual[n, -4.1e-268], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 9.5e-136], N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot 50\right)\\
\mathbf{if}\;n \leq -1.55 \cdot 10^{+55}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;n \leq -4.1 \cdot 10^{-268}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\

\mathbf{elif}\;n \leq 9.5 \cdot 10^{-136}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -1.54999999999999997e55 or 9.5000000000000007e-136 < n

    1. Initial program 21.9%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/22.3%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*22.3%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative22.3%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/22.3%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg22.3%

        \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
      6. distribute-lft-in22.3%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. fma-def22.3%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \left(-1\right)\right)}}{i} \]
      8. metadata-eval22.3%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \color{blue}{-1}\right)}{i} \]
      9. metadata-eval22.3%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified22.3%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Taylor expanded in i around 0 65.0%

      \[\leadsto n \cdot \color{blue}{\left(100 + 100 \cdot \left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-*r*65.0%

        \[\leadsto n \cdot \left(100 + \color{blue}{\left(100 \cdot i\right) \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)}\right) \]
      2. *-commutative65.0%

        \[\leadsto n \cdot \left(100 + \color{blue}{\left(i \cdot 100\right)} \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right) \]
      3. associate-*r/65.0%

        \[\leadsto n \cdot \left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)\right) \]
      4. metadata-eval65.0%

        \[\leadsto n \cdot \left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \frac{\color{blue}{0.5}}{n}\right)\right) \]
    6. Simplified65.0%

      \[\leadsto n \cdot \color{blue}{\left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)} \]
    7. Taylor expanded in n around inf 65.0%

      \[\leadsto n \cdot \left(100 + \color{blue}{50 \cdot i}\right) \]
    8. Step-by-step derivation
      1. *-commutative65.0%

        \[\leadsto n \cdot \left(100 + \color{blue}{i \cdot 50}\right) \]
    9. Simplified65.0%

      \[\leadsto n \cdot \left(100 + \color{blue}{i \cdot 50}\right) \]

    if -1.54999999999999997e55 < n < -4.0999999999999999e-268

    1. Initial program 36.4%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in i around 0 66.8%

      \[\leadsto 100 \cdot \frac{\color{blue}{i}}{\frac{i}{n}} \]

    if -4.0999999999999999e-268 < n < 9.5000000000000007e-136

    1. Initial program 41.1%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in i around 0 73.5%

      \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification66.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1.55 \cdot 10^{+55}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \mathbf{elif}\;n \leq -4.1 \cdot 10^{-268}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 9.5 \cdot 10^{-136}:\\ \;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \]

Alternative 14: 63.0% accurate, 10.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -1.4 \cdot 10^{+55} \lor \neg \left(n \leq 6 \cdot 10^{+45}\right):\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (or (<= n -1.4e+55) (not (<= n 6e+45)))
   (* n (+ 100.0 (* i 50.0)))
   (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
	double tmp;
	if ((n <= -1.4e+55) || !(n <= 6e+45)) {
		tmp = n * (100.0 + (i * 50.0));
	} else {
		tmp = 100.0 * (i / (i / n));
	}
	return tmp;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: tmp
    if ((n <= (-1.4d+55)) .or. (.not. (n <= 6d+45))) then
        tmp = n * (100.0d0 + (i * 50.0d0))
    else
        tmp = 100.0d0 * (i / (i / n))
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double tmp;
	if ((n <= -1.4e+55) || !(n <= 6e+45)) {
		tmp = n * (100.0 + (i * 50.0));
	} else {
		tmp = 100.0 * (i / (i / n));
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if (n <= -1.4e+55) or not (n <= 6e+45):
		tmp = n * (100.0 + (i * 50.0))
	else:
		tmp = 100.0 * (i / (i / n))
	return tmp
function code(i, n)
	tmp = 0.0
	if ((n <= -1.4e+55) || !(n <= 6e+45))
		tmp = Float64(n * Float64(100.0 + Float64(i * 50.0)));
	else
		tmp = Float64(100.0 * Float64(i / Float64(i / n)));
	end
	return tmp
end
function tmp_2 = code(i, n)
	tmp = 0.0;
	if ((n <= -1.4e+55) || ~((n <= 6e+45)))
		tmp = n * (100.0 + (i * 50.0));
	else
		tmp = 100.0 * (i / (i / n));
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[Or[LessEqual[n, -1.4e+55], N[Not[LessEqual[n, 6e+45]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.4 \cdot 10^{+55} \lor \neg \left(n \leq 6 \cdot 10^{+45}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -1.4e55 or 6.00000000000000021e45 < n

    1. Initial program 21.6%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/22.2%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*22.2%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative22.2%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/22.2%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg22.2%

        \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
      6. distribute-lft-in22.2%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. fma-def22.2%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \left(-1\right)\right)}}{i} \]
      8. metadata-eval22.2%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \color{blue}{-1}\right)}{i} \]
      9. metadata-eval22.2%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified22.2%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Taylor expanded in i around 0 66.5%

      \[\leadsto n \cdot \color{blue}{\left(100 + 100 \cdot \left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-*r*66.5%

        \[\leadsto n \cdot \left(100 + \color{blue}{\left(100 \cdot i\right) \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)}\right) \]
      2. *-commutative66.5%

        \[\leadsto n \cdot \left(100 + \color{blue}{\left(i \cdot 100\right)} \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right) \]
      3. associate-*r/66.5%

        \[\leadsto n \cdot \left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)\right) \]
      4. metadata-eval66.5%

        \[\leadsto n \cdot \left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \frac{\color{blue}{0.5}}{n}\right)\right) \]
    6. Simplified66.5%

      \[\leadsto n \cdot \color{blue}{\left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)} \]
    7. Taylor expanded in n around inf 66.5%

      \[\leadsto n \cdot \left(100 + \color{blue}{50 \cdot i}\right) \]
    8. Step-by-step derivation
      1. *-commutative66.5%

        \[\leadsto n \cdot \left(100 + \color{blue}{i \cdot 50}\right) \]
    9. Simplified66.5%

      \[\leadsto n \cdot \left(100 + \color{blue}{i \cdot 50}\right) \]

    if -1.4e55 < n < 6.00000000000000021e45

    1. Initial program 34.5%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in i around 0 61.2%

      \[\leadsto 100 \cdot \frac{\color{blue}{i}}{\frac{i}{n}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification64.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1.4 \cdot 10^{+55} \lor \neg \left(n \leq 6 \cdot 10^{+45}\right):\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \end{array} \]

Alternative 15: 63.9% accurate, 10.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -3.7 \cdot 10^{-268}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{elif}\;n \leq 7.6 \cdot 10^{-136}:\\ \;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= n -3.7e-268)
   (* 100.0 (/ n (+ 1.0 (* i -0.5))))
   (if (<= n 7.6e-136) (* 100.0 (/ 0.0 (/ i n))) (* n (+ 100.0 (* i 50.0))))))
double code(double i, double n) {
	double tmp;
	if (n <= -3.7e-268) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else if (n <= 7.6e-136) {
		tmp = 100.0 * (0.0 / (i / n));
	} else {
		tmp = n * (100.0 + (i * 50.0));
	}
	return tmp;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: tmp
    if (n <= (-3.7d-268)) then
        tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
    else if (n <= 7.6d-136) then
        tmp = 100.0d0 * (0.0d0 / (i / n))
    else
        tmp = n * (100.0d0 + (i * 50.0d0))
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double tmp;
	if (n <= -3.7e-268) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else if (n <= 7.6e-136) {
		tmp = 100.0 * (0.0 / (i / n));
	} else {
		tmp = n * (100.0 + (i * 50.0));
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if n <= -3.7e-268:
		tmp = 100.0 * (n / (1.0 + (i * -0.5)))
	elif n <= 7.6e-136:
		tmp = 100.0 * (0.0 / (i / n))
	else:
		tmp = n * (100.0 + (i * 50.0))
	return tmp
function code(i, n)
	tmp = 0.0
	if (n <= -3.7e-268)
		tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5))));
	elseif (n <= 7.6e-136)
		tmp = Float64(100.0 * Float64(0.0 / Float64(i / n)));
	else
		tmp = Float64(n * Float64(100.0 + Float64(i * 50.0)));
	end
	return tmp
end
function tmp_2 = code(i, n)
	tmp = 0.0;
	if (n <= -3.7e-268)
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	elseif (n <= 7.6e-136)
		tmp = 100.0 * (0.0 / (i / n));
	else
		tmp = n * (100.0 + (i * 50.0));
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[LessEqual[n, -3.7e-268], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7.6e-136], N[(100.0 * N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.7 \cdot 10^{-268}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\

\mathbf{elif}\;n \leq 7.6 \cdot 10^{-136}:\\
\;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\

\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -3.70000000000000018e-268

    1. Initial program 30.1%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 33.5%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative33.5%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*33.5%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def81.3%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified81.3%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 63.0%

      \[\leadsto \frac{n}{\color{blue}{1 + -0.5 \cdot i}} \cdot 100 \]
    6. Step-by-step derivation
      1. *-commutative63.0%

        \[\leadsto \frac{n}{1 + \color{blue}{i \cdot -0.5}} \cdot 100 \]
    7. Simplified63.0%

      \[\leadsto \frac{n}{\color{blue}{1 + i \cdot -0.5}} \cdot 100 \]

    if -3.70000000000000018e-268 < n < 7.6000000000000005e-136

    1. Initial program 41.1%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in i around 0 73.5%

      \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]

    if 7.6000000000000005e-136 < n

    1. Initial program 19.0%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/19.3%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*19.3%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative19.3%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/19.3%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg19.3%

        \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
      6. distribute-lft-in19.3%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. fma-def19.3%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \left(-1\right)\right)}}{i} \]
      8. metadata-eval19.3%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \color{blue}{-1}\right)}{i} \]
      9. metadata-eval19.3%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified19.3%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Taylor expanded in i around 0 71.0%

      \[\leadsto n \cdot \color{blue}{\left(100 + 100 \cdot \left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)\right)} \]
    5. Step-by-step derivation
      1. associate-*r*71.0%

        \[\leadsto n \cdot \left(100 + \color{blue}{\left(100 \cdot i\right) \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)}\right) \]
      2. *-commutative71.0%

        \[\leadsto n \cdot \left(100 + \color{blue}{\left(i \cdot 100\right)} \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right) \]
      3. associate-*r/71.0%

        \[\leadsto n \cdot \left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)\right) \]
      4. metadata-eval71.0%

        \[\leadsto n \cdot \left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \frac{\color{blue}{0.5}}{n}\right)\right) \]
    6. Simplified71.0%

      \[\leadsto n \cdot \color{blue}{\left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)} \]
    7. Taylor expanded in n around inf 71.1%

      \[\leadsto n \cdot \left(100 + \color{blue}{50 \cdot i}\right) \]
    8. Step-by-step derivation
      1. *-commutative71.1%

        \[\leadsto n \cdot \left(100 + \color{blue}{i \cdot 50}\right) \]
    9. Simplified71.1%

      \[\leadsto n \cdot \left(100 + \color{blue}{i \cdot 50}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification67.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -3.7 \cdot 10^{-268}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{elif}\;n \leq 7.6 \cdot 10^{-136}:\\ \;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \]

Alternative 16: 58.8% accurate, 12.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -2 \lor \neg \left(i \leq 1.3 \cdot 10^{+58}\right):\\ \;\;\;\;\frac{n}{i} \cdot -200\\ \mathbf{else}:\\ \;\;\;\;n \cdot 100\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (or (<= i -2.0) (not (<= i 1.3e+58))) (* (/ n i) -200.0) (* n 100.0)))
double code(double i, double n) {
	double tmp;
	if ((i <= -2.0) || !(i <= 1.3e+58)) {
		tmp = (n / i) * -200.0;
	} else {
		tmp = n * 100.0;
	}
	return tmp;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: tmp
    if ((i <= (-2.0d0)) .or. (.not. (i <= 1.3d+58))) then
        tmp = (n / i) * (-200.0d0)
    else
        tmp = n * 100.0d0
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double tmp;
	if ((i <= -2.0) || !(i <= 1.3e+58)) {
		tmp = (n / i) * -200.0;
	} else {
		tmp = n * 100.0;
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if (i <= -2.0) or not (i <= 1.3e+58):
		tmp = (n / i) * -200.0
	else:
		tmp = n * 100.0
	return tmp
function code(i, n)
	tmp = 0.0
	if ((i <= -2.0) || !(i <= 1.3e+58))
		tmp = Float64(Float64(n / i) * -200.0);
	else
		tmp = Float64(n * 100.0);
	end
	return tmp
end
function tmp_2 = code(i, n)
	tmp = 0.0;
	if ((i <= -2.0) || ~((i <= 1.3e+58)))
		tmp = (n / i) * -200.0;
	else
		tmp = n * 100.0;
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[Or[LessEqual[i, -2.0], N[Not[LessEqual[i, 1.3e+58]], $MachinePrecision]], N[(N[(n / i), $MachinePrecision] * -200.0), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq -2 \lor \neg \left(i \leq 1.3 \cdot 10^{+58}\right):\\
\;\;\;\;\frac{n}{i} \cdot -200\\

\mathbf{else}:\\
\;\;\;\;n \cdot 100\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < -2 or 1.29999999999999994e58 < i

    1. Initial program 52.5%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 61.3%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    3. Step-by-step derivation
      1. *-commutative61.3%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*61.3%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def61.3%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified61.3%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \cdot 100} \]
    5. Taylor expanded in i around 0 30.5%

      \[\leadsto \frac{n}{\color{blue}{1 + -0.5 \cdot i}} \cdot 100 \]
    6. Step-by-step derivation
      1. *-commutative30.5%

        \[\leadsto \frac{n}{1 + \color{blue}{i \cdot -0.5}} \cdot 100 \]
    7. Simplified30.5%

      \[\leadsto \frac{n}{\color{blue}{1 + i \cdot -0.5}} \cdot 100 \]
    8. Taylor expanded in i around inf 30.5%

      \[\leadsto \color{blue}{-200 \cdot \frac{n}{i}} \]

    if -2 < i < 1.29999999999999994e58

    1. Initial program 11.4%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in i around 0 78.3%

      \[\leadsto \color{blue}{100 \cdot n} \]
    3. Step-by-step derivation
      1. *-commutative78.3%

        \[\leadsto \color{blue}{n \cdot 100} \]
    4. Simplified78.3%

      \[\leadsto \color{blue}{n \cdot 100} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification59.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -2 \lor \neg \left(i \leq 1.3 \cdot 10^{+58}\right):\\ \;\;\;\;\frac{n}{i} \cdot -200\\ \mathbf{else}:\\ \;\;\;\;n \cdot 100\\ \end{array} \]

Alternative 17: 2.8% accurate, 38.0× speedup?

\[\begin{array}{l} \\ i \cdot -50 \end{array} \]
(FPCore (i n) :precision binary64 (* i -50.0))
double code(double i, double n) {
	return i * -50.0;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    code = i * (-50.0d0)
end function
public static double code(double i, double n) {
	return i * -50.0;
}
def code(i, n):
	return i * -50.0
function code(i, n)
	return Float64(i * -50.0)
end
function tmp = code(i, n)
	tmp = i * -50.0;
end
code[i_, n_] := N[(i * -50.0), $MachinePrecision]
\begin{array}{l}

\\
i \cdot -50
\end{array}
Derivation
  1. Initial program 27.6%

    \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
  2. Step-by-step derivation
    1. associate-/r/28.0%

      \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
    2. associate-*r*28.0%

      \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
    3. *-commutative28.0%

      \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
    4. associate-*r/28.0%

      \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
    5. sub-neg28.0%

      \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
    6. distribute-lft-in28.0%

      \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
    7. fma-def28.0%

      \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \left(-1\right)\right)}}{i} \]
    8. metadata-eval28.0%

      \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \color{blue}{-1}\right)}{i} \]
    9. metadata-eval28.0%

      \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
  3. Simplified28.0%

    \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
  4. Taylor expanded in i around 0 54.9%

    \[\leadsto n \cdot \color{blue}{\left(100 + 100 \cdot \left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)\right)} \]
  5. Step-by-step derivation
    1. associate-*r*54.9%

      \[\leadsto n \cdot \left(100 + \color{blue}{\left(100 \cdot i\right) \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)}\right) \]
    2. *-commutative54.9%

      \[\leadsto n \cdot \left(100 + \color{blue}{\left(i \cdot 100\right)} \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right) \]
    3. associate-*r/54.9%

      \[\leadsto n \cdot \left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)\right) \]
    4. metadata-eval54.9%

      \[\leadsto n \cdot \left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \frac{\color{blue}{0.5}}{n}\right)\right) \]
  6. Simplified54.9%

    \[\leadsto n \cdot \color{blue}{\left(100 + \left(i \cdot 100\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)} \]
  7. Taylor expanded in n around 0 2.7%

    \[\leadsto \color{blue}{-50 \cdot i} \]
  8. Step-by-step derivation
    1. *-commutative2.7%

      \[\leadsto \color{blue}{i \cdot -50} \]
  9. Simplified2.7%

    \[\leadsto \color{blue}{i \cdot -50} \]
  10. Final simplification2.7%

    \[\leadsto i \cdot -50 \]

Alternative 18: 50.0% accurate, 38.0× speedup?

\[\begin{array}{l} \\ n \cdot 100 \end{array} \]
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
	return n * 100.0;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    code = n * 100.0d0
end function
public static double code(double i, double n) {
	return n * 100.0;
}
def code(i, n):
	return n * 100.0
function code(i, n)
	return Float64(n * 100.0)
end
function tmp = code(i, n)
	tmp = n * 100.0;
end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}

\\
n \cdot 100
\end{array}
Derivation
  1. Initial program 27.6%

    \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
  2. Taylor expanded in i around 0 49.4%

    \[\leadsto \color{blue}{100 \cdot n} \]
  3. Step-by-step derivation
    1. *-commutative49.4%

      \[\leadsto \color{blue}{n \cdot 100} \]
  4. Simplified49.4%

    \[\leadsto \color{blue}{n \cdot 100} \]
  5. Final simplification49.4%

    \[\leadsto n \cdot 100 \]

Developer target: 33.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + \frac{i}{n}\\ 100 \cdot \frac{e^{n \cdot \begin{array}{l} \mathbf{if}\;t_0 = 1:\\ \;\;\;\;\frac{i}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{i}{n} \cdot \log t_0}{\left(\frac{i}{n} + 1\right) - 1}\\ \end{array}} - 1}{\frac{i}{n}} \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (+ 1.0 (/ i n))))
   (*
    100.0
    (/
     (-
      (exp
       (*
        n
        (if (== t_0 1.0)
          (/ i n)
          (/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
      1.0)
     (/ i n)))))
double code(double i, double n) {
	double t_0 = 1.0 + (i / n);
	double tmp;
	if (t_0 == 1.0) {
		tmp = i / n;
	} else {
		tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
	}
	return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 + (i / n)
    if (t_0 == 1.0d0) then
        tmp = i / n
    else
        tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
    end if
    code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
	double t_0 = 1.0 + (i / n);
	double tmp;
	if (t_0 == 1.0) {
		tmp = i / n;
	} else {
		tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
	}
	return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n):
	t_0 = 1.0 + (i / n)
	tmp = 0
	if t_0 == 1.0:
		tmp = i / n
	else:
		tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0)
	return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n)
	t_0 = Float64(1.0 + Float64(i / n))
	tmp = 0.0
	if (t_0 == 1.0)
		tmp = Float64(i / n);
	else
		tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0));
	end
	return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n)))
end
function tmp_2 = code(i, n)
	t_0 = 1.0 + (i / n);
	tmp = 0.0;
	if (t_0 == 1.0)
		tmp = i / n;
	else
		tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
	end
	tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t_0 = 1:\\
\;\;\;\;\frac{i}{n}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{n} \cdot \log t_0}{\left(\frac{i}{n} + 1\right) - 1}\\


\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023194 
(FPCore (i n)
  :name "Compound Interest"
  :precision binary64

  :herbie-target
  (* 100.0 (/ (- (exp (* n (if (== (+ 1.0 (/ i n)) 1.0) (/ i n) (/ (* (/ i n) (log (+ 1.0 (/ i n)))) (- (+ (/ i n) 1.0) 1.0))))) 1.0) (/ i n)))

  (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))