Compound Interest

Percentage Accurate: 28.0% → 94.5%
Time: 18.1s
Alternatives: 16
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 16 alternatives:

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

Initial Program: 28.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: 94.5% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq \infty:\\ \;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= (/ (+ (pow (+ 1.0 (/ i n)) n) -1.0) (/ i n)) INFINITY)
   (/ (* (expm1 (* n (log1p (/ i n)))) 100.0) (/ i n))
   (* 100.0 (/ n (+ (fma i -0.5 1.0) (* i (* i 0.08333333333333333)))))))
double code(double i, double n) {
	double tmp;
	if (((pow((1.0 + (i / n)), n) + -1.0) / (i / n)) <= ((double) INFINITY)) {
		tmp = (expm1((n * log1p((i / n)))) * 100.0) / (i / n);
	} else {
		tmp = 100.0 * (n / (fma(i, -0.5, 1.0) + (i * (i * 0.08333333333333333))));
	}
	return tmp;
}
function code(i, n)
	tmp = 0.0
	if (Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) + -1.0) / Float64(i / n)) <= Inf)
		tmp = Float64(Float64(expm1(Float64(n * log1p(Float64(i / n)))) * 100.0) / Float64(i / n));
	else
		tmp = Float64(100.0 * Float64(n / Float64(fma(i, -0.5, 1.0) + Float64(i * Float64(i * 0.08333333333333333)))));
	end
	return tmp
end
code[i_, n_] := If[LessEqual[N[(N[(N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision] + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], Infinity], 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], N[(100.0 * N[(n / N[(N[(i * -0.5 + 1.0), $MachinePrecision] + N[(i * N[(i * 0.08333333333333333), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 31.9%

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{expm1}\left(\color{blue}{n \cdot \log \left(1 + \frac{i}{n}\right)}\right) \cdot 100}{\frac{i}{n}} \]
      8. log1p-udef96.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-rr96.8%

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 93.7% accurate, 0.4× speedup?

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

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

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


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

    1. Initial program 31.9%

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{expm1}\left(\color{blue}{n \cdot \log \left(1 + \frac{i}{n}\right)}\right) \cdot 100}{\frac{i}{n}} \]
      8. log1p-udef96.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-rr96.8%

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 82.3% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;n \leq 3 \cdot 10^{-67}:\\
\;\;\;\;100 \cdot \frac{n}{\mathsf{fma}\left(i, -0.5, 1\right) + i \cdot \left(i \cdot 0.08333333333333333\right)}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -3.39999999999999986e-218 or 3.00000000000000032e-67 < n

    1. Initial program 20.8%

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

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

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

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

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

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

    if -3.39999999999999986e-218 < n < 1.72e-267

    1. Initial program 94.4%

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

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

    if 1.72e-267 < n < 3.00000000000000032e-67

    1. Initial program 22.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 75.8% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;i \leq 2.3 \cdot 10^{+256}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if i < -2.1999999999999998e-8 or 6.8000000000000001e-33 < i < 2.2999999999999999e256

    1. Initial program 50.4%

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

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

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

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

    if -2.1999999999999998e-8 < i < 6.8000000000000001e-33

    1. Initial program 8.6%

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

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

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

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

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

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

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

    if 2.2999999999999999e256 < i

    1. Initial program 28.6%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -2.2 \cdot 10^{-8}:\\ \;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\ \mathbf{elif}\;i \leq 6.8 \cdot 10^{-33}:\\ \;\;\;\;100 \cdot \left(n + \left(0.5 - \frac{0.5}{n}\right) \cdot \left(i \cdot n\right)\right)\\ \mathbf{elif}\;i \leq 2.3 \cdot 10^{+256}:\\ \;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \end{array} \]

Alternative 5: 80.8% accurate, 1.0× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -4.99999999999999996e-221 or 4.19999999999999994e-131 < n

    1. Initial program 20.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.99999999999999996e-221 < n < 4.19999999999999994e-131

    1. Initial program 55.9%

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

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

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

Alternative 6: 81.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.9 \cdot 10^{-217} \lor \neg \left(n \leq 2.4 \cdot 10^{-136}\right):\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -1.89999999999999993e-217 or 2.3999999999999999e-136 < n

    1. Initial program 20.7%

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

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

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

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

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

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

    if -1.89999999999999993e-217 < n < 2.3999999999999999e-136

    1. Initial program 55.9%

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

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

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

Alternative 7: 80.8% accurate, 1.0× speedup?

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

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

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

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


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

    1. Initial program 19.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \frac{100 \cdot e^{i} + \color{blue}{-100}}{i} \]
      3. metadata-eval36.5%

        \[\leadsto n \cdot \frac{100 \cdot e^{i} + \color{blue}{100 \cdot -1}}{i} \]
      4. distribute-lft-in36.4%

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

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

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

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

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

    if -1.09999999999999991e-217 < n < 3.10000000000000008e-132

    1. Initial program 55.9%

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

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

    if 3.10000000000000008e-132 < n

    1. Initial program 22.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto n \cdot \frac{\mathsf{expm1}\left(\color{blue}{i}\right)}{\frac{i}{100}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification85.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1.1 \cdot 10^{-217}:\\ \;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\ \mathbf{elif}\;n \leq 3.1 \cdot 10^{-132}:\\ \;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{100}}\\ \end{array} \]

Alternative 8: 63.7% accurate, 6.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -6.5 \cdot 10^{-219} \lor \neg \left(n \leq 4.1 \cdot 10^{-132}\right):\\
\;\;\;\;n \cdot \left(100 + \left(16.666666666666668 \cdot \left(i \cdot i\right) + i \cdot 50\right)\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -6.49999999999999958e-219 or 4.10000000000000007e-132 < n

    1. Initial program 20.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 + \left(16.666666666666668 \cdot \color{blue}{\left(i \cdot i\right)} + 100 \cdot \left(0.5 \cdot i\right)\right)\right) \]
      5. associate-*r*71.6%

        \[\leadsto n \cdot \left(100 + \left(16.666666666666668 \cdot \left(i \cdot i\right) + \color{blue}{\left(100 \cdot 0.5\right) \cdot i}\right)\right) \]
      6. metadata-eval71.6%

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

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

    if -6.49999999999999958e-219 < n < 4.10000000000000007e-132

    1. Initial program 55.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -6.5 \cdot 10^{-219} \lor \neg \left(n \leq 4.1 \cdot 10^{-132}\right):\\ \;\;\;\;n \cdot \left(100 + \left(16.666666666666668 \cdot \left(i \cdot i\right) + i \cdot 50\right)\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\ \end{array} \]

Alternative 9: 58.3% accurate, 8.6× speedup?

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

\\
\begin{array}{l}
t_0 := 100 \cdot \frac{i}{\frac{i}{n}}\\
\mathbf{if}\;i \leq -5 \cdot 10^{+36}:\\
\;\;\;\;t_0\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if i < -4.99999999999999977e36 or 6.99999999999999971e255 < i

    1. Initial program 57.6%

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

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

    if -4.99999999999999977e36 < i < 3200

    1. Initial program 9.3%

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

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

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

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

    if 3200 < i < 6.99999999999999971e255

    1. Initial program 51.7%

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -5 \cdot 10^{+36}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{elif}\;i \leq 3200:\\ \;\;\;\;n \cdot 100\\ \mathbf{elif}\;i \leq 7 \cdot 10^{+255}:\\ \;\;\;\;50 \cdot \left(i \cdot n\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \end{array} \]

Alternative 10: 64.4% accurate, 8.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -4 \cdot 10^{+271}:\\
\;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if n < -3.99999999999999981e271

    1. Initial program 9.9%

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

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

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

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

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

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

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

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

      \[\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 n around inf 91.7%

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

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

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

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

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

    if -3.99999999999999981e271 < n < -2.4000000000000001e-220

    1. Initial program 20.4%

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

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

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

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

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

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

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

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

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

    if -2.4000000000000001e-220 < n < 1.3499999999999999e-134

    1. Initial program 55.9%

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

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

    if 1.3499999999999999e-134 < n

    1. Initial program 22.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot 100 + \color{blue}{n \cdot \left(\left(i \cdot 0.5\right) \cdot 100\right)} \]
      8. distribute-lft-out74.2%

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

        \[\leadsto n \cdot \left(100 + \color{blue}{i \cdot \left(0.5 \cdot 100\right)}\right) \]
      10. metadata-eval74.2%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4 \cdot 10^{+271}:\\ \;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\ \mathbf{elif}\;n \leq -2.4 \cdot 10^{-220}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{elif}\;n \leq 1.35 \cdot 10^{-134}:\\ \;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \]

Alternative 11: 61.8% accurate, 10.2× speedup?

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -1.7e52 or 2.92000000000000004e-67 < n

    1. Initial program 19.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot 100 + \color{blue}{n \cdot \left(\left(i \cdot 0.5\right) \cdot 100\right)} \]
      8. distribute-lft-out68.2%

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

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

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

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

    if -1.7e52 < n < 2.92000000000000004e-67

    1. Initial program 35.9%

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

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

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

Alternative 12: 61.9% accurate, 10.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.3 \cdot 10^{-216} \lor \neg \left(n \leq 1.35 \cdot 10^{-134}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -1.2999999999999999e-216 or 1.3499999999999999e-134 < n

    1. Initial program 20.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot 100 + \color{blue}{n \cdot \left(\left(i \cdot 0.5\right) \cdot 100\right)} \]
      8. distribute-lft-out66.3%

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

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

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

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

    if -1.2999999999999999e-216 < n < 1.3499999999999999e-134

    1. Initial program 55.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1.3 \cdot 10^{-216} \lor \neg \left(n \leq 1.35 \cdot 10^{-134}\right):\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{0}{\frac{i}{n}}\\ \end{array} \]

Alternative 13: 62.0% accurate, 10.2× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -400000:\\
\;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\

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

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


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

    1. Initial program 17.5%

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

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

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

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

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

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

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

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

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

      \[\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 n around inf 48.1%

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

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

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

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

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

    if -4e5 < n < 3.00000000000000032e-67

    1. Initial program 36.7%

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

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

    if 3.00000000000000032e-67 < n

    1. Initial program 22.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot \left(n \cdot \left(i \cdot 0.5\right) + \color{blue}{n}\right) \]
      5. distribute-rgt-in76.7%

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

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

        \[\leadsto n \cdot 100 + \color{blue}{n \cdot \left(\left(i \cdot 0.5\right) \cdot 100\right)} \]
      8. distribute-lft-out76.7%

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

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

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

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

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

Alternative 14: 54.4% accurate, 16.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 3100:\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;50 \cdot \left(i \cdot n\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= i 3100.0) (* n 100.0) (* 50.0 (* i n))))
double code(double i, double n) {
	double tmp;
	if (i <= 3100.0) {
		tmp = n * 100.0;
	} else {
		tmp = 50.0 * (i * n);
	}
	return tmp;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: tmp
    if (i <= 3100.0d0) then
        tmp = n * 100.0d0
    else
        tmp = 50.0d0 * (i * n)
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double tmp;
	if (i <= 3100.0) {
		tmp = n * 100.0;
	} else {
		tmp = 50.0 * (i * n);
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if i <= 3100.0:
		tmp = n * 100.0
	else:
		tmp = 50.0 * (i * n)
	return tmp
function code(i, n)
	tmp = 0.0
	if (i <= 3100.0)
		tmp = Float64(n * 100.0);
	else
		tmp = Float64(50.0 * Float64(i * n));
	end
	return tmp
end
function tmp_2 = code(i, n)
	tmp = 0.0;
	if (i <= 3100.0)
		tmp = n * 100.0;
	else
		tmp = 50.0 * (i * n);
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[LessEqual[i, 3100.0], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 20.3%

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

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

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

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

    if 3100 < i

    1. Initial program 48.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 15: 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 26.3%

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

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

      \[\leadsto 100 \cdot \left(n + \color{blue}{\left(n \cdot i\right) \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)}\right) \]
    2. *-commutative57.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) \]
    3. associate-*r/57.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) \]
    4. metadata-eval57.7%

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

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

      \[\leadsto \color{blue}{i \cdot -50} \]
  7. Simplified2.8%

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

    \[\leadsto i \cdot -50 \]

Alternative 16: 49.1% 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 26.3%

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

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

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

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

    \[\leadsto n \cdot 100 \]

Developer target: 34.2% accurate, 0.5× speedup?

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

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

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


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

Reproduce

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