Compound Interest

Percentage Accurate: 28.6% → 94.3%
Time: 18.0s
Alternatives: 16
Speedup: 8.1×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 alternatives:

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

Initial Program: 28.6% accurate, 1.0× speedup?

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

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

Alternative 1: 94.3% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\ t_1 := \frac{t\_0 + -1}{\frac{i}{n}}\\ \mathbf{if}\;t\_1 \leq 0:\\ \;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\ \mathbf{elif}\;t\_1 \leq \infty:\\ \;\;\;\;\frac{n \cdot \mathsf{fma}\left(t\_0, 100, -100\right)}{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 (/ (+ t_0 -1.0) (/ i n))))
   (if (<= t_1 0.0)
     (* 100.0 (/ (expm1 (* n (log1p (/ i n)))) (/ i n)))
     (if (<= t_1 INFINITY) (/ (* n (fma t_0 100.0 -100.0)) i) (* n 100.0)))))
double code(double i, double n) {
	double t_0 = pow((1.0 + (i / n)), n);
	double t_1 = (t_0 + -1.0) / (i / n);
	double tmp;
	if (t_1 <= 0.0) {
		tmp = 100.0 * (expm1((n * log1p((i / n)))) / (i / n));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = (n * fma(t_0, 100.0, -100.0)) / i;
	} else {
		tmp = n * 100.0;
	}
	return tmp;
}
function code(i, n)
	t_0 = Float64(1.0 + Float64(i / n)) ^ n
	t_1 = Float64(Float64(t_0 + -1.0) / Float64(i / n))
	tmp = 0.0
	if (t_1 <= 0.0)
		tmp = Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / Float64(i / n)));
	elseif (t_1 <= Inf)
		tmp = Float64(Float64(n * fma(t_0, 100.0, -100.0)) / 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[(N[(t$95$0 + -1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 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$1, Infinity], N[(N[(n * N[(t$95$0 * 100.0 + -100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]]]]
\begin{array}{l}

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

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

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


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

    1. Initial program 29.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. pow-to-expN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1}{\frac{i}{n}} \]
      4. 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}} \]
      5. *-commutativeN/A

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

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

      \[\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 98.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. 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. lift-pow.f64N/A

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

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

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

        \[\leadsto 100 \cdot \frac{\left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right) \cdot 1}{\color{blue}{\frac{i}{n}}} \]
      9. 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)} \]
      10. 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) \]
      11. clear-numN/A

        \[\leadsto 100 \cdot \left(\left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right) \cdot \color{blue}{\frac{n}{i}}\right) \]
      12. 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}} \]
      13. associate-*r/N/A

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

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({\left(1 + \frac{i}{n}\right)}^{n}, 100, -100\right) \cdot 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-*.f6470.5

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\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:\\ \;\;\;\;\frac{n \cdot \mathsf{fma}\left({\left(1 + \frac{i}{n}\right)}^{n}, 100, -100\right)}{i}\\ \mathbf{else}:\\ \;\;\;\;n \cdot 100\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 87.9% 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 -0.0033:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;n \leq 1.3:\\ \;\;\;\;100 \cdot \frac{\frac{-i}{\mathsf{fma}\left(i, 0.5 + \frac{-0.5}{n}, -1\right)}}{\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 -0.0033)
     t_0
     (if (<= n 1.3)
       (* 100.0 (/ (/ (- i) (fma i (+ 0.5 (/ -0.5 n)) -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 <= -0.0033) {
		tmp = t_0;
	} else if (n <= 1.3) {
		tmp = 100.0 * ((-i / fma(i, (0.5 + (-0.5 / n)), -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 <= -0.0033)
		tmp = t_0;
	elseif (n <= 1.3)
		tmp = Float64(100.0 * Float64(Float64(Float64(-i) / fma(i, Float64(0.5 + Float64(-0.5 / n)), -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, -0.0033], t$95$0, If[LessEqual[n, 1.3], N[(100.0 * N[(N[((-i) / N[(i * N[(0.5 + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $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 -0.0033:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -0.0033 or 1.30000000000000004 < n

    1. Initial program 25.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.f6493.9

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

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

    if -0.0033 < n < 1.30000000000000004

    1. Initial program 34.5%

      \[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}{\left(1 + i \cdot \left(1 + i \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)} - 1}{\frac{i}{n}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

        \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i, \mathsf{fma}\left(i, \frac{1}{2} - \color{blue}{\frac{\frac{1}{2} \cdot 1}{n}}, 1\right), 1\right) - 1}{\frac{i}{n}} \]
      7. metadata-evalN/A

        \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i, \mathsf{fma}\left(i, \frac{1}{2} - \frac{\color{blue}{\frac{1}{2}}}{n}, 1\right), 1\right) - 1}{\frac{i}{n}} \]
      8. lower-/.f647.0

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot \frac{\color{blue}{\frac{\left(\left(i \cdot \left(\frac{1}{2} - \frac{\frac{1}{2}}{n}\right)\right) \cdot \left(i \cdot \left(\frac{1}{2} - \frac{\frac{1}{2}}{n}\right)\right) - 1 \cdot 1\right) \cdot i}{i \cdot \left(\frac{1}{2} - \frac{\frac{1}{2}}{n}\right) - 1}}}{\frac{i}{n}} \]
    7. Applied egg-rr41.8%

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

      \[\leadsto 100 \cdot \frac{\frac{\color{blue}{-1 \cdot i}}{\mathsf{fma}\left(i, \frac{1}{2} + \frac{\frac{-1}{2}}{n}, -1\right)}}{\frac{i}{n}} \]
    9. Step-by-step derivation
      1. mul-1-negN/A

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

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

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

Alternative 3: 74.8% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -3.2 \cdot 10^{+65}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\ \mathbf{elif}\;n \leq 1.15:\\ \;\;\;\;100 \cdot \frac{\frac{-i}{\mathsf{fma}\left(i, 0.5 + \frac{-0.5}{n}, -1\right)}}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \frac{1}{\frac{i}{i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)}}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= n -3.2e+65)
   (* n (fma i (fma i 16.666666666666668 50.0) 100.0))
   (if (<= n 1.15)
     (* 100.0 (/ (/ (- i) (fma i (+ 0.5 (/ -0.5 n)) -1.0)) (/ i n)))
     (*
      n
      (/
       1.0
       (/
        i
        (*
         i
         (fma
          i
          (fma i (fma i 4.166666666666667 16.666666666666668) 50.0)
          100.0))))))))
double code(double i, double n) {
	double tmp;
	if (n <= -3.2e+65) {
		tmp = n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0);
	} else if (n <= 1.15) {
		tmp = 100.0 * ((-i / fma(i, (0.5 + (-0.5 / n)), -1.0)) / (i / n));
	} else {
		tmp = n * (1.0 / (i / (i * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0))));
	}
	return tmp;
}
function code(i, n)
	tmp = 0.0
	if (n <= -3.2e+65)
		tmp = Float64(n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0));
	elseif (n <= 1.15)
		tmp = Float64(100.0 * Float64(Float64(Float64(-i) / fma(i, Float64(0.5 + Float64(-0.5 / n)), -1.0)) / Float64(i / n)));
	else
		tmp = Float64(n * Float64(1.0 / Float64(i / Float64(i * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0)))));
	end
	return tmp
end
code[i_, n_] := If[LessEqual[n, -3.2e+65], N[(n * N[(i * N[(i * 16.666666666666668 + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.15], N[(100.0 * N[(N[((-i) / N[(i * N[(0.5 + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(1.0 / N[(i / N[(i * N[(i * N[(i * N[(i * 4.166666666666667 + 16.666666666666668), $MachinePrecision] + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.2 \cdot 10^{+65}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\

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

\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{\frac{i}{i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)}}\\


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

    1. Initial program 28.3%

      \[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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.20000000000000007e65 < n < 1.1499999999999999

    1. Initial program 35.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 100 \cdot \frac{\color{blue}{\left(1 + i \cdot \left(1 + i \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)} - 1}{\frac{i}{n}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

        \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i, \mathsf{fma}\left(i, \frac{1}{2} - \color{blue}{\frac{\frac{1}{2} \cdot 1}{n}}, 1\right), 1\right) - 1}{\frac{i}{n}} \]
      7. metadata-evalN/A

        \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i, \mathsf{fma}\left(i, \frac{1}{2} - \frac{\color{blue}{\frac{1}{2}}}{n}, 1\right), 1\right) - 1}{\frac{i}{n}} \]
      8. lower-/.f646.7

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot \frac{\color{blue}{\frac{\left(\left(i \cdot \left(\frac{1}{2} - \frac{\frac{1}{2}}{n}\right)\right) \cdot \left(i \cdot \left(\frac{1}{2} - \frac{\frac{1}{2}}{n}\right)\right) - 1 \cdot 1\right) \cdot i}{i \cdot \left(\frac{1}{2} - \frac{\frac{1}{2}}{n}\right) - 1}}}{\frac{i}{n}} \]
    7. Applied egg-rr42.8%

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

      \[\leadsto 100 \cdot \frac{\frac{\color{blue}{-1 \cdot i}}{\mathsf{fma}\left(i, \frac{1}{2} + \frac{\frac{-1}{2}}{n}, -1\right)}}{\frac{i}{n}} \]
    9. Step-by-step derivation
      1. mul-1-negN/A

        \[\leadsto 100 \cdot \frac{\frac{\color{blue}{\mathsf{neg}\left(i\right)}}{\mathsf{fma}\left(i, \frac{1}{2} + \frac{\frac{-1}{2}}{n}, -1\right)}}{\frac{i}{n}} \]
      2. lower-neg.f6483.9

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

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

    if 1.1499999999999999 < n

    1. Initial program 22.3%

      \[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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(\color{blue}{\left(100 \cdot \mathsf{expm1}\left(i\right)\right)} \cdot \frac{1}{i}\right) \]
      13. lower-/.f6496.2

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(\left(i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \color{blue}{\mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right)}, 50\right), 100\right)\right) \cdot \frac{1}{i}\right) \]
    10. Simplified81.3%

      \[\leadsto n \cdot \left(\color{blue}{\left(i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\right)} \cdot \frac{1}{i}\right) \]
    11. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

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

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

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

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

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

        \[\leadsto n \cdot \frac{1}{\color{blue}{\frac{i}{i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)}}} \]
    12. Applied egg-rr81.5%

      \[\leadsto n \cdot \color{blue}{\frac{1}{\frac{i}{i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)}}} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 67.2% accurate, 2.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -2.2 \cdot 10^{-197}:\\ \;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\ \mathbf{elif}\;n \leq 6.8 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.8:\\ \;\;\;\;100 \cdot \left(i \cdot \frac{-1}{\frac{-i}{n}}\right)\\ \mathbf{else}:\\ \;\;\;\;n \cdot \frac{1}{\frac{i}{i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)}}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= n -2.2e-197)
   (fma i (* n (fma 16.666666666666668 i 50.0)) (* n 100.0))
   (if (<= n 6.8e-169)
     0.0
     (if (<= n 1.8)
       (* 100.0 (* i (/ -1.0 (/ (- i) n))))
       (*
        n
        (/
         1.0
         (/
          i
          (*
           i
           (fma
            i
            (fma i (fma i 4.166666666666667 16.666666666666668) 50.0)
            100.0)))))))))
double code(double i, double n) {
	double tmp;
	if (n <= -2.2e-197) {
		tmp = fma(i, (n * fma(16.666666666666668, i, 50.0)), (n * 100.0));
	} else if (n <= 6.8e-169) {
		tmp = 0.0;
	} else if (n <= 1.8) {
		tmp = 100.0 * (i * (-1.0 / (-i / n)));
	} else {
		tmp = n * (1.0 / (i / (i * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0))));
	}
	return tmp;
}
function code(i, n)
	tmp = 0.0
	if (n <= -2.2e-197)
		tmp = fma(i, Float64(n * fma(16.666666666666668, i, 50.0)), Float64(n * 100.0));
	elseif (n <= 6.8e-169)
		tmp = 0.0;
	elseif (n <= 1.8)
		tmp = Float64(100.0 * Float64(i * Float64(-1.0 / Float64(Float64(-i) / n))));
	else
		tmp = Float64(n * Float64(1.0 / Float64(i / Float64(i * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0)))));
	end
	return tmp
end
code[i_, n_] := If[LessEqual[n, -2.2e-197], N[(i * N[(n * N[(16.666666666666668 * i + 50.0), $MachinePrecision]), $MachinePrecision] + N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6.8e-169], 0.0, If[LessEqual[n, 1.8], N[(100.0 * N[(i * N[(-1.0 / N[((-i) / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(1.0 / N[(i / N[(i * N[(i * N[(i * N[(i * 4.166666666666667 + 16.666666666666668), $MachinePrecision] + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.2 \cdot 10^{-197}:\\
\;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\

\mathbf{elif}\;n \leq 6.8 \cdot 10^{-169}:\\
\;\;\;\;0\\

\mathbf{elif}\;n \leq 1.8:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{-1}{\frac{-i}{n}}\right)\\

\mathbf{else}:\\
\;\;\;\;n \cdot \frac{1}{\frac{i}{i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)}}\\


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

    1. Initial program 28.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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.2e-197 < n < 6.8e-169

    1. Initial program 63.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. pow-to-expN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1}{\frac{i}{n}} \]
      4. 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}} \]
      5. *-commutativeN/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{-100 \cdot n + 100 \cdot n}{i}} \]
    7. Step-by-step derivation
      1. distribute-rgt-outN/A

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

        \[\leadsto \frac{n \cdot \color{blue}{0}}{i} \]
      3. mul0-rgtN/A

        \[\leadsto \frac{\color{blue}{0}}{i} \]
      4. div086.4

        \[\leadsto \color{blue}{0} \]
    8. Simplified86.4%

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

    if 6.8e-169 < n < 1.80000000000000004

    1. Initial program 5.5%

      \[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}{\left(1 + i\right)} - 1}{\frac{i}{n}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot \left(\left(\mathsf{neg}\left(\left(i + \color{blue}{0}\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\frac{i}{n}\right)}\right) \]
      10. +-rgt-identityN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot \left(\left(\mathsf{neg}\left(i\right)\right) \cdot \frac{-1}{\color{blue}{\frac{i}{n}}}\right) \]
      20. lower-/.f6483.0

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

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

    if 1.80000000000000004 < n

    1. Initial program 22.3%

      \[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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(\color{blue}{\left(100 \cdot \mathsf{expm1}\left(i\right)\right)} \cdot \frac{1}{i}\right) \]
      13. lower-/.f6496.2

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(\left(i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \color{blue}{\mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right)}, 50\right), 100\right)\right) \cdot \frac{1}{i}\right) \]
    10. Simplified81.3%

      \[\leadsto n \cdot \left(\color{blue}{\left(i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\right)} \cdot \frac{1}{i}\right) \]
    11. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

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

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

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

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

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

        \[\leadsto n \cdot \frac{1}{\color{blue}{\frac{i}{i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)}}} \]
    12. Applied egg-rr81.5%

      \[\leadsto n \cdot \color{blue}{\frac{1}{\frac{i}{i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)}}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification74.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.2 \cdot 10^{-197}:\\ \;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\ \mathbf{elif}\;n \leq 6.8 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.8:\\ \;\;\;\;100 \cdot \left(i \cdot \frac{-1}{\frac{-i}{n}}\right)\\ \mathbf{else}:\\ \;\;\;\;n \cdot \frac{1}{\frac{i}{i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 67.1% accurate, 2.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -1 \cdot 10^{-197}:\\ \;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\ \mathbf{elif}\;n \leq 2.5 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 3.2:\\ \;\;\;\;100 \cdot \left(i \cdot \frac{-1}{\frac{-i}{n}}\right)\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(\left(i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\right) \cdot \frac{1}{i}\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= n -1e-197)
   (fma i (* n (fma 16.666666666666668 i 50.0)) (* n 100.0))
   (if (<= n 2.5e-169)
     0.0
     (if (<= n 3.2)
       (* 100.0 (* i (/ -1.0 (/ (- i) n))))
       (*
        n
        (*
         (*
          i
          (fma
           i
           (fma i (fma i 4.166666666666667 16.666666666666668) 50.0)
           100.0))
         (/ 1.0 i)))))))
double code(double i, double n) {
	double tmp;
	if (n <= -1e-197) {
		tmp = fma(i, (n * fma(16.666666666666668, i, 50.0)), (n * 100.0));
	} else if (n <= 2.5e-169) {
		tmp = 0.0;
	} else if (n <= 3.2) {
		tmp = 100.0 * (i * (-1.0 / (-i / n)));
	} else {
		tmp = n * ((i * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0)) * (1.0 / i));
	}
	return tmp;
}
function code(i, n)
	tmp = 0.0
	if (n <= -1e-197)
		tmp = fma(i, Float64(n * fma(16.666666666666668, i, 50.0)), Float64(n * 100.0));
	elseif (n <= 2.5e-169)
		tmp = 0.0;
	elseif (n <= 3.2)
		tmp = Float64(100.0 * Float64(i * Float64(-1.0 / Float64(Float64(-i) / n))));
	else
		tmp = Float64(n * Float64(Float64(i * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0)) * Float64(1.0 / i)));
	end
	return tmp
end
code[i_, n_] := If[LessEqual[n, -1e-197], N[(i * N[(n * N[(16.666666666666668 * i + 50.0), $MachinePrecision]), $MachinePrecision] + N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.5e-169], 0.0, If[LessEqual[n, 3.2], N[(100.0 * N[(i * N[(-1.0 / N[((-i) / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(N[(i * N[(i * N[(i * N[(i * 4.166666666666667 + 16.666666666666668), $MachinePrecision] + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision] * N[(1.0 / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -1 \cdot 10^{-197}:\\
\;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\

\mathbf{elif}\;n \leq 2.5 \cdot 10^{-169}:\\
\;\;\;\;0\\

\mathbf{elif}\;n \leq 3.2:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{-1}{\frac{-i}{n}}\right)\\

\mathbf{else}:\\
\;\;\;\;n \cdot \left(\left(i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\right) \cdot \frac{1}{i}\right)\\


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

    1. Initial program 28.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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.9999999999999999e-198 < n < 2.5000000000000001e-169

    1. Initial program 63.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. pow-to-expN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1}{\frac{i}{n}} \]
      4. 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}} \]
      5. *-commutativeN/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{-100 \cdot n + 100 \cdot n}{i}} \]
    7. Step-by-step derivation
      1. distribute-rgt-outN/A

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

        \[\leadsto \frac{n \cdot \color{blue}{0}}{i} \]
      3. mul0-rgtN/A

        \[\leadsto \frac{\color{blue}{0}}{i} \]
      4. div086.4

        \[\leadsto \color{blue}{0} \]
    8. Simplified86.4%

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

    if 2.5000000000000001e-169 < n < 3.2000000000000002

    1. Initial program 5.5%

      \[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}{\left(1 + i\right)} - 1}{\frac{i}{n}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{\left(i + 1\right)} - 1}{\frac{i}{n}} \]
      2. lower-+.f6420.5

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot \left(\left(\mathsf{neg}\left(\left(i + \color{blue}{0}\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\frac{i}{n}\right)}\right) \]
      10. +-rgt-identityN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot \left(\left(\mathsf{neg}\left(i\right)\right) \cdot \frac{-1}{\color{blue}{\frac{i}{n}}}\right) \]
      20. lower-/.f6483.5

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

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

    if 3.2000000000000002 < 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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(\color{blue}{\left(100 \cdot \mathsf{expm1}\left(i\right)\right)} \cdot \frac{1}{i}\right) \]
      13. lower-/.f6496.2

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(\left(i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \color{blue}{\mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right)}, 50\right), 100\right)\right) \cdot \frac{1}{i}\right) \]
    10. Simplified81.1%

      \[\leadsto n \cdot \left(\color{blue}{\left(i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\right)} \cdot \frac{1}{i}\right) \]
  3. Recombined 4 regimes into one program.
  4. Final simplification74.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1 \cdot 10^{-197}:\\ \;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\ \mathbf{elif}\;n \leq 2.5 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 3.2:\\ \;\;\;\;100 \cdot \left(i \cdot \frac{-1}{\frac{-i}{n}}\right)\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(\left(i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\right) \cdot \frac{1}{i}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 67.2% accurate, 2.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -9.5 \cdot 10^{-200}:\\ \;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\ \mathbf{elif}\;n \leq 4.5 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.9:\\ \;\;\;\;100 \cdot \left(i \cdot \frac{-1}{\frac{-i}{n}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{n \cdot \left(i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\right)}{i}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= n -9.5e-200)
   (fma i (* n (fma 16.666666666666668 i 50.0)) (* n 100.0))
   (if (<= n 4.5e-169)
     0.0
     (if (<= n 1.9)
       (* 100.0 (* i (/ -1.0 (/ (- i) n))))
       (/
        (*
         n
         (*
          i
          (fma
           i
           (fma i (fma i 4.166666666666667 16.666666666666668) 50.0)
           100.0)))
        i)))))
double code(double i, double n) {
	double tmp;
	if (n <= -9.5e-200) {
		tmp = fma(i, (n * fma(16.666666666666668, i, 50.0)), (n * 100.0));
	} else if (n <= 4.5e-169) {
		tmp = 0.0;
	} else if (n <= 1.9) {
		tmp = 100.0 * (i * (-1.0 / (-i / n)));
	} else {
		tmp = (n * (i * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0))) / i;
	}
	return tmp;
}
function code(i, n)
	tmp = 0.0
	if (n <= -9.5e-200)
		tmp = fma(i, Float64(n * fma(16.666666666666668, i, 50.0)), Float64(n * 100.0));
	elseif (n <= 4.5e-169)
		tmp = 0.0;
	elseif (n <= 1.9)
		tmp = Float64(100.0 * Float64(i * Float64(-1.0 / Float64(Float64(-i) / n))));
	else
		tmp = Float64(Float64(n * Float64(i * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0))) / i);
	end
	return tmp
end
code[i_, n_] := If[LessEqual[n, -9.5e-200], N[(i * N[(n * N[(16.666666666666668 * i + 50.0), $MachinePrecision]), $MachinePrecision] + N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.5e-169], 0.0, If[LessEqual[n, 1.9], N[(100.0 * N[(i * N[(-1.0 / N[((-i) / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(n * N[(i * N[(i * N[(i * N[(i * 4.166666666666667 + 16.666666666666668), $MachinePrecision] + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -9.5 \cdot 10^{-200}:\\
\;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\

\mathbf{elif}\;n \leq 4.5 \cdot 10^{-169}:\\
\;\;\;\;0\\

\mathbf{elif}\;n \leq 1.9:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{-1}{\frac{-i}{n}}\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{n \cdot \left(i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\right)}{i}\\


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

    1. Initial program 28.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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -9.4999999999999995e-200 < n < 4.4999999999999999e-169

    1. Initial program 63.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. pow-to-expN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1}{\frac{i}{n}} \]
      4. 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}} \]
      5. *-commutativeN/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{-100 \cdot n + 100 \cdot n}{i}} \]
    7. Step-by-step derivation
      1. distribute-rgt-outN/A

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

        \[\leadsto \frac{n \cdot \color{blue}{0}}{i} \]
      3. mul0-rgtN/A

        \[\leadsto \frac{\color{blue}{0}}{i} \]
      4. div086.4

        \[\leadsto \color{blue}{0} \]
    8. Simplified86.4%

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

    if 4.4999999999999999e-169 < n < 1.8999999999999999

    1. Initial program 5.5%

      \[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}{\left(1 + i\right)} - 1}{\frac{i}{n}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot \left(\left(\mathsf{neg}\left(\left(i + \color{blue}{0}\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\frac{i}{n}\right)}\right) \]
      10. +-rgt-identityN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot \left(\left(\mathsf{neg}\left(i\right)\right) \cdot \frac{-1}{\color{blue}{\frac{i}{n}}}\right) \]
      20. lower-/.f6483.0

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

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

    if 1.8999999999999999 < n

    1. Initial program 22.3%

      \[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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(\color{blue}{\left(100 \cdot \mathsf{expm1}\left(i\right)\right)} \cdot \frac{1}{i}\right) \]
      13. lower-/.f6496.2

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(\left(i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \color{blue}{\mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right)}, 50\right), 100\right)\right) \cdot \frac{1}{i}\right) \]
    10. Simplified81.3%

      \[\leadsto n \cdot \left(\color{blue}{\left(i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\right)} \cdot \frac{1}{i}\right) \]
    11. Step-by-step derivation
      1. lift-fma.f64N/A

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\color{blue}{\left(i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\right) \cdot n}}{i} \]
    12. Applied egg-rr81.3%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -9.5 \cdot 10^{-200}:\\ \;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\ \mathbf{elif}\;n \leq 4.5 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.9:\\ \;\;\;\;100 \cdot \left(i \cdot \frac{-1}{\frac{-i}{n}}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{n \cdot \left(i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, \mathsf{fma}\left(i, 4.166666666666667, 16.666666666666668\right), 50\right), 100\right)\right)}{i}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 67.0% accurate, 2.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -2.3 \cdot 10^{-197}:\\ \;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\ \mathbf{elif}\;n \leq 2.3 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.85:\\ \;\;\;\;100 \cdot \left(i \cdot \frac{-1}{\frac{-i}{n}}\right)\\ \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} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= n -2.3e-197)
   (fma i (* n (fma 16.666666666666668 i 50.0)) (* n 100.0))
   (if (<= n 2.3e-169)
     0.0
     (if (<= n 1.85)
       (* 100.0 (* i (/ -1.0 (/ (- i) n))))
       (*
        n
        (fma
         i
         (fma i (fma i 4.166666666666667 16.666666666666668) 50.0)
         100.0))))))
double code(double i, double n) {
	double tmp;
	if (n <= -2.3e-197) {
		tmp = fma(i, (n * fma(16.666666666666668, i, 50.0)), (n * 100.0));
	} else if (n <= 2.3e-169) {
		tmp = 0.0;
	} else if (n <= 1.85) {
		tmp = 100.0 * (i * (-1.0 / (-i / n)));
	} else {
		tmp = n * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0);
	}
	return tmp;
}
function code(i, n)
	tmp = 0.0
	if (n <= -2.3e-197)
		tmp = fma(i, Float64(n * fma(16.666666666666668, i, 50.0)), Float64(n * 100.0));
	elseif (n <= 2.3e-169)
		tmp = 0.0;
	elseif (n <= 1.85)
		tmp = Float64(100.0 * Float64(i * Float64(-1.0 / Float64(Float64(-i) / n))));
	else
		tmp = Float64(n * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0));
	end
	return tmp
end
code[i_, n_] := If[LessEqual[n, -2.3e-197], N[(i * N[(n * N[(16.666666666666668 * i + 50.0), $MachinePrecision]), $MachinePrecision] + N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.3e-169], 0.0, If[LessEqual[n, 1.85], N[(100.0 * N[(i * N[(-1.0 / N[((-i) / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(i * N[(i * N[(i * 4.166666666666667 + 16.666666666666668), $MachinePrecision] + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.3 \cdot 10^{-197}:\\
\;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\

\mathbf{elif}\;n \leq 2.3 \cdot 10^{-169}:\\
\;\;\;\;0\\

\mathbf{elif}\;n \leq 1.85:\\
\;\;\;\;100 \cdot \left(i \cdot \frac{-1}{\frac{-i}{n}}\right)\\

\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}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if n < -2.3000000000000001e-197

    1. Initial program 28.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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.3000000000000001e-197 < n < 2.3000000000000001e-169

    1. Initial program 63.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. pow-to-expN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1}{\frac{i}{n}} \]
      4. 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}} \]
      5. *-commutativeN/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{-100 \cdot n + 100 \cdot n}{i}} \]
    7. Step-by-step derivation
      1. distribute-rgt-outN/A

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

        \[\leadsto \frac{n \cdot \color{blue}{0}}{i} \]
      3. mul0-rgtN/A

        \[\leadsto \frac{\color{blue}{0}}{i} \]
      4. div086.4

        \[\leadsto \color{blue}{0} \]
    8. Simplified86.4%

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

    if 2.3000000000000001e-169 < n < 1.8500000000000001

    1. Initial program 5.5%

      \[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}{\left(1 + i\right)} - 1}{\frac{i}{n}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot \left(\left(\mathsf{neg}\left(\left(i + \color{blue}{0}\right)\right)\right) \cdot \frac{1}{\mathsf{neg}\left(\frac{i}{n}\right)}\right) \]
      10. +-rgt-identityN/A

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

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

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot \left(\left(\mathsf{neg}\left(i\right)\right) \cdot \frac{-1}{\color{blue}{\frac{i}{n}}}\right) \]
      20. lower-/.f6483.0

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

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

    if 1.8500000000000001 < n

    1. Initial program 22.3%

      \[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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(\color{blue}{\left(100 \cdot \mathsf{expm1}\left(i\right)\right)} \cdot \frac{1}{i}\right) \]
      13. lower-/.f6496.2

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.3 \cdot 10^{-197}:\\ \;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\ \mathbf{elif}\;n \leq 2.3 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.85:\\ \;\;\;\;100 \cdot \left(i \cdot \frac{-1}{\frac{-i}{n}}\right)\\ \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} \]
  5. Add Preprocessing

Alternative 8: 66.7% accurate, 3.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -2.3 \cdot 10^{-197}:\\ \;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\ \mathbf{elif}\;n \leq 6.8 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.65:\\ \;\;\;\;i \cdot \left(100 \cdot \frac{n}{i}\right)\\ \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} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= n -2.3e-197)
   (fma i (* n (fma 16.666666666666668 i 50.0)) (* n 100.0))
   (if (<= n 6.8e-169)
     0.0
     (if (<= n 1.65)
       (* i (* 100.0 (/ n i)))
       (*
        n
        (fma
         i
         (fma i (fma i 4.166666666666667 16.666666666666668) 50.0)
         100.0))))))
double code(double i, double n) {
	double tmp;
	if (n <= -2.3e-197) {
		tmp = fma(i, (n * fma(16.666666666666668, i, 50.0)), (n * 100.0));
	} else if (n <= 6.8e-169) {
		tmp = 0.0;
	} else if (n <= 1.65) {
		tmp = i * (100.0 * (n / i));
	} else {
		tmp = n * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0);
	}
	return tmp;
}
function code(i, n)
	tmp = 0.0
	if (n <= -2.3e-197)
		tmp = fma(i, Float64(n * fma(16.666666666666668, i, 50.0)), Float64(n * 100.0));
	elseif (n <= 6.8e-169)
		tmp = 0.0;
	elseif (n <= 1.65)
		tmp = Float64(i * Float64(100.0 * Float64(n / i)));
	else
		tmp = Float64(n * fma(i, fma(i, fma(i, 4.166666666666667, 16.666666666666668), 50.0), 100.0));
	end
	return tmp
end
code[i_, n_] := If[LessEqual[n, -2.3e-197], N[(i * N[(n * N[(16.666666666666668 * i + 50.0), $MachinePrecision]), $MachinePrecision] + N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6.8e-169], 0.0, If[LessEqual[n, 1.65], N[(i * N[(100.0 * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(i * N[(i * N[(i * 4.166666666666667 + 16.666666666666668), $MachinePrecision] + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.3 \cdot 10^{-197}:\\
\;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\

\mathbf{elif}\;n \leq 6.8 \cdot 10^{-169}:\\
\;\;\;\;0\\

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

\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}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if n < -2.3000000000000001e-197

    1. Initial program 28.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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.3000000000000001e-197 < n < 6.8e-169

    1. Initial program 63.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. pow-to-expN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1}{\frac{i}{n}} \]
      4. 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}} \]
      5. *-commutativeN/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{-100 \cdot n + 100 \cdot n}{i}} \]
    7. Step-by-step derivation
      1. distribute-rgt-outN/A

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

        \[\leadsto \frac{n \cdot \color{blue}{0}}{i} \]
      3. mul0-rgtN/A

        \[\leadsto \frac{\color{blue}{0}}{i} \]
      4. div086.4

        \[\leadsto \color{blue}{0} \]
    8. Simplified86.4%

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

    if 6.8e-169 < n < 1.6499999999999999

    1. Initial program 5.5%

      \[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}{\left(1 + i\right)} - 1}{\frac{i}{n}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto i \cdot \color{blue}{\left(\frac{n}{i} \cdot 100\right)} \]
      18. lower-/.f6482.8

        \[\leadsto i \cdot \left(\color{blue}{\frac{n}{i}} \cdot 100\right) \]
    7. Applied egg-rr82.8%

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

    if 1.6499999999999999 < n

    1. Initial program 22.3%

      \[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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(\color{blue}{\left(100 \cdot \mathsf{expm1}\left(i\right)\right)} \cdot \frac{1}{i}\right) \]
      13. lower-/.f6496.2

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.3 \cdot 10^{-197}:\\ \;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\ \mathbf{elif}\;n \leq 6.8 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.65:\\ \;\;\;\;i \cdot \left(100 \cdot \frac{n}{i}\right)\\ \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} \]
  5. Add Preprocessing

Alternative 9: 66.3% accurate, 3.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -4.9 \cdot 10^{-200}:\\ \;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\ \mathbf{elif}\;n \leq 2.25 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.65:\\ \;\;\;\;i \cdot \left(100 \cdot \frac{n}{i}\right)\\ \mathbf{else}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(i, i \cdot \left(i \cdot 4.166666666666667\right), 100\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= n -4.9e-200)
   (fma i (* n (fma 16.666666666666668 i 50.0)) (* n 100.0))
   (if (<= n 2.25e-169)
     0.0
     (if (<= n 1.65)
       (* i (* 100.0 (/ n i)))
       (* n (fma i (* i (* i 4.166666666666667)) 100.0))))))
double code(double i, double n) {
	double tmp;
	if (n <= -4.9e-200) {
		tmp = fma(i, (n * fma(16.666666666666668, i, 50.0)), (n * 100.0));
	} else if (n <= 2.25e-169) {
		tmp = 0.0;
	} else if (n <= 1.65) {
		tmp = i * (100.0 * (n / i));
	} else {
		tmp = n * fma(i, (i * (i * 4.166666666666667)), 100.0);
	}
	return tmp;
}
function code(i, n)
	tmp = 0.0
	if (n <= -4.9e-200)
		tmp = fma(i, Float64(n * fma(16.666666666666668, i, 50.0)), Float64(n * 100.0));
	elseif (n <= 2.25e-169)
		tmp = 0.0;
	elseif (n <= 1.65)
		tmp = Float64(i * Float64(100.0 * Float64(n / i)));
	else
		tmp = Float64(n * fma(i, Float64(i * Float64(i * 4.166666666666667)), 100.0));
	end
	return tmp
end
code[i_, n_] := If[LessEqual[n, -4.9e-200], N[(i * N[(n * N[(16.666666666666668 * i + 50.0), $MachinePrecision]), $MachinePrecision] + N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.25e-169], 0.0, If[LessEqual[n, 1.65], N[(i * N[(100.0 * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(i * N[(i * N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.9 \cdot 10^{-200}:\\
\;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\

\mathbf{elif}\;n \leq 2.25 \cdot 10^{-169}:\\
\;\;\;\;0\\

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

\mathbf{else}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(i, i \cdot \left(i \cdot 4.166666666666667\right), 100\right)\\


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

    1. Initial program 28.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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.9e-200 < n < 2.2499999999999999e-169

    1. Initial program 63.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. pow-to-expN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1}{\frac{i}{n}} \]
      4. 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}} \]
      5. *-commutativeN/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{-100 \cdot n + 100 \cdot n}{i}} \]
    7. Step-by-step derivation
      1. distribute-rgt-outN/A

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

        \[\leadsto \frac{n \cdot \color{blue}{0}}{i} \]
      3. mul0-rgtN/A

        \[\leadsto \frac{\color{blue}{0}}{i} \]
      4. div086.4

        \[\leadsto \color{blue}{0} \]
    8. Simplified86.4%

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

    if 2.2499999999999999e-169 < n < 1.6499999999999999

    1. Initial program 5.5%

      \[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}{\left(1 + i\right)} - 1}{\frac{i}{n}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto i \cdot \color{blue}{\left(\frac{n}{i} \cdot 100\right)} \]
      18. lower-/.f6482.8

        \[\leadsto i \cdot \left(\color{blue}{\frac{n}{i}} \cdot 100\right) \]
    7. Applied egg-rr82.8%

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

    if 1.6499999999999999 < n

    1. Initial program 22.3%

      \[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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(\color{blue}{\left(100 \cdot \mathsf{expm1}\left(i\right)\right)} \cdot \frac{1}{i}\right) \]
      13. lower-/.f6496.2

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

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

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

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

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

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

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

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

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

      \[\leadsto n \cdot \mathsf{fma}\left(i, \color{blue}{\frac{25}{6} \cdot {i}^{2}}, 100\right) \]
    12. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto n \cdot \mathsf{fma}\left(i, \color{blue}{{i}^{2} \cdot \frac{25}{6}}, 100\right) \]
      2. unpow2N/A

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

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

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

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

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

        \[\leadsto n \cdot \mathsf{fma}\left(i, i \cdot \color{blue}{\left(i \cdot 4.166666666666667\right)}, 100\right) \]
    13. Simplified79.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4.9 \cdot 10^{-200}:\\ \;\;\;\;\mathsf{fma}\left(i, n \cdot \mathsf{fma}\left(16.666666666666668, i, 50\right), n \cdot 100\right)\\ \mathbf{elif}\;n \leq 2.25 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.65:\\ \;\;\;\;i \cdot \left(100 \cdot \frac{n}{i}\right)\\ \mathbf{else}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(i, i \cdot \left(i \cdot 4.166666666666667\right), 100\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 66.5% accurate, 3.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -2.55 \cdot 10^{-197}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\ \mathbf{elif}\;n \leq 2.3 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.55:\\ \;\;\;\;i \cdot \left(100 \cdot \frac{n}{i}\right)\\ \mathbf{else}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(i, i \cdot \left(i \cdot 4.166666666666667\right), 100\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= n -2.55e-197)
   (* n (fma i (fma i 16.666666666666668 50.0) 100.0))
   (if (<= n 2.3e-169)
     0.0
     (if (<= n 1.55)
       (* i (* 100.0 (/ n i)))
       (* n (fma i (* i (* i 4.166666666666667)) 100.0))))))
double code(double i, double n) {
	double tmp;
	if (n <= -2.55e-197) {
		tmp = n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0);
	} else if (n <= 2.3e-169) {
		tmp = 0.0;
	} else if (n <= 1.55) {
		tmp = i * (100.0 * (n / i));
	} else {
		tmp = n * fma(i, (i * (i * 4.166666666666667)), 100.0);
	}
	return tmp;
}
function code(i, n)
	tmp = 0.0
	if (n <= -2.55e-197)
		tmp = Float64(n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0));
	elseif (n <= 2.3e-169)
		tmp = 0.0;
	elseif (n <= 1.55)
		tmp = Float64(i * Float64(100.0 * Float64(n / i)));
	else
		tmp = Float64(n * fma(i, Float64(i * Float64(i * 4.166666666666667)), 100.0));
	end
	return tmp
end
code[i_, n_] := If[LessEqual[n, -2.55e-197], N[(n * N[(i * N[(i * 16.666666666666668 + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.3e-169], 0.0, If[LessEqual[n, 1.55], N[(i * N[(100.0 * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n * N[(i * N[(i * N[(i * 4.166666666666667), $MachinePrecision]), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.55 \cdot 10^{-197}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\

\mathbf{elif}\;n \leq 2.3 \cdot 10^{-169}:\\
\;\;\;\;0\\

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

\mathbf{else}:\\
\;\;\;\;n \cdot \mathsf{fma}\left(i, i \cdot \left(i \cdot 4.166666666666667\right), 100\right)\\


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

    1. Initial program 28.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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.5500000000000001e-197 < n < 2.3000000000000001e-169

    1. Initial program 63.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. pow-to-expN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1}{\frac{i}{n}} \]
      4. 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}} \]
      5. *-commutativeN/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{-100 \cdot n + 100 \cdot n}{i}} \]
    7. Step-by-step derivation
      1. distribute-rgt-outN/A

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

        \[\leadsto \frac{n \cdot \color{blue}{0}}{i} \]
      3. mul0-rgtN/A

        \[\leadsto \frac{\color{blue}{0}}{i} \]
      4. div086.4

        \[\leadsto \color{blue}{0} \]
    8. Simplified86.4%

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

    if 2.3000000000000001e-169 < n < 1.55000000000000004

    1. Initial program 5.5%

      \[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}{\left(1 + i\right)} - 1}{\frac{i}{n}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto i \cdot \color{blue}{\left(\frac{n}{i} \cdot 100\right)} \]
      18. lower-/.f6482.8

        \[\leadsto i \cdot \left(\color{blue}{\frac{n}{i}} \cdot 100\right) \]
    7. Applied egg-rr82.8%

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

    if 1.55000000000000004 < n

    1. Initial program 22.3%

      \[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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(\color{blue}{\left(100 \cdot \mathsf{expm1}\left(i\right)\right)} \cdot \frac{1}{i}\right) \]
      13. lower-/.f6496.2

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

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

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

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

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

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

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

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

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

      \[\leadsto n \cdot \mathsf{fma}\left(i, \color{blue}{\frac{25}{6} \cdot {i}^{2}}, 100\right) \]
    12. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto n \cdot \mathsf{fma}\left(i, \color{blue}{{i}^{2} \cdot \frac{25}{6}}, 100\right) \]
      2. unpow2N/A

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

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

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

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

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

        \[\leadsto n \cdot \mathsf{fma}\left(i, i \cdot \color{blue}{\left(i \cdot 4.166666666666667\right)}, 100\right) \]
    13. Simplified79.6%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.55 \cdot 10^{-197}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\ \mathbf{elif}\;n \leq 2.3 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.55:\\ \;\;\;\;i \cdot \left(100 \cdot \frac{n}{i}\right)\\ \mathbf{else}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(i, i \cdot \left(i \cdot 4.166666666666667\right), 100\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 65.0% accurate, 3.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\ \mathbf{if}\;n \leq -7.8 \cdot 10^{-200}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;n \leq 2.25 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 6.8 \cdot 10^{-6}:\\ \;\;\;\;i \cdot \left(100 \cdot \frac{n}{i}\right)\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (* n (fma i (fma i 16.666666666666668 50.0) 100.0))))
   (if (<= n -7.8e-200)
     t_0
     (if (<= n 2.25e-169)
       0.0
       (if (<= n 6.8e-6) (* i (* 100.0 (/ n i))) t_0)))))
double code(double i, double n) {
	double t_0 = n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0);
	double tmp;
	if (n <= -7.8e-200) {
		tmp = t_0;
	} else if (n <= 2.25e-169) {
		tmp = 0.0;
	} else if (n <= 6.8e-6) {
		tmp = i * (100.0 * (n / i));
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(i, n)
	t_0 = Float64(n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0))
	tmp = 0.0
	if (n <= -7.8e-200)
		tmp = t_0;
	elseif (n <= 2.25e-169)
		tmp = 0.0;
	elseif (n <= 6.8e-6)
		tmp = Float64(i * Float64(100.0 * Float64(n / i)));
	else
		tmp = t_0;
	end
	return tmp
end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(i * N[(i * 16.666666666666668 + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -7.8e-200], t$95$0, If[LessEqual[n, 2.25e-169], 0.0, If[LessEqual[n, 6.8e-6], N[(i * N[(100.0 * N[(n / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\
\mathbf{if}\;n \leq -7.8 \cdot 10^{-200}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;n \leq 2.25 \cdot 10^{-169}:\\
\;\;\;\;0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -7.79999999999999998e-200 or 6.80000000000000012e-6 < n

    1. Initial program 25.3%

      \[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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -7.79999999999999998e-200 < n < 2.2499999999999999e-169

    1. Initial program 63.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. pow-to-expN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1}{\frac{i}{n}} \]
      4. 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}} \]
      5. *-commutativeN/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{-100 \cdot n + 100 \cdot n}{i}} \]
    7. Step-by-step derivation
      1. distribute-rgt-outN/A

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

        \[\leadsto \frac{n \cdot \color{blue}{0}}{i} \]
      3. mul0-rgtN/A

        \[\leadsto \frac{\color{blue}{0}}{i} \]
      4. div086.4

        \[\leadsto \color{blue}{0} \]
    8. Simplified86.4%

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

    if 2.2499999999999999e-169 < n < 6.80000000000000012e-6

    1. Initial program 5.5%

      \[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}{\left(1 + i\right)} - 1}{\frac{i}{n}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto i \cdot \color{blue}{\left(\frac{n}{i} \cdot 100\right)} \]
      18. lower-/.f6482.8

        \[\leadsto i \cdot \left(\color{blue}{\frac{n}{i}} \cdot 100\right) \]
    7. Applied egg-rr82.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -7.8 \cdot 10^{-200}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\ \mathbf{elif}\;n \leq 2.25 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 6.8 \cdot 10^{-6}:\\ \;\;\;\;i \cdot \left(100 \cdot \frac{n}{i}\right)\\ \mathbf{else}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 64.0% accurate, 4.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\ \mathbf{if}\;n \leq -1.3 \cdot 10^{-198}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;n \leq 4.2 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (* n (fma i (fma i 16.666666666666668 50.0) 100.0))))
   (if (<= n -1.3e-198) t_0 (if (<= n 4.2e-169) 0.0 t_0))))
double code(double i, double n) {
	double t_0 = n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0);
	double tmp;
	if (n <= -1.3e-198) {
		tmp = t_0;
	} else if (n <= 4.2e-169) {
		tmp = 0.0;
	} else {
		tmp = t_0;
	}
	return tmp;
}
function code(i, n)
	t_0 = Float64(n * fma(i, fma(i, 16.666666666666668, 50.0), 100.0))
	tmp = 0.0
	if (n <= -1.3e-198)
		tmp = t_0;
	elseif (n <= 4.2e-169)
		tmp = 0.0;
	else
		tmp = t_0;
	end
	return tmp
end
code[i_, n_] := Block[{t$95$0 = N[(n * N[(i * N[(i * 16.666666666666668 + 50.0), $MachinePrecision] + 100.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.3e-198], t$95$0, If[LessEqual[n, 4.2e-169], 0.0, t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := n \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, 16.666666666666668, 50\right), 100\right)\\
\mathbf{if}\;n \leq -1.3 \cdot 10^{-198}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;n \leq 4.2 \cdot 10^{-169}:\\
\;\;\;\;0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -1.30000000000000003e-198 or 4.2000000000000001e-169 < n

    1. Initial program 22.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 \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. associate-*r/N/A

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(\color{blue}{\left(100 \cdot \mathsf{expm1}\left(i\right)\right)} \cdot \frac{1}{i}\right) \]
      13. lower-/.f6484.2

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

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

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

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

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

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

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

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

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

    if -1.30000000000000003e-198 < n < 4.2000000000000001e-169

    1. Initial program 63.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. pow-to-expN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1}{\frac{i}{n}} \]
      4. 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}} \]
      5. *-commutativeN/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{-100 \cdot n + 100 \cdot n}{i}} \]
    7. Step-by-step derivation
      1. distribute-rgt-outN/A

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

        \[\leadsto \frac{n \cdot \color{blue}{0}}{i} \]
      3. mul0-rgtN/A

        \[\leadsto \frac{\color{blue}{0}}{i} \]
      4. div086.4

        \[\leadsto \color{blue}{0} \]
    8. Simplified86.4%

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

Alternative 13: 61.8% accurate, 6.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -2.1 \cdot 10^{-199}:\\ \;\;\;\;100 \cdot \mathsf{fma}\left(n, i \cdot 0.5, n\right)\\ \mathbf{elif}\;n \leq 5.5 \cdot 10^{-169}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;n \cdot \mathsf{fma}\left(50, i, 100\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= n -2.1e-199)
   (* 100.0 (fma n (* i 0.5) n))
   (if (<= n 5.5e-169) 0.0 (* n (fma 50.0 i 100.0)))))
double code(double i, double n) {
	double tmp;
	if (n <= -2.1e-199) {
		tmp = 100.0 * fma(n, (i * 0.5), n);
	} else if (n <= 5.5e-169) {
		tmp = 0.0;
	} else {
		tmp = n * fma(50.0, i, 100.0);
	}
	return tmp;
}
function code(i, n)
	tmp = 0.0
	if (n <= -2.1e-199)
		tmp = Float64(100.0 * fma(n, Float64(i * 0.5), n));
	elseif (n <= 5.5e-169)
		tmp = 0.0;
	else
		tmp = Float64(n * fma(50.0, i, 100.0));
	end
	return tmp
end
code[i_, n_] := If[LessEqual[n, -2.1e-199], N[(100.0 * N[(n * N[(i * 0.5), $MachinePrecision] + n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.5e-169], 0.0, N[(n * N[(50.0 * i + 100.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.1 \cdot 10^{-199}:\\
\;\;\;\;100 \cdot \mathsf{fma}\left(n, i \cdot 0.5, n\right)\\

\mathbf{elif}\;n \leq 5.5 \cdot 10^{-169}:\\
\;\;\;\;0\\

\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 < -2.10000000000000002e-199

    1. Initial program 28.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 100 \cdot \frac{\color{blue}{\left(1 + i \cdot \left(1 + i \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)} - 1}{\frac{i}{n}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

        \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i, \mathsf{fma}\left(i, \frac{1}{2} - \color{blue}{\frac{\frac{1}{2} \cdot 1}{n}}, 1\right), 1\right) - 1}{\frac{i}{n}} \]
      7. metadata-evalN/A

        \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i, \mathsf{fma}\left(i, \frac{1}{2} - \frac{\color{blue}{\frac{1}{2}}}{n}, 1\right), 1\right) - 1}{\frac{i}{n}} \]
      8. lower-/.f646.7

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot \mathsf{fma}\left(n, \color{blue}{i \cdot \frac{1}{2}}, n\right) \]
      6. lower-*.f6455.7

        \[\leadsto 100 \cdot \mathsf{fma}\left(n, \color{blue}{i \cdot 0.5}, n\right) \]
    8. Simplified55.7%

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

    if -2.10000000000000002e-199 < n < 5.4999999999999994e-169

    1. Initial program 63.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. pow-to-expN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1}{\frac{i}{n}} \]
      4. 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}} \]
      5. *-commutativeN/A

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

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

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

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

      \[\leadsto \color{blue}{\frac{-100 \cdot n + 100 \cdot n}{i}} \]
    7. Step-by-step derivation
      1. distribute-rgt-outN/A

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

        \[\leadsto \frac{n \cdot \color{blue}{0}}{i} \]
      3. mul0-rgtN/A

        \[\leadsto \frac{\color{blue}{0}}{i} \]
      4. div086.4

        \[\leadsto \color{blue}{0} \]
    8. Simplified86.4%

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

    if 5.4999999999999994e-169 < n

    1. Initial program 17.5%

      \[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}{\left(1 + i \cdot \left(1 + i \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)} - 1}{\frac{i}{n}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

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

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

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

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

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

        \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i, \mathsf{fma}\left(i, \frac{1}{2} - \color{blue}{\frac{\frac{1}{2} \cdot 1}{n}}, 1\right), 1\right) - 1}{\frac{i}{n}} \]
      7. metadata-evalN/A

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(\color{blue}{\left(100 \cdot \frac{1}{2}\right) \cdot i} + 100 \cdot 1\right) \]
      8. metadata-evalN/A

        \[\leadsto n \cdot \left(\color{blue}{50} \cdot i + 100 \cdot 1\right) \]
      9. metadata-evalN/A

        \[\leadsto n \cdot \left(50 \cdot i + \color{blue}{100}\right) \]
      10. lower-fma.f6468.3

        \[\leadsto n \cdot \color{blue}{\mathsf{fma}\left(50, i, 100\right)} \]
    8. Simplified68.3%

      \[\leadsto \color{blue}{n \cdot \mathsf{fma}\left(50, i, 100\right)} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 14: 61.9% 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 -5 \cdot 10^{-198}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;n \leq 1.45 \cdot 10^{-168}:\\ \;\;\;\;0\\ \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 -5e-198) t_0 (if (<= n 1.45e-168) 0.0 t_0))))
double code(double i, double n) {
	double t_0 = n * fma(50.0, i, 100.0);
	double tmp;
	if (n <= -5e-198) {
		tmp = t_0;
	} else if (n <= 1.45e-168) {
		tmp = 0.0;
	} 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 <= -5e-198)
		tmp = t_0;
	elseif (n <= 1.45e-168)
		tmp = 0.0;
	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, -5e-198], t$95$0, If[LessEqual[n, 1.45e-168], 0.0, t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := n \cdot \mathsf{fma}\left(50, i, 100\right)\\
\mathbf{if}\;n \leq -5 \cdot 10^{-198}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;n \leq 1.45 \cdot 10^{-168}:\\
\;\;\;\;0\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -4.9999999999999999e-198 or 1.4499999999999999e-168 < n

    1. Initial program 22.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 100 \cdot \frac{\color{blue}{\left(1 + i \cdot \left(1 + i \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \frac{1}{n}\right)\right)\right)} - 1}{\frac{i}{n}} \]
    4. Step-by-step derivation
      1. +-commutativeN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{\left(i \cdot \left(1 + i \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \frac{1}{n}\right)\right) + 1\right)} - 1}{\frac{i}{n}} \]
      2. lower-fma.f64N/A

        \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{fma}\left(i, 1 + i \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \frac{1}{n}\right), 1\right)} - 1}{\frac{i}{n}} \]
      3. +-commutativeN/A

        \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i, \color{blue}{i \cdot \left(\frac{1}{2} - \frac{1}{2} \cdot \frac{1}{n}\right) + 1}, 1\right) - 1}{\frac{i}{n}} \]
      4. lower-fma.f64N/A

        \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i, \color{blue}{\mathsf{fma}\left(i, \frac{1}{2} - \frac{1}{2} \cdot \frac{1}{n}, 1\right)}, 1\right) - 1}{\frac{i}{n}} \]
      5. lower--.f64N/A

        \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i, \mathsf{fma}\left(i, \color{blue}{\frac{1}{2} - \frac{1}{2} \cdot \frac{1}{n}}, 1\right), 1\right) - 1}{\frac{i}{n}} \]
      6. associate-*r/N/A

        \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i, \mathsf{fma}\left(i, \frac{1}{2} - \color{blue}{\frac{\frac{1}{2} \cdot 1}{n}}, 1\right), 1\right) - 1}{\frac{i}{n}} \]
      7. metadata-evalN/A

        \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i, \mathsf{fma}\left(i, \frac{1}{2} - \frac{\color{blue}{\frac{1}{2}}}{n}, 1\right), 1\right) - 1}{\frac{i}{n}} \]
      8. lower-/.f6410.4

        \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i, \mathsf{fma}\left(i, 0.5 - \color{blue}{\frac{0.5}{n}}, 1\right), 1\right) - 1}{\frac{i}{n}} \]
    5. Simplified10.4%

      \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{fma}\left(i, \mathsf{fma}\left(i, 0.5 - \frac{0.5}{n}, 1\right), 1\right)} - 1}{\frac{i}{n}} \]
    6. Taylor expanded in n around inf

      \[\leadsto \color{blue}{100 \cdot \left(n \cdot \left(1 + \frac{1}{2} \cdot i\right)\right)} \]
    7. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \color{blue}{\left(100 \cdot n\right) \cdot \left(1 + \frac{1}{2} \cdot i\right)} \]
      2. *-commutativeN/A

        \[\leadsto \color{blue}{\left(n \cdot 100\right)} \cdot \left(1 + \frac{1}{2} \cdot i\right) \]
      3. associate-*r*N/A

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \left(1 + \frac{1}{2} \cdot i\right)\right)} \]
      4. lower-*.f64N/A

        \[\leadsto \color{blue}{n \cdot \left(100 \cdot \left(1 + \frac{1}{2} \cdot i\right)\right)} \]
      5. +-commutativeN/A

        \[\leadsto n \cdot \left(100 \cdot \color{blue}{\left(\frac{1}{2} \cdot i + 1\right)}\right) \]
      6. distribute-lft-inN/A

        \[\leadsto n \cdot \color{blue}{\left(100 \cdot \left(\frac{1}{2} \cdot i\right) + 100 \cdot 1\right)} \]
      7. associate-*r*N/A

        \[\leadsto n \cdot \left(\color{blue}{\left(100 \cdot \frac{1}{2}\right) \cdot i} + 100 \cdot 1\right) \]
      8. metadata-evalN/A

        \[\leadsto n \cdot \left(\color{blue}{50} \cdot i + 100 \cdot 1\right) \]
      9. metadata-evalN/A

        \[\leadsto n \cdot \left(50 \cdot i + \color{blue}{100}\right) \]
      10. lower-fma.f6462.8

        \[\leadsto n \cdot \color{blue}{\mathsf{fma}\left(50, i, 100\right)} \]
    8. Simplified62.8%

      \[\leadsto \color{blue}{n \cdot \mathsf{fma}\left(50, i, 100\right)} \]

    if -4.9999999999999999e-198 < n < 1.4499999999999999e-168

    1. Initial program 63.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. pow-to-expN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1}{\frac{i}{n}} \]
      4. 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}} \]
      5. *-commutativeN/A

        \[\leadsto 100 \cdot \frac{\mathsf{expm1}\left(\color{blue}{n \cdot \log \left(1 + \frac{i}{n}\right)}\right)}{\frac{i}{n}} \]
      6. 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}} \]
      7. 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}} \]
      8. lower-log1p.f6477.0

        \[\leadsto 100 \cdot \frac{\mathsf{expm1}\left(n \cdot \color{blue}{\mathsf{log1p}\left(\frac{i}{n}\right)}\right)}{\frac{i}{n}} \]
    4. Applied egg-rr77.0%

      \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}}{\frac{i}{n}} \]
    5. Applied egg-rr20.3%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-n, \frac{100}{i}, \frac{100 \cdot \left(n \cdot {\left(\frac{i}{n} + 1\right)}^{n}\right)}{i}\right)} \]
    6. Taylor expanded in i around 0

      \[\leadsto \color{blue}{\frac{-100 \cdot n + 100 \cdot n}{i}} \]
    7. Step-by-step derivation
      1. distribute-rgt-outN/A

        \[\leadsto \frac{\color{blue}{n \cdot \left(-100 + 100\right)}}{i} \]
      2. metadata-evalN/A

        \[\leadsto \frac{n \cdot \color{blue}{0}}{i} \]
      3. mul0-rgtN/A

        \[\leadsto \frac{\color{blue}{0}}{i} \]
      4. div086.4

        \[\leadsto \color{blue}{0} \]
    8. Simplified86.4%

      \[\leadsto \color{blue}{0} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 15: 59.5% accurate, 8.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -9.5 \cdot 10^{-8}:\\ \;\;\;\;0\\ \mathbf{elif}\;i \leq 0.000145:\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= i -9.5e-8) 0.0 (if (<= i 0.000145) (* n 100.0) 0.0)))
double code(double i, double n) {
	double tmp;
	if (i <= -9.5e-8) {
		tmp = 0.0;
	} else if (i <= 0.000145) {
		tmp = n * 100.0;
	} else {
		tmp = 0.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-8)) then
        tmp = 0.0d0
    else if (i <= 0.000145d0) then
        tmp = n * 100.0d0
    else
        tmp = 0.0d0
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double tmp;
	if (i <= -9.5e-8) {
		tmp = 0.0;
	} else if (i <= 0.000145) {
		tmp = n * 100.0;
	} else {
		tmp = 0.0;
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if i <= -9.5e-8:
		tmp = 0.0
	elif i <= 0.000145:
		tmp = n * 100.0
	else:
		tmp = 0.0
	return tmp
function code(i, n)
	tmp = 0.0
	if (i <= -9.5e-8)
		tmp = 0.0;
	elseif (i <= 0.000145)
		tmp = Float64(n * 100.0);
	else
		tmp = 0.0;
	end
	return tmp
end
function tmp_2 = code(i, n)
	tmp = 0.0;
	if (i <= -9.5e-8)
		tmp = 0.0;
	elseif (i <= 0.000145)
		tmp = n * 100.0;
	else
		tmp = 0.0;
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[LessEqual[i, -9.5e-8], 0.0, If[LessEqual[i, 0.000145], N[(n * 100.0), $MachinePrecision], 0.0]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq -9.5 \cdot 10^{-8}:\\
\;\;\;\;0\\

\mathbf{elif}\;i \leq 0.000145:\\
\;\;\;\;n \cdot 100\\

\mathbf{else}:\\
\;\;\;\;0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < -9.50000000000000036e-8 or 1.45e-4 < i

    1. Initial program 50.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. pow-to-expN/A

        \[\leadsto 100 \cdot \frac{\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1}{\frac{i}{n}} \]
      4. 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}} \]
      5. *-commutativeN/A

        \[\leadsto 100 \cdot \frac{\mathsf{expm1}\left(\color{blue}{n \cdot \log \left(1 + \frac{i}{n}\right)}\right)}{\frac{i}{n}} \]
      6. 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}} \]
      7. 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}} \]
      8. lower-log1p.f6478.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 egg-rr78.8%

      \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}}{\frac{i}{n}} \]
    5. Applied egg-rr42.0%

      \[\leadsto \color{blue}{\mathsf{fma}\left(-n, \frac{100}{i}, \frac{100 \cdot \left(n \cdot {\left(\frac{i}{n} + 1\right)}^{n}\right)}{i}\right)} \]
    6. Taylor expanded in i around 0

      \[\leadsto \color{blue}{\frac{-100 \cdot n + 100 \cdot n}{i}} \]
    7. Step-by-step derivation
      1. distribute-rgt-outN/A

        \[\leadsto \frac{\color{blue}{n \cdot \left(-100 + 100\right)}}{i} \]
      2. metadata-evalN/A

        \[\leadsto \frac{n \cdot \color{blue}{0}}{i} \]
      3. mul0-rgtN/A

        \[\leadsto \frac{\color{blue}{0}}{i} \]
      4. div032.9

        \[\leadsto \color{blue}{0} \]
    8. Simplified32.9%

      \[\leadsto \color{blue}{0} \]

    if -9.50000000000000036e-8 < i < 1.45e-4

    1. Initial program 10.8%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Add Preprocessing
    3. Taylor expanded in i around 0

      \[\leadsto \color{blue}{100 \cdot n} \]
    4. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \color{blue}{n \cdot 100} \]
      2. lower-*.f6488.4

        \[\leadsto \color{blue}{n \cdot 100} \]
    5. Simplified88.4%

      \[\leadsto \color{blue}{n \cdot 100} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 16: 18.3% accurate, 146.0× speedup?

\[\begin{array}{l} \\ 0 \end{array} \]
(FPCore (i n) :precision binary64 0.0)
double code(double i, double n) {
	return 0.0;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    code = 0.0d0
end function
public static double code(double i, double n) {
	return 0.0;
}
def code(i, n):
	return 0.0
function code(i, n)
	return 0.0
end
function tmp = code(i, n)
	tmp = 0.0;
end
code[i_, n_] := 0.0
\begin{array}{l}

\\
0
\end{array}
Derivation
  1. Initial program 29.3%

    \[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. pow-to-expN/A

      \[\leadsto 100 \cdot \frac{\color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}} - 1}{\frac{i}{n}} \]
    4. 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}} \]
    5. *-commutativeN/A

      \[\leadsto 100 \cdot \frac{\mathsf{expm1}\left(\color{blue}{n \cdot \log \left(1 + \frac{i}{n}\right)}\right)}{\frac{i}{n}} \]
    6. 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}} \]
    7. 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}} \]
    8. lower-log1p.f6476.3

      \[\leadsto 100 \cdot \frac{\mathsf{expm1}\left(n \cdot \color{blue}{\mathsf{log1p}\left(\frac{i}{n}\right)}\right)}{\frac{i}{n}} \]
  4. Applied egg-rr76.3%

    \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}}{\frac{i}{n}} \]
  5. Applied egg-rr21.3%

    \[\leadsto \color{blue}{\mathsf{fma}\left(-n, \frac{100}{i}, \frac{100 \cdot \left(n \cdot {\left(\frac{i}{n} + 1\right)}^{n}\right)}{i}\right)} \]
  6. Taylor expanded in i around 0

    \[\leadsto \color{blue}{\frac{-100 \cdot n + 100 \cdot n}{i}} \]
  7. Step-by-step derivation
    1. distribute-rgt-outN/A

      \[\leadsto \frac{\color{blue}{n \cdot \left(-100 + 100\right)}}{i} \]
    2. metadata-evalN/A

      \[\leadsto \frac{n \cdot \color{blue}{0}}{i} \]
    3. mul0-rgtN/A

      \[\leadsto \frac{\color{blue}{0}}{i} \]
    4. div021.4

      \[\leadsto \color{blue}{0} \]
  8. Simplified21.4%

    \[\leadsto \color{blue}{0} \]
  9. Add Preprocessing

Developer Target 1: 34.3% 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 2024207 
(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))))