Compound Interest

Percentage Accurate: 27.7% → 97.3%
Time: 22.6s
Alternatives: 19
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 19 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: 27.7% accurate, 1.0× speedup?

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

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

Alternative 1: 97.3% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-248}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i} \cdot \left(n \cdot 100\right)\\

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{n \cdot \mathsf{fma}\left(t\_0, 100, -100\right)}{i}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 5.0000000000000001e-248

    1. Initial program 30.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000001e-248 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0

    1. Initial program 94.8%

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

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

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

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

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

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

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

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

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

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

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

    if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--1.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq 5 \cdot 10^{-248}:\\ \;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i} \cdot \left(n \cdot 100\right)\\ \mathbf{elif}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq \infty:\\ \;\;\;\;\frac{n \cdot \mathsf{fma}\left({\left(1 + \frac{i}{n}\right)}^{n}, 100, -100\right)}{i}\\ \mathbf{else}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 83.2% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0 \cdot 100\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0

    1. Initial program 30.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(\color{blue}{100 \cdot \frac{e^{i}}{i}} - \frac{100}{i}\right) \]
      3. metadata-eval44.6%

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--45.2%

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

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

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

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

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

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

    1. Initial program 92.0%

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

    if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--1.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 83.2% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{-100 + t\_0 \cdot 100}{\frac{i}{n}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < -0.0

    1. Initial program 30.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(\color{blue}{100 \cdot \frac{e^{i}}{i}} - \frac{100}{i}\right) \]
      3. metadata-eval44.6%

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--45.2%

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

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

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

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

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

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

    1. Initial program 92.0%

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

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

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

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

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

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

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

    if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--1.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 97.4% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-248}:\\
\;\;\;\;n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{i}\\

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{-100 + t\_0 \cdot 100}{\frac{i}{n}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 5.0000000000000001e-248

    1. Initial program 30.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000001e-248 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0

    1. Initial program 94.8%

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

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

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

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

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

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

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

    if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--1.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq 5 \cdot 10^{-248}:\\ \;\;\;\;n \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right) \cdot 100}{i}\\ \mathbf{elif}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq \infty:\\ \;\;\;\;\frac{-100 + {\left(1 + \frac{i}{n}\right)}^{n} \cdot 100}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 97.5% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-248}:\\
\;\;\;\;n \cdot \left(\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i} \cdot 100\right)\\

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{-100 + t\_0 \cdot 100}{\frac{i}{n}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 5.0000000000000001e-248

    1. Initial program 30.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000001e-248 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0

    1. Initial program 94.8%

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

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

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

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

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

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

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

    if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--1.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq 5 \cdot 10^{-248}:\\ \;\;\;\;n \cdot \left(\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i} \cdot 100\right)\\ \mathbf{elif}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq \infty:\\ \;\;\;\;\frac{-100 + {\left(1 + \frac{i}{n}\right)}^{n} \cdot 100}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 97.3% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_1 \leq 5 \cdot 10^{-248}:\\
\;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i} \cdot \left(n \cdot 100\right)\\

\mathbf{elif}\;t\_1 \leq \infty:\\
\;\;\;\;\frac{-100 + t\_0 \cdot 100}{\frac{i}{n}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 5.0000000000000001e-248

    1. Initial program 30.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 5.0000000000000001e-248 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < +inf.0

    1. Initial program 94.8%

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

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

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

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

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

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

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

    if +inf.0 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n))

    1. Initial program 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--1.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq 5 \cdot 10^{-248}:\\ \;\;\;\;\frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i} \cdot \left(n \cdot 100\right)\\ \mathbf{elif}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq \infty:\\ \;\;\;\;\frac{-100 + {\left(1 + \frac{i}{n}\right)}^{n} \cdot 100}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 75.0% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\ \mathbf{if}\;i \leq -1.1 \cdot 10^{-6}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;i \leq 7.2 \cdot 10^{-6}:\\ \;\;\;\;100 \cdot \left(n \cdot \left(1 + \left(\frac{i}{n} \cdot -0.5 + i \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\right)\\ \mathbf{elif}\;i \leq 9 \cdot 10^{+199}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;i \leq 3.6 \cdot 10^{+245}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;50 \cdot \left(i \cdot n\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (* 100.0 (/ (expm1 i) (/ i n)))))
   (if (<= i -1.1e-6)
     t_0
     (if (<= i 7.2e-6)
       (*
        100.0
        (*
         n
         (+ 1.0 (+ (* (/ i n) -0.5) (* i (+ 0.5 (* i 0.16666666666666666)))))))
       (if (<= i 9e+199)
         t_0
         (if (<= i 3.6e+245) (/ 0.0 (/ i n)) (* 50.0 (* i n))))))))
double code(double i, double n) {
	double t_0 = 100.0 * (expm1(i) / (i / n));
	double tmp;
	if (i <= -1.1e-6) {
		tmp = t_0;
	} else if (i <= 7.2e-6) {
		tmp = 100.0 * (n * (1.0 + (((i / n) * -0.5) + (i * (0.5 + (i * 0.16666666666666666))))));
	} else if (i <= 9e+199) {
		tmp = t_0;
	} else if (i <= 3.6e+245) {
		tmp = 0.0 / (i / n);
	} else {
		tmp = 50.0 * (i * n);
	}
	return tmp;
}
public static double code(double i, double n) {
	double t_0 = 100.0 * (Math.expm1(i) / (i / n));
	double tmp;
	if (i <= -1.1e-6) {
		tmp = t_0;
	} else if (i <= 7.2e-6) {
		tmp = 100.0 * (n * (1.0 + (((i / n) * -0.5) + (i * (0.5 + (i * 0.16666666666666666))))));
	} else if (i <= 9e+199) {
		tmp = t_0;
	} else if (i <= 3.6e+245) {
		tmp = 0.0 / (i / n);
	} else {
		tmp = 50.0 * (i * n);
	}
	return tmp;
}
def code(i, n):
	t_0 = 100.0 * (math.expm1(i) / (i / n))
	tmp = 0
	if i <= -1.1e-6:
		tmp = t_0
	elif i <= 7.2e-6:
		tmp = 100.0 * (n * (1.0 + (((i / n) * -0.5) + (i * (0.5 + (i * 0.16666666666666666))))))
	elif i <= 9e+199:
		tmp = t_0
	elif i <= 3.6e+245:
		tmp = 0.0 / (i / n)
	else:
		tmp = 50.0 * (i * n)
	return tmp
function code(i, n)
	t_0 = Float64(100.0 * Float64(expm1(i) / Float64(i / n)))
	tmp = 0.0
	if (i <= -1.1e-6)
		tmp = t_0;
	elseif (i <= 7.2e-6)
		tmp = Float64(100.0 * Float64(n * Float64(1.0 + Float64(Float64(Float64(i / n) * -0.5) + Float64(i * Float64(0.5 + Float64(i * 0.16666666666666666)))))));
	elseif (i <= 9e+199)
		tmp = t_0;
	elseif (i <= 3.6e+245)
		tmp = Float64(0.0 / Float64(i / n));
	else
		tmp = Float64(50.0 * Float64(i * n));
	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, -1.1e-6], t$95$0, If[LessEqual[i, 7.2e-6], N[(100.0 * N[(n * N[(1.0 + N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(i * N[(0.5 + N[(i * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 9e+199], t$95$0, If[LessEqual[i, 3.6e+245], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(50.0 * N[(i * n), $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 -1.1 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;i \leq 7.2 \cdot 10^{-6}:\\
\;\;\;\;100 \cdot \left(n \cdot \left(1 + \left(\frac{i}{n} \cdot -0.5 + i \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\right)\\

\mathbf{elif}\;i \leq 9 \cdot 10^{+199}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;i \leq 3.6 \cdot 10^{+245}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if i < -1.1000000000000001e-6 or 7.19999999999999967e-6 < i < 8.9999999999999994e199

    1. Initial program 49.7%

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

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

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

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

    if -1.1000000000000001e-6 < i < 7.19999999999999967e-6

    1. Initial program 9.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 8.9999999999999994e199 < i < 3.6000000000000002e245

    1. Initial program 37.7%

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

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

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

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

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

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

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

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

    if 3.6000000000000002e245 < i

    1. Initial program 70.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--45.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto 50 \cdot \color{blue}{\left(n \cdot i\right)} \]
    13. Simplified45.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -1.1 \cdot 10^{-6}:\\ \;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\ \mathbf{elif}\;i \leq 7.2 \cdot 10^{-6}:\\ \;\;\;\;100 \cdot \left(n \cdot \left(1 + \left(\frac{i}{n} \cdot -0.5 + i \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\right)\\ \mathbf{elif}\;i \leq 9 \cdot 10^{+199}:\\ \;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\ \mathbf{elif}\;i \leq 3.6 \cdot 10^{+245}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;50 \cdot \left(i \cdot n\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 82.2% accurate, 0.9× speedup?

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

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

\mathbf{elif}\;n \leq 5.2 \cdot 10^{-153}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\

\mathbf{elif}\;n \leq 0.00045:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -2.5e-248 or 4.4999999999999999e-4 < n

    1. Initial program 26.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--41.7%

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

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

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

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

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

    if -2.5e-248 < n < 5.2000000000000003e-153

    1. Initial program 59.8%

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

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

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

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

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

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

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

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

    if 5.2000000000000003e-153 < n < 4.4999999999999999e-4

    1. Initial program 14.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--2.7%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{n}{\color{blue}{0.01} \cdot \frac{i}{\mathsf{expm1}\left(i\right)}} \]
    11. Applied egg-rr42.4%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.5 \cdot 10^{-248}:\\ \;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \mathbf{elif}\;n \leq 5.2 \cdot 10^{-153}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 0.00045:\\ \;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 69.3% accurate, 3.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\ \mathbf{if}\;n \leq -1 \cdot 10^{+125}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;n \leq -5.2 \cdot 10^{-244}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{elif}\;n \leq 6.8 \cdot 10^{-153}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 6.2 \cdot 10^{+23}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0
         (*
          n
          (+
           100.0
           (*
            i
            (+ 50.0 (* i (+ 16.666666666666668 (* i 4.166666666666667)))))))))
   (if (<= n -1e+125)
     t_0
     (if (<= n -5.2e-244)
       (/ n (+ 0.01 (* i -0.005)))
       (if (<= n 6.8e-153)
         (/ 0.0 (/ i n))
         (if (<= n 6.2e+23)
           (/ n (+ 0.01 (* i (- (* i 0.0008333333333333334) 0.005))))
           t_0))))))
double code(double i, double n) {
	double t_0 = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
	double tmp;
	if (n <= -1e+125) {
		tmp = t_0;
	} else if (n <= -5.2e-244) {
		tmp = n / (0.01 + (i * -0.005));
	} else if (n <= 6.8e-153) {
		tmp = 0.0 / (i / n);
	} else if (n <= 6.2e+23) {
		tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: tmp
    t_0 = n * (100.0d0 + (i * (50.0d0 + (i * (16.666666666666668d0 + (i * 4.166666666666667d0))))))
    if (n <= (-1d+125)) then
        tmp = t_0
    else if (n <= (-5.2d-244)) then
        tmp = n / (0.01d0 + (i * (-0.005d0)))
    else if (n <= 6.8d-153) then
        tmp = 0.0d0 / (i / n)
    else if (n <= 6.2d+23) then
        tmp = n / (0.01d0 + (i * ((i * 0.0008333333333333334d0) - 0.005d0)))
    else
        tmp = t_0
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double t_0 = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
	double tmp;
	if (n <= -1e+125) {
		tmp = t_0;
	} else if (n <= -5.2e-244) {
		tmp = n / (0.01 + (i * -0.005));
	} else if (n <= 6.8e-153) {
		tmp = 0.0 / (i / n);
	} else if (n <= 6.2e+23) {
		tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(i, n):
	t_0 = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))))
	tmp = 0
	if n <= -1e+125:
		tmp = t_0
	elif n <= -5.2e-244:
		tmp = n / (0.01 + (i * -0.005))
	elif n <= 6.8e-153:
		tmp = 0.0 / (i / n)
	elif n <= 6.2e+23:
		tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)))
	else:
		tmp = t_0
	return tmp
function code(i, n)
	t_0 = Float64(n * Float64(100.0 + Float64(i * Float64(50.0 + Float64(i * Float64(16.666666666666668 + Float64(i * 4.166666666666667)))))))
	tmp = 0.0
	if (n <= -1e+125)
		tmp = t_0;
	elseif (n <= -5.2e-244)
		tmp = Float64(n / Float64(0.01 + Float64(i * -0.005)));
	elseif (n <= 6.8e-153)
		tmp = Float64(0.0 / Float64(i / n));
	elseif (n <= 6.2e+23)
		tmp = Float64(n / Float64(0.01 + Float64(i * Float64(Float64(i * 0.0008333333333333334) - 0.005))));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(i, n)
	t_0 = n * (100.0 + (i * (50.0 + (i * (16.666666666666668 + (i * 4.166666666666667))))));
	tmp = 0.0;
	if (n <= -1e+125)
		tmp = t_0;
	elseif (n <= -5.2e-244)
		tmp = n / (0.01 + (i * -0.005));
	elseif (n <= 6.8e-153)
		tmp = 0.0 / (i / n);
	elseif (n <= 6.2e+23)
		tmp = n / (0.01 + (i * ((i * 0.0008333333333333334) - 0.005)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * N[(50.0 + N[(i * N[(16.666666666666668 + N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1e+125], t$95$0, If[LessEqual[n, -5.2e-244], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6.8e-153], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6.2e+23], N[(n / N[(0.01 + N[(i * N[(N[(i * 0.0008333333333333334), $MachinePrecision] - 0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\
\mathbf{if}\;n \leq -1 \cdot 10^{+125}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;n \leq -5.2 \cdot 10^{-244}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\

\mathbf{elif}\;n \leq 6.8 \cdot 10^{-153}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\

\mathbf{elif}\;n \leq 6.2 \cdot 10^{+23}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if n < -9.9999999999999992e124 or 6.19999999999999941e23 < n

    1. Initial program 15.3%

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

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

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

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

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg16.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-in16.0%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--47.7%

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

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

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

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

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

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

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

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

    if -9.9999999999999992e124 < n < -5.2000000000000003e-244

    1. Initial program 41.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--31.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.2000000000000003e-244 < n < 6.7999999999999997e-153

    1. Initial program 59.8%

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

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

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

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

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

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

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

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

    if 6.7999999999999997e-153 < n < 6.19999999999999941e23

    1. Initial program 18.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--11.6%

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

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

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

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

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

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

      \[\leadsto n \cdot \color{blue}{\frac{\mathsf{expm1}\left(i\right) \cdot 100}{i}} \]
    10. Step-by-step derivation
      1. clear-num48.4%

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

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

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

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

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

        \[\leadsto \frac{n}{\color{blue}{0.01} \cdot \frac{i}{\mathsf{expm1}\left(i\right)}} \]
    11. Applied egg-rr48.3%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1 \cdot 10^{+125}:\\ \;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\ \mathbf{elif}\;n \leq -5.2 \cdot 10^{-244}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{elif}\;n \leq 6.8 \cdot 10^{-153}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 6.2 \cdot 10^{+23}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 65.9% accurate, 4.1× speedup?

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

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

\mathbf{elif}\;n \leq 5.2 \cdot 10^{-153}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\

\mathbf{elif}\;n \leq 6.2 \cdot 10^{+23}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\

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


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

    1. Initial program 31.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--38.4%

        \[\leadsto n \cdot \color{blue}{\left(100 \cdot \left(\frac{e^{i}}{i} - \frac{1}{i}\right)\right)} \]
      6. div-sub37.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{n}{\color{blue}{0.01} \cdot \frac{i}{\mathsf{expm1}\left(i\right)}} \]
    11. Applied egg-rr83.7%

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

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

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

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

    if -1.8e-245 < n < 5.2000000000000003e-153

    1. Initial program 59.8%

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

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

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

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

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

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

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

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

    if 5.2000000000000003e-153 < n < 6.19999999999999941e23

    1. Initial program 18.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--11.6%

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

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

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

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

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

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

      \[\leadsto n \cdot \color{blue}{\frac{\mathsf{expm1}\left(i\right) \cdot 100}{i}} \]
    10. Step-by-step derivation
      1. clear-num48.4%

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

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

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

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

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

        \[\leadsto \frac{n}{\color{blue}{0.01} \cdot \frac{i}{\mathsf{expm1}\left(i\right)}} \]
    11. Applied egg-rr48.3%

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

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

    if 6.19999999999999941e23 < n

    1. Initial program 15.8%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1.8 \cdot 10^{-245}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{elif}\;n \leq 5.2 \cdot 10^{-153}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 6.2 \cdot 10^{+23}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \left(n + i \cdot \left(n \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 65.5% accurate, 4.4× speedup?

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

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

\mathbf{elif}\;n \leq 5.2 \cdot 10^{-153}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\

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

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


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

    1. Initial program 31.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--38.4%

        \[\leadsto n \cdot \color{blue}{\left(100 \cdot \left(\frac{e^{i}}{i} - \frac{1}{i}\right)\right)} \]
      6. div-sub37.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{n}{\color{blue}{0.01} \cdot \frac{i}{\mathsf{expm1}\left(i\right)}} \]
    11. Applied egg-rr83.7%

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

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

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

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

    if -3.89999999999999979e-246 < n < 5.2000000000000003e-153

    1. Initial program 59.8%

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

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

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

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

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

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

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

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

    if 5.2000000000000003e-153 < n < 1.6000000000000001

    1. Initial program 15.9%

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

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

    if 1.6000000000000001 < n

    1. Initial program 17.0%

      \[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 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*17.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--47.3%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -3.9 \cdot 10^{-246}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{elif}\;n \leq 5.2 \cdot 10^{-153}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 1.6:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 65.9% accurate, 4.4× speedup?

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

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

\mathbf{elif}\;n \leq 8.2 \cdot 10^{-153}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\

\mathbf{elif}\;n \leq 6.2 \cdot 10^{+23}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\

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


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

    1. Initial program 31.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--38.4%

        \[\leadsto n \cdot \color{blue}{\left(100 \cdot \left(\frac{e^{i}}{i} - \frac{1}{i}\right)\right)} \]
      6. div-sub37.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{n}{\color{blue}{0.01} \cdot \frac{i}{\mathsf{expm1}\left(i\right)}} \]
    11. Applied egg-rr83.7%

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

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

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

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

    if -9.4999999999999997e-249 < n < 8.2e-153

    1. Initial program 59.8%

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

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

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

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

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

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

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

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

    if 8.2e-153 < n < 6.19999999999999941e23

    1. Initial program 18.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto n \cdot \color{blue}{\frac{100 \cdot e^{i} - 100}{i}} \]
    6. Step-by-step derivation
      1. div-sub11.6%

        \[\leadsto n \cdot \color{blue}{\left(\frac{100 \cdot e^{i}}{i} - \frac{100}{i}\right)} \]
      2. associate-*r/11.4%

        \[\leadsto n \cdot \left(\color{blue}{100 \cdot \frac{e^{i}}{i}} - \frac{100}{i}\right) \]
      3. metadata-eval11.4%

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \frac{\color{blue}{100 \cdot 1}}{i}\right) \]
      4. associate-*r/11.5%

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--11.6%

        \[\leadsto n \cdot \color{blue}{\left(100 \cdot \left(\frac{e^{i}}{i} - \frac{1}{i}\right)\right)} \]
      6. div-sub11.7%

        \[\leadsto n \cdot \left(100 \cdot \color{blue}{\frac{e^{i} - 1}{i}}\right) \]
      7. *-commutative11.7%

        \[\leadsto n \cdot \color{blue}{\left(\frac{e^{i} - 1}{i} \cdot 100\right)} \]
      8. expm1-define48.4%

        \[\leadsto n \cdot \left(\frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{i} \cdot 100\right) \]
    7. Simplified48.4%

      \[\leadsto n \cdot \color{blue}{\left(\frac{\mathsf{expm1}\left(i\right)}{i} \cdot 100\right)} \]
    8. Step-by-step derivation
      1. associate-*l/48.4%

        \[\leadsto n \cdot \color{blue}{\frac{\mathsf{expm1}\left(i\right) \cdot 100}{i}} \]
    9. Applied egg-rr48.4%

      \[\leadsto n \cdot \color{blue}{\frac{\mathsf{expm1}\left(i\right) \cdot 100}{i}} \]
    10. Step-by-step derivation
      1. clear-num48.4%

        \[\leadsto n \cdot \color{blue}{\frac{1}{\frac{i}{\mathsf{expm1}\left(i\right) \cdot 100}}} \]
      2. un-div-inv48.3%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right) \cdot 100}}} \]
      3. *-un-lft-identity48.3%

        \[\leadsto \frac{n}{\frac{\color{blue}{1 \cdot i}}{\mathsf{expm1}\left(i\right) \cdot 100}} \]
      4. *-commutative48.3%

        \[\leadsto \frac{n}{\frac{1 \cdot i}{\color{blue}{100 \cdot \mathsf{expm1}\left(i\right)}}} \]
      5. times-frac48.3%

        \[\leadsto \frac{n}{\color{blue}{\frac{1}{100} \cdot \frac{i}{\mathsf{expm1}\left(i\right)}}} \]
      6. metadata-eval48.3%

        \[\leadsto \frac{n}{\color{blue}{0.01} \cdot \frac{i}{\mathsf{expm1}\left(i\right)}} \]
    11. Applied egg-rr48.3%

      \[\leadsto \color{blue}{\frac{n}{0.01 \cdot \frac{i}{\mathsf{expm1}\left(i\right)}}} \]
    12. Taylor expanded in i around 0 61.7%

      \[\leadsto \frac{n}{\color{blue}{0.01 + i \cdot \left(0.0008333333333333334 \cdot i - 0.005\right)}} \]

    if 6.19999999999999941e23 < n

    1. Initial program 15.8%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/16.4%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*16.4%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative16.4%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/16.4%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg16.4%

        \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
      6. distribute-lft-in16.4%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. metadata-eval16.4%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \color{blue}{-1}}{i} \]
      8. metadata-eval16.4%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{-100}}{i} \]
      9. metadata-eval16.4%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{\left(-100\right)}}{i} \]
      10. fma-define16.4%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}}{i} \]
      11. metadata-eval16.4%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified16.4%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Add Preprocessing
    5. Taylor expanded in n around inf 44.9%

      \[\leadsto n \cdot \color{blue}{\frac{100 \cdot e^{i} - 100}{i}} \]
    6. Step-by-step derivation
      1. div-sub45.1%

        \[\leadsto n \cdot \color{blue}{\left(\frac{100 \cdot e^{i}}{i} - \frac{100}{i}\right)} \]
      2. associate-*r/46.6%

        \[\leadsto n \cdot \left(\color{blue}{100 \cdot \frac{e^{i}}{i}} - \frac{100}{i}\right) \]
      3. metadata-eval46.6%

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \frac{\color{blue}{100 \cdot 1}}{i}\right) \]
      4. associate-*r/46.0%

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--46.0%

        \[\leadsto n \cdot \color{blue}{\left(100 \cdot \left(\frac{e^{i}}{i} - \frac{1}{i}\right)\right)} \]
      6. div-sub44.9%

        \[\leadsto n \cdot \left(100 \cdot \color{blue}{\frac{e^{i} - 1}{i}}\right) \]
      7. *-commutative44.9%

        \[\leadsto n \cdot \color{blue}{\left(\frac{e^{i} - 1}{i} \cdot 100\right)} \]
      8. expm1-define98.4%

        \[\leadsto n \cdot \left(\frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{i} \cdot 100\right) \]
    7. Simplified98.4%

      \[\leadsto n \cdot \color{blue}{\left(\frac{\mathsf{expm1}\left(i\right)}{i} \cdot 100\right)} \]
    8. Taylor expanded in i around 0 76.2%

      \[\leadsto n \cdot \color{blue}{\left(100 + i \cdot \left(50 + 16.666666666666668 \cdot i\right)\right)} \]
    9. Step-by-step derivation
      1. *-commutative76.2%

        \[\leadsto n \cdot \left(100 + i \cdot \left(50 + \color{blue}{i \cdot 16.666666666666668}\right)\right) \]
    10. Simplified76.2%

      \[\leadsto n \cdot \color{blue}{\left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification67.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -9.5 \cdot 10^{-249}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{elif}\;n \leq 8.2 \cdot 10^{-153}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 6.2 \cdot 10^{+23}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot \left(i \cdot 0.0008333333333333334 - 0.005\right)}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 63.8% accurate, 5.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{if}\;n \leq -1.05 \cdot 10^{-245}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;n \leq 5.2 \cdot 10^{-153}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 6.8 \cdot 10^{+25}:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (/ n (+ 0.01 (* i -0.005)))))
   (if (<= n -1.05e-245)
     t_0
     (if (<= n 5.2e-153)
       (/ 0.0 (/ i n))
       (if (<= n 6.8e+25) t_0 (* n (+ 100.0 (* i 50.0))))))))
double code(double i, double n) {
	double t_0 = n / (0.01 + (i * -0.005));
	double tmp;
	if (n <= -1.05e-245) {
		tmp = t_0;
	} else if (n <= 5.2e-153) {
		tmp = 0.0 / (i / n);
	} else if (n <= 6.8e+25) {
		tmp = t_0;
	} else {
		tmp = n * (100.0 + (i * 50.0));
	}
	return tmp;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: tmp
    t_0 = n / (0.01d0 + (i * (-0.005d0)))
    if (n <= (-1.05d-245)) then
        tmp = t_0
    else if (n <= 5.2d-153) then
        tmp = 0.0d0 / (i / n)
    else if (n <= 6.8d+25) then
        tmp = t_0
    else
        tmp = n * (100.0d0 + (i * 50.0d0))
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double t_0 = n / (0.01 + (i * -0.005));
	double tmp;
	if (n <= -1.05e-245) {
		tmp = t_0;
	} else if (n <= 5.2e-153) {
		tmp = 0.0 / (i / n);
	} else if (n <= 6.8e+25) {
		tmp = t_0;
	} else {
		tmp = n * (100.0 + (i * 50.0));
	}
	return tmp;
}
def code(i, n):
	t_0 = n / (0.01 + (i * -0.005))
	tmp = 0
	if n <= -1.05e-245:
		tmp = t_0
	elif n <= 5.2e-153:
		tmp = 0.0 / (i / n)
	elif n <= 6.8e+25:
		tmp = t_0
	else:
		tmp = n * (100.0 + (i * 50.0))
	return tmp
function code(i, n)
	t_0 = Float64(n / Float64(0.01 + Float64(i * -0.005)))
	tmp = 0.0
	if (n <= -1.05e-245)
		tmp = t_0;
	elseif (n <= 5.2e-153)
		tmp = Float64(0.0 / Float64(i / n));
	elseif (n <= 6.8e+25)
		tmp = t_0;
	else
		tmp = Float64(n * Float64(100.0 + Float64(i * 50.0)));
	end
	return tmp
end
function tmp_2 = code(i, n)
	t_0 = n / (0.01 + (i * -0.005));
	tmp = 0.0;
	if (n <= -1.05e-245)
		tmp = t_0;
	elseif (n <= 5.2e-153)
		tmp = 0.0 / (i / n);
	elseif (n <= 6.8e+25)
		tmp = t_0;
	else
		tmp = n * (100.0 + (i * 50.0));
	end
	tmp_2 = tmp;
end
code[i_, n_] := Block[{t$95$0 = N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.05e-245], t$95$0, If[LessEqual[n, 5.2e-153], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6.8e+25], t$95$0, N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{if}\;n \leq -1.05 \cdot 10^{-245}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;n \leq 5.2 \cdot 10^{-153}:\\
\;\;\;\;\frac{0}{\frac{i}{n}}\\

\mathbf{elif}\;n \leq 6.8 \cdot 10^{+25}:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -1.05000000000000005e-245 or 5.2000000000000003e-153 < n < 6.79999999999999967e25

    1. Initial program 28.7%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/28.7%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*28.7%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative28.7%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/28.7%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg28.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-in28.7%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. metadata-eval28.7%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \color{blue}{-1}}{i} \]
      8. metadata-eval28.7%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{-100}}{i} \]
      9. metadata-eval28.7%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{\left(-100\right)}}{i} \]
      10. fma-define28.7%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}}{i} \]
      11. metadata-eval28.7%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified28.7%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Add Preprocessing
    5. Taylor expanded in n around inf 32.1%

      \[\leadsto n \cdot \color{blue}{\frac{100 \cdot e^{i} - 100}{i}} \]
    6. Step-by-step derivation
      1. div-sub32.1%

        \[\leadsto n \cdot \color{blue}{\left(\frac{100 \cdot e^{i}}{i} - \frac{100}{i}\right)} \]
      2. associate-*r/32.0%

        \[\leadsto n \cdot \left(\color{blue}{100 \cdot \frac{e^{i}}{i}} - \frac{100}{i}\right) \]
      3. metadata-eval32.0%

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \frac{\color{blue}{100 \cdot 1}}{i}\right) \]
      4. associate-*r/32.1%

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--32.6%

        \[\leadsto n \cdot \color{blue}{\left(100 \cdot \left(\frac{e^{i}}{i} - \frac{1}{i}\right)\right)} \]
      6. div-sub32.1%

        \[\leadsto n \cdot \left(100 \cdot \color{blue}{\frac{e^{i} - 1}{i}}\right) \]
      7. *-commutative32.1%

        \[\leadsto n \cdot \color{blue}{\left(\frac{e^{i} - 1}{i} \cdot 100\right)} \]
      8. expm1-define76.1%

        \[\leadsto n \cdot \left(\frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{i} \cdot 100\right) \]
    7. Simplified76.1%

      \[\leadsto n \cdot \color{blue}{\left(\frac{\mathsf{expm1}\left(i\right)}{i} \cdot 100\right)} \]
    8. Step-by-step derivation
      1. associate-*l/76.0%

        \[\leadsto n \cdot \color{blue}{\frac{\mathsf{expm1}\left(i\right) \cdot 100}{i}} \]
    9. Applied egg-rr76.0%

      \[\leadsto n \cdot \color{blue}{\frac{\mathsf{expm1}\left(i\right) \cdot 100}{i}} \]
    10. Step-by-step derivation
      1. clear-num76.0%

        \[\leadsto n \cdot \color{blue}{\frac{1}{\frac{i}{\mathsf{expm1}\left(i\right) \cdot 100}}} \]
      2. un-div-inv76.0%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right) \cdot 100}}} \]
      3. *-un-lft-identity76.0%

        \[\leadsto \frac{n}{\frac{\color{blue}{1 \cdot i}}{\mathsf{expm1}\left(i\right) \cdot 100}} \]
      4. *-commutative76.0%

        \[\leadsto \frac{n}{\frac{1 \cdot i}{\color{blue}{100 \cdot \mathsf{expm1}\left(i\right)}}} \]
      5. times-frac76.0%

        \[\leadsto \frac{n}{\color{blue}{\frac{1}{100} \cdot \frac{i}{\mathsf{expm1}\left(i\right)}}} \]
      6. metadata-eval76.0%

        \[\leadsto \frac{n}{\color{blue}{0.01} \cdot \frac{i}{\mathsf{expm1}\left(i\right)}} \]
    11. Applied egg-rr76.0%

      \[\leadsto \color{blue}{\frac{n}{0.01 \cdot \frac{i}{\mathsf{expm1}\left(i\right)}}} \]
    12. Taylor expanded in i around 0 61.6%

      \[\leadsto \frac{n}{\color{blue}{0.01 + -0.005 \cdot i}} \]
    13. Step-by-step derivation
      1. *-commutative61.6%

        \[\leadsto \frac{n}{0.01 + \color{blue}{i \cdot -0.005}} \]
    14. Simplified61.6%

      \[\leadsto \frac{n}{\color{blue}{0.01 + i \cdot -0.005}} \]

    if -1.05000000000000005e-245 < n < 5.2000000000000003e-153

    1. Initial program 59.8%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-*r/59.8%

        \[\leadsto \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{\frac{i}{n}}} \]
      2. sub-neg59.8%

        \[\leadsto \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{\frac{i}{n}} \]
      3. distribute-rgt-in59.8%

        \[\leadsto \frac{\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n} \cdot 100 + \left(-1\right) \cdot 100}}{\frac{i}{n}} \]
      4. metadata-eval59.8%

        \[\leadsto \frac{{\left(1 + \frac{i}{n}\right)}^{n} \cdot 100 + \color{blue}{-1} \cdot 100}{\frac{i}{n}} \]
      5. metadata-eval59.8%

        \[\leadsto \frac{{\left(1 + \frac{i}{n}\right)}^{n} \cdot 100 + \color{blue}{-100}}{\frac{i}{n}} \]
    3. Simplified59.8%

      \[\leadsto \color{blue}{\frac{{\left(1 + \frac{i}{n}\right)}^{n} \cdot 100 + -100}{\frac{i}{n}}} \]
    4. Add Preprocessing
    5. Taylor expanded in i around 0 75.4%

      \[\leadsto \frac{\color{blue}{1} \cdot 100 + -100}{\frac{i}{n}} \]

    if 6.79999999999999967e25 < n

    1. Initial program 15.8%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/16.4%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*16.4%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative16.4%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/16.4%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg16.4%

        \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
      6. distribute-lft-in16.4%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. metadata-eval16.4%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \color{blue}{-1}}{i} \]
      8. metadata-eval16.4%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{-100}}{i} \]
      9. metadata-eval16.4%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{\left(-100\right)}}{i} \]
      10. fma-define16.4%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}}{i} \]
      11. metadata-eval16.4%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified16.4%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Add Preprocessing
    5. Taylor expanded in n around inf 44.9%

      \[\leadsto n \cdot \color{blue}{\frac{100 \cdot e^{i} - 100}{i}} \]
    6. Step-by-step derivation
      1. div-sub45.1%

        \[\leadsto n \cdot \color{blue}{\left(\frac{100 \cdot e^{i}}{i} - \frac{100}{i}\right)} \]
      2. associate-*r/46.6%

        \[\leadsto n \cdot \left(\color{blue}{100 \cdot \frac{e^{i}}{i}} - \frac{100}{i}\right) \]
      3. metadata-eval46.6%

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \frac{\color{blue}{100 \cdot 1}}{i}\right) \]
      4. associate-*r/46.0%

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--46.0%

        \[\leadsto n \cdot \color{blue}{\left(100 \cdot \left(\frac{e^{i}}{i} - \frac{1}{i}\right)\right)} \]
      6. div-sub44.9%

        \[\leadsto n \cdot \left(100 \cdot \color{blue}{\frac{e^{i} - 1}{i}}\right) \]
      7. *-commutative44.9%

        \[\leadsto n \cdot \color{blue}{\left(\frac{e^{i} - 1}{i} \cdot 100\right)} \]
      8. expm1-define98.4%

        \[\leadsto n \cdot \left(\frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{i} \cdot 100\right) \]
    7. Simplified98.4%

      \[\leadsto n \cdot \color{blue}{\left(\frac{\mathsf{expm1}\left(i\right)}{i} \cdot 100\right)} \]
    8. Taylor expanded in i around 0 71.6%

      \[\leadsto \color{blue}{50 \cdot \left(i \cdot n\right) + 100 \cdot n} \]
    9. Step-by-step derivation
      1. +-commutative71.6%

        \[\leadsto \color{blue}{100 \cdot n + 50 \cdot \left(i \cdot n\right)} \]
      2. associate-*r*71.6%

        \[\leadsto 100 \cdot n + \color{blue}{\left(50 \cdot i\right) \cdot n} \]
      3. distribute-rgt-in71.6%

        \[\leadsto \color{blue}{n \cdot \left(100 + 50 \cdot i\right)} \]
      4. *-commutative71.6%

        \[\leadsto \color{blue}{\left(100 + 50 \cdot i\right) \cdot n} \]
    10. Simplified71.6%

      \[\leadsto \color{blue}{\left(100 + 50 \cdot i\right) \cdot n} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification66.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1.05 \cdot 10^{-245}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{elif}\;n \leq 5.2 \cdot 10^{-153}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 6.8 \cdot 10^{+25}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 56.1% accurate, 6.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -5 \cdot 10^{+67} \lor \neg \left(n \leq 2 \cdot 10^{-37}\right):\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (or (<= n -5e+67) (not (<= n 2e-37)))
   (* n 100.0)
   (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
	double tmp;
	if ((n <= -5e+67) || !(n <= 2e-37)) {
		tmp = n * 100.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 <= (-5d+67)) .or. (.not. (n <= 2d-37))) then
        tmp = n * 100.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 <= -5e+67) || !(n <= 2e-37)) {
		tmp = n * 100.0;
	} else {
		tmp = 100.0 * (i / (i / n));
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if (n <= -5e+67) or not (n <= 2e-37):
		tmp = n * 100.0
	else:
		tmp = 100.0 * (i / (i / n))
	return tmp
function code(i, n)
	tmp = 0.0
	if ((n <= -5e+67) || !(n <= 2e-37))
		tmp = Float64(n * 100.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 <= -5e+67) || ~((n <= 2e-37)))
		tmp = n * 100.0;
	else
		tmp = 100.0 * (i / (i / n));
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[Or[LessEqual[n, -5e+67], N[Not[LessEqual[n, 2e-37]], $MachinePrecision]], N[(n * 100.0), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -5 \cdot 10^{+67} \lor \neg \left(n \leq 2 \cdot 10^{-37}\right):\\
\;\;\;\;n \cdot 100\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -4.99999999999999976e67 or 2.00000000000000013e-37 < n

    1. Initial program 20.8%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Add Preprocessing
    3. Taylor expanded in i around 0 54.5%

      \[\leadsto \color{blue}{100 \cdot n} \]
    4. Step-by-step derivation
      1. *-commutative54.5%

        \[\leadsto \color{blue}{n \cdot 100} \]
    5. Simplified54.5%

      \[\leadsto \color{blue}{n \cdot 100} \]

    if -4.99999999999999976e67 < n < 2.00000000000000013e-37

    1. Initial program 39.0%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Add Preprocessing
    3. Taylor expanded in i around 0 60.5%

      \[\leadsto 100 \cdot \frac{\color{blue}{i}}{\frac{i}{n}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification57.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -5 \cdot 10^{+67} \lor \neg \left(n \leq 2 \cdot 10^{-37}\right):\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 62.3% accurate, 6.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -2.6 \cdot 10^{+67} \lor \neg \left(n \leq 1.52\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 -2.6e+67) (not (<= n 1.52)))
   (* n (+ 100.0 (* i 50.0)))
   (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
	double tmp;
	if ((n <= -2.6e+67) || !(n <= 1.52)) {
		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 <= (-2.6d+67)) .or. (.not. (n <= 1.52d0))) 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 <= -2.6e+67) || !(n <= 1.52)) {
		tmp = n * (100.0 + (i * 50.0));
	} else {
		tmp = 100.0 * (i / (i / n));
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if (n <= -2.6e+67) or not (n <= 1.52):
		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 <= -2.6e+67) || !(n <= 1.52))
		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 <= -2.6e+67) || ~((n <= 1.52)))
		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, -2.6e+67], N[Not[LessEqual[n, 1.52]], $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 -2.6 \cdot 10^{+67} \lor \neg \left(n \leq 1.52\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 < -2.6e67 or 1.52 < n

    1. Initial program 19.9%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/20.5%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*20.5%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative20.5%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/20.6%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg20.6%

        \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
      6. distribute-lft-in20.6%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. metadata-eval20.6%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \color{blue}{-1}}{i} \]
      8. metadata-eval20.6%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{-100}}{i} \]
      9. metadata-eval20.6%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{\left(-100\right)}}{i} \]
      10. fma-define20.6%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}}{i} \]
      11. metadata-eval20.6%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified20.6%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Add Preprocessing
    5. Taylor expanded in n around inf 44.9%

      \[\leadsto n \cdot \color{blue}{\frac{100 \cdot e^{i} - 100}{i}} \]
    6. Step-by-step derivation
      1. div-sub45.0%

        \[\leadsto n \cdot \color{blue}{\left(\frac{100 \cdot e^{i}}{i} - \frac{100}{i}\right)} \]
      2. associate-*r/45.8%

        \[\leadsto n \cdot \left(\color{blue}{100 \cdot \frac{e^{i}}{i}} - \frac{100}{i}\right) \]
      3. metadata-eval45.8%

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \frac{\color{blue}{100 \cdot 1}}{i}\right) \]
      4. associate-*r/45.4%

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--46.0%

        \[\leadsto n \cdot \color{blue}{\left(100 \cdot \left(\frac{e^{i}}{i} - \frac{1}{i}\right)\right)} \]
      6. div-sub44.9%

        \[\leadsto n \cdot \left(100 \cdot \color{blue}{\frac{e^{i} - 1}{i}}\right) \]
      7. *-commutative44.9%

        \[\leadsto n \cdot \color{blue}{\left(\frac{e^{i} - 1}{i} \cdot 100\right)} \]
      8. expm1-define95.2%

        \[\leadsto n \cdot \left(\frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{i} \cdot 100\right) \]
    7. Simplified95.2%

      \[\leadsto n \cdot \color{blue}{\left(\frac{\mathsf{expm1}\left(i\right)}{i} \cdot 100\right)} \]
    8. Taylor expanded in i around 0 64.0%

      \[\leadsto \color{blue}{50 \cdot \left(i \cdot n\right) + 100 \cdot n} \]
    9. Step-by-step derivation
      1. +-commutative64.0%

        \[\leadsto \color{blue}{100 \cdot n + 50 \cdot \left(i \cdot n\right)} \]
      2. associate-*r*64.0%

        \[\leadsto 100 \cdot n + \color{blue}{\left(50 \cdot i\right) \cdot n} \]
      3. distribute-rgt-in64.0%

        \[\leadsto \color{blue}{n \cdot \left(100 + 50 \cdot i\right)} \]
      4. *-commutative64.0%

        \[\leadsto \color{blue}{\left(100 + 50 \cdot i\right) \cdot n} \]
    10. Simplified64.0%

      \[\leadsto \color{blue}{\left(100 + 50 \cdot i\right) \cdot n} \]

    if -2.6e67 < n < 1.52

    1. Initial program 39.4%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Add Preprocessing
    3. Taylor expanded in i around 0 59.7%

      \[\leadsto 100 \cdot \frac{\color{blue}{i}}{\frac{i}{n}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification62.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.6 \cdot 10^{+67} \lor \neg \left(n \leq 1.52\right):\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 62.0% accurate, 9.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq 6.2 \cdot 10^{+23}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= n 6.2e+23) (/ n (+ 0.01 (* i -0.005))) (* n (+ 100.0 (* i 50.0)))))
double code(double i, double n) {
	double tmp;
	if (n <= 6.2e+23) {
		tmp = n / (0.01 + (i * -0.005));
	} 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 <= 6.2d+23) then
        tmp = n / (0.01d0 + (i * (-0.005d0)))
    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 <= 6.2e+23) {
		tmp = n / (0.01 + (i * -0.005));
	} else {
		tmp = n * (100.0 + (i * 50.0));
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if n <= 6.2e+23:
		tmp = n / (0.01 + (i * -0.005))
	else:
		tmp = n * (100.0 + (i * 50.0))
	return tmp
function code(i, n)
	tmp = 0.0
	if (n <= 6.2e+23)
		tmp = Float64(n / Float64(0.01 + Float64(i * -0.005)));
	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 <= 6.2e+23)
		tmp = n / (0.01 + (i * -0.005));
	else
		tmp = n * (100.0 + (i * 50.0));
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[LessEqual[n, 6.2e+23], N[(n / N[(0.01 + N[(i * -0.005), $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 6.2 \cdot 10^{+23}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\

\mathbf{else}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < 6.19999999999999941e23

    1. Initial program 34.0%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/34.0%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*34.0%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative34.0%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/34.0%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg34.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-in34.0%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. metadata-eval34.0%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \color{blue}{-1}}{i} \]
      8. metadata-eval34.0%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{-100}}{i} \]
      9. metadata-eval34.0%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{\left(-100\right)}}{i} \]
      10. fma-define34.0%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}}{i} \]
      11. metadata-eval34.0%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified34.0%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Add Preprocessing
    5. Taylor expanded in n around inf 33.4%

      \[\leadsto n \cdot \color{blue}{\frac{100 \cdot e^{i} - 100}{i}} \]
    6. Step-by-step derivation
      1. div-sub33.4%

        \[\leadsto n \cdot \color{blue}{\left(\frac{100 \cdot e^{i}}{i} - \frac{100}{i}\right)} \]
      2. associate-*r/33.2%

        \[\leadsto n \cdot \left(\color{blue}{100 \cdot \frac{e^{i}}{i}} - \frac{100}{i}\right) \]
      3. metadata-eval33.2%

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \frac{\color{blue}{100 \cdot 1}}{i}\right) \]
      4. associate-*r/33.4%

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--33.8%

        \[\leadsto n \cdot \color{blue}{\left(100 \cdot \left(\frac{e^{i}}{i} - \frac{1}{i}\right)\right)} \]
      6. div-sub33.4%

        \[\leadsto n \cdot \left(100 \cdot \color{blue}{\frac{e^{i} - 1}{i}}\right) \]
      7. *-commutative33.4%

        \[\leadsto n \cdot \color{blue}{\left(\frac{e^{i} - 1}{i} \cdot 100\right)} \]
      8. expm1-define68.3%

        \[\leadsto n \cdot \left(\frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{i} \cdot 100\right) \]
    7. Simplified68.3%

      \[\leadsto n \cdot \color{blue}{\left(\frac{\mathsf{expm1}\left(i\right)}{i} \cdot 100\right)} \]
    8. Step-by-step derivation
      1. associate-*l/68.3%

        \[\leadsto n \cdot \color{blue}{\frac{\mathsf{expm1}\left(i\right) \cdot 100}{i}} \]
    9. Applied egg-rr68.3%

      \[\leadsto n \cdot \color{blue}{\frac{\mathsf{expm1}\left(i\right) \cdot 100}{i}} \]
    10. Step-by-step derivation
      1. clear-num68.3%

        \[\leadsto n \cdot \color{blue}{\frac{1}{\frac{i}{\mathsf{expm1}\left(i\right) \cdot 100}}} \]
      2. un-div-inv68.2%

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{expm1}\left(i\right) \cdot 100}}} \]
      3. *-un-lft-identity68.2%

        \[\leadsto \frac{n}{\frac{\color{blue}{1 \cdot i}}{\mathsf{expm1}\left(i\right) \cdot 100}} \]
      4. *-commutative68.2%

        \[\leadsto \frac{n}{\frac{1 \cdot i}{\color{blue}{100 \cdot \mathsf{expm1}\left(i\right)}}} \]
      5. times-frac68.3%

        \[\leadsto \frac{n}{\color{blue}{\frac{1}{100} \cdot \frac{i}{\mathsf{expm1}\left(i\right)}}} \]
      6. metadata-eval68.3%

        \[\leadsto \frac{n}{\color{blue}{0.01} \cdot \frac{i}{\mathsf{expm1}\left(i\right)}} \]
    11. Applied egg-rr68.3%

      \[\leadsto \color{blue}{\frac{n}{0.01 \cdot \frac{i}{\mathsf{expm1}\left(i\right)}}} \]
    12. Taylor expanded in i around 0 58.8%

      \[\leadsto \frac{n}{\color{blue}{0.01 + -0.005 \cdot i}} \]
    13. Step-by-step derivation
      1. *-commutative58.8%

        \[\leadsto \frac{n}{0.01 + \color{blue}{i \cdot -0.005}} \]
    14. Simplified58.8%

      \[\leadsto \frac{n}{\color{blue}{0.01 + i \cdot -0.005}} \]

    if 6.19999999999999941e23 < n

    1. Initial program 15.8%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/16.4%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*16.4%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative16.4%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/16.4%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg16.4%

        \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
      6. distribute-lft-in16.4%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. metadata-eval16.4%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \color{blue}{-1}}{i} \]
      8. metadata-eval16.4%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{-100}}{i} \]
      9. metadata-eval16.4%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{\left(-100\right)}}{i} \]
      10. fma-define16.4%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}}{i} \]
      11. metadata-eval16.4%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified16.4%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Add Preprocessing
    5. Taylor expanded in n around inf 44.9%

      \[\leadsto n \cdot \color{blue}{\frac{100 \cdot e^{i} - 100}{i}} \]
    6. Step-by-step derivation
      1. div-sub45.1%

        \[\leadsto n \cdot \color{blue}{\left(\frac{100 \cdot e^{i}}{i} - \frac{100}{i}\right)} \]
      2. associate-*r/46.6%

        \[\leadsto n \cdot \left(\color{blue}{100 \cdot \frac{e^{i}}{i}} - \frac{100}{i}\right) \]
      3. metadata-eval46.6%

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \frac{\color{blue}{100 \cdot 1}}{i}\right) \]
      4. associate-*r/46.0%

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--46.0%

        \[\leadsto n \cdot \color{blue}{\left(100 \cdot \left(\frac{e^{i}}{i} - \frac{1}{i}\right)\right)} \]
      6. div-sub44.9%

        \[\leadsto n \cdot \left(100 \cdot \color{blue}{\frac{e^{i} - 1}{i}}\right) \]
      7. *-commutative44.9%

        \[\leadsto n \cdot \color{blue}{\left(\frac{e^{i} - 1}{i} \cdot 100\right)} \]
      8. expm1-define98.4%

        \[\leadsto n \cdot \left(\frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{i} \cdot 100\right) \]
    7. Simplified98.4%

      \[\leadsto n \cdot \color{blue}{\left(\frac{\mathsf{expm1}\left(i\right)}{i} \cdot 100\right)} \]
    8. Taylor expanded in i around 0 71.6%

      \[\leadsto \color{blue}{50 \cdot \left(i \cdot n\right) + 100 \cdot n} \]
    9. Step-by-step derivation
      1. +-commutative71.6%

        \[\leadsto \color{blue}{100 \cdot n + 50 \cdot \left(i \cdot n\right)} \]
      2. associate-*r*71.6%

        \[\leadsto 100 \cdot n + \color{blue}{\left(50 \cdot i\right) \cdot n} \]
      3. distribute-rgt-in71.6%

        \[\leadsto \color{blue}{n \cdot \left(100 + 50 \cdot i\right)} \]
      4. *-commutative71.6%

        \[\leadsto \color{blue}{\left(100 + 50 \cdot i\right) \cdot n} \]
    10. Simplified71.6%

      \[\leadsto \color{blue}{\left(100 + 50 \cdot i\right) \cdot n} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification62.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq 6.2 \cdot 10^{+23}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 54.4% accurate, 11.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 1.9 \cdot 10^{+34}:\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;50 \cdot \left(i \cdot n\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= i 1.9e+34) (* n 100.0) (* 50.0 (* i n))))
double code(double i, double n) {
	double tmp;
	if (i <= 1.9e+34) {
		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 <= 1.9d+34) 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 <= 1.9e+34) {
		tmp = n * 100.0;
	} else {
		tmp = 50.0 * (i * n);
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if i <= 1.9e+34:
		tmp = n * 100.0
	else:
		tmp = 50.0 * (i * n)
	return tmp
function code(i, n)
	tmp = 0.0
	if (i <= 1.9e+34)
		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 <= 1.9e+34)
		tmp = n * 100.0;
	else
		tmp = 50.0 * (i * n);
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[LessEqual[i, 1.9e+34], N[(n * 100.0), $MachinePrecision], N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.9 \cdot 10^{+34}:\\
\;\;\;\;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 < 1.9000000000000001e34

    1. Initial program 25.9%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Add Preprocessing
    3. Taylor expanded in i around 0 59.5%

      \[\leadsto \color{blue}{100 \cdot n} \]
    4. Step-by-step derivation
      1. *-commutative59.5%

        \[\leadsto \color{blue}{n \cdot 100} \]
    5. Simplified59.5%

      \[\leadsto \color{blue}{n \cdot 100} \]

    if 1.9000000000000001e34 < i

    1. Initial program 41.0%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. associate-/r/41.3%

        \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
      2. associate-*r*41.3%

        \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
      3. *-commutative41.3%

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
      4. associate-*r/41.4%

        \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
      5. sub-neg41.4%

        \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
      6. distribute-lft-in41.4%

        \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
      7. metadata-eval41.4%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \color{blue}{-1}}{i} \]
      8. metadata-eval41.4%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{-100}}{i} \]
      9. metadata-eval41.4%

        \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{\left(-100\right)}}{i} \]
      10. fma-define41.4%

        \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}}{i} \]
      11. metadata-eval41.4%

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
    3. Simplified41.4%

      \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
    4. Add Preprocessing
    5. Taylor expanded in n around inf 48.0%

      \[\leadsto n \cdot \color{blue}{\frac{100 \cdot e^{i} - 100}{i}} \]
    6. Step-by-step derivation
      1. div-sub48.0%

        \[\leadsto n \cdot \color{blue}{\left(\frac{100 \cdot e^{i}}{i} - \frac{100}{i}\right)} \]
      2. associate-*r/48.0%

        \[\leadsto n \cdot \left(\color{blue}{100 \cdot \frac{e^{i}}{i}} - \frac{100}{i}\right) \]
      3. metadata-eval48.0%

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \frac{\color{blue}{100 \cdot 1}}{i}\right) \]
      4. associate-*r/48.0%

        \[\leadsto n \cdot \left(100 \cdot \frac{e^{i}}{i} - \color{blue}{100 \cdot \frac{1}{i}}\right) \]
      5. distribute-lft-out--48.0%

        \[\leadsto n \cdot \color{blue}{\left(100 \cdot \left(\frac{e^{i}}{i} - \frac{1}{i}\right)\right)} \]
      6. div-sub48.0%

        \[\leadsto n \cdot \left(100 \cdot \color{blue}{\frac{e^{i} - 1}{i}}\right) \]
      7. *-commutative48.0%

        \[\leadsto n \cdot \color{blue}{\left(\frac{e^{i} - 1}{i} \cdot 100\right)} \]
      8. expm1-define48.0%

        \[\leadsto n \cdot \left(\frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{i} \cdot 100\right) \]
    7. Simplified48.0%

      \[\leadsto n \cdot \color{blue}{\left(\frac{\mathsf{expm1}\left(i\right)}{i} \cdot 100\right)} \]
    8. Step-by-step derivation
      1. associate-*l/48.0%

        \[\leadsto n \cdot \color{blue}{\frac{\mathsf{expm1}\left(i\right) \cdot 100}{i}} \]
    9. Applied egg-rr48.0%

      \[\leadsto n \cdot \color{blue}{\frac{\mathsf{expm1}\left(i\right) \cdot 100}{i}} \]
    10. Taylor expanded in i around 0 27.8%

      \[\leadsto n \cdot \frac{\color{blue}{i \cdot \left(100 + 50 \cdot i\right)}}{i} \]
    11. Taylor expanded in i around inf 26.4%

      \[\leadsto \color{blue}{50 \cdot \left(i \cdot n\right)} \]
    12. Step-by-step derivation
      1. *-commutative26.4%

        \[\leadsto 50 \cdot \color{blue}{\left(n \cdot i\right)} \]
    13. Simplified26.4%

      \[\leadsto \color{blue}{50 \cdot \left(n \cdot i\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification52.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq 1.9 \cdot 10^{+34}:\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;50 \cdot \left(i \cdot n\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 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 29.2%

    \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
  2. Step-by-step derivation
    1. associate-/r/29.3%

      \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
    2. associate-*r*29.3%

      \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
    3. *-commutative29.3%

      \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
    4. associate-*r/29.3%

      \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
    5. sub-neg29.3%

      \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
    6. distribute-lft-in29.3%

      \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
    7. metadata-eval29.3%

      \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \color{blue}{-1}}{i} \]
    8. metadata-eval29.3%

      \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{-100}}{i} \]
    9. metadata-eval29.3%

      \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{\left(-100\right)}}{i} \]
    10. fma-define29.3%

      \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}}{i} \]
    11. metadata-eval29.3%

      \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
  3. Simplified29.3%

    \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
  4. Add Preprocessing
  5. Taylor expanded in i around 0 51.6%

    \[\leadsto n \cdot \color{blue}{\left(100 + 100 \cdot \left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)\right)} \]
  6. Step-by-step derivation
    1. *-commutative51.6%

      \[\leadsto n \cdot \left(100 + \color{blue}{\left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right) \cdot 100}\right) \]
    2. associate-*r/51.6%

      \[\leadsto n \cdot \left(100 + \left(i \cdot \left(0.5 - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)\right) \cdot 100\right) \]
    3. metadata-eval51.6%

      \[\leadsto n \cdot \left(100 + \left(i \cdot \left(0.5 - \frac{\color{blue}{0.5}}{n}\right)\right) \cdot 100\right) \]
  7. Simplified51.6%

    \[\leadsto n \cdot \color{blue}{\left(100 + \left(i \cdot \left(0.5 - \frac{0.5}{n}\right)\right) \cdot 100\right)} \]
  8. Taylor expanded in n around 0 2.7%

    \[\leadsto \color{blue}{-50 \cdot i} \]
  9. Step-by-step derivation
    1. *-commutative2.7%

      \[\leadsto \color{blue}{i \cdot -50} \]
  10. Simplified2.7%

    \[\leadsto \color{blue}{i \cdot -50} \]
  11. Final simplification2.7%

    \[\leadsto i \cdot -50 \]
  12. Add Preprocessing

Alternative 19: 49.0% accurate, 38.0× speedup?

\[\begin{array}{l} \\ n \cdot 100 \end{array} \]
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
	return n * 100.0;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    code = n * 100.0d0
end function
public static double code(double i, double n) {
	return n * 100.0;
}
def code(i, n):
	return n * 100.0
function code(i, n)
	return Float64(n * 100.0)
end
function tmp = code(i, n)
	tmp = n * 100.0;
end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}

\\
n \cdot 100
\end{array}
Derivation
  1. Initial program 29.2%

    \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
  2. Add Preprocessing
  3. Taylor expanded in i around 0 47.7%

    \[\leadsto \color{blue}{100 \cdot n} \]
  4. Step-by-step derivation
    1. *-commutative47.7%

      \[\leadsto \color{blue}{n \cdot 100} \]
  5. Simplified47.7%

    \[\leadsto \color{blue}{n \cdot 100} \]
  6. Final simplification47.7%

    \[\leadsto n \cdot 100 \]
  7. Add Preprocessing

Developer target: 34.5% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + \frac{i}{n}\\ 100 \cdot \frac{e^{n \cdot \begin{array}{l} \mathbf{if}\;t\_0 = 1:\\ \;\;\;\;\frac{i}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{i}{n} \cdot \log t\_0}{\left(\frac{i}{n} + 1\right) - 1}\\ \end{array}} - 1}{\frac{i}{n}} \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (+ 1.0 (/ i n))))
   (*
    100.0
    (/
     (-
      (exp
       (*
        n
        (if (== t_0 1.0)
          (/ i n)
          (/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
      1.0)
     (/ i n)))))
double code(double i, double n) {
	double t_0 = 1.0 + (i / n);
	double tmp;
	if (t_0 == 1.0) {
		tmp = i / n;
	} else {
		tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
	}
	return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 + (i / n)
    if (t_0 == 1.0d0) then
        tmp = i / n
    else
        tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
    end if
    code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
	double t_0 = 1.0 + (i / n);
	double tmp;
	if (t_0 == 1.0) {
		tmp = i / n;
	} else {
		tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
	}
	return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n):
	t_0 = 1.0 + (i / n)
	tmp = 0
	if t_0 == 1.0:
		tmp = i / n
	else:
		tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0)
	return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n)
	t_0 = Float64(1.0 + Float64(i / n))
	tmp = 0.0
	if (t_0 == 1.0)
		tmp = Float64(i / n);
	else
		tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0));
	end
	return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n)))
end
function tmp_2 = code(i, n)
	t_0 = 1.0 + (i / n);
	tmp = 0.0;
	if (t_0 == 1.0)
		tmp = i / n;
	else
		tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
	end
	tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t\_0 = 1:\\
\;\;\;\;\frac{i}{n}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{n} \cdot \log t\_0}{\left(\frac{i}{n} + 1\right) - 1}\\


\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024095 
(FPCore (i n)
  :name "Compound Interest"
  :precision binary64

  :alt
  (* 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))))