Compound Interest

Percentage Accurate: 29.0% → 98.0%
Time: 26.5s
Alternatives: 21
Speedup: 38.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 21 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: 29.0% 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: 98.0% 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:\\ \;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{\frac{i}{n}}\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \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)
     (/ (* (expm1 (* n (log1p (/ i n)))) 100.0) (/ i n))
     (if (<= t_1 INFINITY)
       (/ (+ (* t_0 100.0) -100.0) (/ i n))
       (/ 100.0 (+ (* (/ i n) -0.5) (/ 1.0 n)))))))
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 = (expm1((n * log1p((i / n)))) * 100.0) / (i / n);
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = ((t_0 * 100.0) + -100.0) / (i / n);
	} else {
		tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
	}
	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 = (Math.expm1((n * Math.log1p((i / n)))) * 100.0) / (i / n);
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = ((t_0 * 100.0) + -100.0) / (i / n);
	} else {
		tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
	}
	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 = (math.expm1((n * math.log1p((i / n)))) * 100.0) / (i / n)
	elif t_1 <= math.inf:
		tmp = ((t_0 * 100.0) + -100.0) / (i / n)
	else:
		tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n))
	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(Float64(expm1(Float64(n * log1p(Float64(i / n)))) * 100.0) / Float64(i / n));
	elseif (t_1 <= Inf)
		tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n));
	else
		tmp = Float64(100.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n)));
	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[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * 100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $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:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{\frac{i}{n}}\\

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\

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


\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 20.1%

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

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

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

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

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

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

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

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

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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

    \[\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) \cdot 100}{\frac{i}{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} \cdot 100 + -100}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \end{array} \]

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

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

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


\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 20.1%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.7%

      \[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-def84.0%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq 0:\\ \;\;\;\;\frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{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}:\\ \;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \end{array} \]

Alternative 3: 83.5% accurate, 0.3× speedup?

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

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

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

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


\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 20.1%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\

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


\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 20.1%

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq 0:\\ \;\;\;\;\frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{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} \cdot 100 + -100}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \end{array} \]

Alternative 5: 96.5% 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:\\ \;\;\;\;\left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100\right) \cdot \frac{n}{i}\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \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)
     (* (* (expm1 (* n (log1p (/ i n)))) 100.0) (/ n i))
     (if (<= t_1 INFINITY)
       (/ (+ (* t_0 100.0) -100.0) (/ i n))
       (/ 100.0 (+ (* (/ i n) -0.5) (/ 1.0 n)))))))
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 = (expm1((n * log1p((i / n)))) * 100.0) * (n / i);
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = ((t_0 * 100.0) + -100.0) / (i / n);
	} else {
		tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
	}
	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 = (Math.expm1((n * Math.log1p((i / n)))) * 100.0) * (n / i);
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = ((t_0 * 100.0) + -100.0) / (i / n);
	} else {
		tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
	}
	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 = (math.expm1((n * math.log1p((i / n)))) * 100.0) * (n / i)
	elif t_1 <= math.inf:
		tmp = ((t_0 * 100.0) + -100.0) / (i / n)
	else:
		tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n))
	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(Float64(expm1(Float64(n * log1p(Float64(i / n)))) * 100.0) * Float64(n / i));
	elseif (t_1 <= Inf)
		tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n));
	else
		tmp = Float64(100.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n)));
	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[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] * 100.0), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $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:\\
\;\;\;\;\left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100\right) \cdot \frac{n}{i}\\

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\

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


\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 20.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

      \[\leadsto \frac{100}{\color{blue}{-0.5 \cdot \frac{i}{n} + \frac{1}{n}}} \]
  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:\\ \;\;\;\;\left(\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100\right) \cdot \frac{n}{i}\\ \mathbf{elif}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq \infty:\\ \;\;\;\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} \cdot 100 + -100}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \end{array} \]

Alternative 6: 97.3% 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:\\ \;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i} \cdot \left(n \cdot 100\right)\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \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)
     (* (/ (expm1 (* n (log1p (/ i n)))) i) (* n 100.0))
     (if (<= t_1 INFINITY)
       (/ (+ (* t_0 100.0) -100.0) (/ i n))
       (/ 100.0 (+ (* (/ i n) -0.5) (/ 1.0 n)))))))
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 = (expm1((n * log1p((i / n)))) / i) * (n * 100.0);
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = ((t_0 * 100.0) + -100.0) / (i / n);
	} else {
		tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
	}
	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 = (Math.expm1((n * Math.log1p((i / n)))) / i) * (n * 100.0);
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = ((t_0 * 100.0) + -100.0) / (i / n);
	} else {
		tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
	}
	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 = (math.expm1((n * math.log1p((i / n)))) / i) * (n * 100.0)
	elif t_1 <= math.inf:
		tmp = ((t_0 * 100.0) + -100.0) / (i / n)
	else:
		tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n))
	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(Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i) * Float64(n * 100.0));
	elseif (t_1 <= Inf)
		tmp = Float64(Float64(Float64(t_0 * 100.0) + -100.0) / Float64(i / n));
	else
		tmp = Float64(100.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n)));
	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[(N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(N[(N[(t$95$0 * 100.0), $MachinePrecision] + -100.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(100.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $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:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i} \cdot \left(n \cdot 100\right)\\

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\

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


\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 20.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 99.7%

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

    \[\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)}{i} \cdot \left(n \cdot 100\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} \cdot 100 + -100}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \end{array} \]

Alternative 7: 78.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 9.5 \cdot 10^{+176}:\\ \;\;\;\;\frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{n}}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \left(\frac{n}{i} \cdot \left(-1 + {\left(\frac{i}{n}\right)}^{n}\right)\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= i 9.5e+176)
   (/ 100.0 (/ (/ i (expm1 i)) n))
   (* 100.0 (* (/ n i) (+ -1.0 (pow (/ i n) n))))))
double code(double i, double n) {
	double tmp;
	if (i <= 9.5e+176) {
		tmp = 100.0 / ((i / expm1(i)) / n);
	} else {
		tmp = 100.0 * ((n / i) * (-1.0 + pow((i / n), n)));
	}
	return tmp;
}
public static double code(double i, double n) {
	double tmp;
	if (i <= 9.5e+176) {
		tmp = 100.0 / ((i / Math.expm1(i)) / n);
	} else {
		tmp = 100.0 * ((n / i) * (-1.0 + Math.pow((i / n), n)));
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if i <= 9.5e+176:
		tmp = 100.0 / ((i / math.expm1(i)) / n)
	else:
		tmp = 100.0 * ((n / i) * (-1.0 + math.pow((i / n), n)))
	return tmp
function code(i, n)
	tmp = 0.0
	if (i <= 9.5e+176)
		tmp = Float64(100.0 / Float64(Float64(i / expm1(i)) / n));
	else
		tmp = Float64(100.0 * Float64(Float64(n / i) * Float64(-1.0 + (Float64(i / n) ^ n))));
	end
	return tmp
end
code[i_, n_] := If[LessEqual[i, 9.5e+176], N[(100.0 / N[(N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(n / i), $MachinePrecision] * N[(-1.0 + N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 20.2%

      \[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-def85.6%

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

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

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

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

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

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

    if 9.4999999999999995e176 < i

    1. Initial program 63.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 78.1% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 9.5 \cdot 10^{+176}:\\ \;\;\;\;\frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{n}}\\ \mathbf{else}:\\ \;\;\;\;\left(n \cdot 100\right) \cdot \frac{-1 + {\left(\frac{i}{n}\right)}^{n}}{i}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= i 9.5e+176)
   (/ 100.0 (/ (/ i (expm1 i)) n))
   (* (* n 100.0) (/ (+ -1.0 (pow (/ i n) n)) i))))
double code(double i, double n) {
	double tmp;
	if (i <= 9.5e+176) {
		tmp = 100.0 / ((i / expm1(i)) / n);
	} else {
		tmp = (n * 100.0) * ((-1.0 + pow((i / n), n)) / i);
	}
	return tmp;
}
public static double code(double i, double n) {
	double tmp;
	if (i <= 9.5e+176) {
		tmp = 100.0 / ((i / Math.expm1(i)) / n);
	} else {
		tmp = (n * 100.0) * ((-1.0 + Math.pow((i / n), n)) / i);
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if i <= 9.5e+176:
		tmp = 100.0 / ((i / math.expm1(i)) / n)
	else:
		tmp = (n * 100.0) * ((-1.0 + math.pow((i / n), n)) / i)
	return tmp
function code(i, n)
	tmp = 0.0
	if (i <= 9.5e+176)
		tmp = Float64(100.0 / Float64(Float64(i / expm1(i)) / n));
	else
		tmp = Float64(Float64(n * 100.0) * Float64(Float64(-1.0 + (Float64(i / n) ^ n)) / i));
	end
	return tmp
end
code[i_, n_] := If[LessEqual[i, 9.5e+176], N[(100.0 / N[(N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(-1.0 + N[Power[N[(i / n), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 20.2%

      \[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-def85.6%

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

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

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

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

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

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

    if 9.4999999999999995e176 < i

    1. Initial program 63.0%

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

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

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

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

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

        \[\leadsto \frac{{\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{-1}}{i} \cdot \left(n \cdot 100\right) \]
    3. Simplified63.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 inf 63.4%

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

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

Alternative 9: 76.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;i \leq -1.6 \cdot 10^{-70} \lor \neg \left(i \leq 2.7 \cdot 10^{-27}\right):\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < -1.5999999999999999e-70 or 2.69999999999999989e-27 < i

    1. Initial program 44.1%

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

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

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

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

    if -1.5999999999999999e-70 < i < 2.69999999999999989e-27

    1. Initial program 4.9%

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

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

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

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

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

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

      \[\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 93.7%

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

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

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

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

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

Alternative 10: 77.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 10^{+98}:\\ \;\;\;\;\frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{n}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\left(n \cdot 100\right) \cdot \left(\left(n \cdot n\right) \cdot 10000\right)}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= i 1e+98)
   (/ 100.0 (/ (/ i (expm1 i)) n))
   (cbrt (* (* n 100.0) (* (* n n) 10000.0)))))
double code(double i, double n) {
	double tmp;
	if (i <= 1e+98) {
		tmp = 100.0 / ((i / expm1(i)) / n);
	} else {
		tmp = cbrt(((n * 100.0) * ((n * n) * 10000.0)));
	}
	return tmp;
}
public static double code(double i, double n) {
	double tmp;
	if (i <= 1e+98) {
		tmp = 100.0 / ((i / Math.expm1(i)) / n);
	} else {
		tmp = Math.cbrt(((n * 100.0) * ((n * n) * 10000.0)));
	}
	return tmp;
}
function code(i, n)
	tmp = 0.0
	if (i <= 1e+98)
		tmp = Float64(100.0 / Float64(Float64(i / expm1(i)) / n));
	else
		tmp = cbrt(Float64(Float64(n * 100.0) * Float64(Float64(n * n) * 10000.0)));
	end
	return tmp
end
code[i_, n_] := If[LessEqual[i, 1e+98], N[(100.0 / N[(N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision], N[Power[N[(N[(n * 100.0), $MachinePrecision] * N[(N[(n * n), $MachinePrecision] * 10000.0), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq 10^{+98}:\\
\;\;\;\;\frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{n}}\\

\mathbf{else}:\\
\;\;\;\;\sqrt[3]{\left(n \cdot 100\right) \cdot \left(\left(n \cdot n\right) \cdot 10000\right)}\\


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

    1. Initial program 18.1%

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

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

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

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

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

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

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

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

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

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

    if 9.99999999999999998e97 < i

    1. Initial program 55.1%

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{100}{\color{blue}{\frac{1}{n}}} \]
    8. Step-by-step derivation
      1. associate-/r/4.5%

        \[\leadsto \color{blue}{\frac{100}{1} \cdot n} \]
      2. metadata-eval4.5%

        \[\leadsto \color{blue}{100} \cdot n \]
      3. *-commutative4.5%

        \[\leadsto \color{blue}{n \cdot 100} \]
      4. add-cbrt-cube58.4%

        \[\leadsto \color{blue}{\sqrt[3]{\left(\left(n \cdot 100\right) \cdot \left(n \cdot 100\right)\right) \cdot \left(n \cdot 100\right)}} \]
    9. Applied egg-rr58.4%

      \[\leadsto \color{blue}{\sqrt[3]{\left(\left(n \cdot 100\right) \cdot \left(n \cdot 100\right)\right) \cdot \left(n \cdot 100\right)}} \]
    10. Step-by-step derivation
      1. associate-*l*58.4%

        \[\leadsto \sqrt[3]{\color{blue}{\left(n \cdot 100\right) \cdot \left(\left(n \cdot 100\right) \cdot \left(n \cdot 100\right)\right)}} \]
      2. *-commutative58.4%

        \[\leadsto \sqrt[3]{\color{blue}{\left(100 \cdot n\right)} \cdot \left(\left(n \cdot 100\right) \cdot \left(n \cdot 100\right)\right)} \]
      3. swap-sqr58.4%

        \[\leadsto \sqrt[3]{\left(100 \cdot n\right) \cdot \color{blue}{\left(\left(n \cdot n\right) \cdot \left(100 \cdot 100\right)\right)}} \]
      4. metadata-eval58.4%

        \[\leadsto \sqrt[3]{\left(100 \cdot n\right) \cdot \left(\left(n \cdot n\right) \cdot \color{blue}{10000}\right)} \]
    11. Simplified58.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq 10^{+98}:\\ \;\;\;\;\frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{n}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt[3]{\left(n \cdot 100\right) \cdot \left(\left(n \cdot n\right) \cdot 10000\right)}\\ \end{array} \]

Alternative 11: 76.3% accurate, 1.1× speedup?

\[\begin{array}{l} \\ 100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}} \end{array} \]
(FPCore (i n) :precision binary64 (* 100.0 (/ n (/ i (expm1 i)))))
double code(double i, double n) {
	return 100.0 * (n / (i / expm1(i)));
}
public static double code(double i, double n) {
	return 100.0 * (n / (i / Math.expm1(i)));
}
def code(i, n):
	return 100.0 * (n / (i / math.expm1(i)))
function code(i, n)
	return Float64(100.0 * Float64(n / Float64(i / expm1(i))))
end
code[i_, n_] := N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}
\end{array}
Derivation
  1. Initial program 23.9%

    \[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-def80.6%

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

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

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

Alternative 12: 76.3% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{n}} \end{array} \]
(FPCore (i n) :precision binary64 (/ 100.0 (/ (/ i (expm1 i)) n)))
double code(double i, double n) {
	return 100.0 / ((i / expm1(i)) / n);
}
public static double code(double i, double n) {
	return 100.0 / ((i / Math.expm1(i)) / n);
}
def code(i, n):
	return 100.0 / ((i / math.expm1(i)) / n)
function code(i, n)
	return Float64(100.0 / Float64(Float64(i / expm1(i)) / n))
end
code[i_, n_] := N[(100.0 / N[(N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / n), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\frac{100}{\frac{\frac{i}{\mathsf{expm1}\left(i\right)}}{n}}
\end{array}
Derivation
  1. Initial program 23.9%

    \[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-def80.6%

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

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

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

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

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

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

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

Alternative 13: 62.3% accurate, 7.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < 3.3999999999999999e-87

    1. Initial program 27.1%

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

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

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

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

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

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

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

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

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

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

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

    if 3.3999999999999999e-87 < n

    1. Initial program 18.0%

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

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

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

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

Alternative 14: 62.3% accurate, 7.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < 3.3999999999999999e-87

    1. Initial program 27.1%

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

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

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

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

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

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

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

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

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

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

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

    if 3.3999999999999999e-87 < n

    1. Initial program 18.0%

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

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

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

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

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

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

      \[\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 68.9%

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

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

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

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

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

Alternative 15: 63.7% accurate, 7.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < 1.55e-16

    1. Initial program 25.6%

      \[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-def73.6%

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

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

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

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

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

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

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

    if 1.55e-16 < n

    1. Initial program 19.8%

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

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

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

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

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

        \[\leadsto \frac{{\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{-1}}{i} \cdot \left(n \cdot 100\right) \]
    3. Simplified20.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 21.3%

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

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

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

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

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

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

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

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

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

Alternative 16: 61.9% accurate, 8.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < 1.8e104

    1. Initial program 25.1%

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

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

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

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

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

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

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

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

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

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

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

    if 1.8e104 < n

    1. Initial program 19.6%

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

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

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

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

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

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

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

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

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

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

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

Alternative 17: 62.2% accurate, 10.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -1 \cdot 10^{+82} \lor \neg \left(n \leq 1.5 \cdot 10^{-16}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -9.9999999999999996e81 or 1.49999999999999997e-16 < 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 44.2%

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

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

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

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

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

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

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

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

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

    if -9.9999999999999996e81 < n < 1.49999999999999997e-16

    1. Initial program 28.4%

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

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

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

Alternative 18: 58.5% accurate, 10.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;i \leq -2.05 \cdot 10^{-70}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\

\mathbf{elif}\;i \leq 1.2:\\
\;\;\;\;100 \cdot \left(n + i \cdot -0.5\right)\\

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


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

    1. Initial program 43.9%

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

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

    if -2.04999999999999989e-70 < i < 1.19999999999999996

    1. Initial program 4.8%

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

      \[\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*92.7%

        \[\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/92.7%

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

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

      \[\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 0 92.3%

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

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

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

    if 1.19999999999999996 < i

    1. Initial program 47.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{50 \cdot \left(i \cdot n\right)} \]
    11. Step-by-step derivation
      1. *-commutative24.7%

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

        \[\leadsto \color{blue}{\left(n \cdot i\right)} \cdot 50 \]
      3. associate-*l*24.7%

        \[\leadsto \color{blue}{n \cdot \left(i \cdot 50\right)} \]
    12. Simplified24.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -2.05 \cdot 10^{-70}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{elif}\;i \leq 1.2:\\ \;\;\;\;100 \cdot \left(n + i \cdot -0.5\right)\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(i \cdot 50\right)\\ \end{array} \]

Alternative 19: 54.6% accurate, 16.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;i \leq 2:\\
\;\;\;\;n \cdot 100\\

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


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

    1. Initial program 17.0%

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

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

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

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

    if 2 < i

    1. Initial program 47.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{50 \cdot \left(i \cdot n\right)} \]
    11. Step-by-step derivation
      1. *-commutative24.7%

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

        \[\leadsto \color{blue}{\left(n \cdot i\right)} \cdot 50 \]
      3. associate-*l*24.7%

        \[\leadsto \color{blue}{n \cdot \left(i \cdot 50\right)} \]
    12. Simplified24.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq 2:\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(i \cdot 50\right)\\ \end{array} \]

Alternative 20: 2.8% accurate, 38.0× speedup?

\[\begin{array}{l} \\ i \cdot -50 \end{array} \]
(FPCore (i n) :precision binary64 (* i -50.0))
double code(double i, double n) {
	return i * -50.0;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    code = i * (-50.0d0)
end function
public static double code(double i, double n) {
	return i * -50.0;
}
def code(i, n):
	return i * -50.0
function code(i, n)
	return Float64(i * -50.0)
end
function tmp = code(i, n)
	tmp = i * -50.0;
end
code[i_, n_] := N[(i * -50.0), $MachinePrecision]
\begin{array}{l}

\\
i \cdot -50
\end{array}
Derivation
  1. Initial program 23.9%

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

    \[\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*58.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/58.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-eval58.9%

      \[\leadsto 100 \cdot \left(n + \left(i \cdot n\right) \cdot \left(0.5 - \frac{\color{blue}{0.5}}{n}\right)\right) \]
  4. Simplified58.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 0 3.0%

    \[\leadsto \color{blue}{-50 \cdot i} \]
  6. Step-by-step derivation
    1. *-commutative3.0%

      \[\leadsto \color{blue}{i \cdot -50} \]
  7. Simplified3.0%

    \[\leadsto \color{blue}{i \cdot -50} \]
  8. Final simplification3.0%

    \[\leadsto i \cdot -50 \]

Alternative 21: 48.9% accurate, 38.0× speedup?

\[\begin{array}{l} \\ n \cdot 100 \end{array} \]
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
	return n * 100.0;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    code = n * 100.0d0
end function
public static double code(double i, double n) {
	return n * 100.0;
}
def code(i, n):
	return n * 100.0
function code(i, n)
	return Float64(n * 100.0)
end
function tmp = code(i, n)
	tmp = n * 100.0;
end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}

\\
n \cdot 100
\end{array}
Derivation
  1. Initial program 23.9%

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

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

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

    \[\leadsto \color{blue}{n \cdot 100} \]
  5. Final simplification54.3%

    \[\leadsto n \cdot 100 \]

Developer target: 35.0% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + \frac{i}{n}\\ 100 \cdot \frac{e^{n \cdot \begin{array}{l} \mathbf{if}\;t_0 = 1:\\ \;\;\;\;\frac{i}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{i}{n} \cdot \log t_0}{\left(\frac{i}{n} + 1\right) - 1}\\ \end{array}} - 1}{\frac{i}{n}} \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (+ 1.0 (/ i n))))
   (*
    100.0
    (/
     (-
      (exp
       (*
        n
        (if (== t_0 1.0)
          (/ i n)
          (/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
      1.0)
     (/ i n)))))
double code(double i, double n) {
	double t_0 = 1.0 + (i / n);
	double tmp;
	if (t_0 == 1.0) {
		tmp = i / n;
	} else {
		tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
	}
	return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 + (i / n)
    if (t_0 == 1.0d0) then
        tmp = i / n
    else
        tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
    end if
    code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
	double t_0 = 1.0 + (i / n);
	double tmp;
	if (t_0 == 1.0) {
		tmp = i / n;
	} else {
		tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
	}
	return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n):
	t_0 = 1.0 + (i / n)
	tmp = 0
	if t_0 == 1.0:
		tmp = i / n
	else:
		tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0)
	return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n)
	t_0 = Float64(1.0 + Float64(i / n))
	tmp = 0.0
	if (t_0 == 1.0)
		tmp = Float64(i / n);
	else
		tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0));
	end
	return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n)))
end
function tmp_2 = code(i, n)
	t_0 = 1.0 + (i / n);
	tmp = 0.0;
	if (t_0 == 1.0)
		tmp = i / n;
	else
		tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
	end
	tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t_0 = 1:\\
\;\;\;\;\frac{i}{n}\\

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


\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2023278 
(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))))