Compound Interest

Percentage Accurate: 28.5% → 84.0%
Time: 23.9s
Alternatives: 15
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 15 alternatives:

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

Initial Program: 28.5% 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: 84.0% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\


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

    1. Initial program 96.0%

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

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

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

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

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

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

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

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

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

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

    if -1.00000000000000002e-169 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0

    1. Initial program 15.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{100 \cdot e^{i} - 100}}} \]
      2. fma-neg32.8%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
      3. metadata-eval32.8%

        \[\leadsto \frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, \color{blue}{-100}\right)}} \]
    6. Simplified32.8%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
    7. Taylor expanded in i around inf 32.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-n\right) \cdot \left(-\color{blue}{\frac{100}{\frac{i}{\mathsf{expm1}\left(i\right)}}}\right) \]
      9. distribute-neg-frac77.3%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-n \cdot -100}}{\frac{i}{\mathsf{expm1}\left(i\right)}} \]
      3. distribute-rgt-neg-in77.3%

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

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

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

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

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

    1. Initial program 95.0%

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \color{blue}{-1}\right)}{i} \]
      8. 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. Taylor expanded in n around inf 1.9%

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{100 \cdot e^{i} - 100}}} \]
      2. fma-neg1.9%

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

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

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
    7. Taylor expanded in i around 0 99.9%

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

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

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

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

Alternative 2: 84.0% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t_1 \leq 0:\\
\;\;\;\;\frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\


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

    1. Initial program 96.0%

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

    if -1.00000000000000002e-169 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < 0.0

    1. Initial program 15.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{100 \cdot e^{i} - 100}}} \]
      2. fma-neg32.8%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
      3. metadata-eval32.8%

        \[\leadsto \frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, \color{blue}{-100}\right)}} \]
    6. Simplified32.8%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
    7. Taylor expanded in i around inf 32.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-n\right) \cdot \left(-\color{blue}{\frac{100}{\frac{i}{\mathsf{expm1}\left(i\right)}}}\right) \]
      9. distribute-neg-frac77.3%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-n \cdot -100}}{\frac{i}{\mathsf{expm1}\left(i\right)}} \]
      3. distribute-rgt-neg-in77.3%

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

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

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

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

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

    1. Initial program 95.0%

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

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

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

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

        \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, 100 \cdot \color{blue}{-1}\right)}{i} \]
      8. 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. Taylor expanded in n around inf 1.9%

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{100 \cdot e^{i} - 100}}} \]
      2. fma-neg1.9%

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

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

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
    7. Taylor expanded in i around 0 99.9%

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

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

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

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

Alternative 3: 76.3% accurate, 1.0× speedup?

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

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

\mathbf{elif}\;i \leq -3.9 \cdot 10^{-166}:\\
\;\;\;\;\frac{n \cdot \left(i \cdot \left(100 + i \cdot 50\right)\right)}{i}\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if i < -1.99999999999999992e-23 or 9.00000000000000018e-38 < i

    1. Initial program 43.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.99999999999999992e-23 < i < -3.89999999999999999e-166

    1. Initial program 15.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{n \cdot \left(i \cdot \left(100 + i \cdot \color{blue}{50}\right)\right)}{i} \]
    11. Applied egg-rr89.4%

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

    if -3.89999999999999999e-166 < i < 9.00000000000000018e-38

    1. Initial program 4.6%

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

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

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

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

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

      \[\leadsto \color{blue}{100 \cdot n + 100 \cdot \left(i \cdot \left(n \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)\right)} \]
    5. Step-by-step derivation
      1. distribute-lft-out93.7%

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -2 \cdot 10^{-23}:\\ \;\;\;\;100 \cdot \left(\mathsf{expm1}\left(i\right) \cdot \frac{n}{i}\right)\\ \mathbf{elif}\;i \leq -3.9 \cdot 10^{-166}:\\ \;\;\;\;\frac{n \cdot \left(i \cdot \left(100 + i \cdot 50\right)\right)}{i}\\ \mathbf{elif}\;i \leq 9 \cdot 10^{-38}:\\ \;\;\;\;100 \cdot \left(n + i \cdot \left(n \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \left(\mathsf{expm1}\left(i\right) \cdot \frac{n}{i}\right)\\ \end{array} \]

Alternative 4: 81.6% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;n \leq 0.19:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -4.7e-198 or 0.19 < n

    1. Initial program 22.4%

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

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

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

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

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

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

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

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

    if -4.7e-198 < n < 1.75e-188

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

    if 1.75e-188 < n < 0.19

    1. Initial program 10.5%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
      3. metadata-eval3.3%

        \[\leadsto \frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, \color{blue}{-100}\right)}} \]
    6. Simplified3.3%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
    7. Taylor expanded in i around 0 67.4%

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

        \[\leadsto \frac{n}{0.01 + \color{blue}{i \cdot -0.005}} \]
    9. Simplified67.4%

      \[\leadsto \frac{n}{\color{blue}{0.01 + i \cdot -0.005}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification81.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4.7 \cdot 10^{-198}:\\ \;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \mathbf{elif}\;n \leq 1.75 \cdot 10^{-188}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 0.19:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \end{array} \]

Alternative 5: 81.6% accurate, 1.0× speedup?

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

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

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

\mathbf{elif}\;n \leq 0.5:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -4.79999999999999973e-198 or 0.5 < n

    1. Initial program 22.4%

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

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

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

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

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

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

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

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

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

    if -4.79999999999999973e-198 < n < 4.40000000000000026e-186

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

    if 4.40000000000000026e-186 < n < 0.5

    1. Initial program 10.5%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
      3. metadata-eval3.3%

        \[\leadsto \frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, \color{blue}{-100}\right)}} \]
    6. Simplified3.3%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
    7. Taylor expanded in i around 0 67.4%

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

        \[\leadsto \frac{n}{0.01 + \color{blue}{i \cdot -0.005}} \]
    9. Simplified67.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4.8 \cdot 10^{-198}:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \mathbf{elif}\;n \leq 4.4 \cdot 10^{-186}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 0.5:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \end{array} \]

Alternative 6: 81.5% accurate, 1.0× speedup?

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

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

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

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

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


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

    1. Initial program 22.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{100 \cdot e^{i} - 100}}} \]
      2. fma-neg28.0%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
      3. metadata-eval28.0%

        \[\leadsto \frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, \color{blue}{-100}\right)}} \]
    6. Simplified28.0%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
    7. Taylor expanded in i around inf 28.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(-n\right) \cdot \left(-\color{blue}{\frac{100}{\frac{i}{\mathsf{expm1}\left(i\right)}}}\right) \]
      9. distribute-neg-frac82.3%

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

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

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

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

        \[\leadsto \frac{\color{blue}{-n \cdot -100}}{\frac{i}{\mathsf{expm1}\left(i\right)}} \]
      3. distribute-rgt-neg-in82.4%

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

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

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

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

    if -5.89999999999999974e-198 < n < 1.1e-183

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

    if 1.1e-183 < n < 4.3999999999999999e-5

    1. Initial program 10.5%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
      3. metadata-eval3.3%

        \[\leadsto \frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, \color{blue}{-100}\right)}} \]
    6. Simplified3.3%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
    7. Taylor expanded in i around 0 67.4%

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

        \[\leadsto \frac{n}{0.01 + \color{blue}{i \cdot -0.005}} \]
    9. Simplified67.4%

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

    if 4.3999999999999999e-5 < n

    1. Initial program 22.4%

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -5.9 \cdot 10^{-198}:\\ \;\;\;\;\frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \mathbf{elif}\;n \leq 1.1 \cdot 10^{-183}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 4.4 \cdot 10^{-5}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \end{array} \]

Alternative 7: 68.1% accurate, 3.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{if}\;n \leq -3.5 \cdot 10^{+210}:\\ \;\;\;\;n \cdot \left(100 + 100 \cdot \left(i \cdot \left(0.5 - \frac{0.5}{n}\right) + \left(i \cdot i\right) \cdot \left(0.16666666666666666 + \left(\frac{0.3333333333333333}{n \cdot n} - \frac{0.5}{n}\right)\right)\right)\right)\\ \mathbf{elif}\;n \leq -4.5 \cdot 10^{-198}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;n \leq 1.75 \cdot 10^{-188}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 3.3:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{n \cdot \left(i \cdot \left(100 + i \cdot 50\right)\right)}{i}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (/ n (+ 0.01 (* i -0.005)))))
   (if (<= n -3.5e+210)
     (*
      n
      (+
       100.0
       (*
        100.0
        (+
         (* i (- 0.5 (/ 0.5 n)))
         (*
          (* i i)
          (+
           0.16666666666666666
           (- (/ 0.3333333333333333 (* n n)) (/ 0.5 n))))))))
     (if (<= n -4.5e-198)
       t_0
       (if (<= n 1.75e-188)
         (/ 0.0 (/ i n))
         (if (<= n 3.3) t_0 (/ (* n (* i (+ 100.0 (* i 50.0)))) i)))))))
double code(double i, double n) {
	double t_0 = n / (0.01 + (i * -0.005));
	double tmp;
	if (n <= -3.5e+210) {
		tmp = n * (100.0 + (100.0 * ((i * (0.5 - (0.5 / n))) + ((i * i) * (0.16666666666666666 + ((0.3333333333333333 / (n * n)) - (0.5 / n)))))));
	} else if (n <= -4.5e-198) {
		tmp = t_0;
	} else if (n <= 1.75e-188) {
		tmp = 0.0 / (i / n);
	} else if (n <= 3.3) {
		tmp = t_0;
	} else {
		tmp = (n * (i * (100.0 + (i * 50.0)))) / i;
	}
	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 <= (-3.5d+210)) then
        tmp = n * (100.0d0 + (100.0d0 * ((i * (0.5d0 - (0.5d0 / n))) + ((i * i) * (0.16666666666666666d0 + ((0.3333333333333333d0 / (n * n)) - (0.5d0 / n)))))))
    else if (n <= (-4.5d-198)) then
        tmp = t_0
    else if (n <= 1.75d-188) then
        tmp = 0.0d0 / (i / n)
    else if (n <= 3.3d0) then
        tmp = t_0
    else
        tmp = (n * (i * (100.0d0 + (i * 50.0d0)))) / i
    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 <= -3.5e+210) {
		tmp = n * (100.0 + (100.0 * ((i * (0.5 - (0.5 / n))) + ((i * i) * (0.16666666666666666 + ((0.3333333333333333 / (n * n)) - (0.5 / n)))))));
	} else if (n <= -4.5e-198) {
		tmp = t_0;
	} else if (n <= 1.75e-188) {
		tmp = 0.0 / (i / n);
	} else if (n <= 3.3) {
		tmp = t_0;
	} else {
		tmp = (n * (i * (100.0 + (i * 50.0)))) / i;
	}
	return tmp;
}
def code(i, n):
	t_0 = n / (0.01 + (i * -0.005))
	tmp = 0
	if n <= -3.5e+210:
		tmp = n * (100.0 + (100.0 * ((i * (0.5 - (0.5 / n))) + ((i * i) * (0.16666666666666666 + ((0.3333333333333333 / (n * n)) - (0.5 / n)))))))
	elif n <= -4.5e-198:
		tmp = t_0
	elif n <= 1.75e-188:
		tmp = 0.0 / (i / n)
	elif n <= 3.3:
		tmp = t_0
	else:
		tmp = (n * (i * (100.0 + (i * 50.0)))) / i
	return tmp
function code(i, n)
	t_0 = Float64(n / Float64(0.01 + Float64(i * -0.005)))
	tmp = 0.0
	if (n <= -3.5e+210)
		tmp = Float64(n * Float64(100.0 + Float64(100.0 * Float64(Float64(i * Float64(0.5 - Float64(0.5 / n))) + Float64(Float64(i * i) * Float64(0.16666666666666666 + Float64(Float64(0.3333333333333333 / Float64(n * n)) - Float64(0.5 / n))))))));
	elseif (n <= -4.5e-198)
		tmp = t_0;
	elseif (n <= 1.75e-188)
		tmp = Float64(0.0 / Float64(i / n));
	elseif (n <= 3.3)
		tmp = t_0;
	else
		tmp = Float64(Float64(n * Float64(i * Float64(100.0 + Float64(i * 50.0)))) / i);
	end
	return tmp
end
function tmp_2 = code(i, n)
	t_0 = n / (0.01 + (i * -0.005));
	tmp = 0.0;
	if (n <= -3.5e+210)
		tmp = n * (100.0 + (100.0 * ((i * (0.5 - (0.5 / n))) + ((i * i) * (0.16666666666666666 + ((0.3333333333333333 / (n * n)) - (0.5 / n)))))));
	elseif (n <= -4.5e-198)
		tmp = t_0;
	elseif (n <= 1.75e-188)
		tmp = 0.0 / (i / n);
	elseif (n <= 3.3)
		tmp = t_0;
	else
		tmp = (n * (i * (100.0 + (i * 50.0)))) / i;
	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, -3.5e+210], N[(n * N[(100.0 + N[(100.0 * N[(N[(i * N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(i * i), $MachinePrecision] * N[(0.16666666666666666 + N[(N[(0.3333333333333333 / N[(n * n), $MachinePrecision]), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -4.5e-198], t$95$0, If[LessEqual[n, 1.75e-188], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.3], t$95$0, N[(N[(n * N[(i * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{if}\;n \leq -3.5 \cdot 10^{+210}:\\
\;\;\;\;n \cdot \left(100 + 100 \cdot \left(i \cdot \left(0.5 - \frac{0.5}{n}\right) + \left(i \cdot i\right) \cdot \left(0.16666666666666666 + \left(\frac{0.3333333333333333}{n \cdot n} - \frac{0.5}{n}\right)\right)\right)\right)\\

\mathbf{elif}\;n \leq -4.5 \cdot 10^{-198}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;n \leq 3.3:\\
\;\;\;\;t_0\\

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


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

    1. Initial program 15.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.5e210 < n < -4.4999999999999998e-198 or 1.75e-188 < n < 3.2999999999999998

    1. Initial program 19.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
      3. metadata-eval15.3%

        \[\leadsto \frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, \color{blue}{-100}\right)}} \]
    6. Simplified15.3%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
    7. Taylor expanded in i around 0 67.0%

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

        \[\leadsto \frac{n}{0.01 + \color{blue}{i \cdot -0.005}} \]
    9. Simplified67.0%

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

    if -4.4999999999999998e-198 < n < 1.75e-188

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

    if 3.2999999999999998 < n

    1. Initial program 22.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -3.5 \cdot 10^{+210}:\\ \;\;\;\;n \cdot \left(100 + 100 \cdot \left(i \cdot \left(0.5 - \frac{0.5}{n}\right) + \left(i \cdot i\right) \cdot \left(0.16666666666666666 + \left(\frac{0.3333333333333333}{n \cdot n} - \frac{0.5}{n}\right)\right)\right)\right)\\ \mathbf{elif}\;n \leq -4.5 \cdot 10^{-198}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{elif}\;n \leq 1.75 \cdot 10^{-188}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 3.3:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{else}:\\ \;\;\;\;\frac{n \cdot \left(i \cdot \left(100 + i \cdot 50\right)\right)}{i}\\ \end{array} \]

Alternative 8: 67.9% accurate, 5.9× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{n}{0.01 + i \cdot -0.005}\\
t_1 := \frac{n \cdot \left(i \cdot \left(100 + i \cdot 50\right)\right)}{i}\\
\mathbf{if}\;n \leq -3.6 \cdot 10^{+210}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;n \leq -5.2 \cdot 10^{-198}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;n \leq 3.3:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -3.6000000000000003e210 or 3.2999999999999998 < n

    1. Initial program 20.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.6000000000000003e210 < n < -5.20000000000000014e-198 or 2.24999999999999997e-188 < n < 3.2999999999999998

    1. Initial program 19.4%

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
      3. metadata-eval15.3%

        \[\leadsto \frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, \color{blue}{-100}\right)}} \]
    6. Simplified15.3%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
    7. Taylor expanded in i around 0 67.0%

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

        \[\leadsto \frac{n}{0.01 + \color{blue}{i \cdot -0.005}} \]
    9. Simplified67.0%

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

    if -5.20000000000000014e-198 < n < 2.24999999999999997e-188

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -3.6 \cdot 10^{+210}:\\ \;\;\;\;\frac{n \cdot \left(i \cdot \left(100 + i \cdot 50\right)\right)}{i}\\ \mathbf{elif}\;n \leq -5.2 \cdot 10^{-198}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{elif}\;n \leq 2.25 \cdot 10^{-188}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 3.3:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{else}:\\ \;\;\;\;\frac{n \cdot \left(i \cdot \left(100 + i \cdot 50\right)\right)}{i}\\ \end{array} \]

Alternative 9: 64.4% accurate, 7.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{if}\;n \leq -4.5 \cdot 10^{-198}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;n \leq 1.1 \cdot 10^{-187}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 5.8 \cdot 10^{-6}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;n \cdot 100 + 50 \cdot \left(i \cdot n\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (/ n (+ 0.01 (* i -0.005)))))
   (if (<= n -4.5e-198)
     t_0
     (if (<= n 1.1e-187)
       (/ 0.0 (/ i n))
       (if (<= n 5.8e-6) t_0 (+ (* n 100.0) (* 50.0 (* i n))))))))
double code(double i, double n) {
	double t_0 = n / (0.01 + (i * -0.005));
	double tmp;
	if (n <= -4.5e-198) {
		tmp = t_0;
	} else if (n <= 1.1e-187) {
		tmp = 0.0 / (i / n);
	} else if (n <= 5.8e-6) {
		tmp = t_0;
	} else {
		tmp = (n * 100.0) + (50.0 * (i * n));
	}
	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 <= (-4.5d-198)) then
        tmp = t_0
    else if (n <= 1.1d-187) then
        tmp = 0.0d0 / (i / n)
    else if (n <= 5.8d-6) then
        tmp = t_0
    else
        tmp = (n * 100.0d0) + (50.0d0 * (i * n))
    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 <= -4.5e-198) {
		tmp = t_0;
	} else if (n <= 1.1e-187) {
		tmp = 0.0 / (i / n);
	} else if (n <= 5.8e-6) {
		tmp = t_0;
	} else {
		tmp = (n * 100.0) + (50.0 * (i * n));
	}
	return tmp;
}
def code(i, n):
	t_0 = n / (0.01 + (i * -0.005))
	tmp = 0
	if n <= -4.5e-198:
		tmp = t_0
	elif n <= 1.1e-187:
		tmp = 0.0 / (i / n)
	elif n <= 5.8e-6:
		tmp = t_0
	else:
		tmp = (n * 100.0) + (50.0 * (i * n))
	return tmp
function code(i, n)
	t_0 = Float64(n / Float64(0.01 + Float64(i * -0.005)))
	tmp = 0.0
	if (n <= -4.5e-198)
		tmp = t_0;
	elseif (n <= 1.1e-187)
		tmp = Float64(0.0 / Float64(i / n));
	elseif (n <= 5.8e-6)
		tmp = t_0;
	else
		tmp = Float64(Float64(n * 100.0) + Float64(50.0 * Float64(i * n)));
	end
	return tmp
end
function tmp_2 = code(i, n)
	t_0 = n / (0.01 + (i * -0.005));
	tmp = 0.0;
	if (n <= -4.5e-198)
		tmp = t_0;
	elseif (n <= 1.1e-187)
		tmp = 0.0 / (i / n);
	elseif (n <= 5.8e-6)
		tmp = t_0;
	else
		tmp = (n * 100.0) + (50.0 * (i * n));
	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, -4.5e-198], t$95$0, If[LessEqual[n, 1.1e-187], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.8e-6], t$95$0, N[(N[(n * 100.0), $MachinePrecision] + N[(50.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{n}{0.01 + i \cdot -0.005}\\
\mathbf{if}\;n \leq -4.5 \cdot 10^{-198}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;n \leq 5.8 \cdot 10^{-6}:\\
\;\;\;\;t_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -4.4999999999999998e-198 or 1.10000000000000004e-187 < n < 5.8000000000000004e-6

    1. Initial program 18.8%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{100 \cdot e^{i} - 100}}} \]
      2. fma-neg20.5%

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

        \[\leadsto \frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, \color{blue}{-100}\right)}} \]
    6. Simplified20.5%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
    7. Taylor expanded in i around 0 65.0%

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

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

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

    if -4.4999999999999998e-198 < n < 1.10000000000000004e-187

    1. Initial program 55.5%

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

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

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

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

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

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

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

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

    if 5.8000000000000004e-6 < n

    1. Initial program 22.4%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4.5 \cdot 10^{-198}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{elif}\;n \leq 1.1 \cdot 10^{-187}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 5.8 \cdot 10^{-6}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{else}:\\ \;\;\;\;n \cdot 100 + 50 \cdot \left(i \cdot n\right)\\ \end{array} \]

Alternative 10: 61.0% accurate, 10.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.75:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\

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


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

    1. Initial program 17.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{100 \cdot e^{i} - 100}}} \]
      2. fma-neg24.8%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
      3. metadata-eval24.8%

        \[\leadsto \frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, \color{blue}{-100}\right)}} \]
    6. Simplified24.8%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
    7. Taylor expanded in i around 0 72.5%

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

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

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

    if 1.75 < i

    1. Initial program 44.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto n \cdot \frac{\color{blue}{50 \cdot {i}^{2}}}{i} \]
    11. Step-by-step derivation
      1. unpow232.8%

        \[\leadsto n \cdot \frac{50 \cdot \color{blue}{\left(i \cdot i\right)}}{i} \]
    12. Simplified32.8%

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

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

Alternative 11: 62.1% accurate, 10.3× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq 0.0082:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\

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


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

    1. Initial program 24.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, \color{blue}{-100}\right)}} \]
    6. Simplified24.1%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
    7. Taylor expanded in i around 0 62.0%

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

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

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

    if 0.00820000000000000069 < n

    1. Initial program 22.4%

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq 0.0082:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{else}:\\ \;\;\;\;n \cdot 100 + 50 \cdot \left(i \cdot n\right)\\ \end{array} \]

Alternative 12: 60.2% accurate, 12.6× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.75:\\
\;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\

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


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

    1. Initial program 17.4%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{100 \cdot e^{i} - 100}}} \]
      2. fma-neg24.8%

        \[\leadsto \frac{n}{\frac{i}{\color{blue}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
      3. metadata-eval24.8%

        \[\leadsto \frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, \color{blue}{-100}\right)}} \]
    6. Simplified24.8%

      \[\leadsto \color{blue}{\frac{n}{\frac{i}{\mathsf{fma}\left(100, e^{i}, -100\right)}}} \]
    7. Taylor expanded in i around 0 72.5%

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

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

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

    if 1.75 < i

    1. Initial program 44.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 13: 54.8% accurate, 16.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;i \leq 5.2 \cdot 10^{+25}:\\
\;\;\;\;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 < 5.1999999999999997e25

    1. Initial program 17.6%

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

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

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

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

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

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

        \[\leadsto \color{blue}{n \cdot 100} \]
    6. Simplified66.7%

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

    if 5.1999999999999997e25 < i

    1. Initial program 46.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 14: 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 24.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto i \cdot -50 \]

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

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

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

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

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

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

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

      \[\leadsto \color{blue}{n \cdot 100} \]
  6. Simplified53.0%

    \[\leadsto \color{blue}{n \cdot 100} \]
  7. Final simplification53.0%

    \[\leadsto n \cdot 100 \]

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 2023297 
(FPCore (i n)
  :name "Compound Interest"
  :precision binary64

  :herbie-target
  (* 100.0 (/ (- (exp (* n (if (== (+ 1.0 (/ i n)) 1.0) (/ i n) (/ (* (/ i n) (log (+ 1.0 (/ i n)))) (- (+ (/ i n) 1.0) 1.0))))) 1.0) (/ i n)))

  (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))