Compound Interest

Percentage Accurate: 28.7% → 96.9%
Time: 19.5s
Alternatives: 16
Speedup: 16.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 16 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.7% 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: 96.9% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;\frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}}\\

\mathbf{elif}\;t_0 \leq \infty:\\
\;\;\;\;t_0 \cdot 100\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\


\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)) < 0.0

    1. Initial program 26.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.6%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\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.9%

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

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

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

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

      \[\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 + -0.5 \cdot i}} \cdot 100 \]
    6. Step-by-step derivation
      1. *-commutative100.0%

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

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

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

Alternative 2: 96.8% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n \cdot 100}}\\

\mathbf{elif}\;t_0 \leq \infty:\\
\;\;\;\;t_0 \cdot 100\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\


\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)) < 0.0

    1. Initial program 26.9%

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.6%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\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.9%

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

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

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

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

      \[\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 + -0.5 \cdot i}} \cdot 100 \]
    6. Step-by-step derivation
      1. *-commutative100.0%

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

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

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

Alternative 3: 96.7% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{\frac{i}{100}}{n}}\\

\mathbf{elif}\;t_0 \leq \infty:\\
\;\;\;\;t_0 \cdot 100\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\


\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)) < 0.0

    1. Initial program 26.9%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{\color{blue}{1 \cdot i}}{n \cdot 100}} \]
      2. times-frac96.5%

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

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

        \[\leadsto \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\color{blue}{\frac{1 \cdot \frac{i}{100}}{n}}} \]
      2. *-lft-identity96.6%

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

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

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

    1. Initial program 99.6%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\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.9%

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

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

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

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

      \[\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 + -0.5 \cdot i}} \cdot 100 \]
    6. Step-by-step derivation
      1. *-commutative100.0%

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

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

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

Alternative 4: 80.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \mathbf{if}\;n \leq -4.3 \cdot 10^{-120}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;n \leq 5.1 \cdot 10^{-144}:\\ \;\;\;\;\frac{1}{\frac{n \cdot \left(i \cdot -0.005\right) + n \cdot 0.01}{n \cdot n}}\\ \mathbf{elif}\;n \leq 1.25 \cdot 10^{-98}:\\ \;\;\;\;100 \cdot \frac{n \cdot n}{\frac{i}{\log \left(\frac{i}{n}\right)}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (* 100.0 (/ n (/ i (expm1 i))))))
   (if (<= n -4.3e-120)
     t_0
     (if (<= n 5.1e-144)
       (/ 1.0 (/ (+ (* n (* i -0.005)) (* n 0.01)) (* n n)))
       (if (<= n 1.25e-98) (* 100.0 (/ (* n n) (/ i (log (/ i n))))) t_0)))))
double code(double i, double n) {
	double t_0 = 100.0 * (n / (i / expm1(i)));
	double tmp;
	if (n <= -4.3e-120) {
		tmp = t_0;
	} else if (n <= 5.1e-144) {
		tmp = 1.0 / (((n * (i * -0.005)) + (n * 0.01)) / (n * n));
	} else if (n <= 1.25e-98) {
		tmp = 100.0 * ((n * n) / (i / log((i / n))));
	} else {
		tmp = t_0;
	}
	return tmp;
}
public static double code(double i, double n) {
	double t_0 = 100.0 * (n / (i / Math.expm1(i)));
	double tmp;
	if (n <= -4.3e-120) {
		tmp = t_0;
	} else if (n <= 5.1e-144) {
		tmp = 1.0 / (((n * (i * -0.005)) + (n * 0.01)) / (n * n));
	} else if (n <= 1.25e-98) {
		tmp = 100.0 * ((n * n) / (i / Math.log((i / n))));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(i, n):
	t_0 = 100.0 * (n / (i / math.expm1(i)))
	tmp = 0
	if n <= -4.3e-120:
		tmp = t_0
	elif n <= 5.1e-144:
		tmp = 1.0 / (((n * (i * -0.005)) + (n * 0.01)) / (n * n))
	elif n <= 1.25e-98:
		tmp = 100.0 * ((n * n) / (i / math.log((i / n))))
	else:
		tmp = t_0
	return tmp
function code(i, n)
	t_0 = Float64(100.0 * Float64(n / Float64(i / expm1(i))))
	tmp = 0.0
	if (n <= -4.3e-120)
		tmp = t_0;
	elseif (n <= 5.1e-144)
		tmp = Float64(1.0 / Float64(Float64(Float64(n * Float64(i * -0.005)) + Float64(n * 0.01)) / Float64(n * n)));
	elseif (n <= 1.25e-98)
		tmp = Float64(100.0 * Float64(Float64(n * n) / Float64(i / log(Float64(i / n)))));
	else
		tmp = t_0;
	end
	return tmp
end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -4.3e-120], t$95$0, If[LessEqual[n, 5.1e-144], N[(1.0 / N[(N[(N[(n * N[(i * -0.005), $MachinePrecision]), $MachinePrecision] + N[(n * 0.01), $MachinePrecision]), $MachinePrecision] / N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.25e-98], N[(100.0 * N[(N[(n * n), $MachinePrecision] / N[(i / N[Log[N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

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

\mathbf{elif}\;n \leq 5.1 \cdot 10^{-144}:\\
\;\;\;\;\frac{1}{\frac{n \cdot \left(i \cdot -0.005\right) + n \cdot 0.01}{n \cdot n}}\\

\mathbf{elif}\;n \leq 1.25 \cdot 10^{-98}:\\
\;\;\;\;100 \cdot \frac{n \cdot n}{\frac{i}{\log \left(\frac{i}{n}\right)}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -4.29999999999999982e-120 or 1.25000000000000005e-98 < n

    1. Initial program 20.5%

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

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

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

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

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

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

    if -4.29999999999999982e-120 < n < 5.1e-144

    1. Initial program 55.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(i\right)}}} \]
      2. clear-num46.8%

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

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

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

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

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

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

        \[\leadsto \frac{1}{\frac{i}{\color{blue}{\left(100 \cdot \mathsf{expm1}\left(i\right)\right) \cdot n}}} \]
      6. *-commutative31.5%

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

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

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

      \[\leadsto \frac{1}{\color{blue}{-0.005 \cdot \frac{i}{n} + 0.01 \cdot \frac{1}{n}}} \]
    10. Step-by-step derivation
      1. associate-*r/54.9%

        \[\leadsto \frac{1}{\color{blue}{\frac{-0.005 \cdot i}{n}} + 0.01 \cdot \frac{1}{n}} \]
      2. un-div-inv55.0%

        \[\leadsto \frac{1}{\frac{-0.005 \cdot i}{n} + \color{blue}{\frac{0.01}{n}}} \]
      3. frac-add66.1%

        \[\leadsto \frac{1}{\color{blue}{\frac{\left(-0.005 \cdot i\right) \cdot n + n \cdot 0.01}{n \cdot n}}} \]
      4. *-commutative66.1%

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(i \cdot -0.005\right)} \cdot n + n \cdot 0.01}{n \cdot n}} \]
    11. Applied egg-rr66.1%

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

    if 5.1e-144 < n < 1.25000000000000005e-98

    1. Initial program 46.4%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{100 \cdot \frac{{n}^{2} \cdot \left(\log i + -1 \cdot \log n\right)}{i}} \]
    5. Step-by-step derivation
      1. associate-/l*99.6%

        \[\leadsto 100 \cdot \color{blue}{\frac{{n}^{2}}{\frac{i}{\log i + -1 \cdot \log n}}} \]
      2. unpow299.6%

        \[\leadsto 100 \cdot \frac{\color{blue}{n \cdot n}}{\frac{i}{\log i + -1 \cdot \log n}} \]
      3. mul-1-neg99.6%

        \[\leadsto 100 \cdot \frac{n \cdot n}{\frac{i}{\log i + \color{blue}{\left(-\log n\right)}}} \]
      4. unsub-neg99.6%

        \[\leadsto 100 \cdot \frac{n \cdot n}{\frac{i}{\color{blue}{\log i - \log n}}} \]
      5. log-div99.8%

        \[\leadsto 100 \cdot \frac{n \cdot n}{\frac{i}{\color{blue}{\log \left(\frac{i}{n}\right)}}} \]
    6. Simplified99.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4.3 \cdot 10^{-120}:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \mathbf{elif}\;n \leq 5.1 \cdot 10^{-144}:\\ \;\;\;\;\frac{1}{\frac{n \cdot \left(i \cdot -0.005\right) + n \cdot 0.01}{n \cdot n}}\\ \mathbf{elif}\;n \leq 1.25 \cdot 10^{-98}:\\ \;\;\;\;100 \cdot \frac{n \cdot n}{\frac{i}{\log \left(\frac{i}{n}\right)}}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \end{array} \]

Alternative 5: 74.9% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;i \leq -4.2 \cdot 10^{-13} \lor \neg \left(i \leq 20000000000000\right):\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < -4.19999999999999977e-13 or 2e13 < i

    1. Initial program 53.1%

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

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

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

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

    if -4.19999999999999977e-13 < i < 2e13

    1. Initial program 9.4%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -4.2 \cdot 10^{-13} \lor \neg \left(i \leq 20000000000000\right):\\ \;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \end{array} \]

Alternative 6: 79.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.85 \cdot 10^{-132} \lor \neg \left(n \leq 2.2 \cdot 10^{-82}\right):\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -1.8500000000000001e-132 or 2.19999999999999986e-82 < n

    1. Initial program 20.6%

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

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

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

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

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

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

    if -1.8500000000000001e-132 < n < 2.19999999999999986e-82

    1. Initial program 53.6%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification84.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1.85 \cdot 10^{-132} \lor \neg \left(n \leq 2.2 \cdot 10^{-82}\right):\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 7: 63.9% accurate, 6.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -8.2 \cdot 10^{-94} \lor \neg \left(n \leq 2.05 \cdot 10^{-81}\right):\\
\;\;\;\;100 \cdot \left(n + n \cdot \left(i \cdot 0.5 + 0.16666666666666666 \cdot \left(i \cdot i\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -8.20000000000000001e-94 or 2.04999999999999992e-81 < n

    1. Initial program 20.0%

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

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

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

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

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

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

        \[\leadsto 100 \cdot \left(n + \left(\color{blue}{\left(0.5 \cdot i\right) \cdot n} + 0.16666666666666666 \cdot \left({i}^{2} \cdot n\right)\right)\right) \]
      3. associate-*r*69.9%

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

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

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

        \[\leadsto 100 \cdot \left(n + n \cdot \left(i \cdot 0.5 + 0.16666666666666666 \cdot \color{blue}{\left(i \cdot i\right)}\right)\right) \]
    7. Simplified70.2%

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

    if -8.20000000000000001e-94 < n < 2.04999999999999992e-81

    1. Initial program 52.8%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification67.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -8.2 \cdot 10^{-94} \lor \neg \left(n \leq 2.05 \cdot 10^{-81}\right):\\ \;\;\;\;100 \cdot \left(n + n \cdot \left(i \cdot 0.5 + 0.16666666666666666 \cdot \left(i \cdot i\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 8: 67.1% accurate, 6.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -9 \cdot 10^{+132} \lor \neg \left(n \leq 1.5 \cdot 10^{-170}\right):\\
\;\;\;\;100 \cdot \left(n + n \cdot \left(i \cdot 0.5 + 0.16666666666666666 \cdot \left(i \cdot i\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{n \cdot \left(i \cdot -0.005\right) + n \cdot 0.01}{n \cdot n}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -8.99999999999999944e132 or 1.50000000000000007e-170 < n

    1. Initial program 19.5%

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

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

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

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

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

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

        \[\leadsto 100 \cdot \left(n + \left(\color{blue}{\left(0.5 \cdot i\right) \cdot n} + 0.16666666666666666 \cdot \left({i}^{2} \cdot n\right)\right)\right) \]
      3. associate-*r*69.3%

        \[\leadsto 100 \cdot \left(n + \left(\left(0.5 \cdot i\right) \cdot n + \color{blue}{\left(0.16666666666666666 \cdot {i}^{2}\right) \cdot n}\right)\right) \]
      4. distribute-rgt-out69.6%

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

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

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

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

    if -8.99999999999999944e132 < n < 1.50000000000000007e-170

    1. Initial program 40.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{-0.005 \cdot \frac{i}{n} + 0.01 \cdot \frac{1}{n}}} \]
    10. Step-by-step derivation
      1. associate-*r/60.2%

        \[\leadsto \frac{1}{\color{blue}{\frac{-0.005 \cdot i}{n}} + 0.01 \cdot \frac{1}{n}} \]
      2. un-div-inv60.3%

        \[\leadsto \frac{1}{\frac{-0.005 \cdot i}{n} + \color{blue}{\frac{0.01}{n}}} \]
      3. frac-add66.6%

        \[\leadsto \frac{1}{\color{blue}{\frac{\left(-0.005 \cdot i\right) \cdot n + n \cdot 0.01}{n \cdot n}}} \]
      4. *-commutative66.6%

        \[\leadsto \frac{1}{\frac{\color{blue}{\left(i \cdot -0.005\right)} \cdot n + n \cdot 0.01}{n \cdot n}} \]
    11. Applied egg-rr66.6%

      \[\leadsto \frac{1}{\color{blue}{\frac{\left(i \cdot -0.005\right) \cdot n + n \cdot 0.01}{n \cdot n}}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification68.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -9 \cdot 10^{+132} \lor \neg \left(n \leq 1.5 \cdot 10^{-170}\right):\\ \;\;\;\;100 \cdot \left(n + n \cdot \left(i \cdot 0.5 + 0.16666666666666666 \cdot \left(i \cdot i\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1}{\frac{n \cdot \left(i \cdot -0.005\right) + n \cdot 0.01}{n \cdot n}}\\ \end{array} \]

Alternative 9: 62.4% accurate, 10.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -2:\\ \;\;\;\;\frac{-200}{\frac{i}{n}}\\ \mathbf{elif}\;i \leq 1.7 \cdot 10^{-21}:\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= i -2.0)
   (/ -200.0 (/ i n))
   (if (<= i 1.7e-21) (* n 100.0) (* 16.666666666666668 (* n (* i i))))))
double code(double i, double n) {
	double tmp;
	if (i <= -2.0) {
		tmp = -200.0 / (i / n);
	} else if (i <= 1.7e-21) {
		tmp = n * 100.0;
	} else {
		tmp = 16.666666666666668 * (n * (i * i));
	}
	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)) then
        tmp = (-200.0d0) / (i / n)
    else if (i <= 1.7d-21) then
        tmp = n * 100.0d0
    else
        tmp = 16.666666666666668d0 * (n * (i * i))
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double tmp;
	if (i <= -2.0) {
		tmp = -200.0 / (i / n);
	} else if (i <= 1.7e-21) {
		tmp = n * 100.0;
	} else {
		tmp = 16.666666666666668 * (n * (i * i));
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if i <= -2.0:
		tmp = -200.0 / (i / n)
	elif i <= 1.7e-21:
		tmp = n * 100.0
	else:
		tmp = 16.666666666666668 * (n * (i * i))
	return tmp
function code(i, n)
	tmp = 0.0
	if (i <= -2.0)
		tmp = Float64(-200.0 / Float64(i / n));
	elseif (i <= 1.7e-21)
		tmp = Float64(n * 100.0);
	else
		tmp = Float64(16.666666666666668 * Float64(n * Float64(i * i)));
	end
	return tmp
end
function tmp_2 = code(i, n)
	tmp = 0.0;
	if (i <= -2.0)
		tmp = -200.0 / (i / n);
	elseif (i <= 1.7e-21)
		tmp = n * 100.0;
	else
		tmp = 16.666666666666668 * (n * (i * i));
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[LessEqual[i, -2.0], N[(-200.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.7e-21], N[(n * 100.0), $MachinePrecision], N[(16.666666666666668 * N[(n * N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

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

\mathbf{elif}\;i \leq 1.7 \cdot 10^{-21}:\\
\;\;\;\;n \cdot 100\\

\mathbf{else}:\\
\;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\


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

    1. Initial program 59.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-200 \cdot \frac{n}{i}} \]
    9. Step-by-step derivation
      1. clear-num34.0%

        \[\leadsto -200 \cdot \color{blue}{\frac{1}{\frac{i}{n}}} \]
      2. un-div-inv34.0%

        \[\leadsto \color{blue}{\frac{-200}{\frac{i}{n}}} \]
    10. Applied egg-rr34.0%

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

    if -2 < i < 1.7e-21

    1. Initial program 7.5%

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

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

        \[\leadsto \color{blue}{n \cdot 100} \]
    4. Simplified87.9%

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

    if 1.7e-21 < i

    1. Initial program 49.1%

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

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

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

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

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

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

        \[\leadsto 100 \cdot \left(n + \left(\color{blue}{\left(0.5 \cdot i\right) \cdot n} + 0.16666666666666666 \cdot \left({i}^{2} \cdot n\right)\right)\right) \]
      3. associate-*r*39.0%

        \[\leadsto 100 \cdot \left(n + \left(\left(0.5 \cdot i\right) \cdot n + \color{blue}{\left(0.16666666666666666 \cdot {i}^{2}\right) \cdot n}\right)\right) \]
      4. distribute-rgt-out39.0%

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

        \[\leadsto 100 \cdot \left(n + n \cdot \left(\color{blue}{i \cdot 0.5} + 0.16666666666666666 \cdot {i}^{2}\right)\right) \]
      6. unpow239.0%

        \[\leadsto 100 \cdot \left(n + n \cdot \left(i \cdot 0.5 + 0.16666666666666666 \cdot \color{blue}{\left(i \cdot i\right)}\right)\right) \]
    7. Simplified39.0%

      \[\leadsto 100 \cdot \color{blue}{\left(n + n \cdot \left(i \cdot 0.5 + 0.16666666666666666 \cdot \left(i \cdot i\right)\right)\right)} \]
    8. Taylor expanded in i around inf 39.1%

      \[\leadsto \color{blue}{16.666666666666668 \cdot \left({i}^{2} \cdot n\right)} \]
    9. Step-by-step derivation
      1. unpow239.1%

        \[\leadsto 16.666666666666668 \cdot \left(\color{blue}{\left(i \cdot i\right)} \cdot n\right) \]
      2. *-commutative39.1%

        \[\leadsto 16.666666666666668 \cdot \color{blue}{\left(n \cdot \left(i \cdot i\right)\right)} \]
    10. Simplified39.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -2:\\ \;\;\;\;\frac{-200}{\frac{i}{n}}\\ \mathbf{elif}\;i \leq 1.7 \cdot 10^{-21}:\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\ \end{array} \]

Alternative 10: 62.4% accurate, 10.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < 1.7e-21

    1. Initial program 22.0%

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

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

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

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

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

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

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

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

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

    if 1.7e-21 < i

    1. Initial program 49.1%

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

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

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

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

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

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

        \[\leadsto 100 \cdot \left(n + \left(\color{blue}{\left(0.5 \cdot i\right) \cdot n} + 0.16666666666666666 \cdot \left({i}^{2} \cdot n\right)\right)\right) \]
      3. associate-*r*39.0%

        \[\leadsto 100 \cdot \left(n + \left(\left(0.5 \cdot i\right) \cdot n + \color{blue}{\left(0.16666666666666666 \cdot {i}^{2}\right) \cdot n}\right)\right) \]
      4. distribute-rgt-out39.0%

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

        \[\leadsto 100 \cdot \left(n + n \cdot \left(\color{blue}{i \cdot 0.5} + 0.16666666666666666 \cdot {i}^{2}\right)\right) \]
      6. unpow239.0%

        \[\leadsto 100 \cdot \left(n + n \cdot \left(i \cdot 0.5 + 0.16666666666666666 \cdot \color{blue}{\left(i \cdot i\right)}\right)\right) \]
    7. Simplified39.0%

      \[\leadsto 100 \cdot \color{blue}{\left(n + n \cdot \left(i \cdot 0.5 + 0.16666666666666666 \cdot \left(i \cdot i\right)\right)\right)} \]
    8. Taylor expanded in i around inf 39.1%

      \[\leadsto \color{blue}{16.666666666666668 \cdot \left({i}^{2} \cdot n\right)} \]
    9. Step-by-step derivation
      1. unpow239.1%

        \[\leadsto 16.666666666666668 \cdot \left(\color{blue}{\left(i \cdot i\right)} \cdot n\right) \]
      2. *-commutative39.1%

        \[\leadsto 16.666666666666668 \cdot \color{blue}{\left(n \cdot \left(i \cdot i\right)\right)} \]
    10. Simplified39.1%

      \[\leadsto \color{blue}{16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq 1.7 \cdot 10^{-21}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{else}:\\ \;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\ \end{array} \]

Alternative 11: 62.4% accurate, 10.3× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < 1.7e-21

    1. Initial program 22.0%

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

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

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

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

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

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

        \[\leadsto \color{blue}{100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}} \]
      2. clear-num85.9%

        \[\leadsto 100 \cdot \color{blue}{\frac{1}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{n}}} \]
      3. un-div-inv85.8%

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

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

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

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

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

    if 1.7e-21 < i

    1. Initial program 49.1%

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

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

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

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

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

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

        \[\leadsto 100 \cdot \left(n + \left(\color{blue}{\left(0.5 \cdot i\right) \cdot n} + 0.16666666666666666 \cdot \left({i}^{2} \cdot n\right)\right)\right) \]
      3. associate-*r*39.0%

        \[\leadsto 100 \cdot \left(n + \left(\left(0.5 \cdot i\right) \cdot n + \color{blue}{\left(0.16666666666666666 \cdot {i}^{2}\right) \cdot n}\right)\right) \]
      4. distribute-rgt-out39.0%

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

        \[\leadsto 100 \cdot \left(n + n \cdot \left(\color{blue}{i \cdot 0.5} + 0.16666666666666666 \cdot {i}^{2}\right)\right) \]
      6. unpow239.0%

        \[\leadsto 100 \cdot \left(n + n \cdot \left(i \cdot 0.5 + 0.16666666666666666 \cdot \color{blue}{\left(i \cdot i\right)}\right)\right) \]
    7. Simplified39.0%

      \[\leadsto 100 \cdot \color{blue}{\left(n + n \cdot \left(i \cdot 0.5 + 0.16666666666666666 \cdot \left(i \cdot i\right)\right)\right)} \]
    8. Taylor expanded in i around inf 39.1%

      \[\leadsto \color{blue}{16.666666666666668 \cdot \left({i}^{2} \cdot n\right)} \]
    9. Step-by-step derivation
      1. unpow239.1%

        \[\leadsto 16.666666666666668 \cdot \left(\color{blue}{\left(i \cdot i\right)} \cdot n\right) \]
      2. *-commutative39.1%

        \[\leadsto 16.666666666666668 \cdot \color{blue}{\left(n \cdot \left(i \cdot i\right)\right)} \]
    10. Simplified39.1%

      \[\leadsto \color{blue}{16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq 1.7 \cdot 10^{-21}:\\ \;\;\;\;\frac{100}{\frac{1 + i \cdot -0.5}{n}}\\ \mathbf{else}:\\ \;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\ \end{array} \]

Alternative 12: 62.3% accurate, 12.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 1.7 \cdot 10^{-21}:\\ \;\;\;\;\frac{n}{i \cdot -0.005 + 0.01}\\ \mathbf{else}:\\ \;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= i 1.7e-21)
   (/ n (+ (* i -0.005) 0.01))
   (* 16.666666666666668 (* n (* i i)))))
double code(double i, double n) {
	double tmp;
	if (i <= 1.7e-21) {
		tmp = n / ((i * -0.005) + 0.01);
	} else {
		tmp = 16.666666666666668 * (n * (i * i));
	}
	return tmp;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: tmp
    if (i <= 1.7d-21) then
        tmp = n / ((i * (-0.005d0)) + 0.01d0)
    else
        tmp = 16.666666666666668d0 * (n * (i * i))
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double tmp;
	if (i <= 1.7e-21) {
		tmp = n / ((i * -0.005) + 0.01);
	} else {
		tmp = 16.666666666666668 * (n * (i * i));
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if i <= 1.7e-21:
		tmp = n / ((i * -0.005) + 0.01)
	else:
		tmp = 16.666666666666668 * (n * (i * i))
	return tmp
function code(i, n)
	tmp = 0.0
	if (i <= 1.7e-21)
		tmp = Float64(n / Float64(Float64(i * -0.005) + 0.01));
	else
		tmp = Float64(16.666666666666668 * Float64(n * Float64(i * i)));
	end
	return tmp
end
function tmp_2 = code(i, n)
	tmp = 0.0;
	if (i <= 1.7e-21)
		tmp = n / ((i * -0.005) + 0.01);
	else
		tmp = 16.666666666666668 * (n * (i * i));
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[LessEqual[i, 1.7e-21], N[(n / N[(N[(i * -0.005), $MachinePrecision] + 0.01), $MachinePrecision]), $MachinePrecision], N[(16.666666666666668 * N[(n * N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.7 \cdot 10^{-21}:\\
\;\;\;\;\frac{n}{i \cdot -0.005 + 0.01}\\

\mathbf{else}:\\
\;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < 1.7e-21

    1. Initial program 22.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{1}{\color{blue}{-0.005 \cdot \frac{i}{n} + 0.01 \cdot \frac{1}{n}}} \]
    10. Taylor expanded in n around 0 72.6%

      \[\leadsto \color{blue}{\frac{n}{0.01 + -0.005 \cdot i}} \]
    11. Step-by-step derivation
      1. *-commutative72.6%

        \[\leadsto \frac{n}{0.01 + \color{blue}{i \cdot -0.005}} \]
    12. Simplified72.6%

      \[\leadsto \color{blue}{\frac{n}{0.01 + i \cdot -0.005}} \]

    if 1.7e-21 < i

    1. Initial program 49.1%

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

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

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

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

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

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

        \[\leadsto 100 \cdot \left(n + \left(\color{blue}{\left(0.5 \cdot i\right) \cdot n} + 0.16666666666666666 \cdot \left({i}^{2} \cdot n\right)\right)\right) \]
      3. associate-*r*39.0%

        \[\leadsto 100 \cdot \left(n + \left(\left(0.5 \cdot i\right) \cdot n + \color{blue}{\left(0.16666666666666666 \cdot {i}^{2}\right) \cdot n}\right)\right) \]
      4. distribute-rgt-out39.0%

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

        \[\leadsto 100 \cdot \left(n + n \cdot \left(\color{blue}{i \cdot 0.5} + 0.16666666666666666 \cdot {i}^{2}\right)\right) \]
      6. unpow239.0%

        \[\leadsto 100 \cdot \left(n + n \cdot \left(i \cdot 0.5 + 0.16666666666666666 \cdot \color{blue}{\left(i \cdot i\right)}\right)\right) \]
    7. Simplified39.0%

      \[\leadsto 100 \cdot \color{blue}{\left(n + n \cdot \left(i \cdot 0.5 + 0.16666666666666666 \cdot \left(i \cdot i\right)\right)\right)} \]
    8. Taylor expanded in i around inf 39.1%

      \[\leadsto \color{blue}{16.666666666666668 \cdot \left({i}^{2} \cdot n\right)} \]
    9. Step-by-step derivation
      1. unpow239.1%

        \[\leadsto 16.666666666666668 \cdot \left(\color{blue}{\left(i \cdot i\right)} \cdot n\right) \]
      2. *-commutative39.1%

        \[\leadsto 16.666666666666668 \cdot \color{blue}{\left(n \cdot \left(i \cdot i\right)\right)} \]
    10. Simplified39.1%

      \[\leadsto \color{blue}{16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq 1.7 \cdot 10^{-21}:\\ \;\;\;\;\frac{n}{i \cdot -0.005 + 0.01}\\ \mathbf{else}:\\ \;\;\;\;16.666666666666668 \cdot \left(n \cdot \left(i \cdot i\right)\right)\\ \end{array} \]

Alternative 13: 59.2% accurate, 16.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -350:\\ \;\;\;\;0\\ \mathbf{elif}\;i \leq 1.7 \cdot 10^{-21}:\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= i -350.0) 0.0 (if (<= i 1.7e-21) (* n 100.0) 0.0)))
double code(double i, double n) {
	double tmp;
	if (i <= -350.0) {
		tmp = 0.0;
	} else if (i <= 1.7e-21) {
		tmp = n * 100.0;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: tmp
    if (i <= (-350.0d0)) then
        tmp = 0.0d0
    else if (i <= 1.7d-21) then
        tmp = n * 100.0d0
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double tmp;
	if (i <= -350.0) {
		tmp = 0.0;
	} else if (i <= 1.7e-21) {
		tmp = n * 100.0;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if i <= -350.0:
		tmp = 0.0
	elif i <= 1.7e-21:
		tmp = n * 100.0
	else:
		tmp = 0.0
	return tmp
function code(i, n)
	tmp = 0.0
	if (i <= -350.0)
		tmp = 0.0;
	elseif (i <= 1.7e-21)
		tmp = Float64(n * 100.0);
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(i, n)
	tmp = 0.0;
	if (i <= -350.0)
		tmp = 0.0;
	elseif (i <= 1.7e-21)
		tmp = n * 100.0;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[LessEqual[i, -350.0], 0.0, If[LessEqual[i, 1.7e-21], N[(n * 100.0), $MachinePrecision], 0.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq -350:\\
\;\;\;\;0\\

\mathbf{elif}\;i \leq 1.7 \cdot 10^{-21}:\\
\;\;\;\;n \cdot 100\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < -350 or 1.7e-21 < i

    1. Initial program 54.9%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0} \]

    if -350 < i < 1.7e-21

    1. Initial program 7.4%

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

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

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

      \[\leadsto \color{blue}{n \cdot 100} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -350:\\ \;\;\;\;0\\ \mathbf{elif}\;i \leq 1.7 \cdot 10^{-21}:\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 14: 58.9% accurate, 16.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -2:\\ \;\;\;\;-200 \cdot \frac{n}{i}\\ \mathbf{elif}\;i \leq 1.7 \cdot 10^{-21}:\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= i -2.0) (* -200.0 (/ n i)) (if (<= i 1.7e-21) (* n 100.0) 0.0)))
double code(double i, double n) {
	double tmp;
	if (i <= -2.0) {
		tmp = -200.0 * (n / i);
	} else if (i <= 1.7e-21) {
		tmp = n * 100.0;
	} else {
		tmp = 0.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)) then
        tmp = (-200.0d0) * (n / i)
    else if (i <= 1.7d-21) then
        tmp = n * 100.0d0
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double tmp;
	if (i <= -2.0) {
		tmp = -200.0 * (n / i);
	} else if (i <= 1.7e-21) {
		tmp = n * 100.0;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if i <= -2.0:
		tmp = -200.0 * (n / i)
	elif i <= 1.7e-21:
		tmp = n * 100.0
	else:
		tmp = 0.0
	return tmp
function code(i, n)
	tmp = 0.0
	if (i <= -2.0)
		tmp = Float64(-200.0 * Float64(n / i));
	elseif (i <= 1.7e-21)
		tmp = Float64(n * 100.0);
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(i, n)
	tmp = 0.0;
	if (i <= -2.0)
		tmp = -200.0 * (n / i);
	elseif (i <= 1.7e-21)
		tmp = n * 100.0;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[LessEqual[i, -2.0], N[(-200.0 * N[(n / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.7e-21], N[(n * 100.0), $MachinePrecision], 0.0]]
\begin{array}{l}

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

\mathbf{elif}\;i \leq 1.7 \cdot 10^{-21}:\\
\;\;\;\;n \cdot 100\\

\mathbf{else}:\\
\;\;\;\;0\\


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

    1. Initial program 59.9%

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

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

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

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

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

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

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

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

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

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

    if -2 < i < 1.7e-21

    1. Initial program 7.5%

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

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

        \[\leadsto \color{blue}{n \cdot 100} \]
    4. Simplified87.9%

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

    if 1.7e-21 < i

    1. Initial program 49.1%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification62.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -2:\\ \;\;\;\;-200 \cdot \frac{n}{i}\\ \mathbf{elif}\;i \leq 1.7 \cdot 10^{-21}:\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 15: 59.1% accurate, 16.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -2:\\ \;\;\;\;\frac{-200}{\frac{i}{n}}\\ \mathbf{elif}\;i \leq 1.7 \cdot 10^{-21}:\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= i -2.0) (/ -200.0 (/ i n)) (if (<= i 1.7e-21) (* n 100.0) 0.0)))
double code(double i, double n) {
	double tmp;
	if (i <= -2.0) {
		tmp = -200.0 / (i / n);
	} else if (i <= 1.7e-21) {
		tmp = n * 100.0;
	} else {
		tmp = 0.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)) then
        tmp = (-200.0d0) / (i / n)
    else if (i <= 1.7d-21) then
        tmp = n * 100.0d0
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double tmp;
	if (i <= -2.0) {
		tmp = -200.0 / (i / n);
	} else if (i <= 1.7e-21) {
		tmp = n * 100.0;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if i <= -2.0:
		tmp = -200.0 / (i / n)
	elif i <= 1.7e-21:
		tmp = n * 100.0
	else:
		tmp = 0.0
	return tmp
function code(i, n)
	tmp = 0.0
	if (i <= -2.0)
		tmp = Float64(-200.0 / Float64(i / n));
	elseif (i <= 1.7e-21)
		tmp = Float64(n * 100.0);
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(i, n)
	tmp = 0.0;
	if (i <= -2.0)
		tmp = -200.0 / (i / n);
	elseif (i <= 1.7e-21)
		tmp = n * 100.0;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[LessEqual[i, -2.0], N[(-200.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.7e-21], N[(n * 100.0), $MachinePrecision], 0.0]]
\begin{array}{l}

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

\mathbf{elif}\;i \leq 1.7 \cdot 10^{-21}:\\
\;\;\;\;n \cdot 100\\

\mathbf{else}:\\
\;\;\;\;0\\


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

    1. Initial program 59.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{-200 \cdot \frac{n}{i}} \]
    9. Step-by-step derivation
      1. clear-num34.0%

        \[\leadsto -200 \cdot \color{blue}{\frac{1}{\frac{i}{n}}} \]
      2. un-div-inv34.0%

        \[\leadsto \color{blue}{\frac{-200}{\frac{i}{n}}} \]
    10. Applied egg-rr34.0%

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

    if -2 < i < 1.7e-21

    1. Initial program 7.5%

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

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

        \[\leadsto \color{blue}{n \cdot 100} \]
    4. Simplified87.9%

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

    if 1.7e-21 < i

    1. Initial program 49.1%

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{0} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification62.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -2:\\ \;\;\;\;\frac{-200}{\frac{i}{n}}\\ \mathbf{elif}\;i \leq 1.7 \cdot 10^{-21}:\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 16: 17.8% accurate, 114.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (i n) :precision binary64 0.0)
double code(double i, double n) {
	return 0.0;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    code = 0.0d0
end function
public static double code(double i, double n) {
	return 0.0;
}
def code(i, n):
	return 0.0
function code(i, n)
	return 0.0
end
function tmp = code(i, n)
	tmp = 0.0;
end
code[i_, n_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 28.2%

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{0} \]
  6. Final simplification17.2%

    \[\leadsto 0 \]

Developer target: 34.2% 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 2023283 
(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))))