Compound Interest

Percentage Accurate: 28.8% → 97.6%
Time: 20.5s
Alternatives: 15
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 15 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.8% 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: 97.6% 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 5 \cdot 10^{-289}:\\ \;\;\;\;\frac{1}{\frac{\frac{i}{n}}{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \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 5e-289)
     (/ 1.0 (/ (/ i n) (* (expm1 (* n (log1p (/ 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 <= 5e-289) {
		tmp = 1.0 / ((i / n) / (expm1((n * log1p((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 <= 5e-289) {
		tmp = 1.0 / ((i / n) / (Math.expm1((n * Math.log1p((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 <= 5e-289:
		tmp = 1.0 / ((i / n) / (math.expm1((n * math.log1p((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 <= 5e-289)
		tmp = Float64(1.0 / Float64(Float64(i / n) / Float64(expm1(Float64(n * log1p(Float64(i / 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, 5e-289], N[(1.0 / N[(N[(i / n), $MachinePrecision] / N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * 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 5 \cdot 10^{-289}:\\
\;\;\;\;\frac{1}{\frac{\frac{i}{n}}{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \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)) < 5.00000000000000029e-289

    1. Initial program 27.3%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.9%

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

    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-def86.2%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified86.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 simplification98.1%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq 5 \cdot 10^{-289}:\\ \;\;\;\;\frac{1}{\frac{\frac{i}{n}}{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \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 2: 83.7% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\ t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\ \mathbf{if}\;t_1 \leq 0:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;100 \cdot \left(t_0 \cdot \frac{n}{i}\right) - 100 \cdot \frac{n}{i}\\ \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)) (t_1 (/ (+ t_0 -1.0) (/ i n))))
   (if (<= t_1 0.0)
     (* 100.0 (/ n (/ i (expm1 i))))
     (if (<= t_1 INFINITY)
       (- (* 100.0 (* t_0 (/ n i))) (* 100.0 (/ n i)))
       (* 100.0 (/ n (+ 1.0 (* i -0.5))))))))
double code(double i, double n) {
	double t_0 = pow((1.0 + (i / n)), n);
	double t_1 = (t_0 + -1.0) / (i / n);
	double tmp;
	if (t_1 <= 0.0) {
		tmp = 100.0 * (n / (i / expm1(i)));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = (100.0 * (t_0 * (n / i))) - (100.0 * (n / i));
	} 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);
	double t_1 = (t_0 + -1.0) / (i / n);
	double tmp;
	if (t_1 <= 0.0) {
		tmp = 100.0 * (n / (i / Math.expm1(i)));
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = (100.0 * (t_0 * (n / i))) - (100.0 * (n / i));
	} 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)
	t_1 = (t_0 + -1.0) / (i / n)
	tmp = 0
	if t_1 <= 0.0:
		tmp = 100.0 * (n / (i / math.expm1(i)))
	elif t_1 <= math.inf:
		tmp = (100.0 * (t_0 * (n / i))) - (100.0 * (n / i))
	else:
		tmp = 100.0 * (n / (1.0 + (i * -0.5)))
	return tmp
function code(i, n)
	t_0 = Float64(1.0 + Float64(i / n)) ^ n
	t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n))
	tmp = 0.0
	if (t_1 <= 0.0)
		tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i))));
	elseif (t_1 <= Inf)
		tmp = Float64(Float64(100.0 * Float64(t_0 * Float64(n / i))) - Float64(100.0 * Float64(n / i)));
	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[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]}, Block[{t$95$1 = N[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(100.0 * N[(t$95$0 * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(100.0 * N[(n / i), $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}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 0:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;100 \cdot \left(t_0 \cdot \frac{n}{i}\right) - 100 \cdot \frac{n}{i}\\

\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. Taylor expanded in n around inf 40.5%

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

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

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

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

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

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

    1. Initial program 99.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in n around inf 1.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-def86.2%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified86.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 simplification82.7%

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

Alternative 3: 83.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:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\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)
     (* 100.0 (/ n (/ i (expm1 i))))
     (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 = 100.0 * (n / (i / expm1(i)));
	} 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 = 100.0 * (n / (i / Math.expm1(i)));
	} 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 = 100.0 * (n / (i / math.expm1(i)))
	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(100.0 * Float64(n / Float64(i / expm1(i))));
	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[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $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:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\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. Taylor expanded in n around inf 40.5%

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

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

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

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

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

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

    1. Initial program 99.4%

      \[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-def86.2%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified86.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 simplification82.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq 0:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \mathbf{elif}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq \infty:\\ \;\;\;\;\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: 96.0% 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 5 \cdot 10^{-289}:\\ \;\;\;\;100 \cdot \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{n}{i}\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 5e-289)
     (* 100.0 (* (expm1 (* n (log1p (/ i n)))) (/ n i)))
     (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 <= 5e-289) {
		tmp = 100.0 * (expm1((n * log1p((i / n)))) * (n / i));
	} 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 <= 5e-289) {
		tmp = 100.0 * (Math.expm1((n * Math.log1p((i / n)))) * (n / i));
	} 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 <= 5e-289:
		tmp = 100.0 * (math.expm1((n * math.log1p((i / n)))) * (n / i))
	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 <= 5e-289)
		tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(n / i)));
	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, 5e-289], N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(n / i), $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 5 \cdot 10^{-289}:\\
\;\;\;\;100 \cdot \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{n}{i}\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)) < 5.00000000000000029e-289

    1. Initial program 27.3%

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.9%

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

    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-def86.2%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified86.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 5 \cdot 10^{-289}:\\ \;\;\;\;100 \cdot \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{n}{i}\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 5: 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 5 \cdot 10^{-289}:\\ \;\;\;\;n \cdot \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{100}{i}\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 5e-289)
     (* n (* (expm1 (* n (log1p (/ i n)))) (/ 100.0 i)))
     (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 <= 5e-289) {
		tmp = n * (expm1((n * log1p((i / n)))) * (100.0 / i));
	} 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 <= 5e-289) {
		tmp = n * (Math.expm1((n * Math.log1p((i / n)))) * (100.0 / i));
	} 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 <= 5e-289:
		tmp = n * (math.expm1((n * math.log1p((i / n)))) * (100.0 / i))
	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 <= 5e-289)
		tmp = Float64(n * Float64(expm1(Float64(n * log1p(Float64(i / n)))) * Float64(100.0 / i)));
	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, 5e-289], N[(n * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * N[(100.0 / i), $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 5 \cdot 10^{-289}:\\
\;\;\;\;n \cdot \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{100}{i}\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)) < 5.00000000000000029e-289

    1. Initial program 27.3%

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Step-by-step derivation
      1. expm1-log1p-u25.6%

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

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

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

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

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

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

        \[\leadsto n \cdot \left(e^{\mathsf{log1p}\left(\frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}}{i}\right)} - 1\right) \]
      8. *-commutative20.2%

        \[\leadsto n \cdot \left(e^{\mathsf{log1p}\left(\frac{\color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right) \cdot 100}}{i}\right)} - 1\right) \]
      9. add-exp-log20.2%

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

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

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

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

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

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

        \[\leadsto n \cdot \color{blue}{\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{i}} \]
      3. *-rgt-identity96.9%

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

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

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

        \[\leadsto n \cdot \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \color{blue}{\frac{100 \cdot 1}{i}}\right) \]
      7. metadata-eval96.9%

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

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

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

    1. Initial program 99.9%

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

    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-def86.2%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{expm1}\left(i\right)}}} \cdot 100 \]
    4. Simplified86.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.8%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq 5 \cdot 10^{-289}:\\ \;\;\;\;n \cdot \left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot \frac{100}{i}\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 6: 83.2% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ t_1 := 100 \cdot \frac{n}{1 + {i}^{2} \cdot 0.08333333333333333}\\ \mathbf{if}\;n \leq -1.35 \cdot 10^{-15}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;n \leq -1.22 \cdot 10^{-175}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;n \leq 5.2 \cdot 10^{-172}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.55:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (* 100.0 (/ n (/ i (expm1 i)))))
        (t_1 (* 100.0 (/ n (+ 1.0 (* (pow i 2.0) 0.08333333333333333))))))
   (if (<= n -1.35e-15)
     t_0
     (if (<= n -1.22e-175)
       t_1
       (if (<= n 5.2e-172) 0.0 (if (<= n 1.55) t_1 t_0))))))
double code(double i, double n) {
	double t_0 = 100.0 * (n / (i / expm1(i)));
	double t_1 = 100.0 * (n / (1.0 + (pow(i, 2.0) * 0.08333333333333333)));
	double tmp;
	if (n <= -1.35e-15) {
		tmp = t_0;
	} else if (n <= -1.22e-175) {
		tmp = t_1;
	} else if (n <= 5.2e-172) {
		tmp = 0.0;
	} else if (n <= 1.55) {
		tmp = t_1;
	} 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 t_1 = 100.0 * (n / (1.0 + (Math.pow(i, 2.0) * 0.08333333333333333)));
	double tmp;
	if (n <= -1.35e-15) {
		tmp = t_0;
	} else if (n <= -1.22e-175) {
		tmp = t_1;
	} else if (n <= 5.2e-172) {
		tmp = 0.0;
	} else if (n <= 1.55) {
		tmp = t_1;
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(i, n):
	t_0 = 100.0 * (n / (i / math.expm1(i)))
	t_1 = 100.0 * (n / (1.0 + (math.pow(i, 2.0) * 0.08333333333333333)))
	tmp = 0
	if n <= -1.35e-15:
		tmp = t_0
	elif n <= -1.22e-175:
		tmp = t_1
	elif n <= 5.2e-172:
		tmp = 0.0
	elif n <= 1.55:
		tmp = t_1
	else:
		tmp = t_0
	return tmp
function code(i, n)
	t_0 = Float64(100.0 * Float64(n / Float64(i / expm1(i))))
	t_1 = Float64(100.0 * Float64(n / Float64(1.0 + Float64((i ^ 2.0) * 0.08333333333333333))))
	tmp = 0.0
	if (n <= -1.35e-15)
		tmp = t_0;
	elseif (n <= -1.22e-175)
		tmp = t_1;
	elseif (n <= 5.2e-172)
		tmp = 0.0;
	elseif (n <= 1.55)
		tmp = t_1;
	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]}, Block[{t$95$1 = N[(100.0 * N[(n / N[(1.0 + N[(N[Power[i, 2.0], $MachinePrecision] * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.35e-15], t$95$0, If[LessEqual[n, -1.22e-175], t$95$1, If[LessEqual[n, 5.2e-172], 0.0, If[LessEqual[n, 1.55], t$95$1, t$95$0]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
t_1 := 100 \cdot \frac{n}{1 + {i}^{2} \cdot 0.08333333333333333}\\
\mathbf{if}\;n \leq -1.35 \cdot 10^{-15}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;n \leq -1.22 \cdot 10^{-175}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;n \leq 5.2 \cdot 10^{-172}:\\
\;\;\;\;0\\

\mathbf{elif}\;n \leq 1.55:\\
\;\;\;\;t_1\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -1.35000000000000005e-15 or 1.55000000000000004 < n

    1. Initial program 22.7%

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

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

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

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

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

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

    if -1.35000000000000005e-15 < n < -1.2200000000000001e-175 or 5.1999999999999996e-172 < n < 1.55000000000000004

    1. Initial program 21.9%

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

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

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

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

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

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

      \[\leadsto \frac{n}{\color{blue}{1 + \left(-0.5 \cdot i + 0.08333333333333333 \cdot {i}^{2}\right)}} \cdot 100 \]
    6. Taylor expanded in i around inf 72.6%

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

        \[\leadsto \frac{n}{1 + \color{blue}{{i}^{2} \cdot 0.08333333333333333}} \cdot 100 \]
    8. Simplified72.6%

      \[\leadsto \frac{n}{1 + \color{blue}{{i}^{2} \cdot 0.08333333333333333}} \cdot 100 \]

    if -1.2200000000000001e-175 < n < 5.1999999999999996e-172

    1. Initial program 67.4%

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

      \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
    3. Taylor expanded in i around 0 79.2%

      \[\leadsto 100 \cdot \color{blue}{0} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification85.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1.35 \cdot 10^{-15}:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \mathbf{elif}\;n \leq -1.22 \cdot 10^{-175}:\\ \;\;\;\;100 \cdot \frac{n}{1 + {i}^{2} \cdot 0.08333333333333333}\\ \mathbf{elif}\;n \leq 5.2 \cdot 10^{-172}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.55:\\ \;\;\;\;100 \cdot \frac{n}{1 + {i}^{2} \cdot 0.08333333333333333}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \end{array} \]

Alternative 7: 75.8% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;i \leq -4 \cdot 10^{-14} \lor \neg \left(i \leq 1.8 \cdot 10^{-7}\right):\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < -4e-14 or 1.79999999999999997e-7 < i

    1. Initial program 51.3%

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

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

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

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

    if -4e-14 < i < 1.79999999999999997e-7

    1. Initial program 7.1%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -4 \cdot 10^{-14} \lor \neg \left(i \leq 1.8 \cdot 10^{-7}\right):\\ \;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot 100\\ \end{array} \]

Alternative 8: 75.6% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;i \leq -4.4 \cdot 10^{-15} \lor \neg \left(i \leq 1.8 \cdot 10^{-7}\right):\\
\;\;\;\;\mathsf{expm1}\left(i\right) \cdot \left(100 \cdot \frac{n}{i}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < -4.39999999999999971e-15 or 1.79999999999999997e-7 < i

    1. Initial program 51.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.39999999999999971e-15 < i < 1.79999999999999997e-7

    1. Initial program 7.1%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -4.4 \cdot 10^{-15} \lor \neg \left(i \leq 1.8 \cdot 10^{-7}\right):\\ \;\;\;\;\mathsf{expm1}\left(i\right) \cdot \left(100 \cdot \frac{n}{i}\right)\\ \mathbf{else}:\\ \;\;\;\;n \cdot 100\\ \end{array} \]

Alternative 9: 80.3% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -1.22 \cdot 10^{-175} \lor \neg \left(n \leq 8.5 \cdot 10^{-128}\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.22e-175) (not (<= n 8.5e-128)))
   (* 100.0 (/ n (/ i (expm1 i))))
   0.0))
double code(double i, double n) {
	double tmp;
	if ((n <= -1.22e-175) || !(n <= 8.5e-128)) {
		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.22e-175) || !(n <= 8.5e-128)) {
		tmp = 100.0 * (n / (i / Math.expm1(i)));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if (n <= -1.22e-175) or not (n <= 8.5e-128):
		tmp = 100.0 * (n / (i / math.expm1(i)))
	else:
		tmp = 0.0
	return tmp
function code(i, n)
	tmp = 0.0
	if ((n <= -1.22e-175) || !(n <= 8.5e-128))
		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.22e-175], N[Not[LessEqual[n, 8.5e-128]], $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.22 \cdot 10^{-175} \lor \neg \left(n \leq 8.5 \cdot 10^{-128}\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.2200000000000001e-175 or 8.4999999999999996e-128 < n

    1. Initial program 22.7%

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

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

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

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

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

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

    if -1.2200000000000001e-175 < n < 8.4999999999999996e-128

    1. Initial program 57.9%

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

      \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
    3. Taylor expanded in i around 0 72.2%

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

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

Alternative 10: 58.9% accurate, 10.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;i \leq -3.2 \cdot 10^{-22}:\\
\;\;\;\;0\\

\mathbf{elif}\;i \leq 0.76:\\
\;\;\;\;n \cdot 100\\

\mathbf{elif}\;i \leq 3.5 \cdot 10^{+125}:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if i < -3.19999999999999987e-22 or 0.76000000000000001 < i < 3.50000000000000011e125

    1. Initial program 52.2%

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

      \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
    3. Taylor expanded in i around 0 34.2%

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

    if -3.19999999999999987e-22 < i < 0.76000000000000001

    1. Initial program 6.3%

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

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

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

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

    if 3.50000000000000011e125 < i

    1. Initial program 51.6%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -3.2 \cdot 10^{-22}:\\ \;\;\;\;0\\ \mathbf{elif}\;i \leq 0.76:\\ \;\;\;\;n \cdot 100\\ \mathbf{elif}\;i \leq 3.5 \cdot 10^{+125}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;50 \cdot \left(i \cdot n\right)\\ \end{array} \]

Alternative 11: 61.2% accurate, 10.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -5 \cdot 10^{-88} \lor \neg \left(n \leq 1.05 \cdot 10^{-128}\right):\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (or (<= n -5e-88) (not (<= n 1.05e-128))) (* n (+ 100.0 (* i 50.0))) 0.0))
double code(double i, double n) {
	double tmp;
	if ((n <= -5e-88) || !(n <= 1.05e-128)) {
		tmp = n * (100.0 + (i * 50.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 ((n <= (-5d-88)) .or. (.not. (n <= 1.05d-128))) then
        tmp = n * (100.0d0 + (i * 50.0d0))
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double tmp;
	if ((n <= -5e-88) || !(n <= 1.05e-128)) {
		tmp = n * (100.0 + (i * 50.0));
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if (n <= -5e-88) or not (n <= 1.05e-128):
		tmp = n * (100.0 + (i * 50.0))
	else:
		tmp = 0.0
	return tmp
function code(i, n)
	tmp = 0.0
	if ((n <= -5e-88) || !(n <= 1.05e-128))
		tmp = Float64(n * Float64(100.0 + Float64(i * 50.0)));
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(i, n)
	tmp = 0.0;
	if ((n <= -5e-88) || ~((n <= 1.05e-128)))
		tmp = n * (100.0 + (i * 50.0));
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[Or[LessEqual[n, -5e-88], N[Not[LessEqual[n, 1.05e-128]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 0.0]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -5 \cdot 10^{-88} \lor \neg \left(n \leq 1.05 \cdot 10^{-128}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -5.00000000000000009e-88 or 1.0500000000000001e-128 < n

    1. Initial program 20.7%

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

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot n + \color{blue}{\left(50 \cdot i\right) \cdot n} \]
      3. distribute-rgt-out65.2%

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

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

    if -5.00000000000000009e-88 < n < 1.0500000000000001e-128

    1. Initial program 55.6%

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

      \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
    3. Taylor expanded in i around 0 66.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -5 \cdot 10^{-88} \lor \neg \left(n \leq 1.05 \cdot 10^{-128}\right):\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

Alternative 12: 62.8% accurate, 10.2× speedup?

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

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

\mathbf{elif}\;n \leq 1.06 \cdot 10^{-128}:\\
\;\;\;\;0\\

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


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

    1. Initial program 26.6%

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

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

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

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

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

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

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

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

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

    if -2.3e-175 < n < 1.05999999999999995e-128

    1. Initial program 57.9%

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

      \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
    3. Taylor expanded in i around 0 72.2%

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

    if 1.05999999999999995e-128 < n

    1. Initial program 19.0%

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

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot n + \color{blue}{\left(50 \cdot i\right) \cdot n} \]
      3. distribute-rgt-out72.7%

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

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

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

Alternative 13: 62.7% accurate, 10.2× speedup?

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

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

\mathbf{elif}\;n \leq 1.05 \cdot 10^{-128}:\\
\;\;\;\;0\\

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


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

    1. Initial program 26.6%

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

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

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

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

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

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

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

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

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

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

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

    if -1.2200000000000001e-175 < n < 1.0500000000000001e-128

    1. Initial program 57.9%

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

      \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
    3. Taylor expanded in i around 0 72.2%

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

    if 1.0500000000000001e-128 < n

    1. Initial program 19.0%

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

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot n + \color{blue}{\left(50 \cdot i\right) \cdot n} \]
      3. distribute-rgt-out72.7%

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

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

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

Alternative 14: 57.5% accurate, 16.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;i \leq -3.2 \cdot 10^{-22}:\\
\;\;\;\;0\\

\mathbf{elif}\;i \leq 0.47:\\
\;\;\;\;n \cdot 100\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < -3.19999999999999987e-22 or 0.46999999999999997 < i

    1. Initial program 52.0%

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

      \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
    3. Taylor expanded in i around 0 29.3%

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

    if -3.19999999999999987e-22 < i < 0.46999999999999997

    1. Initial program 6.3%

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

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

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

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

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

Alternative 15: 17.2% 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.5%

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

    \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
  3. Taylor expanded in i around 0 17.8%

    \[\leadsto 100 \cdot \color{blue}{0} \]
  4. Final simplification17.8%

    \[\leadsto 0 \]

Developer target: 34.5% 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 2023322 
(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))))