Compound Interest

Percentage Accurate: 30.0% → 88.8%
Time: 26.5s
Alternatives: 21
Speedup: 38.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 21 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: 30.0% accurate, 1.0× speedup?

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

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

Alternative 1: 88.8% 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 2 \cdot 10^{-237}:\\ \;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\right)\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-77}:\\ \;\;\;\;n \cdot \frac{\mathsf{fma}\left(100, t\_0, -100\right)}{i}\\ \mathbf{else}:\\ \;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\\ \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 2e-237)
     (* n (* 100.0 (/ (expm1 (* n (log1p (/ i n)))) i)))
     (if (<= t_1 2e-77)
       (* n (/ (fma 100.0 t_0 -100.0) i))
       (* (* n 100.0) (/ (expm1 i) i))))))
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 <= 2e-237) {
		tmp = n * (100.0 * (expm1((n * log1p((i / n)))) / i));
	} else if (t_1 <= 2e-77) {
		tmp = n * (fma(100.0, t_0, -100.0) / i);
	} else {
		tmp = (n * 100.0) * (expm1(i) / i);
	}
	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 <= 2e-237)
		tmp = Float64(n * Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i)));
	elseif (t_1 <= 2e-77)
		tmp = Float64(n * Float64(fma(100.0, t_0, -100.0) / i));
	else
		tmp = Float64(Float64(n * 100.0) * Float64(expm1(i) / i));
	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, 2e-237], N[(n * N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-77], N[(n * N[(N[(100.0 * t$95$0 + -100.0), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

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

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


\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)) < 2e-237

    1. Initial program 23.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e-237 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 1.9999999999999999e-77

    1. Initial program 92.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 18.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 88.8% 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 2 \cdot 10^{-237}:\\ \;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-77}:\\ \;\;\;\;n \cdot \frac{-100 + t\_0 \cdot 100}{i}\\ \mathbf{else}:\\ \;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\\ \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 2e-237)
     (* n (/ (* 100.0 (expm1 (* n (log1p (/ i n))))) i))
     (if (<= t_1 2e-77)
       (* n (/ (+ -100.0 (* t_0 100.0)) i))
       (* (* n 100.0) (/ (expm1 i) i))))))
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 <= 2e-237) {
		tmp = n * ((100.0 * expm1((n * log1p((i / n))))) / i);
	} else if (t_1 <= 2e-77) {
		tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
	} else {
		tmp = (n * 100.0) * (expm1(i) / i);
	}
	return tmp;
}
public static double code(double i, double n) {
	double t_0 = Math.pow((1.0 + (i / n)), n);
	double t_1 = (t_0 + -1.0) / (i / n);
	double tmp;
	if (t_1 <= 2e-237) {
		tmp = n * ((100.0 * Math.expm1((n * Math.log1p((i / n))))) / i);
	} else if (t_1 <= 2e-77) {
		tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
	} else {
		tmp = (n * 100.0) * (Math.expm1(i) / i);
	}
	return tmp;
}
def code(i, n):
	t_0 = math.pow((1.0 + (i / n)), n)
	t_1 = (t_0 + -1.0) / (i / n)
	tmp = 0
	if t_1 <= 2e-237:
		tmp = n * ((100.0 * math.expm1((n * math.log1p((i / n))))) / i)
	elif t_1 <= 2e-77:
		tmp = n * ((-100.0 + (t_0 * 100.0)) / i)
	else:
		tmp = (n * 100.0) * (math.expm1(i) / i)
	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 <= 2e-237)
		tmp = Float64(n * Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / i));
	elseif (t_1 <= 2e-77)
		tmp = Float64(n * Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / i));
	else
		tmp = Float64(Float64(n * 100.0) * Float64(expm1(i) / i));
	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, 2e-237], N[(n * N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-77], N[(n * N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-77}:\\
\;\;\;\;n \cdot \frac{-100 + t\_0 \cdot 100}{i}\\

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


\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)) < 2e-237

    1. Initial program 23.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e-237 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 1.9999999999999999e-77

    1. Initial program 92.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 18.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 88.8% 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 2 \cdot 10^{-237}:\\ \;\;\;\;n \cdot \left(100 \cdot \frac{\mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\right)\\ \mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-77}:\\ \;\;\;\;n \cdot \frac{-100 + t\_0 \cdot 100}{i}\\ \mathbf{else}:\\ \;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\\ \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 2e-237)
     (* n (* 100.0 (/ (expm1 (* n (log1p (/ i n)))) i)))
     (if (<= t_1 2e-77)
       (* n (/ (+ -100.0 (* t_0 100.0)) i))
       (* (* n 100.0) (/ (expm1 i) i))))))
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 <= 2e-237) {
		tmp = n * (100.0 * (expm1((n * log1p((i / n)))) / i));
	} else if (t_1 <= 2e-77) {
		tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
	} else {
		tmp = (n * 100.0) * (expm1(i) / i);
	}
	return tmp;
}
public static double code(double i, double n) {
	double t_0 = Math.pow((1.0 + (i / n)), n);
	double t_1 = (t_0 + -1.0) / (i / n);
	double tmp;
	if (t_1 <= 2e-237) {
		tmp = n * (100.0 * (Math.expm1((n * Math.log1p((i / n)))) / i));
	} else if (t_1 <= 2e-77) {
		tmp = n * ((-100.0 + (t_0 * 100.0)) / i);
	} else {
		tmp = (n * 100.0) * (Math.expm1(i) / i);
	}
	return tmp;
}
def code(i, n):
	t_0 = math.pow((1.0 + (i / n)), n)
	t_1 = (t_0 + -1.0) / (i / n)
	tmp = 0
	if t_1 <= 2e-237:
		tmp = n * (100.0 * (math.expm1((n * math.log1p((i / n)))) / i))
	elif t_1 <= 2e-77:
		tmp = n * ((-100.0 + (t_0 * 100.0)) / i)
	else:
		tmp = (n * 100.0) * (math.expm1(i) / i)
	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 <= 2e-237)
		tmp = Float64(n * Float64(100.0 * Float64(expm1(Float64(n * log1p(Float64(i / n)))) / i)));
	elseif (t_1 <= 2e-77)
		tmp = Float64(n * Float64(Float64(-100.0 + Float64(t_0 * 100.0)) / i));
	else
		tmp = Float64(Float64(n * 100.0) * Float64(expm1(i) / i));
	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, 2e-237], N[(n * N[(100.0 * N[(N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-77], N[(n * N[(N[(-100.0 + N[(t$95$0 * 100.0), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(N[(n * 100.0), $MachinePrecision] * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

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

\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-77}:\\
\;\;\;\;n \cdot \frac{-100 + t\_0 \cdot 100}{i}\\

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


\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)) < 2e-237

    1. Initial program 23.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2e-237 < (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)) < 1.9999999999999999e-77

    1. Initial program 92.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 18.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 80.0% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.2 \cdot 10^{-146} \lor \neg \left(n \leq 8.5 \cdot 10^{-197}\right):\\
\;\;\;\;n \cdot \left(\mathsf{expm1}\left(i\right) \cdot \frac{100}{i}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -3.1999999999999999e-146 or 8.5e-197 < n

    1. Initial program 17.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.1999999999999999e-146 < n < 8.5e-197

    1. Initial program 52.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -3.2 \cdot 10^{-146} \lor \neg \left(n \leq 8.5 \cdot 10^{-197}\right):\\ \;\;\;\;n \cdot \left(\mathsf{expm1}\left(i\right) \cdot \frac{100}{i}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 80.1% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.4 \cdot 10^{-146} \lor \neg \left(n \leq 1.15 \cdot 10^{-194}\right):\\
\;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -4.4e-146 or 1.15000000000000001e-194 < n

    1. Initial program 17.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.4e-146 < n < 1.15000000000000001e-194

    1. Initial program 52.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4.4 \cdot 10^{-146} \lor \neg \left(n \leq 1.15 \cdot 10^{-194}\right):\\ \;\;\;\;\left(n \cdot 100\right) \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 80.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.2 \cdot 10^{-146} \lor \neg \left(n \leq 6 \cdot 10^{-198}\right):\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -3.1999999999999999e-146 or 6.0000000000000002e-198 < n

    1. Initial program 17.7%

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

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

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

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

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

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

    if -3.1999999999999999e-146 < n < 6.0000000000000002e-198

    1. Initial program 52.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -3.2 \cdot 10^{-146} \lor \neg \left(n \leq 6 \cdot 10^{-198}\right):\\ \;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 80.1% accurate, 1.0× speedup?

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

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

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

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


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

    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 n around inf 33.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.20000000000000008e-145 < n < 5.5999999999999997e-196

    1. Initial program 52.1%

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

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

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

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

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

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

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

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

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

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

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

    if 5.5999999999999997e-196 < n

    1. Initial program 18.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1.2 \cdot 10^{-145}:\\ \;\;\;\;n \cdot \left(\mathsf{expm1}\left(i\right) \cdot \frac{100}{i}\right)\\ \mathbf{elif}\;n \leq 5.6 \cdot 10^{-196}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \frac{\mathsf{expm1}\left(i\right)}{i \cdot 0.01}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 80.1% accurate, 1.0× speedup?

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

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

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

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


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

    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 n around inf 33.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.39999999999999998e-145 < n < 4.0000000000000004e-195

    1. Initial program 52.1%

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

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

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

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

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

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

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

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

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

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

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

    if 4.0000000000000004e-195 < n

    1. Initial program 18.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4.4 \cdot 10^{-145}:\\ \;\;\;\;n \cdot \left(\mathsf{expm1}\left(i\right) \cdot \frac{100}{i}\right)\\ \mathbf{elif}\;n \leq 4 \cdot 10^{-195}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(i\right)}{i}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 69.0% accurate, 3.3× speedup?

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

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

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

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

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


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

    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 n around inf 33.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -6.5000000000000002e-145 < n < 4.5e-225

    1. Initial program 56.9%

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

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

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

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

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

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

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

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

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

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

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

    if 4.5e-225 < n < 1.8999999999999999

    1. Initial program 10.3%

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

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

    if 1.8999999999999999 < n

    1. Initial program 22.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -6.5 \cdot 10^{-145}:\\ \;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\ \mathbf{elif}\;n \leq 4.5 \cdot 10^{-225}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 1.9:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\frac{n \cdot \left(i \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\right)}{i}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 68.8% accurate, 3.8× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -4.8000000000000003e-146 or 0.94999999999999996 < n

    1. Initial program 19.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.8000000000000003e-146 < n < 3.5e-226

    1. Initial program 56.9%

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

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

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

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

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

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

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

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

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

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

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

    if 3.5e-226 < n < 0.94999999999999996

    1. Initial program 10.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 68.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4.8 \cdot 10^{-146}:\\ \;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\ \mathbf{elif}\;n \leq 3.5 \cdot 10^{-226}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 0.95:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 67.9% accurate, 3.8× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.8 \cdot 10^{-145}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\

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

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

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


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

    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 n around inf 33.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.8e-145 < n < 2.2e-225

    1. Initial program 56.9%

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

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

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

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

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

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

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

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

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

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

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

    if 2.2e-225 < n < 1.82000000000000006

    1. Initial program 10.3%

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

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

    if 1.82000000000000006 < n

    1. Initial program 22.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{n \cdot \left(i \cdot \left(100 + i \cdot \left(50 + \color{blue}{i \cdot 16.666666666666668}\right)\right)\right)}{i} \]
    10. Simplified80.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1.8 \cdot 10^{-145}:\\ \;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot \left(16.666666666666668 + i \cdot 4.166666666666667\right)\right)\right)\\ \mathbf{elif}\;n \leq 2.2 \cdot 10^{-225}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 1.82:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\frac{n \cdot \left(i \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\right)}{i}\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 67.4% accurate, 4.1× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -9 \cdot 10^{-145}:\\
\;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\

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

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

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


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

    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 n around inf 33.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 + i \cdot \left(50 + \color{blue}{i \cdot 16.666666666666668}\right)\right) \]
    11. Simplified64.5%

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

    if -9.0000000000000001e-145 < n < 4.5e-225

    1. Initial program 56.9%

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

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

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

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

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

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

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

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

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

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

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

    if 4.5e-225 < n < 7.40000000000000009e-7

    1. Initial program 10.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 68.4%

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

    if 7.40000000000000009e-7 < n

    1. Initial program 22.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(n \cdot 100\right) \cdot \left(1 + i \cdot \left(0.5 + \color{blue}{i \cdot 0.16666666666666666}\right)\right) \]
    12. Simplified79.1%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -9 \cdot 10^{-145}:\\ \;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\ \mathbf{elif}\;n \leq 4.5 \cdot 10^{-225}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 7.4 \cdot 10^{-7}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot \left(0.5 + i \cdot 0.16666666666666666\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 67.4% accurate, 4.4× speedup?

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

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

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

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

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


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

    1. Initial program 19.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto n \cdot \left(100 + i \cdot \left(50 + \color{blue}{i \cdot 16.666666666666668}\right)\right) \]
    11. Simplified69.8%

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

    if -8.50000000000000043e-145 < n < 3.19999999999999975e-225

    1. Initial program 56.9%

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

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

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

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

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

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

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

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

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

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

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

    if 3.19999999999999975e-225 < n < 1

    1. Initial program 10.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 68.4%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -8.5 \cdot 10^{-145}:\\ \;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\ \mathbf{elif}\;n \leq 3.2 \cdot 10^{-225}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 1:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot \left(50 + i \cdot 16.666666666666668\right)\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 64.9% accurate, 4.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.6 \cdot 10^{-144}:\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\

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

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

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


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

    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 n around inf 33.0%

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

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

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

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

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

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

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

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

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

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

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

    if -1.59999999999999986e-144 < n < 6.6e-226

    1. Initial program 56.9%

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

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

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

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

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

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

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

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

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

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

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

    if 6.6e-226 < n < 5.20000000000000009e-15

    1. Initial program 9.7%

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

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

    if 5.20000000000000009e-15 < n

    1. Initial program 22.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(n \cdot 100\right) \cdot \left(1 + \color{blue}{i \cdot 0.5}\right) \]
    12. Simplified70.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1.6 \cdot 10^{-144}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \mathbf{elif}\;n \leq 6.6 \cdot 10^{-226}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 5.2 \cdot 10^{-15}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot 0.5\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 64.9% accurate, 5.2× speedup?

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

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < -3.9999999999999998e-144 or 5.20000000000000009e-15 < n

    1. Initial program 19.2%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.9999999999999998e-144 < n < 1.25e-225

    1. Initial program 56.9%

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

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

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

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

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

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

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

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

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

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

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

    if 1.25e-225 < n < 5.20000000000000009e-15

    1. Initial program 9.7%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4 \cdot 10^{-144}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \mathbf{elif}\;n \leq 1.25 \cdot 10^{-225}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 5.2 \cdot 10^{-15}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 59.0% accurate, 6.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < -9.9999999999999994e38 or 4.0000000000000003e-15 < i

    1. Initial program 46.4%

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

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

    if -9.9999999999999994e38 < i < 4.0000000000000003e-15

    1. Initial program 9.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 80.5%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -1 \cdot 10^{+39} \lor \neg \left(i \leq 4 \cdot 10^{-15}\right):\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot 100\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 64.6% accurate, 6.7× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -5.2 \cdot 10^{+17} \lor \neg \left(n \leq 5.2 \cdot 10^{-15}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -5.2e17 or 5.20000000000000009e-15 < n

    1. Initial program 18.4%

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

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot n + \color{blue}{\left(50 \cdot i\right) \cdot n} \]
      3. distribute-rgt-in65.9%

        \[\leadsto \color{blue}{n \cdot \left(100 + 50 \cdot i\right)} \]
      4. *-commutative65.9%

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

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

    if -5.2e17 < n < 5.20000000000000009e-15

    1. Initial program 30.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -5.2 \cdot 10^{+17} \lor \neg \left(n \leq 5.2 \cdot 10^{-15}\right):\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 64.5% accurate, 6.7× speedup?

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

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

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

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


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

    1. Initial program 13.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{100 \cdot \color{blue}{\left(n \cdot i\right)}}{i} \]
    10. Simplified62.9%

      \[\leadsto \frac{\color{blue}{100 \cdot \left(n \cdot i\right)}}{i} \]
    11. Step-by-step derivation
      1. *-commutative62.9%

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

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

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

    if -2.8000000000000001e33 < n < 5.20000000000000009e-15

    1. Initial program 31.6%

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

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

    if 5.20000000000000009e-15 < 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 41.8%

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot n + \color{blue}{\left(50 \cdot i\right) \cdot n} \]
      3. distribute-rgt-in70.9%

        \[\leadsto \color{blue}{n \cdot \left(100 + 50 \cdot i\right)} \]
      4. *-commutative70.9%

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.8 \cdot 10^{+33}:\\ \;\;\;\;\frac{100}{i} \cdot \left(i \cdot n\right)\\ \mathbf{elif}\;n \leq 5.2 \cdot 10^{-15}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 19: 51.3% accurate, 11.4× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;i \leq 4.8 \cdot 10^{+14}:\\
\;\;\;\;n \cdot 100\\

\mathbf{else}:\\
\;\;\;\;50 \cdot \left(i \cdot n\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < 4.8e14

    1. Initial program 17.2%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Add Preprocessing
    3. Taylor expanded in i around 0 63.1%

      \[\leadsto \color{blue}{100 \cdot n} \]
    4. Step-by-step derivation
      1. *-commutative63.1%

        \[\leadsto \color{blue}{n \cdot 100} \]
    5. Simplified63.1%

      \[\leadsto \color{blue}{n \cdot 100} \]

    if 4.8e14 < i

    1. Initial program 48.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 49.9%

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Step-by-step derivation
      1. *-commutative49.9%

        \[\leadsto \color{blue}{\frac{n \cdot \left(e^{i} - 1\right)}{i} \cdot 100} \]
      2. associate-/l*49.9%

        \[\leadsto \color{blue}{\left(n \cdot \frac{e^{i} - 1}{i}\right)} \cdot 100 \]
      3. expm1-define49.9%

        \[\leadsto \left(n \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{i}\right) \cdot 100 \]
    5. Simplified49.9%

      \[\leadsto \color{blue}{\left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right) \cdot 100} \]
    6. Taylor expanded in i around 0 23.7%

      \[\leadsto \color{blue}{\left(n + 0.5 \cdot \left(i \cdot n\right)\right)} \cdot 100 \]
    7. Step-by-step derivation
      1. *-commutative23.7%

        \[\leadsto \left(n + \color{blue}{\left(i \cdot n\right) \cdot 0.5}\right) \cdot 100 \]
      2. *-commutative23.7%

        \[\leadsto \left(n + \color{blue}{\left(n \cdot i\right)} \cdot 0.5\right) \cdot 100 \]
    8. Simplified23.7%

      \[\leadsto \color{blue}{\left(n + \left(n \cdot i\right) \cdot 0.5\right)} \cdot 100 \]
    9. Taylor expanded in i around inf 23.7%

      \[\leadsto \color{blue}{50 \cdot \left(i \cdot n\right)} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification54.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq 4.8 \cdot 10^{+14}:\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;50 \cdot \left(i \cdot n\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 20: 2.7% accurate, 38.0× speedup?

\[\begin{array}{l} \\ i \cdot -50 \end{array} \]
(FPCore (i n) :precision binary64 (* i -50.0))
double code(double i, double n) {
	return i * -50.0;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    code = i * (-50.0d0)
end function
public static double code(double i, double n) {
	return i * -50.0;
}
def code(i, n):
	return i * -50.0
function code(i, n)
	return Float64(i * -50.0)
end
function tmp = code(i, n)
	tmp = i * -50.0;
end
code[i_, n_] := N[(i * -50.0), $MachinePrecision]
\begin{array}{l}

\\
i \cdot -50
\end{array}
Derivation
  1. Initial program 23.9%

    \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
  2. Step-by-step derivation
    1. associate-/r/24.3%

      \[\leadsto 100 \cdot \color{blue}{\left(\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i} \cdot n\right)} \]
    2. associate-*r*24.3%

      \[\leadsto \color{blue}{\left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right) \cdot n} \]
    3. *-commutative24.3%

      \[\leadsto \color{blue}{n \cdot \left(100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{i}\right)} \]
    4. associate-*r/24.3%

      \[\leadsto n \cdot \color{blue}{\frac{100 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}{i}} \]
    5. sub-neg24.3%

      \[\leadsto n \cdot \frac{100 \cdot \color{blue}{\left({\left(1 + \frac{i}{n}\right)}^{n} + \left(-1\right)\right)}}{i} \]
    6. distribute-lft-in24.3%

      \[\leadsto n \cdot \frac{\color{blue}{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \left(-1\right)}}{i} \]
    7. metadata-eval24.3%

      \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + 100 \cdot \color{blue}{-1}}{i} \]
    8. metadata-eval24.3%

      \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{-100}}{i} \]
    9. metadata-eval24.3%

      \[\leadsto n \cdot \frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + \color{blue}{\left(-100\right)}}{i} \]
    10. fma-define24.3%

      \[\leadsto n \cdot \frac{\color{blue}{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}}{i} \]
    11. metadata-eval24.3%

      \[\leadsto n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, \color{blue}{-100}\right)}{i} \]
  3. Simplified24.3%

    \[\leadsto \color{blue}{n \cdot \frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}} \]
  4. Add Preprocessing
  5. Taylor expanded in i around 0 54.4%

    \[\leadsto n \cdot \frac{\color{blue}{i \cdot \left(100 + 100 \cdot \left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right)\right)}}{i} \]
  6. Step-by-step derivation
    1. *-commutative54.4%

      \[\leadsto n \cdot \frac{i \cdot \left(100 + \color{blue}{\left(i \cdot \left(0.5 - 0.5 \cdot \frac{1}{n}\right)\right) \cdot 100}\right)}{i} \]
    2. associate-*r/54.4%

      \[\leadsto n \cdot \frac{i \cdot \left(100 + \left(i \cdot \left(0.5 - \color{blue}{\frac{0.5 \cdot 1}{n}}\right)\right) \cdot 100\right)}{i} \]
    3. metadata-eval54.4%

      \[\leadsto n \cdot \frac{i \cdot \left(100 + \left(i \cdot \left(0.5 - \frac{\color{blue}{0.5}}{n}\right)\right) \cdot 100\right)}{i} \]
  7. Simplified54.4%

    \[\leadsto n \cdot \frac{\color{blue}{i \cdot \left(100 + \left(i \cdot \left(0.5 - \frac{0.5}{n}\right)\right) \cdot 100\right)}}{i} \]
  8. Taylor expanded in n around 0 2.7%

    \[\leadsto \color{blue}{-50 \cdot i} \]
  9. Step-by-step derivation
    1. *-commutative2.7%

      \[\leadsto \color{blue}{i \cdot -50} \]
  10. Simplified2.7%

    \[\leadsto \color{blue}{i \cdot -50} \]
  11. Final simplification2.7%

    \[\leadsto i \cdot -50 \]
  12. Add Preprocessing

Alternative 21: 46.3% accurate, 38.0× speedup?

\[\begin{array}{l} \\ n \cdot 100 \end{array} \]
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
	return n * 100.0;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    code = n * 100.0d0
end function
public static double code(double i, double n) {
	return n * 100.0;
}
def code(i, n):
	return n * 100.0
function code(i, n)
	return Float64(n * 100.0)
end
function tmp = code(i, n)
	tmp = n * 100.0;
end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}

\\
n \cdot 100
\end{array}
Derivation
  1. Initial program 23.9%

    \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
  2. Add Preprocessing
  3. Taylor expanded in i around 0 50.6%

    \[\leadsto \color{blue}{100 \cdot n} \]
  4. Step-by-step derivation
    1. *-commutative50.6%

      \[\leadsto \color{blue}{n \cdot 100} \]
  5. Simplified50.6%

    \[\leadsto \color{blue}{n \cdot 100} \]
  6. Final simplification50.6%

    \[\leadsto n \cdot 100 \]
  7. Add Preprocessing

Developer target: 32.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + \frac{i}{n}\\ 100 \cdot \frac{e^{n \cdot \begin{array}{l} \mathbf{if}\;t\_0 = 1:\\ \;\;\;\;\frac{i}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{i}{n} \cdot \log t\_0}{\left(\frac{i}{n} + 1\right) - 1}\\ \end{array}} - 1}{\frac{i}{n}} \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (+ 1.0 (/ i n))))
   (*
    100.0
    (/
     (-
      (exp
       (*
        n
        (if (== t_0 1.0)
          (/ i n)
          (/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
      1.0)
     (/ i n)))))
double code(double i, double n) {
	double t_0 = 1.0 + (i / n);
	double tmp;
	if (t_0 == 1.0) {
		tmp = i / n;
	} else {
		tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
	}
	return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: tmp
    t_0 = 1.0d0 + (i / n)
    if (t_0 == 1.0d0) then
        tmp = i / n
    else
        tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0d0) - 1.0d0)
    end if
    code = 100.0d0 * ((exp((n * tmp)) - 1.0d0) / (i / n))
end function
public static double code(double i, double n) {
	double t_0 = 1.0 + (i / n);
	double tmp;
	if (t_0 == 1.0) {
		tmp = i / n;
	} else {
		tmp = ((i / n) * Math.log(t_0)) / (((i / n) + 1.0) - 1.0);
	}
	return 100.0 * ((Math.exp((n * tmp)) - 1.0) / (i / n));
}
def code(i, n):
	t_0 = 1.0 + (i / n)
	tmp = 0
	if t_0 == 1.0:
		tmp = i / n
	else:
		tmp = ((i / n) * math.log(t_0)) / (((i / n) + 1.0) - 1.0)
	return 100.0 * ((math.exp((n * tmp)) - 1.0) / (i / n))
function code(i, n)
	t_0 = Float64(1.0 + Float64(i / n))
	tmp = 0.0
	if (t_0 == 1.0)
		tmp = Float64(i / n);
	else
		tmp = Float64(Float64(Float64(i / n) * log(t_0)) / Float64(Float64(Float64(i / n) + 1.0) - 1.0));
	end
	return Float64(100.0 * Float64(Float64(exp(Float64(n * tmp)) - 1.0) / Float64(i / n)))
end
function tmp_2 = code(i, n)
	t_0 = 1.0 + (i / n);
	tmp = 0.0;
	if (t_0 == 1.0)
		tmp = i / n;
	else
		tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
	end
	tmp_2 = 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
end
code[i_, n_] := Block[{t$95$0 = N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision]}, N[(100.0 * N[(N[(N[Exp[N[(n * If[Equal[t$95$0, 1.0], N[(i / n), $MachinePrecision], N[(N[(N[(i / n), $MachinePrecision] * N[Log[t$95$0], $MachinePrecision]), $MachinePrecision] / N[(N[(N[(i / n), $MachinePrecision] + 1.0), $MachinePrecision] - 1.0), $MachinePrecision]), $MachinePrecision]]), $MachinePrecision]], $MachinePrecision] - 1.0), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 1 + \frac{i}{n}\\
100 \cdot \frac{e^{n \cdot \begin{array}{l}
\mathbf{if}\;t\_0 = 1:\\
\;\;\;\;\frac{i}{n}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{i}{n} \cdot \log t\_0}{\left(\frac{i}{n} + 1\right) - 1}\\


\end{array}} - 1}{\frac{i}{n}}
\end{array}
\end{array}

Reproduce

?
herbie shell --seed 2024059 
(FPCore (i n)
  :name "Compound Interest"
  :precision binary64

  :alt
  (* 100.0 (/ (- (exp (* n (if (== (+ 1.0 (/ i n)) 1.0) (/ i n) (/ (* (/ i n) (log (+ 1.0 (/ i n)))) (- (+ (/ i n) 1.0) 1.0))))) 1.0) (/ i n)))

  (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))