Compound Interest

Percentage Accurate: 28.9% → 96.0%
Time: 13.1s
Alternatives: 15
Speedup: 24.3×

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.9% 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: 96.0% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \mathsf{fma}\left(t\_0, 100, -100\right)\\
t_2 := \frac{t\_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{-13}:\\
\;\;\;\;n \cdot \frac{t\_1}{i}\\

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

\mathbf{elif}\;t\_2 \leq \infty:\\
\;\;\;\;t\_1 \cdot \frac{n}{i}\\

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


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

    1. Initial program 99.6%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 100 \cdot \frac{{\left(1 + \color{blue}{\frac{i}{n}}\right)}^{n} - 1}{\frac{i}{n}} \]
      2. lift-+.f64N/A

        \[\leadsto 100 \cdot \frac{{\color{blue}{\left(1 + \frac{i}{n}\right)}}^{n} - 1}{\frac{i}{n}} \]
      3. lift-pow.f64N/A

        \[\leadsto 100 \cdot \frac{\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n}} - 1}{\frac{i}{n}} \]
      4. lift--.f64N/A

        \[\leadsto 100 \cdot \frac{\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n} - 1}}{\frac{i}{n}} \]
      5. *-rgt-identityN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right) \cdot 1}}{\frac{i}{n}} \]
      6. lift-/.f64N/A

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

        \[\leadsto 100 \cdot \color{blue}{\left(\left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right) \cdot \frac{1}{\frac{i}{n}}\right)} \]
      8. div-invN/A

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

        \[\leadsto \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{\frac{i}{n}}} \]
      10. lift-/.f64N/A

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

        \[\leadsto \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i} \cdot n} \]
      12. lower-*.f64N/A

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

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

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

    1. Initial program 25.1%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 100 \cdot \frac{{\left(1 + \color{blue}{\frac{i}{n}}\right)}^{n} - 1}{\frac{i}{n}} \]
      2. lift-+.f64N/A

        \[\leadsto 100 \cdot \frac{{\color{blue}{\left(1 + \frac{i}{n}\right)}}^{n} - 1}{\frac{i}{n}} \]
      3. sqr-powN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{{\left(1 + \frac{i}{n}\right)}^{\left(\frac{n}{2}\right)} \cdot {\left(1 + \frac{i}{n}\right)}^{\left(\frac{n}{2}\right)}} - 1}{\frac{i}{n}} \]
      4. sqr-powN/A

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

        \[\leadsto 100 \cdot \frac{\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1}{\frac{i}{n}} \]
      6. lower-expm1.f64N/A

        \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(\log \left(1 + \frac{i}{n}\right) \cdot n\right)}}{\frac{i}{n}} \]
      7. *-commutativeN/A

        \[\leadsto 100 \cdot \frac{\mathsf{expm1}\left(\color{blue}{n \cdot \log \left(1 + \frac{i}{n}\right)}\right)}{\frac{i}{n}} \]
      8. lower-*.f64N/A

        \[\leadsto 100 \cdot \frac{\mathsf{expm1}\left(\color{blue}{n \cdot \log \left(1 + \frac{i}{n}\right)}\right)}{\frac{i}{n}} \]
      9. lift-+.f64N/A

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

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

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

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

    1. Initial program 97.9%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. lift-/.f64N/A

        \[\leadsto 100 \cdot \frac{{\left(1 + \color{blue}{\frac{i}{n}}\right)}^{n} - 1}{\frac{i}{n}} \]
      2. lift-+.f64N/A

        \[\leadsto 100 \cdot \frac{{\color{blue}{\left(1 + \frac{i}{n}\right)}}^{n} - 1}{\frac{i}{n}} \]
      3. lift-pow.f64N/A

        \[\leadsto 100 \cdot \frac{\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n}} - 1}{\frac{i}{n}} \]
      4. lift--.f64N/A

        \[\leadsto 100 \cdot \frac{\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n} - 1}}{\frac{i}{n}} \]
      5. *-rgt-identityN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right) \cdot 1}}{\frac{i}{n}} \]
      6. lift-/.f64N/A

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

        \[\leadsto 100 \cdot \color{blue}{\left(\left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right) \cdot \frac{1}{\frac{i}{n}}\right)} \]
      8. lift-/.f64N/A

        \[\leadsto 100 \cdot \left(\left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right) \cdot \frac{1}{\color{blue}{\frac{i}{n}}}\right) \]
      9. clear-numN/A

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

        \[\leadsto \color{blue}{\left(100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)\right) \cdot \frac{n}{i}} \]
      11. lower-*.f64N/A

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

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

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

    1. Initial program 0.0%

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

      \[\leadsto \color{blue}{100 \cdot n} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{n \cdot 100} \]
      2. lower-*.f6473.8

        \[\leadsto \color{blue}{n \cdot 100} \]
    5. Applied rewrites73.8%

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

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

Alternative 2: 80.8% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;n \leq 2.9 \cdot 10^{-147}:\\
\;\;\;\;\frac{n \cdot \left(n \cdot 100\right)}{n}\\

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

\mathbf{else}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot t\_0\\


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

    1. Initial program 26.5%

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

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

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

      \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
    6. Step-by-step derivation
      1. lift-expm1.f64N/A

        \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
      2. lift-/.f64N/A

        \[\leadsto 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\color{blue}{\frac{i}{n}}} \]
      3. lift-/.f64N/A

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

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

        \[\leadsto \color{blue}{\left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right) \cdot n} \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right) \cdot n} \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)} \cdot n \]
      8. lower-/.f6478.9

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

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

    if -2.7e-219 < n < 2.9000000000000001e-147

    1. Initial program 45.2%

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

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

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

      \[\leadsto 100 \cdot \color{blue}{\mathsf{fma}\left(n \cdot i, \mathsf{fma}\left(i, \frac{0.3333333333333333}{n \cdot n} + \left(0.16666666666666666 + \frac{-0.5}{n}\right), 0.5 - \frac{0.5}{n}\right), n\right)} \]
    6. Taylor expanded in n around 0

      \[\leadsto \color{blue}{\frac{\frac{100}{3} \cdot {i}^{2} + n \cdot \left(100 \cdot \left(i \cdot \left(\frac{-1}{2} \cdot i - \frac{1}{2}\right)\right) + 100 \cdot \left(n \cdot \left(1 + i \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot i\right)\right)\right)\right)}{n}} \]
    7. Step-by-step derivation
      1. lower-/.f64N/A

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(n, 100 \cdot \mathsf{fma}\left(n, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 0.16666666666666666, 0.5\right), 1\right), i \cdot \mathsf{fma}\left(i, -0.5, -0.5\right)\right), \left(i \cdot i\right) \cdot 33.333333333333336\right)}{n}} \]
    9. Taylor expanded in i around 0

      \[\leadsto \frac{\color{blue}{100 \cdot {n}^{2}}}{n} \]
    10. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \frac{\color{blue}{{n}^{2} \cdot 100}}{n} \]
      2. unpow2N/A

        \[\leadsto \frac{\color{blue}{\left(n \cdot n\right)} \cdot 100}{n} \]
      3. associate-*l*N/A

        \[\leadsto \frac{\color{blue}{n \cdot \left(n \cdot 100\right)}}{n} \]
      4. *-commutativeN/A

        \[\leadsto \frac{n \cdot \color{blue}{\left(100 \cdot n\right)}}{n} \]
      5. lower-*.f64N/A

        \[\leadsto \frac{\color{blue}{n \cdot \left(100 \cdot n\right)}}{n} \]
      6. lower-*.f6468.7

        \[\leadsto \frac{n \cdot \color{blue}{\left(100 \cdot n\right)}}{n} \]
    11. Applied rewrites68.7%

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

    if 2.9000000000000001e-147 < n < 1.05e-33

    1. Initial program 14.9%

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

      \[\leadsto 100 \cdot \color{blue}{\frac{{n}^{2} \cdot \left(\log i + -1 \cdot \log n\right)}{i}} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

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

        \[\leadsto 100 \cdot \color{blue}{\left(\left(\log i + -1 \cdot \log n\right) \cdot \frac{{n}^{2}}{i}\right)} \]
      3. lower-*.f64N/A

        \[\leadsto 100 \cdot \color{blue}{\left(\left(\log i + -1 \cdot \log n\right) \cdot \frac{{n}^{2}}{i}\right)} \]
      4. mul-1-negN/A

        \[\leadsto 100 \cdot \left(\left(\log i + \color{blue}{\left(\mathsf{neg}\left(\log n\right)\right)}\right) \cdot \frac{{n}^{2}}{i}\right) \]
      5. unsub-negN/A

        \[\leadsto 100 \cdot \left(\color{blue}{\left(\log i - \log n\right)} \cdot \frac{{n}^{2}}{i}\right) \]
      6. lower--.f64N/A

        \[\leadsto 100 \cdot \left(\color{blue}{\left(\log i - \log n\right)} \cdot \frac{{n}^{2}}{i}\right) \]
      7. lower-log.f64N/A

        \[\leadsto 100 \cdot \left(\left(\color{blue}{\log i} - \log n\right) \cdot \frac{{n}^{2}}{i}\right) \]
      8. lower-log.f64N/A

        \[\leadsto 100 \cdot \left(\left(\log i - \color{blue}{\log n}\right) \cdot \frac{{n}^{2}}{i}\right) \]
      9. lower-/.f64N/A

        \[\leadsto 100 \cdot \left(\left(\log i - \log n\right) \cdot \color{blue}{\frac{{n}^{2}}{i}}\right) \]
      10. unpow2N/A

        \[\leadsto 100 \cdot \left(\left(\log i - \log n\right) \cdot \frac{\color{blue}{n \cdot n}}{i}\right) \]
      11. lower-*.f6481.2

        \[\leadsto 100 \cdot \left(\left(\log i - \log n\right) \cdot \frac{\color{blue}{n \cdot n}}{i}\right) \]
    5. Applied rewrites81.2%

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

    if 1.05e-33 < n

    1. Initial program 21.0%

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

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

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

      \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
    6. Step-by-step derivation
      1. lift-expm1.f64N/A

        \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
      2. lift-/.f64N/A

        \[\leadsto 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\color{blue}{\frac{i}{n}}} \]
      3. lift-/.f64N/A

        \[\leadsto 100 \cdot \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}} \cdot 100} \]
      5. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}} \cdot 100 \]
      6. lift-/.f64N/A

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

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

        \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{i} \cdot \left(n \cdot 100\right)} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{\mathsf{expm1}\left(i\right)}{i} \cdot \color{blue}{\left(n \cdot 100\right)} \]
      10. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{i} \cdot \left(n \cdot 100\right)} \]
      11. lower-/.f6492.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.7 \cdot 10^{-219}:\\ \;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \mathbf{elif}\;n \leq 2.9 \cdot 10^{-147}:\\ \;\;\;\;\frac{n \cdot \left(n \cdot 100\right)}{n}\\ \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\ \;\;\;\;100 \cdot \left(\left(\log i - \log n\right) \cdot \frac{n \cdot n}{i}\right)\\ \mathbf{else}:\\ \;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 80.6% accurate, 0.6× speedup?

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

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

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

\mathbf{else}:\\
\;\;\;\;\left(n \cdot 100\right) \cdot t\_0\\


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

    1. Initial program 30.1%

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

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

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

      \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
    6. Step-by-step derivation
      1. lift-expm1.f64N/A

        \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
      2. lift-/.f64N/A

        \[\leadsto 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\color{blue}{\frac{i}{n}}} \]
      3. lift-/.f64N/A

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

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

        \[\leadsto \color{blue}{\left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right) \cdot n} \]
      6. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right) \cdot n} \]
      7. lower-*.f64N/A

        \[\leadsto \color{blue}{\left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)} \cdot n \]
      8. lower-/.f6475.4

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

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

    if -1.999999999999994e-310 < n < 1.05e-33

    1. Initial program 28.9%

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

      \[\leadsto 100 \cdot \frac{\color{blue}{n \cdot \left(\log i + -1 \cdot \log n\right)}}{\frac{i}{n}} \]
    4. Step-by-step derivation
      1. lower-*.f64N/A

        \[\leadsto 100 \cdot \frac{\color{blue}{n \cdot \left(\log i + -1 \cdot \log n\right)}}{\frac{i}{n}} \]
      2. mul-1-negN/A

        \[\leadsto 100 \cdot \frac{n \cdot \left(\log i + \color{blue}{\left(\mathsf{neg}\left(\log n\right)\right)}\right)}{\frac{i}{n}} \]
      3. unsub-negN/A

        \[\leadsto 100 \cdot \frac{n \cdot \color{blue}{\left(\log i - \log n\right)}}{\frac{i}{n}} \]
      4. lower--.f64N/A

        \[\leadsto 100 \cdot \frac{n \cdot \color{blue}{\left(\log i - \log n\right)}}{\frac{i}{n}} \]
      5. lower-log.f64N/A

        \[\leadsto 100 \cdot \frac{n \cdot \left(\color{blue}{\log i} - \log n\right)}{\frac{i}{n}} \]
      6. lower-log.f6473.3

        \[\leadsto 100 \cdot \frac{n \cdot \left(\log i - \color{blue}{\log n}\right)}{\frac{i}{n}} \]
    5. Applied rewrites73.3%

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

    if 1.05e-33 < n

    1. Initial program 21.0%

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

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

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

      \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
    6. Step-by-step derivation
      1. lift-expm1.f64N/A

        \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
      2. lift-/.f64N/A

        \[\leadsto 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\color{blue}{\frac{i}{n}}} \]
      3. lift-/.f64N/A

        \[\leadsto 100 \cdot \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}} \cdot 100} \]
      5. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}} \cdot 100 \]
      6. lift-/.f64N/A

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

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

        \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{i} \cdot \left(n \cdot 100\right)} \]
      9. lift-*.f64N/A

        \[\leadsto \frac{\mathsf{expm1}\left(i\right)}{i} \cdot \color{blue}{\left(n \cdot 100\right)} \]
      10. lower-*.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{i} \cdot \left(n \cdot 100\right)} \]
      11. lower-/.f6492.0

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2 \cdot 10^{-310}:\\ \;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\ \;\;\;\;100 \cdot \frac{n \cdot \left(\log i - \log n\right)}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 78.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\ \mathbf{if}\;n \leq -4.25 \cdot 10^{-35}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;n \leq -2.7 \cdot 10^{-219}:\\ \;\;\;\;\mathsf{expm1}\left(i\right) \cdot \left(100 \cdot \frac{n}{i}\right)\\ \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\ \;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\ \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.25e-35)
     t_0
     (if (<= n -2.7e-219)
       (* (expm1 i) (* 100.0 (/ n i)))
       (if (<= n 1.05e-33) (* 100.0 (/ (+ 1.0 -1.0) (/ i n))) t_0)))))
double code(double i, double n) {
	double t_0 = 100.0 * ((n * expm1(i)) / i);
	double tmp;
	if (n <= -4.25e-35) {
		tmp = t_0;
	} else if (n <= -2.7e-219) {
		tmp = expm1(i) * (100.0 * (n / i));
	} else if (n <= 1.05e-33) {
		tmp = 100.0 * ((1.0 + -1.0) / (i / n));
	} 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.25e-35) {
		tmp = t_0;
	} else if (n <= -2.7e-219) {
		tmp = Math.expm1(i) * (100.0 * (n / i));
	} else if (n <= 1.05e-33) {
		tmp = 100.0 * ((1.0 + -1.0) / (i / n));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(i, n):
	t_0 = 100.0 * ((n * math.expm1(i)) / i)
	tmp = 0
	if n <= -4.25e-35:
		tmp = t_0
	elif n <= -2.7e-219:
		tmp = math.expm1(i) * (100.0 * (n / i))
	elif n <= 1.05e-33:
		tmp = 100.0 * ((1.0 + -1.0) / (i / n))
	else:
		tmp = t_0
	return tmp
function code(i, n)
	t_0 = Float64(100.0 * Float64(Float64(n * expm1(i)) / i))
	tmp = 0.0
	if (n <= -4.25e-35)
		tmp = t_0;
	elseif (n <= -2.7e-219)
		tmp = Float64(expm1(i) * Float64(100.0 * Float64(n / i)));
	elseif (n <= 1.05e-33)
		tmp = Float64(100.0 * Float64(Float64(1.0 + -1.0) / Float64(i / n)));
	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]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -4.25e-35], t$95$0, If[LessEqual[n, -2.7e-219], N[(N[(Exp[i] - 1), $MachinePrecision] * N[(100.0 * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.05e-33], N[(100.0 * N[(N[(1.0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

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

\mathbf{elif}\;n \leq -2.7 \cdot 10^{-219}:\\
\;\;\;\;\mathsf{expm1}\left(i\right) \cdot \left(100 \cdot \frac{n}{i}\right)\\

\mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\
\;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -4.2500000000000001e-35 or 1.05e-33 < n

    1. Initial program 22.6%

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

      \[\leadsto 100 \cdot \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. lower-/.f64N/A

        \[\leadsto 100 \cdot \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
      2. lower-*.f64N/A

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

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

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

    if -4.2500000000000001e-35 < n < -2.7e-219

    1. Initial program 32.2%

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

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

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

      \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
    6. Step-by-step derivation
      1. lift-expm1.f64N/A

        \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
      2. lift-/.f64N/A

        \[\leadsto 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\color{blue}{\frac{i}{n}}} \]
      3. lift-/.f64N/A

        \[\leadsto 100 \cdot \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}} \]
      4. *-commutativeN/A

        \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}} \cdot 100} \]
      5. lift-/.f64N/A

        \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}} \cdot 100 \]
      6. div-invN/A

        \[\leadsto \color{blue}{\left(\mathsf{expm1}\left(i\right) \cdot \frac{1}{\frac{i}{n}}\right)} \cdot 100 \]
      7. lift-/.f64N/A

        \[\leadsto \left(\mathsf{expm1}\left(i\right) \cdot \frac{1}{\color{blue}{\frac{i}{n}}}\right) \cdot 100 \]
      8. clear-numN/A

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

        \[\leadsto \color{blue}{\mathsf{expm1}\left(i\right) \cdot \left(\frac{n}{i} \cdot 100\right)} \]
      10. lower-*.f64N/A

        \[\leadsto \color{blue}{\mathsf{expm1}\left(i\right) \cdot \left(\frac{n}{i} \cdot 100\right)} \]
      11. lower-*.f64N/A

        \[\leadsto \mathsf{expm1}\left(i\right) \cdot \color{blue}{\left(\frac{n}{i} \cdot 100\right)} \]
      12. lower-/.f6459.8

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

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

    if -2.7e-219 < n < 1.05e-33

    1. Initial program 36.9%

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

      \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
    4. Step-by-step derivation
      1. Applied rewrites62.7%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4.25 \cdot 10^{-35}:\\ \;\;\;\;100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\ \mathbf{elif}\;n \leq -2.7 \cdot 10^{-219}:\\ \;\;\;\;\mathsf{expm1}\left(i\right) \cdot \left(100 \cdot \frac{n}{i}\right)\\ \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\ \;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\ \end{array} \]
    7. Add Preprocessing

    Alternative 5: 79.1% accurate, 1.1× speedup?

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

      1. Initial program 26.5%

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

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

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

        \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
      6. Step-by-step derivation
        1. lift-expm1.f64N/A

          \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
        2. lift-/.f64N/A

          \[\leadsto 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\color{blue}{\frac{i}{n}}} \]
        3. lift-/.f64N/A

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

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

          \[\leadsto \color{blue}{\left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right) \cdot n} \]
        6. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right) \cdot n} \]
        7. lower-*.f64N/A

          \[\leadsto \color{blue}{\left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)} \cdot n \]
        8. lower-/.f6478.9

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

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

      if -2.7e-219 < n < 1.05e-33

      1. Initial program 36.9%

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

        \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
      4. Step-by-step derivation
        1. Applied rewrites62.7%

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

        if 1.05e-33 < n

        1. Initial program 21.0%

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

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

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

          \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
        6. Step-by-step derivation
          1. lift-expm1.f64N/A

            \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
          2. lift-/.f64N/A

            \[\leadsto 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\color{blue}{\frac{i}{n}}} \]
          3. lift-/.f64N/A

            \[\leadsto 100 \cdot \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}} \]
          4. *-commutativeN/A

            \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}} \cdot 100} \]
          5. lift-/.f64N/A

            \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}} \cdot 100 \]
          6. lift-/.f64N/A

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

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

            \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{i} \cdot \left(n \cdot 100\right)} \]
          9. lift-*.f64N/A

            \[\leadsto \frac{\mathsf{expm1}\left(i\right)}{i} \cdot \color{blue}{\left(n \cdot 100\right)} \]
          10. lower-*.f64N/A

            \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{i} \cdot \left(n \cdot 100\right)} \]
          11. lower-/.f6492.0

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.7 \cdot 10^{-219}:\\ \;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\ \;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\\ \end{array} \]
      7. Add Preprocessing

      Alternative 6: 79.1% accurate, 1.1× speedup?

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

        1. Initial program 24.4%

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

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

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

          \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
        6. Step-by-step derivation
          1. lift-expm1.f64N/A

            \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
          2. lift-/.f64N/A

            \[\leadsto 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\color{blue}{\frac{i}{n}}} \]
          3. lift-/.f64N/A

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

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

            \[\leadsto \color{blue}{\left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right) \cdot n} \]
          6. lower-*.f64N/A

            \[\leadsto \color{blue}{\left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right) \cdot n} \]
          7. lower-*.f64N/A

            \[\leadsto \color{blue}{\left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)} \cdot n \]
          8. lower-/.f6483.9

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

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

        if -2.7e-219 < n < 1.05e-33

        1. Initial program 36.9%

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

          \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
        4. Step-by-step derivation
          1. Applied rewrites62.7%

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

          \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.7 \cdot 10^{-219}:\\ \;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\ \;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \end{array} \]
        7. Add Preprocessing

        Alternative 7: 76.6% accurate, 1.1× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\ \mathbf{if}\;n \leq -2.9 \cdot 10^{-131}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\ \;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (i n)
         :precision binary64
         (let* ((t_0 (* 100.0 (/ (* n (expm1 i)) i))))
           (if (<= n -2.9e-131)
             t_0
             (if (<= n 1.05e-33) (* 100.0 (/ (+ 1.0 -1.0) (/ i n))) t_0))))
        double code(double i, double n) {
        	double t_0 = 100.0 * ((n * expm1(i)) / i);
        	double tmp;
        	if (n <= -2.9e-131) {
        		tmp = t_0;
        	} else if (n <= 1.05e-33) {
        		tmp = 100.0 * ((1.0 + -1.0) / (i / n));
        	} 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 <= -2.9e-131) {
        		tmp = t_0;
        	} else if (n <= 1.05e-33) {
        		tmp = 100.0 * ((1.0 + -1.0) / (i / n));
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        def code(i, n):
        	t_0 = 100.0 * ((n * math.expm1(i)) / i)
        	tmp = 0
        	if n <= -2.9e-131:
        		tmp = t_0
        	elif n <= 1.05e-33:
        		tmp = 100.0 * ((1.0 + -1.0) / (i / n))
        	else:
        		tmp = t_0
        	return tmp
        
        function code(i, n)
        	t_0 = Float64(100.0 * Float64(Float64(n * expm1(i)) / i))
        	tmp = 0.0
        	if (n <= -2.9e-131)
        		tmp = t_0;
        	elseif (n <= 1.05e-33)
        		tmp = Float64(100.0 * Float64(Float64(1.0 + -1.0) / Float64(i / n)));
        	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]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -2.9e-131], t$95$0, If[LessEqual[n, 1.05e-33], N[(100.0 * N[(N[(1.0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\
        \mathbf{if}\;n \leq -2.9 \cdot 10^{-131}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\
        \;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if n < -2.9000000000000002e-131 or 1.05e-33 < n

          1. Initial program 22.5%

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

            \[\leadsto 100 \cdot \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
          4. Step-by-step derivation
            1. lower-/.f64N/A

              \[\leadsto 100 \cdot \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
            2. lower-*.f64N/A

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

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

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

          if -2.9000000000000002e-131 < n < 1.05e-33

          1. Initial program 40.0%

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

            \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
          4. Step-by-step derivation
            1. Applied rewrites61.8%

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

            \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.9 \cdot 10^{-131}:\\ \;\;\;\;100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\ \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\ \;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i}\\ \end{array} \]
          7. Add Preprocessing

          Alternative 8: 64.4% accurate, 2.6× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -6.2 \cdot 10^{-157}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\\ \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\ \;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\left(n \cdot 100\right) \cdot \frac{i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 0.041666666666666664, 0.16666666666666666\right), 0.5\right), 1\right)}{i}\\ \end{array} \end{array} \]
          (FPCore (i n)
           :precision binary64
           (if (<= n -6.2e-157)
             (*
              n
              (fma i (fma i (fma i 4.166666666666667 16.666666666666668) 50.0) 100.0))
             (if (<= n 1.05e-33)
               (* 100.0 (/ (+ 1.0 -1.0) (/ i n)))
               (*
                (* n 100.0)
                (/
                 (*
                  i
                  (fma
                   i
                   (fma i (fma i 0.041666666666666664 0.16666666666666666) 0.5)
                   1.0))
                 i)))))
          double code(double i, double n) {
          	double tmp;
          	if (n <= -6.2e-157) {
          		tmp = n * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0);
          	} else if (n <= 1.05e-33) {
          		tmp = 100.0 * ((1.0 + -1.0) / (i / n));
          	} else {
          		tmp = (n * 100.0) * ((i * fma(i, fma(i, fma(i, 0.041666666666666664, 0.16666666666666666), 0.5), 1.0)) / i);
          	}
          	return tmp;
          }
          
          function code(i, n)
          	tmp = 0.0
          	if (n <= -6.2e-157)
          		tmp = Float64(n * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0));
          	elseif (n <= 1.05e-33)
          		tmp = Float64(100.0 * Float64(Float64(1.0 + -1.0) / Float64(i / n)));
          	else
          		tmp = Float64(Float64(n * 100.0) * Float64(Float64(i * fma(i, fma(i, fma(i, 0.041666666666666664, 0.16666666666666666), 0.5), 1.0)) / i));
          	end
          	return tmp
          end
          
          code[i_, n_] := If[LessEqual[n, -6.2e-157], N[(n * N[(i * N[(i * N[(i * 4.166666666666667 + 16.666666666666668), $MachinePrecision] + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.05e-33], N[(100.0 * N[(N[(1.0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(i * N[(i * N[(i * N[(i * 0.041666666666666664 + 0.16666666666666666), $MachinePrecision] + 0.5), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;n \leq -6.2 \cdot 10^{-157}:\\
          \;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\\
          
          \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\
          \;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\
          
          \mathbf{else}:\\
          \;\;\;\;\left(n \cdot 100\right) \cdot \frac{i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 0.041666666666666664, 0.16666666666666666\right), 0.5\right), 1\right)}{i}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if n < -6.1999999999999996e-157

            1. Initial program 23.8%

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

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

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

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

              \[\leadsto \color{blue}{100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \left(\frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n\right)\right)} \]
            7. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto \color{blue}{i \cdot \left(50 \cdot n + i \cdot \left(\frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n\right)\right) + 100 \cdot n} \]
              2. lower-fma.f64N/A

                \[\leadsto \color{blue}{\mathsf{fma}\left(i, 50 \cdot n + i \cdot \left(\frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n\right), 100 \cdot n\right)} \]
              3. +-commutativeN/A

                \[\leadsto \mathsf{fma}\left(i, \color{blue}{i \cdot \left(\frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n\right) + 50 \cdot n}, 100 \cdot n\right) \]
              4. lower-fma.f64N/A

                \[\leadsto \mathsf{fma}\left(i, \color{blue}{\mathsf{fma}\left(i, \frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n, 50 \cdot n\right)}, 100 \cdot n\right) \]
              5. associate-*r*N/A

                \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, \color{blue}{\left(\frac{25}{6} \cdot i\right) \cdot n} + \frac{50}{3} \cdot n, 50 \cdot n\right), 100 \cdot n\right) \]
              6. distribute-rgt-outN/A

                \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, \color{blue}{n \cdot \left(\frac{25}{6} \cdot i + \frac{50}{3}\right)}, 50 \cdot n\right), 100 \cdot n\right) \]
              7. lower-*.f64N/A

                \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, \color{blue}{n \cdot \left(\frac{25}{6} \cdot i + \frac{50}{3}\right)}, 50 \cdot n\right), 100 \cdot n\right) \]
              8. lower-fma.f64N/A

                \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \color{blue}{\mathsf{fma}\left(\frac{25}{6}, i, \frac{50}{3}\right)}, 50 \cdot n\right), 100 \cdot n\right) \]
              9. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(\frac{25}{6}, i, \frac{50}{3}\right), \color{blue}{n \cdot 50}\right), 100 \cdot n\right) \]
              10. lower-*.f64N/A

                \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(\frac{25}{6}, i, \frac{50}{3}\right), \color{blue}{n \cdot 50}\right), 100 \cdot n\right) \]
              11. *-commutativeN/A

                \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(\frac{25}{6}, i, \frac{50}{3}\right), n \cdot 50\right), \color{blue}{n \cdot 100}\right) \]
              12. lower-*.f6460.0

                \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(4.166666666666667, i, 16.666666666666668\right), n \cdot 50\right), \color{blue}{n \cdot 100}\right) \]
            8. Applied rewrites60.0%

              \[\leadsto \color{blue}{\mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(4.166666666666667, i, 16.666666666666668\right), n \cdot 50\right), n \cdot 100\right)} \]
            9. Taylor expanded in i around 0

              \[\leadsto \color{blue}{100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \left(\frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n\right)\right)} \]
            10. Step-by-step derivation
              1. +-commutativeN/A

                \[\leadsto 100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \color{blue}{\left(\frac{50}{3} \cdot n + \frac{25}{6} \cdot \left(i \cdot n\right)\right)}\right) \]
              2. associate-*r*N/A

                \[\leadsto 100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \left(\frac{50}{3} \cdot n + \color{blue}{\left(\frac{25}{6} \cdot i\right) \cdot n}\right)\right) \]
              3. distribute-rgt-inN/A

                \[\leadsto 100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \color{blue}{\left(n \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right)}\right) \]
              4. *-commutativeN/A

                \[\leadsto 100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \color{blue}{\left(\left(\frac{50}{3} + \frac{25}{6} \cdot i\right) \cdot n\right)}\right) \]
              5. associate-*r*N/A

                \[\leadsto 100 \cdot n + i \cdot \left(50 \cdot n + \color{blue}{\left(i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right) \cdot n}\right) \]
              6. distribute-rgt-inN/A

                \[\leadsto 100 \cdot n + i \cdot \color{blue}{\left(n \cdot \left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right)\right)} \]
              7. *-commutativeN/A

                \[\leadsto 100 \cdot n + i \cdot \color{blue}{\left(\left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right) \cdot n\right)} \]
              8. associate-*l*N/A

                \[\leadsto 100 \cdot n + \color{blue}{\left(i \cdot \left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right)\right) \cdot n} \]
              9. distribute-rgt-inN/A

                \[\leadsto \color{blue}{n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right)\right)} \]
              10. lower-*.f64N/A

                \[\leadsto \color{blue}{n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right)\right)} \]
              11. +-commutativeN/A

                \[\leadsto n \cdot \color{blue}{\left(i \cdot \left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right) + 100\right)} \]
              12. lower-fma.f64N/A

                \[\leadsto n \cdot \color{blue}{\mathsf{fma}\left(i, 50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right), 100\right)} \]
            11. Applied rewrites60.8%

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

            if -6.1999999999999996e-157 < n < 1.05e-33

            1. Initial program 40.2%

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

              \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
            4. Step-by-step derivation
              1. Applied rewrites62.9%

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

              if 1.05e-33 < n

              1. Initial program 21.0%

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

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

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

                \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
              6. Step-by-step derivation
                1. lift-expm1.f64N/A

                  \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
                2. lift-/.f64N/A

                  \[\leadsto 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\color{blue}{\frac{i}{n}}} \]
                3. lift-/.f64N/A

                  \[\leadsto 100 \cdot \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}} \]
                4. *-commutativeN/A

                  \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}} \cdot 100} \]
                5. lift-/.f64N/A

                  \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}} \cdot 100 \]
                6. lift-/.f64N/A

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

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

                  \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{i} \cdot \left(n \cdot 100\right)} \]
                9. lift-*.f64N/A

                  \[\leadsto \frac{\mathsf{expm1}\left(i\right)}{i} \cdot \color{blue}{\left(n \cdot 100\right)} \]
                10. lower-*.f64N/A

                  \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{i} \cdot \left(n \cdot 100\right)} \]
                11. lower-/.f6492.0

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

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

                \[\leadsto \frac{\color{blue}{i \cdot \left(1 + i \cdot \left(\frac{1}{2} + i \cdot \left(\frac{1}{6} + \frac{1}{24} \cdot i\right)\right)\right)}}{i} \cdot \left(n \cdot 100\right) \]
              9. Step-by-step derivation
                1. lower-*.f64N/A

                  \[\leadsto \frac{\color{blue}{i \cdot \left(1 + i \cdot \left(\frac{1}{2} + i \cdot \left(\frac{1}{6} + \frac{1}{24} \cdot i\right)\right)\right)}}{i} \cdot \left(n \cdot 100\right) \]
                2. +-commutativeN/A

                  \[\leadsto \frac{i \cdot \color{blue}{\left(i \cdot \left(\frac{1}{2} + i \cdot \left(\frac{1}{6} + \frac{1}{24} \cdot i\right)\right) + 1\right)}}{i} \cdot \left(n \cdot 100\right) \]
                3. lower-fma.f64N/A

                  \[\leadsto \frac{i \cdot \color{blue}{\mathsf{fma}\left(i, \frac{1}{2} + i \cdot \left(\frac{1}{6} + \frac{1}{24} \cdot i\right), 1\right)}}{i} \cdot \left(n \cdot 100\right) \]
                4. +-commutativeN/A

                  \[\leadsto \frac{i \cdot \mathsf{fma}\left(i, \color{blue}{i \cdot \left(\frac{1}{6} + \frac{1}{24} \cdot i\right) + \frac{1}{2}}, 1\right)}{i} \cdot \left(n \cdot 100\right) \]
                5. lower-fma.f64N/A

                  \[\leadsto \frac{i \cdot \mathsf{fma}\left(i, \color{blue}{\mathsf{fma}\left(i, \frac{1}{6} + \frac{1}{24} \cdot i, \frac{1}{2}\right)}, 1\right)}{i} \cdot \left(n \cdot 100\right) \]
                6. +-commutativeN/A

                  \[\leadsto \frac{i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \color{blue}{\frac{1}{24} \cdot i + \frac{1}{6}}, \frac{1}{2}\right), 1\right)}{i} \cdot \left(n \cdot 100\right) \]
                7. *-commutativeN/A

                  \[\leadsto \frac{i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \color{blue}{i \cdot \frac{1}{24}} + \frac{1}{6}, \frac{1}{2}\right), 1\right)}{i} \cdot \left(n \cdot 100\right) \]
                8. lower-fma.f6485.6

                  \[\leadsto \frac{i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \color{blue}{\mathsf{fma}\left(i, 0.041666666666666664, 0.16666666666666666\right)}, 0.5\right), 1\right)}{i} \cdot \left(n \cdot 100\right) \]
              10. Applied rewrites85.6%

                \[\leadsto \frac{\color{blue}{i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 0.041666666666666664, 0.16666666666666666\right), 0.5\right), 1\right)}}{i} \cdot \left(n \cdot 100\right) \]
            5. Recombined 3 regimes into one program.
            6. Final simplification68.6%

              \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -6.2 \cdot 10^{-157}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\\ \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\ \;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\left(n \cdot 100\right) \cdot \frac{i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 0.041666666666666664, 0.16666666666666666\right), 0.5\right), 1\right)}{i}\\ \end{array} \]
            7. Add Preprocessing

            Alternative 9: 64.3% accurate, 3.4× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\\ \mathbf{if}\;n \leq -6.2 \cdot 10^{-157}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\ \;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
            (FPCore (i n)
             :precision binary64
             (let* ((t_0
                     (*
                      n
                      (fma
                       i
                       (fma i (fma i 4.166666666666667 16.666666666666668) 50.0)
                       100.0))))
               (if (<= n -6.2e-157)
                 t_0
                 (if (<= n 1.05e-33) (* 100.0 (/ (+ 1.0 -1.0) (/ i n))) t_0))))
            double code(double i, double n) {
            	double t_0 = n * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0);
            	double tmp;
            	if (n <= -6.2e-157) {
            		tmp = t_0;
            	} else if (n <= 1.05e-33) {
            		tmp = 100.0 * ((1.0 + -1.0) / (i / n));
            	} else {
            		tmp = t_0;
            	}
            	return tmp;
            }
            
            function code(i, n)
            	t_0 = Float64(n * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0))
            	tmp = 0.0
            	if (n <= -6.2e-157)
            		tmp = t_0;
            	elseif (n <= 1.05e-33)
            		tmp = Float64(100.0 * Float64(Float64(1.0 + -1.0) / Float64(i / n)));
            	else
            		tmp = t_0;
            	end
            	return tmp
            end
            
            code[i_, n_] := Block[{t$95$0 = N[(n * N[(i * N[(i * N[(i * 4.166666666666667 + 16.666666666666668), $MachinePrecision] + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -6.2e-157], t$95$0, If[LessEqual[n, 1.05e-33], N[(100.0 * N[(N[(1.0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\\
            \mathbf{if}\;n \leq -6.2 \cdot 10^{-157}:\\
            \;\;\;\;t\_0\\
            
            \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\
            \;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\
            
            \mathbf{else}:\\
            \;\;\;\;t\_0\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if n < -6.1999999999999996e-157 or 1.05e-33 < n

              1. Initial program 22.7%

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

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

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

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

                \[\leadsto \color{blue}{100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \left(\frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n\right)\right)} \]
              7. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto \color{blue}{i \cdot \left(50 \cdot n + i \cdot \left(\frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n\right)\right) + 100 \cdot n} \]
                2. lower-fma.f64N/A

                  \[\leadsto \color{blue}{\mathsf{fma}\left(i, 50 \cdot n + i \cdot \left(\frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n\right), 100 \cdot n\right)} \]
                3. +-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(i, \color{blue}{i \cdot \left(\frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n\right) + 50 \cdot n}, 100 \cdot n\right) \]
                4. lower-fma.f64N/A

                  \[\leadsto \mathsf{fma}\left(i, \color{blue}{\mathsf{fma}\left(i, \frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n, 50 \cdot n\right)}, 100 \cdot n\right) \]
                5. associate-*r*N/A

                  \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, \color{blue}{\left(\frac{25}{6} \cdot i\right) \cdot n} + \frac{50}{3} \cdot n, 50 \cdot n\right), 100 \cdot n\right) \]
                6. distribute-rgt-outN/A

                  \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, \color{blue}{n \cdot \left(\frac{25}{6} \cdot i + \frac{50}{3}\right)}, 50 \cdot n\right), 100 \cdot n\right) \]
                7. lower-*.f64N/A

                  \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, \color{blue}{n \cdot \left(\frac{25}{6} \cdot i + \frac{50}{3}\right)}, 50 \cdot n\right), 100 \cdot n\right) \]
                8. lower-fma.f64N/A

                  \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \color{blue}{\mathsf{fma}\left(\frac{25}{6}, i, \frac{50}{3}\right)}, 50 \cdot n\right), 100 \cdot n\right) \]
                9. *-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(\frac{25}{6}, i, \frac{50}{3}\right), \color{blue}{n \cdot 50}\right), 100 \cdot n\right) \]
                10. lower-*.f64N/A

                  \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(\frac{25}{6}, i, \frac{50}{3}\right), \color{blue}{n \cdot 50}\right), 100 \cdot n\right) \]
                11. *-commutativeN/A

                  \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(\frac{25}{6}, i, \frac{50}{3}\right), n \cdot 50\right), \color{blue}{n \cdot 100}\right) \]
                12. lower-*.f6469.6

                  \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(4.166666666666667, i, 16.666666666666668\right), n \cdot 50\right), \color{blue}{n \cdot 100}\right) \]
              8. Applied rewrites69.6%

                \[\leadsto \color{blue}{\mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(4.166666666666667, i, 16.666666666666668\right), n \cdot 50\right), n \cdot 100\right)} \]
              9. Taylor expanded in i around 0

                \[\leadsto \color{blue}{100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \left(\frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n\right)\right)} \]
              10. Step-by-step derivation
                1. +-commutativeN/A

                  \[\leadsto 100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \color{blue}{\left(\frac{50}{3} \cdot n + \frac{25}{6} \cdot \left(i \cdot n\right)\right)}\right) \]
                2. associate-*r*N/A

                  \[\leadsto 100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \left(\frac{50}{3} \cdot n + \color{blue}{\left(\frac{25}{6} \cdot i\right) \cdot n}\right)\right) \]
                3. distribute-rgt-inN/A

                  \[\leadsto 100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \color{blue}{\left(n \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right)}\right) \]
                4. *-commutativeN/A

                  \[\leadsto 100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \color{blue}{\left(\left(\frac{50}{3} + \frac{25}{6} \cdot i\right) \cdot n\right)}\right) \]
                5. associate-*r*N/A

                  \[\leadsto 100 \cdot n + i \cdot \left(50 \cdot n + \color{blue}{\left(i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right) \cdot n}\right) \]
                6. distribute-rgt-inN/A

                  \[\leadsto 100 \cdot n + i \cdot \color{blue}{\left(n \cdot \left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right)\right)} \]
                7. *-commutativeN/A

                  \[\leadsto 100 \cdot n + i \cdot \color{blue}{\left(\left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right) \cdot n\right)} \]
                8. associate-*l*N/A

                  \[\leadsto 100 \cdot n + \color{blue}{\left(i \cdot \left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right)\right) \cdot n} \]
                9. distribute-rgt-inN/A

                  \[\leadsto \color{blue}{n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right)\right)} \]
                10. lower-*.f64N/A

                  \[\leadsto \color{blue}{n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right)\right)} \]
                11. +-commutativeN/A

                  \[\leadsto n \cdot \color{blue}{\left(i \cdot \left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right) + 100\right)} \]
                12. lower-fma.f64N/A

                  \[\leadsto n \cdot \color{blue}{\mathsf{fma}\left(i, 50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right), 100\right)} \]
              11. Applied rewrites70.1%

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

              if -6.1999999999999996e-157 < n < 1.05e-33

              1. Initial program 40.2%

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

                \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
              4. Step-by-step derivation
                1. Applied rewrites62.9%

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -6.2 \cdot 10^{-157}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\\ \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\ \;\;\;\;100 \cdot \frac{1 + -1}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\\ \end{array} \]
              7. Add Preprocessing

              Alternative 10: 64.3% accurate, 4.1× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\\ \mathbf{if}\;n \leq -6.2 \cdot 10^{-157}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\ \;\;\;\;\frac{0}{i}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
              (FPCore (i n)
               :precision binary64
               (let* ((t_0
                       (*
                        n
                        (fma
                         i
                         (fma i (fma i 4.166666666666667 16.666666666666668) 50.0)
                         100.0))))
                 (if (<= n -6.2e-157) t_0 (if (<= n 1.05e-33) (/ 0.0 i) t_0))))
              double code(double i, double n) {
              	double t_0 = n * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0);
              	double tmp;
              	if (n <= -6.2e-157) {
              		tmp = t_0;
              	} else if (n <= 1.05e-33) {
              		tmp = 0.0 / i;
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              function code(i, n)
              	t_0 = Float64(n * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0))
              	tmp = 0.0
              	if (n <= -6.2e-157)
              		tmp = t_0;
              	elseif (n <= 1.05e-33)
              		tmp = Float64(0.0 / i);
              	else
              		tmp = t_0;
              	end
              	return tmp
              end
              
              code[i_, n_] := Block[{t$95$0 = N[(n * N[(i * N[(i * N[(i * 4.166666666666667 + 16.666666666666668), $MachinePrecision] + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -6.2e-157], t$95$0, If[LessEqual[n, 1.05e-33], N[(0.0 / i), $MachinePrecision], t$95$0]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\\
              \mathbf{if}\;n \leq -6.2 \cdot 10^{-157}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\
              \;\;\;\;\frac{0}{i}\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_0\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if n < -6.1999999999999996e-157 or 1.05e-33 < n

                1. Initial program 22.7%

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

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

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

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

                  \[\leadsto \color{blue}{100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \left(\frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n\right)\right)} \]
                7. Step-by-step derivation
                  1. +-commutativeN/A

                    \[\leadsto \color{blue}{i \cdot \left(50 \cdot n + i \cdot \left(\frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n\right)\right) + 100 \cdot n} \]
                  2. lower-fma.f64N/A

                    \[\leadsto \color{blue}{\mathsf{fma}\left(i, 50 \cdot n + i \cdot \left(\frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n\right), 100 \cdot n\right)} \]
                  3. +-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(i, \color{blue}{i \cdot \left(\frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n\right) + 50 \cdot n}, 100 \cdot n\right) \]
                  4. lower-fma.f64N/A

                    \[\leadsto \mathsf{fma}\left(i, \color{blue}{\mathsf{fma}\left(i, \frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n, 50 \cdot n\right)}, 100 \cdot n\right) \]
                  5. associate-*r*N/A

                    \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, \color{blue}{\left(\frac{25}{6} \cdot i\right) \cdot n} + \frac{50}{3} \cdot n, 50 \cdot n\right), 100 \cdot n\right) \]
                  6. distribute-rgt-outN/A

                    \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, \color{blue}{n \cdot \left(\frac{25}{6} \cdot i + \frac{50}{3}\right)}, 50 \cdot n\right), 100 \cdot n\right) \]
                  7. lower-*.f64N/A

                    \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, \color{blue}{n \cdot \left(\frac{25}{6} \cdot i + \frac{50}{3}\right)}, 50 \cdot n\right), 100 \cdot n\right) \]
                  8. lower-fma.f64N/A

                    \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \color{blue}{\mathsf{fma}\left(\frac{25}{6}, i, \frac{50}{3}\right)}, 50 \cdot n\right), 100 \cdot n\right) \]
                  9. *-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(\frac{25}{6}, i, \frac{50}{3}\right), \color{blue}{n \cdot 50}\right), 100 \cdot n\right) \]
                  10. lower-*.f64N/A

                    \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(\frac{25}{6}, i, \frac{50}{3}\right), \color{blue}{n \cdot 50}\right), 100 \cdot n\right) \]
                  11. *-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(\frac{25}{6}, i, \frac{50}{3}\right), n \cdot 50\right), \color{blue}{n \cdot 100}\right) \]
                  12. lower-*.f6469.6

                    \[\leadsto \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(4.166666666666667, i, 16.666666666666668\right), n \cdot 50\right), \color{blue}{n \cdot 100}\right) \]
                8. Applied rewrites69.6%

                  \[\leadsto \color{blue}{\mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(4.166666666666667, i, 16.666666666666668\right), n \cdot 50\right), n \cdot 100\right)} \]
                9. Taylor expanded in i around 0

                  \[\leadsto \color{blue}{100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \left(\frac{25}{6} \cdot \left(i \cdot n\right) + \frac{50}{3} \cdot n\right)\right)} \]
                10. Step-by-step derivation
                  1. +-commutativeN/A

                    \[\leadsto 100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \color{blue}{\left(\frac{50}{3} \cdot n + \frac{25}{6} \cdot \left(i \cdot n\right)\right)}\right) \]
                  2. associate-*r*N/A

                    \[\leadsto 100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \left(\frac{50}{3} \cdot n + \color{blue}{\left(\frac{25}{6} \cdot i\right) \cdot n}\right)\right) \]
                  3. distribute-rgt-inN/A

                    \[\leadsto 100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \color{blue}{\left(n \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right)}\right) \]
                  4. *-commutativeN/A

                    \[\leadsto 100 \cdot n + i \cdot \left(50 \cdot n + i \cdot \color{blue}{\left(\left(\frac{50}{3} + \frac{25}{6} \cdot i\right) \cdot n\right)}\right) \]
                  5. associate-*r*N/A

                    \[\leadsto 100 \cdot n + i \cdot \left(50 \cdot n + \color{blue}{\left(i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right) \cdot n}\right) \]
                  6. distribute-rgt-inN/A

                    \[\leadsto 100 \cdot n + i \cdot \color{blue}{\left(n \cdot \left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right)\right)} \]
                  7. *-commutativeN/A

                    \[\leadsto 100 \cdot n + i \cdot \color{blue}{\left(\left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right) \cdot n\right)} \]
                  8. associate-*l*N/A

                    \[\leadsto 100 \cdot n + \color{blue}{\left(i \cdot \left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right)\right) \cdot n} \]
                  9. distribute-rgt-inN/A

                    \[\leadsto \color{blue}{n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right)\right)} \]
                  10. lower-*.f64N/A

                    \[\leadsto \color{blue}{n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right)\right)} \]
                  11. +-commutativeN/A

                    \[\leadsto n \cdot \color{blue}{\left(i \cdot \left(50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right)\right) + 100\right)} \]
                  12. lower-fma.f64N/A

                    \[\leadsto n \cdot \color{blue}{\mathsf{fma}\left(i, 50 + i \cdot \left(\frac{50}{3} + \frac{25}{6} \cdot i\right), 100\right)} \]
                11. Applied rewrites70.1%

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

                if -6.1999999999999996e-157 < n < 1.05e-33

                1. Initial program 40.2%

                  \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. lift-/.f64N/A

                    \[\leadsto 100 \cdot \frac{{\left(1 + \color{blue}{\frac{i}{n}}\right)}^{n} - 1}{\frac{i}{n}} \]
                  2. lift-+.f64N/A

                    \[\leadsto 100 \cdot \frac{{\color{blue}{\left(1 + \frac{i}{n}\right)}}^{n} - 1}{\frac{i}{n}} \]
                  3. lift-pow.f64N/A

                    \[\leadsto 100 \cdot \frac{\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n}} - 1}{\frac{i}{n}} \]
                  4. lift--.f64N/A

                    \[\leadsto 100 \cdot \frac{\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n} - 1}}{\frac{i}{n}} \]
                  5. *-rgt-identityN/A

                    \[\leadsto 100 \cdot \frac{\color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right) \cdot 1}}{\frac{i}{n}} \]
                  6. lift-/.f64N/A

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

                    \[\leadsto 100 \cdot \color{blue}{\left(\left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right) \cdot \frac{1}{\frac{i}{n}}\right)} \]
                  8. div-invN/A

                    \[\leadsto 100 \cdot \color{blue}{\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}} \]
                  9. lift--.f64N/A

                    \[\leadsto 100 \cdot \frac{\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n} - 1}}{\frac{i}{n}} \]
                  10. div-subN/A

                    \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \frac{1}{\frac{i}{n}}\right)} \]
                  11. lift-/.f64N/A

                    \[\leadsto 100 \cdot \left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \frac{1}{\color{blue}{\frac{i}{n}}}\right) \]
                  12. clear-numN/A

                    \[\leadsto 100 \cdot \left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \color{blue}{\frac{n}{i}}\right) \]
                  13. sub-negN/A

                    \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} + \left(\mathsf{neg}\left(\frac{n}{i}\right)\right)\right)} \]
                  14. +-commutativeN/A

                    \[\leadsto 100 \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{n}{i}\right)\right) + \frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}}\right)} \]
                  15. clear-numN/A

                    \[\leadsto 100 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\frac{1}{\frac{i}{n}}}\right)\right) + \frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}}\right) \]
                  16. associate-/r/N/A

                    \[\leadsto 100 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\frac{1}{i} \cdot n}\right)\right) + \frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}}\right) \]
                  17. distribute-lft-neg-inN/A

                    \[\leadsto 100 \cdot \left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{i}\right)\right) \cdot n} + \frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}}\right) \]
                  18. distribute-frac-neg2N/A

                    \[\leadsto 100 \cdot \left(\color{blue}{\frac{1}{\mathsf{neg}\left(i\right)}} \cdot n + \frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}}\right) \]
                4. Applied rewrites13.0%

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

                  \[\leadsto \color{blue}{100 \cdot \frac{n + -1 \cdot n}{i}} \]
                6. Step-by-step derivation
                  1. associate-*r/N/A

                    \[\leadsto \color{blue}{\frac{100 \cdot \left(n + -1 \cdot n\right)}{i}} \]
                  2. distribute-rgt1-inN/A

                    \[\leadsto \frac{100 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot n\right)}}{i} \]
                  3. metadata-evalN/A

                    \[\leadsto \frac{100 \cdot \left(\color{blue}{0} \cdot n\right)}{i} \]
                  4. mul0-lftN/A

                    \[\leadsto \frac{100 \cdot \color{blue}{0}}{i} \]
                  5. metadata-evalN/A

                    \[\leadsto \frac{\color{blue}{0}}{i} \]
                  6. lower-/.f6462.9

                    \[\leadsto \color{blue}{\frac{0}{i}} \]
                7. Applied rewrites62.9%

                  \[\leadsto \color{blue}{\frac{0}{i}} \]
              3. Recombined 2 regimes into one program.
              4. Add Preprocessing

              Alternative 11: 60.7% accurate, 6.1× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -6.2 \cdot 10^{-157}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\ \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\ \;\;\;\;\frac{0}{i}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(50, i, 100\right)\\ \end{array} \end{array} \]
              (FPCore (i n)
               :precision binary64
               (if (<= n -6.2e-157)
                 (* n (fma i (fma i 16.666666666666668 50.0) 100.0))
                 (if (<= n 1.05e-33) (/ 0.0 i) (* n (fma 50.0 i 100.0)))))
              double code(double i, double n) {
              	double tmp;
              	if (n <= -6.2e-157) {
              		tmp = n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0);
              	} else if (n <= 1.05e-33) {
              		tmp = 0.0 / i;
              	} else {
              		tmp = n * fma(50.0, i, 100.0);
              	}
              	return tmp;
              }
              
              function code(i, n)
              	tmp = 0.0
              	if (n <= -6.2e-157)
              		tmp = Float64(n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0));
              	elseif (n <= 1.05e-33)
              		tmp = Float64(0.0 / i);
              	else
              		tmp = Float64(n * fma(50.0, i, 100.0));
              	end
              	return tmp
              end
              
              code[i_, n_] := If[LessEqual[n, -6.2e-157], N[(n * N[(i * N[(i * 16.666666666666668 + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.05e-33], N[(0.0 / i), $MachinePrecision], N[(n * N[(50.0 * i + 100.0), $MachinePrecision]), $MachinePrecision]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;n \leq -6.2 \cdot 10^{-157}:\\
              \;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\
              
              \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\
              \;\;\;\;\frac{0}{i}\\
              
              \mathbf{else}:\\
              \;\;\;\;n \cdot \mathsf{fma}\left(50, i, 100\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 3 regimes
              2. if n < -6.1999999999999996e-157

                1. Initial program 23.8%

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

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

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

                  \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
                6. Step-by-step derivation
                  1. lift-expm1.f64N/A

                    \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{\frac{i}{n}} \]
                  2. lift-/.f64N/A

                    \[\leadsto 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\color{blue}{\frac{i}{n}}} \]
                  3. lift-/.f64N/A

                    \[\leadsto 100 \cdot \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}} \]
                  4. *-commutativeN/A

                    \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}} \cdot 100} \]
                  5. lift-/.f64N/A

                    \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}} \cdot 100 \]
                  6. lift-/.f64N/A

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

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

                    \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{i} \cdot \left(n \cdot 100\right)} \]
                  9. lift-*.f64N/A

                    \[\leadsto \frac{\mathsf{expm1}\left(i\right)}{i} \cdot \color{blue}{\left(n \cdot 100\right)} \]
                  10. lower-*.f64N/A

                    \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{i} \cdot \left(n \cdot 100\right)} \]
                  11. lower-/.f6478.6

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

                  \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{i} \cdot \left(n \cdot 100\right)} \]
                8. Step-by-step derivation
                  1. lift-expm1.f64N/A

                    \[\leadsto \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{i} \cdot \left(n \cdot 100\right) \]
                  2. lift-/.f64N/A

                    \[\leadsto \color{blue}{\frac{\mathsf{expm1}\left(i\right)}{i}} \cdot \left(n \cdot 100\right) \]
                  3. *-commutativeN/A

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

                    \[\leadsto \color{blue}{\left(\frac{\mathsf{expm1}\left(i\right)}{i} \cdot 100\right) \cdot n} \]
                  5. lower-*.f64N/A

                    \[\leadsto \color{blue}{\left(\frac{\mathsf{expm1}\left(i\right)}{i} \cdot 100\right) \cdot n} \]
                  6. lower-*.f6478.6

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

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

                  \[\leadsto \color{blue}{\left(100 + i \cdot \left(50 + \frac{50}{3} \cdot i\right)\right)} \cdot n \]
                11. Step-by-step derivation
                  1. +-commutativeN/A

                    \[\leadsto \color{blue}{\left(i \cdot \left(50 + \frac{50}{3} \cdot i\right) + 100\right)} \cdot n \]
                  2. lower-fma.f64N/A

                    \[\leadsto \color{blue}{\mathsf{fma}\left(i, 50 + \frac{50}{3} \cdot i, 100\right)} \cdot n \]
                  3. +-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(i, \color{blue}{\frac{50}{3} \cdot i + 50}, 100\right) \cdot n \]
                  4. *-commutativeN/A

                    \[\leadsto \mathsf{fma}\left(i, \color{blue}{i \cdot \frac{50}{3}} + 50, 100\right) \cdot n \]
                  5. lower-fma.f6460.4

                    \[\leadsto \mathsf{fma}\left(i, \color{blue}{\mathsf{fma}\left(i, 16.666666666666668, 50\right)}, 100\right) \cdot n \]
                12. Applied rewrites60.4%

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

                if -6.1999999999999996e-157 < n < 1.05e-33

                1. Initial program 40.2%

                  \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. lift-/.f64N/A

                    \[\leadsto 100 \cdot \frac{{\left(1 + \color{blue}{\frac{i}{n}}\right)}^{n} - 1}{\frac{i}{n}} \]
                  2. lift-+.f64N/A

                    \[\leadsto 100 \cdot \frac{{\color{blue}{\left(1 + \frac{i}{n}\right)}}^{n} - 1}{\frac{i}{n}} \]
                  3. lift-pow.f64N/A

                    \[\leadsto 100 \cdot \frac{\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n}} - 1}{\frac{i}{n}} \]
                  4. lift--.f64N/A

                    \[\leadsto 100 \cdot \frac{\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n} - 1}}{\frac{i}{n}} \]
                  5. *-rgt-identityN/A

                    \[\leadsto 100 \cdot \frac{\color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right) \cdot 1}}{\frac{i}{n}} \]
                  6. lift-/.f64N/A

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

                    \[\leadsto 100 \cdot \color{blue}{\left(\left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right) \cdot \frac{1}{\frac{i}{n}}\right)} \]
                  8. div-invN/A

                    \[\leadsto 100 \cdot \color{blue}{\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}} \]
                  9. lift--.f64N/A

                    \[\leadsto 100 \cdot \frac{\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n} - 1}}{\frac{i}{n}} \]
                  10. div-subN/A

                    \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \frac{1}{\frac{i}{n}}\right)} \]
                  11. lift-/.f64N/A

                    \[\leadsto 100 \cdot \left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \frac{1}{\color{blue}{\frac{i}{n}}}\right) \]
                  12. clear-numN/A

                    \[\leadsto 100 \cdot \left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \color{blue}{\frac{n}{i}}\right) \]
                  13. sub-negN/A

                    \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} + \left(\mathsf{neg}\left(\frac{n}{i}\right)\right)\right)} \]
                  14. +-commutativeN/A

                    \[\leadsto 100 \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{n}{i}\right)\right) + \frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}}\right)} \]
                  15. clear-numN/A

                    \[\leadsto 100 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\frac{1}{\frac{i}{n}}}\right)\right) + \frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}}\right) \]
                  16. associate-/r/N/A

                    \[\leadsto 100 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\frac{1}{i} \cdot n}\right)\right) + \frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}}\right) \]
                  17. distribute-lft-neg-inN/A

                    \[\leadsto 100 \cdot \left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{i}\right)\right) \cdot n} + \frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}}\right) \]
                  18. distribute-frac-neg2N/A

                    \[\leadsto 100 \cdot \left(\color{blue}{\frac{1}{\mathsf{neg}\left(i\right)}} \cdot n + \frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}}\right) \]
                4. Applied rewrites13.0%

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

                  \[\leadsto \color{blue}{100 \cdot \frac{n + -1 \cdot n}{i}} \]
                6. Step-by-step derivation
                  1. associate-*r/N/A

                    \[\leadsto \color{blue}{\frac{100 \cdot \left(n + -1 \cdot n\right)}{i}} \]
                  2. distribute-rgt1-inN/A

                    \[\leadsto \frac{100 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot n\right)}}{i} \]
                  3. metadata-evalN/A

                    \[\leadsto \frac{100 \cdot \left(\color{blue}{0} \cdot n\right)}{i} \]
                  4. mul0-lftN/A

                    \[\leadsto \frac{100 \cdot \color{blue}{0}}{i} \]
                  5. metadata-evalN/A

                    \[\leadsto \frac{\color{blue}{0}}{i} \]
                  6. lower-/.f6462.9

                    \[\leadsto \color{blue}{\frac{0}{i}} \]
                7. Applied rewrites62.9%

                  \[\leadsto \color{blue}{\frac{0}{i}} \]

                if 1.05e-33 < n

                1. Initial program 21.0%

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

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

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

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

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

                    \[\leadsto \color{blue}{\left(50 \cdot i\right) \cdot n} + 100 \cdot n \]
                  2. distribute-rgt-outN/A

                    \[\leadsto \color{blue}{n \cdot \left(50 \cdot i + 100\right)} \]
                  3. lower-*.f64N/A

                    \[\leadsto \color{blue}{n \cdot \left(50 \cdot i + 100\right)} \]
                  4. lower-fma.f6480.2

                    \[\leadsto n \cdot \color{blue}{\mathsf{fma}\left(50, i, 100\right)} \]
                8. Applied rewrites80.2%

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

                \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -6.2 \cdot 10^{-157}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\ \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\ \;\;\;\;\frac{0}{i}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(50, i, 100\right)\\ \end{array} \]
              5. Add Preprocessing

              Alternative 12: 59.8% accurate, 6.1× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := n \cdot \mathsf{fma}\left(50, i, 100\right)\\ \mathbf{if}\;n \leq -6.2 \cdot 10^{-157}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\ \;\;\;\;\frac{0}{i}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
              (FPCore (i n)
               :precision binary64
               (let* ((t_0 (* n (fma 50.0 i 100.0))))
                 (if (<= n -6.2e-157) t_0 (if (<= n 1.05e-33) (/ 0.0 i) t_0))))
              double code(double i, double n) {
              	double t_0 = n * fma(50.0, i, 100.0);
              	double tmp;
              	if (n <= -6.2e-157) {
              		tmp = t_0;
              	} else if (n <= 1.05e-33) {
              		tmp = 0.0 / i;
              	} else {
              		tmp = t_0;
              	}
              	return tmp;
              }
              
              function code(i, n)
              	t_0 = Float64(n * fma(50.0, i, 100.0))
              	tmp = 0.0
              	if (n <= -6.2e-157)
              		tmp = t_0;
              	elseif (n <= 1.05e-33)
              		tmp = Float64(0.0 / i);
              	else
              		tmp = t_0;
              	end
              	return tmp
              end
              
              code[i_, n_] := Block[{t$95$0 = N[(n * N[(50.0 * i + 100.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -6.2e-157], t$95$0, If[LessEqual[n, 1.05e-33], N[(0.0 / i), $MachinePrecision], t$95$0]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := n \cdot \mathsf{fma}\left(50, i, 100\right)\\
              \mathbf{if}\;n \leq -6.2 \cdot 10^{-157}:\\
              \;\;\;\;t\_0\\
              
              \mathbf{elif}\;n \leq 1.05 \cdot 10^{-33}:\\
              \;\;\;\;\frac{0}{i}\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_0\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if n < -6.1999999999999996e-157 or 1.05e-33 < n

                1. Initial program 22.7%

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

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

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

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

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

                    \[\leadsto \color{blue}{\left(50 \cdot i\right) \cdot n} + 100 \cdot n \]
                  2. distribute-rgt-outN/A

                    \[\leadsto \color{blue}{n \cdot \left(50 \cdot i + 100\right)} \]
                  3. lower-*.f64N/A

                    \[\leadsto \color{blue}{n \cdot \left(50 \cdot i + 100\right)} \]
                  4. lower-fma.f6465.4

                    \[\leadsto n \cdot \color{blue}{\mathsf{fma}\left(50, i, 100\right)} \]
                8. Applied rewrites65.4%

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

                if -6.1999999999999996e-157 < n < 1.05e-33

                1. Initial program 40.2%

                  \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
                2. Add Preprocessing
                3. Step-by-step derivation
                  1. lift-/.f64N/A

                    \[\leadsto 100 \cdot \frac{{\left(1 + \color{blue}{\frac{i}{n}}\right)}^{n} - 1}{\frac{i}{n}} \]
                  2. lift-+.f64N/A

                    \[\leadsto 100 \cdot \frac{{\color{blue}{\left(1 + \frac{i}{n}\right)}}^{n} - 1}{\frac{i}{n}} \]
                  3. lift-pow.f64N/A

                    \[\leadsto 100 \cdot \frac{\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n}} - 1}{\frac{i}{n}} \]
                  4. lift--.f64N/A

                    \[\leadsto 100 \cdot \frac{\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n} - 1}}{\frac{i}{n}} \]
                  5. *-rgt-identityN/A

                    \[\leadsto 100 \cdot \frac{\color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right) \cdot 1}}{\frac{i}{n}} \]
                  6. lift-/.f64N/A

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

                    \[\leadsto 100 \cdot \color{blue}{\left(\left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right) \cdot \frac{1}{\frac{i}{n}}\right)} \]
                  8. div-invN/A

                    \[\leadsto 100 \cdot \color{blue}{\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}} \]
                  9. lift--.f64N/A

                    \[\leadsto 100 \cdot \frac{\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n} - 1}}{\frac{i}{n}} \]
                  10. div-subN/A

                    \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \frac{1}{\frac{i}{n}}\right)} \]
                  11. lift-/.f64N/A

                    \[\leadsto 100 \cdot \left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \frac{1}{\color{blue}{\frac{i}{n}}}\right) \]
                  12. clear-numN/A

                    \[\leadsto 100 \cdot \left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} - \color{blue}{\frac{n}{i}}\right) \]
                  13. sub-negN/A

                    \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}} + \left(\mathsf{neg}\left(\frac{n}{i}\right)\right)\right)} \]
                  14. +-commutativeN/A

                    \[\leadsto 100 \cdot \color{blue}{\left(\left(\mathsf{neg}\left(\frac{n}{i}\right)\right) + \frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}}\right)} \]
                  15. clear-numN/A

                    \[\leadsto 100 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\frac{1}{\frac{i}{n}}}\right)\right) + \frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}}\right) \]
                  16. associate-/r/N/A

                    \[\leadsto 100 \cdot \left(\left(\mathsf{neg}\left(\color{blue}{\frac{1}{i} \cdot n}\right)\right) + \frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}}\right) \]
                  17. distribute-lft-neg-inN/A

                    \[\leadsto 100 \cdot \left(\color{blue}{\left(\mathsf{neg}\left(\frac{1}{i}\right)\right) \cdot n} + \frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}}\right) \]
                  18. distribute-frac-neg2N/A

                    \[\leadsto 100 \cdot \left(\color{blue}{\frac{1}{\mathsf{neg}\left(i\right)}} \cdot n + \frac{{\left(1 + \frac{i}{n}\right)}^{n}}{\frac{i}{n}}\right) \]
                4. Applied rewrites13.0%

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

                  \[\leadsto \color{blue}{100 \cdot \frac{n + -1 \cdot n}{i}} \]
                6. Step-by-step derivation
                  1. associate-*r/N/A

                    \[\leadsto \color{blue}{\frac{100 \cdot \left(n + -1 \cdot n\right)}{i}} \]
                  2. distribute-rgt1-inN/A

                    \[\leadsto \frac{100 \cdot \color{blue}{\left(\left(-1 + 1\right) \cdot n\right)}}{i} \]
                  3. metadata-evalN/A

                    \[\leadsto \frac{100 \cdot \left(\color{blue}{0} \cdot n\right)}{i} \]
                  4. mul0-lftN/A

                    \[\leadsto \frac{100 \cdot \color{blue}{0}}{i} \]
                  5. metadata-evalN/A

                    \[\leadsto \frac{\color{blue}{0}}{i} \]
                  6. lower-/.f6462.9

                    \[\leadsto \color{blue}{\frac{0}{i}} \]
                7. Applied rewrites62.9%

                  \[\leadsto \color{blue}{\frac{0}{i}} \]
              3. Recombined 2 regimes into one program.
              4. Add Preprocessing

              Alternative 13: 54.2% accurate, 8.6× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 9.5 \cdot 10^{+25}:\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(i \cdot 50\right)\\ \end{array} \end{array} \]
              (FPCore (i n)
               :precision binary64
               (if (<= i 9.5e+25) (* n 100.0) (* n (* i 50.0))))
              double code(double i, double n) {
              	double tmp;
              	if (i <= 9.5e+25) {
              		tmp = n * 100.0;
              	} else {
              		tmp = n * (i * 50.0);
              	}
              	return tmp;
              }
              
              real(8) function code(i, n)
                  real(8), intent (in) :: i
                  real(8), intent (in) :: n
                  real(8) :: tmp
                  if (i <= 9.5d+25) then
                      tmp = n * 100.0d0
                  else
                      tmp = n * (i * 50.0d0)
                  end if
                  code = tmp
              end function
              
              public static double code(double i, double n) {
              	double tmp;
              	if (i <= 9.5e+25) {
              		tmp = n * 100.0;
              	} else {
              		tmp = n * (i * 50.0);
              	}
              	return tmp;
              }
              
              def code(i, n):
              	tmp = 0
              	if i <= 9.5e+25:
              		tmp = n * 100.0
              	else:
              		tmp = n * (i * 50.0)
              	return tmp
              
              function code(i, n)
              	tmp = 0.0
              	if (i <= 9.5e+25)
              		tmp = Float64(n * 100.0);
              	else
              		tmp = Float64(n * Float64(i * 50.0));
              	end
              	return tmp
              end
              
              function tmp_2 = code(i, n)
              	tmp = 0.0;
              	if (i <= 9.5e+25)
              		tmp = n * 100.0;
              	else
              		tmp = n * (i * 50.0);
              	end
              	tmp_2 = tmp;
              end
              
              code[i_, n_] := If[LessEqual[i, 9.5e+25], N[(n * 100.0), $MachinePrecision], N[(n * N[(i * 50.0), $MachinePrecision]), $MachinePrecision]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              \mathbf{if}\;i \leq 9.5 \cdot 10^{+25}:\\
              \;\;\;\;n \cdot 100\\
              
              \mathbf{else}:\\
              \;\;\;\;n \cdot \left(i \cdot 50\right)\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if i < 9.5000000000000005e25

                1. Initial program 23.1%

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

                  \[\leadsto \color{blue}{100 \cdot n} \]
                4. Step-by-step derivation
                  1. *-commutativeN/A

                    \[\leadsto \color{blue}{n \cdot 100} \]
                  2. lower-*.f6463.7

                    \[\leadsto \color{blue}{n \cdot 100} \]
                5. Applied rewrites63.7%

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

                if 9.5000000000000005e25 < i

                1. Initial program 42.6%

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

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

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

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

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

                    \[\leadsto \color{blue}{\left(50 \cdot i\right) \cdot n} + 100 \cdot n \]
                  2. distribute-rgt-outN/A

                    \[\leadsto \color{blue}{n \cdot \left(50 \cdot i + 100\right)} \]
                  3. lower-*.f64N/A

                    \[\leadsto \color{blue}{n \cdot \left(50 \cdot i + 100\right)} \]
                  4. lower-fma.f6421.5

                    \[\leadsto n \cdot \color{blue}{\mathsf{fma}\left(50, i, 100\right)} \]
                8. Applied rewrites21.5%

                  \[\leadsto \color{blue}{n \cdot \mathsf{fma}\left(50, i, 100\right)} \]
                9. Taylor expanded in i around inf

                  \[\leadsto \color{blue}{50 \cdot \left(i \cdot n\right)} \]
                10. Step-by-step derivation
                  1. *-commutativeN/A

                    \[\leadsto \color{blue}{\left(i \cdot n\right) \cdot 50} \]
                  2. *-commutativeN/A

                    \[\leadsto \color{blue}{\left(n \cdot i\right)} \cdot 50 \]
                  3. associate-*r*N/A

                    \[\leadsto \color{blue}{n \cdot \left(i \cdot 50\right)} \]
                  4. *-commutativeN/A

                    \[\leadsto n \cdot \color{blue}{\left(50 \cdot i\right)} \]
                  5. lower-*.f64N/A

                    \[\leadsto \color{blue}{n \cdot \left(50 \cdot i\right)} \]
                  6. *-commutativeN/A

                    \[\leadsto n \cdot \color{blue}{\left(i \cdot 50\right)} \]
                  7. lower-*.f6421.5

                    \[\leadsto n \cdot \color{blue}{\left(i \cdot 50\right)} \]
                11. Applied rewrites21.5%

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

              Alternative 14: 54.3% accurate, 12.2× speedup?

              \[\begin{array}{l} \\ n \cdot \mathsf{fma}\left(50, i, 100\right) \end{array} \]
              (FPCore (i n) :precision binary64 (* n (fma 50.0 i 100.0)))
              double code(double i, double n) {
              	return n * fma(50.0, i, 100.0);
              }
              
              function code(i, n)
              	return Float64(n * fma(50.0, i, 100.0))
              end
              
              code[i_, n_] := N[(n * N[(50.0 * i + 100.0), $MachinePrecision]), $MachinePrecision]
              
              \begin{array}{l}
              
              \\
              n \cdot \mathsf{fma}\left(50, i, 100\right)
              \end{array}
              
              Derivation
              1. Initial program 27.2%

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

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

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

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

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

                  \[\leadsto \color{blue}{\left(50 \cdot i\right) \cdot n} + 100 \cdot n \]
                2. distribute-rgt-outN/A

                  \[\leadsto \color{blue}{n \cdot \left(50 \cdot i + 100\right)} \]
                3. lower-*.f64N/A

                  \[\leadsto \color{blue}{n \cdot \left(50 \cdot i + 100\right)} \]
                4. lower-fma.f6456.1

                  \[\leadsto n \cdot \color{blue}{\mathsf{fma}\left(50, i, 100\right)} \]
              8. Applied rewrites56.1%

                \[\leadsto \color{blue}{n \cdot \mathsf{fma}\left(50, i, 100\right)} \]
              9. Add Preprocessing

              Alternative 15: 48.7% accurate, 24.3× 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 27.2%

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

                \[\leadsto \color{blue}{100 \cdot n} \]
              4. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto \color{blue}{n \cdot 100} \]
                2. lower-*.f6451.3

                  \[\leadsto \color{blue}{n \cdot 100} \]
              5. Applied rewrites51.3%

                \[\leadsto \color{blue}{n \cdot 100} \]
              6. Add Preprocessing

              Developer Target 1: 35.2% accurate, 0.5× speedup?

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

              Reproduce

              ?
              herbie shell --seed 2024214 
              (FPCore (i n)
                :name "Compound Interest"
                :precision binary64
              
                :alt
                (! :herbie-platform default (let ((lnbase (if (== (+ 1 (/ i n)) 1) (/ i n) (/ (* (/ i n) (log (+ 1 (/ i n)))) (- (+ (/ i n) 1) 1))))) (* 100 (/ (- (exp (* n lnbase)) 1) (/ i n)))))
              
                (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))