Compound Interest

Percentage Accurate: 27.8% → 97.5%
Time: 24.4s
Alternatives: 19
Speedup: 38.0×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 19 alternatives:

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

Initial Program: 27.8% accurate, 1.0× speedup?

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

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

Alternative 1: 97.5% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + \left(0.08333333333333333 \cdot {i}^{2} + i \cdot -0.5\right)}\\


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

    1. Initial program 30.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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-def30.6%

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

        \[\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-udef98.4%

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

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

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

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

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

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

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def64.9%

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

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

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

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

Alternative 2: 96.6% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + \left(0.08333333333333333 \cdot {i}^{2} + i \cdot -0.5\right)}\\


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

    1. Initial program 30.8%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Add Preprocessing
    3. Step-by-step derivation
      1. clear-num30.8%

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

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

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

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

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

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

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

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

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

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def64.9%

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

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

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

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

Alternative 3: 97.5% accurate, 0.3× speedup?

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

\\
\begin{array}{l}
t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\
t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\
\mathbf{if}\;t_1 \leq 5 \cdot 10^{-254}:\\
\;\;\;\;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 \infty:\\
\;\;\;\;\frac{t_0 \cdot 100 + -100}{\frac{i}{n}}\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{n}{1 + \left(0.08333333333333333 \cdot {i}^{2} + i \cdot -0.5\right)}\\


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

    1. Initial program 30.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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-def30.6%

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

        \[\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-udef98.4%

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

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

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

    1. Initial program 97.3%

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

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

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

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

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

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

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

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

    1. Initial program 0.0%

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def64.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq 5 \cdot 10^{-254}:\\ \;\;\;\;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 \infty:\\ \;\;\;\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} \cdot 100 + -100}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{1 + \left(0.08333333333333333 \cdot {i}^{2} + i \cdot -0.5\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 4: 83.6% accurate, 0.9× speedup?

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

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

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

\mathbf{elif}\;n \leq 0.000155:\\
\;\;\;\;100 \cdot \frac{n}{1 + \left(0.08333333333333333 \cdot {i}^{2} + i \cdot -0.5\right)}\\

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


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

    1. Initial program 26.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 39.3%

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

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

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

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

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

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

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

    if -1.30000000000000001e-219 < n < 2.3999999999999999e-208

    1. Initial program 59.3%

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

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

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

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

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

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

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

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

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

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

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

    if 2.3999999999999999e-208 < n < 1.55e-4

    1. Initial program 17.6%

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1.3 \cdot 10^{-219}:\\ \;\;\;\;\frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \mathbf{elif}\;n \leq 2.4 \cdot 10^{-208}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 0.000155:\\ \;\;\;\;100 \cdot \frac{n}{1 + \left(0.08333333333333333 \cdot {i}^{2} + i \cdot -0.5\right)}\\ \mathbf{else}:\\ \;\;\;\;\frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 83.4% accurate, 1.0× speedup?

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

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

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

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

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


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

    1. Initial program 26.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 39.3%

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

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

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

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

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

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

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

    if -1.35e-219 < n < 5.20000000000000011e-179

    1. Initial program 54.5%

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

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

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

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

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

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

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

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

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

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

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

    if 5.20000000000000011e-179 < n < 1.55e-4

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 73.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\ \mathbf{if}\;i \leq -3.1 \cdot 10^{-63}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;i \leq 7.6 \cdot 10^{-55}:\\ \;\;\;\;100 \cdot \left(n + i \cdot -0.5\right)\\ \mathbf{elif}\;i \leq 1.38 \cdot 10^{+68}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;i \leq 8.5 \cdot 10^{+125}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;i \leq 3.6 \cdot 10^{+182}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{n}{i} \cdot -200\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (* 100.0 (/ (expm1 i) (/ i n)))))
   (if (<= i -3.1e-63)
     t_0
     (if (<= i 7.6e-55)
       (* 100.0 (+ n (* i -0.5)))
       (if (<= i 1.38e+68)
         t_0
         (if (<= i 8.5e+125)
           (/ 0.0 (/ i n))
           (if (<= i 3.6e+182) t_0 (* (/ n i) -200.0))))))))
double code(double i, double n) {
	double t_0 = 100.0 * (expm1(i) / (i / n));
	double tmp;
	if (i <= -3.1e-63) {
		tmp = t_0;
	} else if (i <= 7.6e-55) {
		tmp = 100.0 * (n + (i * -0.5));
	} else if (i <= 1.38e+68) {
		tmp = t_0;
	} else if (i <= 8.5e+125) {
		tmp = 0.0 / (i / n);
	} else if (i <= 3.6e+182) {
		tmp = t_0;
	} else {
		tmp = (n / i) * -200.0;
	}
	return tmp;
}
public static double code(double i, double n) {
	double t_0 = 100.0 * (Math.expm1(i) / (i / n));
	double tmp;
	if (i <= -3.1e-63) {
		tmp = t_0;
	} else if (i <= 7.6e-55) {
		tmp = 100.0 * (n + (i * -0.5));
	} else if (i <= 1.38e+68) {
		tmp = t_0;
	} else if (i <= 8.5e+125) {
		tmp = 0.0 / (i / n);
	} else if (i <= 3.6e+182) {
		tmp = t_0;
	} else {
		tmp = (n / i) * -200.0;
	}
	return tmp;
}
def code(i, n):
	t_0 = 100.0 * (math.expm1(i) / (i / n))
	tmp = 0
	if i <= -3.1e-63:
		tmp = t_0
	elif i <= 7.6e-55:
		tmp = 100.0 * (n + (i * -0.5))
	elif i <= 1.38e+68:
		tmp = t_0
	elif i <= 8.5e+125:
		tmp = 0.0 / (i / n)
	elif i <= 3.6e+182:
		tmp = t_0
	else:
		tmp = (n / i) * -200.0
	return tmp
function code(i, n)
	t_0 = Float64(100.0 * Float64(expm1(i) / Float64(i / n)))
	tmp = 0.0
	if (i <= -3.1e-63)
		tmp = t_0;
	elseif (i <= 7.6e-55)
		tmp = Float64(100.0 * Float64(n + Float64(i * -0.5)));
	elseif (i <= 1.38e+68)
		tmp = t_0;
	elseif (i <= 8.5e+125)
		tmp = Float64(0.0 / Float64(i / n));
	elseif (i <= 3.6e+182)
		tmp = t_0;
	else
		tmp = Float64(Float64(n / i) * -200.0);
	end
	return tmp
end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(N[(Exp[i] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -3.1e-63], t$95$0, If[LessEqual[i, 7.6e-55], N[(100.0 * N[(n + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 1.38e+68], t$95$0, If[LessEqual[i, 8.5e+125], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 3.6e+182], t$95$0, N[(N[(n / i), $MachinePrecision] * -200.0), $MachinePrecision]]]]]]]
\begin{array}{l}

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

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

\mathbf{elif}\;i \leq 1.38 \cdot 10^{+68}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;i \leq 3.6 \cdot 10^{+182}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;\frac{n}{i} \cdot -200\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if i < -3.09999999999999984e-63 or 7.5999999999999993e-55 < i < 1.38000000000000003e68 or 8.49999999999999974e125 < i < 3.6e182

    1. Initial program 44.9%

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

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

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

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

    if -3.09999999999999984e-63 < i < 7.5999999999999993e-55

    1. Initial program 10.1%

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

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

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

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

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

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

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

        \[\leadsto 100 \cdot \left(n + \color{blue}{i \cdot -0.5}\right) \]
    8. Simplified88.0%

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

    if 1.38000000000000003e68 < i < 8.49999999999999974e125

    1. Initial program 47.8%

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

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

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

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

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

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

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

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

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

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

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

    if 3.6e182 < i

    1. Initial program 41.9%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \frac{n}{\color{blue}{0.01 + i \cdot -0.005}} \]
    11. Taylor expanded in i around inf 55.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -3.1 \cdot 10^{-63}:\\ \;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\ \mathbf{elif}\;i \leq 7.6 \cdot 10^{-55}:\\ \;\;\;\;100 \cdot \left(n + i \cdot -0.5\right)\\ \mathbf{elif}\;i \leq 1.38 \cdot 10^{+68}:\\ \;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\ \mathbf{elif}\;i \leq 8.5 \cdot 10^{+125}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;i \leq 3.6 \cdot 10^{+182}:\\ \;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right)}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\frac{n}{i} \cdot -200\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 81.3% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -4.2 \cdot 10^{-222} \lor \neg \left(n \leq 4.3 \cdot 10^{-176}\right):\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -4.1999999999999998e-222 or 4.30000000000000012e-176 < n

    1. Initial program 24.9%

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

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

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

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

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

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

    if -4.1999999999999998e-222 < n < 4.30000000000000012e-176

    1. Initial program 54.5%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 81.2% accurate, 1.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.7 \cdot 10^{-221} \lor \neg \left(n \leq 2.4 \cdot 10^{-176}\right):\\
\;\;\;\;\frac{n \cdot 100}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -2.7e-221 or 2.40000000000000006e-176 < n

    1. Initial program 24.9%

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

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

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

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

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

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

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

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

    if -2.7e-221 < n < 2.40000000000000006e-176

    1. Initial program 54.5%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 9: 67.5% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 100 \cdot \frac{n}{1 + i \cdot -0.5}\\ t_1 := i \cdot \left(100 \cdot \left(n \cdot \left(0.5 + \frac{-0.5}{n}\right)\right)\right)\\ \mathbf{if}\;n \leq -1.22 \cdot 10^{+232}:\\ \;\;\;\;\frac{1}{\frac{i}{100 \cdot \left(i \cdot n\right)}}\\ \mathbf{elif}\;n \leq -4.1 \cdot 10^{-220}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;n \leq 1.15 \cdot 10^{-208}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 5.7 \cdot 10^{-9}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;n \leq 2.95 \cdot 10^{+116}:\\ \;\;\;\;\frac{\left(n \cdot 100\right) \cdot \left(n \cdot 100\right) - t_1 \cdot t_1}{n \cdot 100 - t_1}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \left(n + \left(i \cdot n\right) \cdot 0.5\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (* 100.0 (/ n (+ 1.0 (* i -0.5)))))
        (t_1 (* i (* 100.0 (* n (+ 0.5 (/ -0.5 n)))))))
   (if (<= n -1.22e+232)
     (/ 1.0 (/ i (* 100.0 (* i n))))
     (if (<= n -4.1e-220)
       t_0
       (if (<= n 1.15e-208)
         (/ 0.0 (/ i n))
         (if (<= n 5.7e-9)
           t_0
           (if (<= n 2.95e+116)
             (/
              (- (* (* n 100.0) (* n 100.0)) (* t_1 t_1))
              (- (* n 100.0) t_1))
             (* 100.0 (+ n (* (* i n) 0.5))))))))))
double code(double i, double n) {
	double t_0 = 100.0 * (n / (1.0 + (i * -0.5)));
	double t_1 = i * (100.0 * (n * (0.5 + (-0.5 / n))));
	double tmp;
	if (n <= -1.22e+232) {
		tmp = 1.0 / (i / (100.0 * (i * n)));
	} else if (n <= -4.1e-220) {
		tmp = t_0;
	} else if (n <= 1.15e-208) {
		tmp = 0.0 / (i / n);
	} else if (n <= 5.7e-9) {
		tmp = t_0;
	} else if (n <= 2.95e+116) {
		tmp = (((n * 100.0) * (n * 100.0)) - (t_1 * t_1)) / ((n * 100.0) - t_1);
	} else {
		tmp = 100.0 * (n + ((i * n) * 0.5));
	}
	return tmp;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: tmp
    t_0 = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
    t_1 = i * (100.0d0 * (n * (0.5d0 + ((-0.5d0) / n))))
    if (n <= (-1.22d+232)) then
        tmp = 1.0d0 / (i / (100.0d0 * (i * n)))
    else if (n <= (-4.1d-220)) then
        tmp = t_0
    else if (n <= 1.15d-208) then
        tmp = 0.0d0 / (i / n)
    else if (n <= 5.7d-9) then
        tmp = t_0
    else if (n <= 2.95d+116) then
        tmp = (((n * 100.0d0) * (n * 100.0d0)) - (t_1 * t_1)) / ((n * 100.0d0) - t_1)
    else
        tmp = 100.0d0 * (n + ((i * n) * 0.5d0))
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double t_0 = 100.0 * (n / (1.0 + (i * -0.5)));
	double t_1 = i * (100.0 * (n * (0.5 + (-0.5 / n))));
	double tmp;
	if (n <= -1.22e+232) {
		tmp = 1.0 / (i / (100.0 * (i * n)));
	} else if (n <= -4.1e-220) {
		tmp = t_0;
	} else if (n <= 1.15e-208) {
		tmp = 0.0 / (i / n);
	} else if (n <= 5.7e-9) {
		tmp = t_0;
	} else if (n <= 2.95e+116) {
		tmp = (((n * 100.0) * (n * 100.0)) - (t_1 * t_1)) / ((n * 100.0) - t_1);
	} else {
		tmp = 100.0 * (n + ((i * n) * 0.5));
	}
	return tmp;
}
def code(i, n):
	t_0 = 100.0 * (n / (1.0 + (i * -0.5)))
	t_1 = i * (100.0 * (n * (0.5 + (-0.5 / n))))
	tmp = 0
	if n <= -1.22e+232:
		tmp = 1.0 / (i / (100.0 * (i * n)))
	elif n <= -4.1e-220:
		tmp = t_0
	elif n <= 1.15e-208:
		tmp = 0.0 / (i / n)
	elif n <= 5.7e-9:
		tmp = t_0
	elif n <= 2.95e+116:
		tmp = (((n * 100.0) * (n * 100.0)) - (t_1 * t_1)) / ((n * 100.0) - t_1)
	else:
		tmp = 100.0 * (n + ((i * n) * 0.5))
	return tmp
function code(i, n)
	t_0 = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5))))
	t_1 = Float64(i * Float64(100.0 * Float64(n * Float64(0.5 + Float64(-0.5 / n)))))
	tmp = 0.0
	if (n <= -1.22e+232)
		tmp = Float64(1.0 / Float64(i / Float64(100.0 * Float64(i * n))));
	elseif (n <= -4.1e-220)
		tmp = t_0;
	elseif (n <= 1.15e-208)
		tmp = Float64(0.0 / Float64(i / n));
	elseif (n <= 5.7e-9)
		tmp = t_0;
	elseif (n <= 2.95e+116)
		tmp = Float64(Float64(Float64(Float64(n * 100.0) * Float64(n * 100.0)) - Float64(t_1 * t_1)) / Float64(Float64(n * 100.0) - t_1));
	else
		tmp = Float64(100.0 * Float64(n + Float64(Float64(i * n) * 0.5)));
	end
	return tmp
end
function tmp_2 = code(i, n)
	t_0 = 100.0 * (n / (1.0 + (i * -0.5)));
	t_1 = i * (100.0 * (n * (0.5 + (-0.5 / n))));
	tmp = 0.0;
	if (n <= -1.22e+232)
		tmp = 1.0 / (i / (100.0 * (i * n)));
	elseif (n <= -4.1e-220)
		tmp = t_0;
	elseif (n <= 1.15e-208)
		tmp = 0.0 / (i / n);
	elseif (n <= 5.7e-9)
		tmp = t_0;
	elseif (n <= 2.95e+116)
		tmp = (((n * 100.0) * (n * 100.0)) - (t_1 * t_1)) / ((n * 100.0) - t_1);
	else
		tmp = 100.0 * (n + ((i * n) * 0.5));
	end
	tmp_2 = tmp;
end
code[i_, n_] := Block[{t$95$0 = N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(i * N[(100.0 * N[(n * N[(0.5 + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.22e+232], N[(1.0 / N[(i / N[(100.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -4.1e-220], t$95$0, If[LessEqual[n, 1.15e-208], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.7e-9], t$95$0, If[LessEqual[n, 2.95e+116], N[(N[(N[(N[(n * 100.0), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision] / N[(N[(n * 100.0), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n + N[(N[(i * n), $MachinePrecision] * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}

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

\mathbf{elif}\;n \leq -4.1 \cdot 10^{-220}:\\
\;\;\;\;t_0\\

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

\mathbf{elif}\;n \leq 5.7 \cdot 10^{-9}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;n \leq 2.95 \cdot 10^{+116}:\\
\;\;\;\;\frac{\left(n \cdot 100\right) \cdot \left(n \cdot 100\right) - t_1 \cdot t_1}{n \cdot 100 - t_1}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 5 regimes
  2. if n < -1.21999999999999994e232

    1. Initial program 8.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{\frac{i}{n}}{i \cdot 100 + 0}}} \]
      2. associate-/l/59.9%

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

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

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

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

        \[\leadsto \frac{1}{\frac{i}{100 \cdot \color{blue}{\left(n \cdot i\right)}}} \]
    11. Simplified59.9%

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

    if -1.21999999999999994e232 < n < -4.09999999999999991e-220 or 1.14999999999999998e-208 < n < 5.6999999999999998e-9

    1. Initial program 30.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 25.4%

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

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

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

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

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

      \[\leadsto \frac{n}{\color{blue}{1 + -0.5 \cdot i}} \cdot 100 \]
    7. Step-by-step derivation
      1. *-commutative62.4%

        \[\leadsto \frac{n}{1 + \color{blue}{i \cdot -0.5}} \cdot 100 \]
    8. Simplified62.4%

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

    if -4.09999999999999991e-220 < n < 1.14999999999999998e-208

    1. Initial program 59.3%

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

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

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

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

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

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

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

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

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

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

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

    if 5.6999999999999998e-9 < n < 2.95e116

    1. Initial program 27.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 69.4%

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

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

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

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

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

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

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

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

    if 2.95e116 < n

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def99.9%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1.22 \cdot 10^{+232}:\\ \;\;\;\;\frac{1}{\frac{i}{100 \cdot \left(i \cdot n\right)}}\\ \mathbf{elif}\;n \leq -4.1 \cdot 10^{-220}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{elif}\;n \leq 1.15 \cdot 10^{-208}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 5.7 \cdot 10^{-9}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{elif}\;n \leq 2.95 \cdot 10^{+116}:\\ \;\;\;\;\frac{\left(n \cdot 100\right) \cdot \left(n \cdot 100\right) - \left(i \cdot \left(100 \cdot \left(n \cdot \left(0.5 + \frac{-0.5}{n}\right)\right)\right)\right) \cdot \left(i \cdot \left(100 \cdot \left(n \cdot \left(0.5 + \frac{-0.5}{n}\right)\right)\right)\right)}{n \cdot 100 - i \cdot \left(100 \cdot \left(n \cdot \left(0.5 + \frac{-0.5}{n}\right)\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \left(n + \left(i \cdot n\right) \cdot 0.5\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 64.9% accurate, 8.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -2.9 \cdot 10^{+231}:\\ \;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\ \mathbf{elif}\;n \leq -3.5 \cdot 10^{-220}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{elif}\;n \leq 6.5 \cdot 10^{-177}:\\ \;\;\;\;\frac{0}{\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.9e+231)
   (/ (* 100.0 (* i n)) i)
   (if (<= n -3.5e-220)
     (/ n (+ 0.01 (* i -0.005)))
     (if (<= n 6.5e-177) (/ 0.0 (/ i n)) (* n (+ 100.0 (* i 50.0)))))))
double code(double i, double n) {
	double tmp;
	if (n <= -2.9e+231) {
		tmp = (100.0 * (i * n)) / i;
	} else if (n <= -3.5e-220) {
		tmp = n / (0.01 + (i * -0.005));
	} else if (n <= 6.5e-177) {
		tmp = 0.0 / (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.9d+231)) then
        tmp = (100.0d0 * (i * n)) / i
    else if (n <= (-3.5d-220)) then
        tmp = n / (0.01d0 + (i * (-0.005d0)))
    else if (n <= 6.5d-177) then
        tmp = 0.0d0 / (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.9e+231) {
		tmp = (100.0 * (i * n)) / i;
	} else if (n <= -3.5e-220) {
		tmp = n / (0.01 + (i * -0.005));
	} else if (n <= 6.5e-177) {
		tmp = 0.0 / (i / n);
	} else {
		tmp = n * (100.0 + (i * 50.0));
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if n <= -2.9e+231:
		tmp = (100.0 * (i * n)) / i
	elif n <= -3.5e-220:
		tmp = n / (0.01 + (i * -0.005))
	elif n <= 6.5e-177:
		tmp = 0.0 / (i / n)
	else:
		tmp = n * (100.0 + (i * 50.0))
	return tmp
function code(i, n)
	tmp = 0.0
	if (n <= -2.9e+231)
		tmp = Float64(Float64(100.0 * Float64(i * n)) / i);
	elseif (n <= -3.5e-220)
		tmp = Float64(n / Float64(0.01 + Float64(i * -0.005)));
	elseif (n <= 6.5e-177)
		tmp = Float64(0.0 / 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.9e+231)
		tmp = (100.0 * (i * n)) / i;
	elseif (n <= -3.5e-220)
		tmp = n / (0.01 + (i * -0.005));
	elseif (n <= 6.5e-177)
		tmp = 0.0 / (i / n);
	else
		tmp = n * (100.0 + (i * 50.0));
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[LessEqual[n, -2.9e+231], N[(N[(100.0 * N[(i * n), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], If[LessEqual[n, -3.5e-220], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6.5e-177], N[(0.0 / N[(i / n), $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.9 \cdot 10^{+231}:\\
\;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\

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

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

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


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

    1. Initial program 8.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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-def8.8%

        \[\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-pow8.8%

        \[\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-udef78.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-rr78.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} \]
    7. Step-by-step derivation
      1. clear-num78.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.9000000000000001e231 < n < -3.49999999999999988e-220

    1. Initial program 35.1%

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def78.5%

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

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

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

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

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

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

        \[\leadsto \frac{n}{0.01 + \color{blue}{i \cdot -0.005}} \]
    10. Simplified60.8%

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

    if -3.49999999999999988e-220 < n < 6.4999999999999998e-177

    1. Initial program 54.5%

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

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

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

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

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

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

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

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

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

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

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

    if 6.4999999999999998e-177 < n

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def83.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.9 \cdot 10^{+231}:\\ \;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\ \mathbf{elif}\;n \leq -3.5 \cdot 10^{-220}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{elif}\;n \leq 6.5 \cdot 10^{-177}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 65.0% accurate, 8.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -2.65 \cdot 10^{+231}:\\ \;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\ \mathbf{elif}\;n \leq -3.8 \cdot 10^{-222}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{elif}\;n \leq 2.4 \cdot 10^{-176}:\\ \;\;\;\;\frac{0}{\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.65e+231)
   (/ (* 100.0 (* i n)) i)
   (if (<= n -3.8e-222)
     (* 100.0 (/ n (+ 1.0 (* i -0.5))))
     (if (<= n 2.4e-176) (/ 0.0 (/ i n)) (* n (+ 100.0 (* i 50.0)))))))
double code(double i, double n) {
	double tmp;
	if (n <= -2.65e+231) {
		tmp = (100.0 * (i * n)) / i;
	} else if (n <= -3.8e-222) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else if (n <= 2.4e-176) {
		tmp = 0.0 / (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.65d+231)) then
        tmp = (100.0d0 * (i * n)) / i
    else if (n <= (-3.8d-222)) then
        tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
    else if (n <= 2.4d-176) then
        tmp = 0.0d0 / (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.65e+231) {
		tmp = (100.0 * (i * n)) / i;
	} else if (n <= -3.8e-222) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else if (n <= 2.4e-176) {
		tmp = 0.0 / (i / n);
	} else {
		tmp = n * (100.0 + (i * 50.0));
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if n <= -2.65e+231:
		tmp = (100.0 * (i * n)) / i
	elif n <= -3.8e-222:
		tmp = 100.0 * (n / (1.0 + (i * -0.5)))
	elif n <= 2.4e-176:
		tmp = 0.0 / (i / n)
	else:
		tmp = n * (100.0 + (i * 50.0))
	return tmp
function code(i, n)
	tmp = 0.0
	if (n <= -2.65e+231)
		tmp = Float64(Float64(100.0 * Float64(i * n)) / i);
	elseif (n <= -3.8e-222)
		tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5))));
	elseif (n <= 2.4e-176)
		tmp = Float64(0.0 / 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.65e+231)
		tmp = (100.0 * (i * n)) / i;
	elseif (n <= -3.8e-222)
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	elseif (n <= 2.4e-176)
		tmp = 0.0 / (i / n);
	else
		tmp = n * (100.0 + (i * 50.0));
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[LessEqual[n, -2.65e+231], N[(N[(100.0 * N[(i * n), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision], If[LessEqual[n, -3.8e-222], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.4e-176], N[(0.0 / N[(i / n), $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.65 \cdot 10^{+231}:\\
\;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\

\mathbf{elif}\;n \leq -3.8 \cdot 10^{-222}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\

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

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


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

    1. Initial program 8.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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-def8.8%

        \[\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-pow8.8%

        \[\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-udef78.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-rr78.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} \]
    7. Step-by-step derivation
      1. clear-num78.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.6499999999999999e231 < n < -3.79999999999999997e-222

    1. Initial program 35.1%

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def78.5%

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

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

      \[\leadsto \frac{n}{\color{blue}{1 + -0.5 \cdot i}} \cdot 100 \]
    7. Step-by-step derivation
      1. *-commutative60.8%

        \[\leadsto \frac{n}{1 + \color{blue}{i \cdot -0.5}} \cdot 100 \]
    8. Simplified60.8%

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

    if -3.79999999999999997e-222 < n < 2.40000000000000006e-176

    1. Initial program 54.5%

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

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

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

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

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

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

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

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

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

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

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

    if 2.40000000000000006e-176 < n

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def83.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.65 \cdot 10^{+231}:\\ \;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\ \mathbf{elif}\;n \leq -3.8 \cdot 10^{-222}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{elif}\;n \leq 2.4 \cdot 10^{-176}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 65.0% accurate, 8.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -7.2 \cdot 10^{+231}:\\ \;\;\;\;\frac{1}{\frac{i}{100 \cdot \left(i \cdot n\right)}}\\ \mathbf{elif}\;n \leq -4.3 \cdot 10^{-222}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{elif}\;n \leq 9.2 \cdot 10^{-177}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= n -7.2e+231)
   (/ 1.0 (/ i (* 100.0 (* i n))))
   (if (<= n -4.3e-222)
     (* 100.0 (/ n (+ 1.0 (* i -0.5))))
     (if (<= n 9.2e-177) (/ 0.0 (/ i n)) (* n (+ 100.0 (* i 50.0)))))))
double code(double i, double n) {
	double tmp;
	if (n <= -7.2e+231) {
		tmp = 1.0 / (i / (100.0 * (i * n)));
	} else if (n <= -4.3e-222) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else if (n <= 9.2e-177) {
		tmp = 0.0 / (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 <= (-7.2d+231)) then
        tmp = 1.0d0 / (i / (100.0d0 * (i * n)))
    else if (n <= (-4.3d-222)) then
        tmp = 100.0d0 * (n / (1.0d0 + (i * (-0.5d0))))
    else if (n <= 9.2d-177) then
        tmp = 0.0d0 / (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 <= -7.2e+231) {
		tmp = 1.0 / (i / (100.0 * (i * n)));
	} else if (n <= -4.3e-222) {
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	} else if (n <= 9.2e-177) {
		tmp = 0.0 / (i / n);
	} else {
		tmp = n * (100.0 + (i * 50.0));
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if n <= -7.2e+231:
		tmp = 1.0 / (i / (100.0 * (i * n)))
	elif n <= -4.3e-222:
		tmp = 100.0 * (n / (1.0 + (i * -0.5)))
	elif n <= 9.2e-177:
		tmp = 0.0 / (i / n)
	else:
		tmp = n * (100.0 + (i * 50.0))
	return tmp
function code(i, n)
	tmp = 0.0
	if (n <= -7.2e+231)
		tmp = Float64(1.0 / Float64(i / Float64(100.0 * Float64(i * n))));
	elseif (n <= -4.3e-222)
		tmp = Float64(100.0 * Float64(n / Float64(1.0 + Float64(i * -0.5))));
	elseif (n <= 9.2e-177)
		tmp = Float64(0.0 / 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 <= -7.2e+231)
		tmp = 1.0 / (i / (100.0 * (i * n)));
	elseif (n <= -4.3e-222)
		tmp = 100.0 * (n / (1.0 + (i * -0.5)));
	elseif (n <= 9.2e-177)
		tmp = 0.0 / (i / n);
	else
		tmp = n * (100.0 + (i * 50.0));
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[LessEqual[n, -7.2e+231], N[(1.0 / N[(i / N[(100.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -4.3e-222], N[(100.0 * N[(n / N[(1.0 + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 9.2e-177], N[(0.0 / N[(i / n), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

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

\mathbf{elif}\;n \leq -4.3 \cdot 10^{-222}:\\
\;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\

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

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


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

    1. Initial program 8.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \color{blue}{\frac{1}{\frac{\frac{i}{n}}{i \cdot 100 + 0}}} \]
      2. associate-/l/59.9%

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

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

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

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

        \[\leadsto \frac{1}{\frac{i}{100 \cdot \color{blue}{\left(n \cdot i\right)}}} \]
    11. Simplified59.9%

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

    if -7.1999999999999999e231 < n < -4.29999999999999991e-222

    1. Initial program 35.1%

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def78.5%

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

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

      \[\leadsto \frac{n}{\color{blue}{1 + -0.5 \cdot i}} \cdot 100 \]
    7. Step-by-step derivation
      1. *-commutative60.8%

        \[\leadsto \frac{n}{1 + \color{blue}{i \cdot -0.5}} \cdot 100 \]
    8. Simplified60.8%

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

    if -4.29999999999999991e-222 < n < 9.20000000000000087e-177

    1. Initial program 54.5%

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

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

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

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

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

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

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

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

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

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

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

    if 9.20000000000000087e-177 < n

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def83.7%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -7.2 \cdot 10^{+231}:\\ \;\;\;\;\frac{1}{\frac{i}{100 \cdot \left(i \cdot n\right)}}\\ \mathbf{elif}\;n \leq -4.3 \cdot 10^{-222}:\\ \;\;\;\;100 \cdot \frac{n}{1 + i \cdot -0.5}\\ \mathbf{elif}\;n \leq 9.2 \cdot 10^{-177}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 13: 61.8% accurate, 10.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -6.2 \cdot 10^{+114} \lor \neg \left(n \leq 5.5 \cdot 10^{-5}\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 -6.2e+114) (not (<= n 5.5e-5)))
   (* n (+ 100.0 (* i 50.0)))
   (* 100.0 (/ i (/ i n)))))
double code(double i, double n) {
	double tmp;
	if ((n <= -6.2e+114) || !(n <= 5.5e-5)) {
		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 <= (-6.2d+114)) .or. (.not. (n <= 5.5d-5))) 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 <= -6.2e+114) || !(n <= 5.5e-5)) {
		tmp = n * (100.0 + (i * 50.0));
	} else {
		tmp = 100.0 * (i / (i / n));
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if (n <= -6.2e+114) or not (n <= 5.5e-5):
		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 <= -6.2e+114) || !(n <= 5.5e-5))
		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 <= -6.2e+114) || ~((n <= 5.5e-5)))
		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, -6.2e+114], N[Not[LessEqual[n, 5.5e-5]], $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 -6.2 \cdot 10^{+114} \lor \neg \left(n \leq 5.5 \cdot 10^{-5}\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 < -6.2000000000000001e114 or 5.5000000000000002e-5 < n

    1. Initial program 18.6%

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

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

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

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

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

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

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

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

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

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

    if -6.2000000000000001e114 < n < 5.5000000000000002e-5

    1. Initial program 38.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 57.5%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -6.2 \cdot 10^{+114} \lor \neg \left(n \leq 5.5 \cdot 10^{-5}\right):\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 63.5% accurate, 10.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -7.5 \cdot 10^{+231} \lor \neg \left(n \leq 2.4 \cdot 10^{-55}\right):\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (or (<= n -7.5e+231) (not (<= n 2.4e-55)))
   (* n (+ 100.0 (* i 50.0)))
   (/ n (+ 0.01 (* i -0.005)))))
double code(double i, double n) {
	double tmp;
	if ((n <= -7.5e+231) || !(n <= 2.4e-55)) {
		tmp = n * (100.0 + (i * 50.0));
	} else {
		tmp = n / (0.01 + (i * -0.005));
	}
	return tmp;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: tmp
    if ((n <= (-7.5d+231)) .or. (.not. (n <= 2.4d-55))) then
        tmp = n * (100.0d0 + (i * 50.0d0))
    else
        tmp = n / (0.01d0 + (i * (-0.005d0)))
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double tmp;
	if ((n <= -7.5e+231) || !(n <= 2.4e-55)) {
		tmp = n * (100.0 + (i * 50.0));
	} else {
		tmp = n / (0.01 + (i * -0.005));
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if (n <= -7.5e+231) or not (n <= 2.4e-55):
		tmp = n * (100.0 + (i * 50.0))
	else:
		tmp = n / (0.01 + (i * -0.005))
	return tmp
function code(i, n)
	tmp = 0.0
	if ((n <= -7.5e+231) || !(n <= 2.4e-55))
		tmp = Float64(n * Float64(100.0 + Float64(i * 50.0)));
	else
		tmp = Float64(n / Float64(0.01 + Float64(i * -0.005)));
	end
	return tmp
end
function tmp_2 = code(i, n)
	tmp = 0.0;
	if ((n <= -7.5e+231) || ~((n <= 2.4e-55)))
		tmp = n * (100.0 + (i * 50.0));
	else
		tmp = n / (0.01 + (i * -0.005));
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[Or[LessEqual[n, -7.5e+231], N[Not[LessEqual[n, 2.4e-55]], $MachinePrecision]], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(n / N[(0.01 + N[(i * -0.005), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;n \leq -7.5 \cdot 10^{+231} \lor \neg \left(n \leq 2.4 \cdot 10^{-55}\right):\\
\;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -7.50000000000000008e231 or 2.39999999999999991e-55 < n

    1. Initial program 15.9%

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def94.6%

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

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

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

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

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

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

    if -7.50000000000000008e231 < n < 2.39999999999999991e-55

    1. Initial program 37.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 32.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{n}{0.01 + \color{blue}{i \cdot -0.005}} \]
    10. Simplified59.7%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -7.5 \cdot 10^{+231} \lor \neg \left(n \leq 2.4 \cdot 10^{-55}\right):\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 58.7% accurate, 10.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -2:\\ \;\;\;\;\frac{n}{i} \cdot -200\\ \mathbf{elif}\;i \leq 2 \cdot 10^{-8}:\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= i -2.0)
   (* (/ n i) -200.0)
   (if (<= i 2e-8) (* n 100.0) (* 100.0 (/ i (/ i n))))))
double code(double i, double n) {
	double tmp;
	if (i <= -2.0) {
		tmp = (n / i) * -200.0;
	} else if (i <= 2e-8) {
		tmp = n * 100.0;
	} else {
		tmp = 100.0 * (i / (i / n));
	}
	return tmp;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    real(8) :: tmp
    if (i <= (-2.0d0)) then
        tmp = (n / i) * (-200.0d0)
    else if (i <= 2d-8) then
        tmp = n * 100.0d0
    else
        tmp = 100.0d0 * (i / (i / n))
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double tmp;
	if (i <= -2.0) {
		tmp = (n / i) * -200.0;
	} else if (i <= 2e-8) {
		tmp = n * 100.0;
	} else {
		tmp = 100.0 * (i / (i / n));
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if i <= -2.0:
		tmp = (n / i) * -200.0
	elif i <= 2e-8:
		tmp = n * 100.0
	else:
		tmp = 100.0 * (i / (i / n))
	return tmp
function code(i, n)
	tmp = 0.0
	if (i <= -2.0)
		tmp = Float64(Float64(n / i) * -200.0);
	elseif (i <= 2e-8)
		tmp = Float64(n * 100.0);
	else
		tmp = Float64(100.0 * Float64(i / Float64(i / n)));
	end
	return tmp
end
function tmp_2 = code(i, n)
	tmp = 0.0;
	if (i <= -2.0)
		tmp = (n / i) * -200.0;
	elseif (i <= 2e-8)
		tmp = n * 100.0;
	else
		tmp = 100.0 * (i / (i / n));
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[LessEqual[i, -2.0], N[(N[(n / i), $MachinePrecision] * -200.0), $MachinePrecision], If[LessEqual[i, 2e-8], N[(n * 100.0), $MachinePrecision], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq -2:\\
\;\;\;\;\frac{n}{i} \cdot -200\\

\mathbf{elif}\;i \leq 2 \cdot 10^{-8}:\\
\;\;\;\;n \cdot 100\\

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


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

    1. Initial program 65.9%

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def77.9%

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

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

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

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

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

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

        \[\leadsto \frac{n}{0.01 + \color{blue}{i \cdot -0.005}} \]
    10. Simplified34.1%

      \[\leadsto \frac{n}{\color{blue}{0.01 + i \cdot -0.005}} \]
    11. Taylor expanded in i around inf 34.1%

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

    if -2 < i < 2e-8

    1. Initial program 12.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 80.4%

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

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

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

    if 2e-8 < i

    1. Initial program 35.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 32.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -2:\\ \;\;\;\;\frac{n}{i} \cdot -200\\ \mathbf{elif}\;i \leq 2 \cdot 10^{-8}:\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 63.5% accurate, 10.2× speedup?

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

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

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

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


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

    1. Initial program 8.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\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-def8.8%

        \[\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-pow8.8%

        \[\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-udef78.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-rr78.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} \]
    7. Step-by-step derivation
      1. clear-num78.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.2000000000000001e232 < n < 2.2e-55

    1. Initial program 37.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 32.1%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{n}{0.01 + \color{blue}{i \cdot -0.005}} \]
    10. Simplified59.7%

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

    if 2.2e-55 < n

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

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

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

        \[\leadsto \color{blue}{\frac{n}{\frac{i}{e^{i} - 1}}} \cdot 100 \]
      3. expm1-def93.6%

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1.2 \cdot 10^{+232}:\\ \;\;\;\;\frac{100 \cdot \left(i \cdot n\right)}{i}\\ \mathbf{elif}\;n \leq 2.2 \cdot 10^{-55}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 17: 58.6% accurate, 12.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -2 \lor \neg \left(i \leq 1.05 \cdot 10^{+58}\right):\\ \;\;\;\;\frac{n}{i} \cdot -200\\ \mathbf{else}:\\ \;\;\;\;n \cdot 100\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (or (<= i -2.0) (not (<= i 1.05e+58))) (* (/ n i) -200.0) (* n 100.0)))
double code(double i, double n) {
	double tmp;
	if ((i <= -2.0) || !(i <= 1.05e+58)) {
		tmp = (n / i) * -200.0;
	} 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 <= (-2.0d0)) .or. (.not. (i <= 1.05d+58))) then
        tmp = (n / i) * (-200.0d0)
    else
        tmp = n * 100.0d0
    end if
    code = tmp
end function
public static double code(double i, double n) {
	double tmp;
	if ((i <= -2.0) || !(i <= 1.05e+58)) {
		tmp = (n / i) * -200.0;
	} else {
		tmp = n * 100.0;
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if (i <= -2.0) or not (i <= 1.05e+58):
		tmp = (n / i) * -200.0
	else:
		tmp = n * 100.0
	return tmp
function code(i, n)
	tmp = 0.0
	if ((i <= -2.0) || !(i <= 1.05e+58))
		tmp = Float64(Float64(n / i) * -200.0);
	else
		tmp = Float64(n * 100.0);
	end
	return tmp
end
function tmp_2 = code(i, n)
	tmp = 0.0;
	if ((i <= -2.0) || ~((i <= 1.05e+58)))
		tmp = (n / i) * -200.0;
	else
		tmp = n * 100.0;
	end
	tmp_2 = tmp;
end
code[i_, n_] := If[Or[LessEqual[i, -2.0], N[Not[LessEqual[i, 1.05e+58]], $MachinePrecision]], N[(N[(n / i), $MachinePrecision] * -200.0), $MachinePrecision], N[(n * 100.0), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq -2 \lor \neg \left(i \leq 1.05 \cdot 10^{+58}\right):\\
\;\;\;\;\frac{n}{i} \cdot -200\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if i < -2 or 1.05000000000000006e58 < i

    1. Initial program 55.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 59.3%

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{n}{0.01 + \color{blue}{i \cdot -0.005}} \]
    10. Simplified36.2%

      \[\leadsto \frac{n}{\color{blue}{0.01 + i \cdot -0.005}} \]
    11. Taylor expanded in i around inf 36.2%

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

    if -2 < i < 1.05000000000000006e58

    1. Initial program 12.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 73.7%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -2 \lor \neg \left(i \leq 1.05 \cdot 10^{+58}\right):\\ \;\;\;\;\frac{n}{i} \cdot -200\\ \mathbf{else}:\\ \;\;\;\;n \cdot 100\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 2.8% accurate, 38.0× speedup?

\[\begin{array}{l} \\ i \cdot -50 \end{array} \]
(FPCore (i n) :precision binary64 (* i -50.0))
double code(double i, double n) {
	return i * -50.0;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    code = i * (-50.0d0)
end function
public static double code(double i, double n) {
	return i * -50.0;
}
def code(i, n):
	return i * -50.0
function code(i, n)
	return Float64(i * -50.0)
end
function tmp = code(i, n)
	tmp = i * -50.0;
end
code[i_, n_] := N[(i * -50.0), $MachinePrecision]
\begin{array}{l}

\\
i \cdot -50
\end{array}
Derivation
  1. Initial program 29.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 50.1%

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

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

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

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

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

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

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

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

    \[\leadsto i \cdot -50 \]
  10. Add Preprocessing

Alternative 19: 49.8% accurate, 38.0× speedup?

\[\begin{array}{l} \\ n \cdot 100 \end{array} \]
(FPCore (i n) :precision binary64 (* n 100.0))
double code(double i, double n) {
	return n * 100.0;
}
real(8) function code(i, n)
    real(8), intent (in) :: i
    real(8), intent (in) :: n
    code = n * 100.0d0
end function
public static double code(double i, double n) {
	return n * 100.0;
}
def code(i, n):
	return n * 100.0
function code(i, n)
	return Float64(n * 100.0)
end
function tmp = code(i, n)
	tmp = n * 100.0;
end
code[i_, n_] := N[(n * 100.0), $MachinePrecision]
\begin{array}{l}

\\
n \cdot 100
\end{array}
Derivation
  1. Initial program 29.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 47.1%

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

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

    \[\leadsto \color{blue}{n \cdot 100} \]
  6. Final simplification47.1%

    \[\leadsto n \cdot 100 \]
  7. Add Preprocessing

Developer target: 34.0% 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 2024019 
(FPCore (i n)
  :name "Compound Interest"
  :precision binary64

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

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