Compound Interest

Percentage Accurate: 28.1% → 99.5%
Time: 23.6s
Alternatives: 19
Speedup: 16.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: 28.1% 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: 99.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 -4 \cdot 10^{-6}:\\ \;\;\;\;100 \cdot \frac{n \cdot t_0 - n}{i}\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;\frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{\frac{i}{n}}\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;t_1 \cdot 100\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{1}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \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 -4e-6)
     (* 100.0 (/ (- (* n t_0) n) i))
     (if (<= t_1 0.0)
       (/ (* 100.0 (expm1 (* n (log1p (/ i n))))) (/ i n))
       (if (<= t_1 INFINITY)
         (* t_1 100.0)
         (* 100.0 (/ 1.0 (+ (* (/ i n) -0.5) (/ 1.0 n)))))))))
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 <= -4e-6) {
		tmp = 100.0 * (((n * t_0) - n) / i);
	} else if (t_1 <= 0.0) {
		tmp = (100.0 * expm1((n * log1p((i / n))))) / (i / n);
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_1 * 100.0;
	} else {
		tmp = 100.0 * (1.0 / (((i / n) * -0.5) + (1.0 / n)));
	}
	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 <= -4e-6) {
		tmp = 100.0 * (((n * t_0) - n) / i);
	} else if (t_1 <= 0.0) {
		tmp = (100.0 * Math.expm1((n * Math.log1p((i / n))))) / (i / n);
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_1 * 100.0;
	} else {
		tmp = 100.0 * (1.0 / (((i / n) * -0.5) + (1.0 / n)));
	}
	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 <= -4e-6:
		tmp = 100.0 * (((n * t_0) - n) / i)
	elif t_1 <= 0.0:
		tmp = (100.0 * math.expm1((n * math.log1p((i / n))))) / (i / n)
	elif t_1 <= math.inf:
		tmp = t_1 * 100.0
	else:
		tmp = 100.0 * (1.0 / (((i / n) * -0.5) + (1.0 / n)))
	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 <= -4e-6)
		tmp = Float64(100.0 * Float64(Float64(Float64(n * t_0) - n) / i));
	elseif (t_1 <= 0.0)
		tmp = Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / Float64(i / n));
	elseif (t_1 <= Inf)
		tmp = Float64(t_1 * 100.0);
	else
		tmp = Float64(100.0 * Float64(1.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n))));
	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, -4e-6], N[(100.0 * N[(N[(N[(n * t$95$0), $MachinePrecision] - n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(t$95$1 * 100.0), $MachinePrecision], N[(100.0 * N[(1.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $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 -4 \cdot 10^{-6}:\\
\;\;\;\;100 \cdot \frac{n \cdot t_0 - n}{i}\\

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

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_1 \cdot 100\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{1}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\


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

    1. Initial program 99.8%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. div-sub99.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.99999999999999982e-6 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0

    1. Initial program 26.3%

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

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

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

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

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

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

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

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

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

    1. Initial program 100.0%

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

    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. Taylor expanded in n around inf 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 2: 85.1% 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 -\infty:\\ \;\;\;\;100 \cdot \frac{n \cdot t_0 - n}{i}\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;t_1 \cdot 100\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{1}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \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 (- INFINITY))
     (* 100.0 (/ (- (* n t_0) n) i))
     (if (<= t_1 0.0)
       (* 100.0 (/ n (/ i (expm1 i))))
       (if (<= t_1 INFINITY)
         (* t_1 100.0)
         (* 100.0 (/ 1.0 (+ (* (/ i n) -0.5) (/ 1.0 n)))))))))
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 <= -((double) INFINITY)) {
		tmp = 100.0 * (((n * t_0) - n) / i);
	} else if (t_1 <= 0.0) {
		tmp = 100.0 * (n / (i / expm1(i)));
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_1 * 100.0;
	} else {
		tmp = 100.0 * (1.0 / (((i / n) * -0.5) + (1.0 / n)));
	}
	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 <= -Double.POSITIVE_INFINITY) {
		tmp = 100.0 * (((n * t_0) - n) / i);
	} else if (t_1 <= 0.0) {
		tmp = 100.0 * (n / (i / Math.expm1(i)));
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_1 * 100.0;
	} else {
		tmp = 100.0 * (1.0 / (((i / n) * -0.5) + (1.0 / n)));
	}
	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 <= -math.inf:
		tmp = 100.0 * (((n * t_0) - n) / i)
	elif t_1 <= 0.0:
		tmp = 100.0 * (n / (i / math.expm1(i)))
	elif t_1 <= math.inf:
		tmp = t_1 * 100.0
	else:
		tmp = 100.0 * (1.0 / (((i / n) * -0.5) + (1.0 / n)))
	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 <= Float64(-Inf))
		tmp = Float64(100.0 * Float64(Float64(Float64(n * t_0) - n) / i));
	elseif (t_1 <= 0.0)
		tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i))));
	elseif (t_1 <= Inf)
		tmp = Float64(t_1 * 100.0);
	else
		tmp = Float64(100.0 * Float64(1.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n))));
	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, (-Infinity)], N[(100.0 * N[(N[(N[(n * t$95$0), $MachinePrecision] - n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(t$95$1 * 100.0), $MachinePrecision], N[(100.0 * N[(1.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $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 -\infty:\\
\;\;\;\;100 \cdot \frac{n \cdot t_0 - n}{i}\\

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

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_1 \cdot 100\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{1}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\


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

    1. Initial program 100.0%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. div-sub100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 27.1%

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

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

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

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

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

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

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

    1. Initial program 100.0%

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

    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. Taylor expanded in n around inf 0.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq -\infty:\\ \;\;\;\;100 \cdot \frac{n \cdot {\left(1 + \frac{i}{n}\right)}^{n} - n}{i}\\ \mathbf{elif}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq 0:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(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} + -1}{\frac{i}{n}} \cdot 100\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{1}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \end{array} \]

Alternative 3: 98.8% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_1 \cdot 100\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{1}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\


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

    1. Initial program 100.0%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. div-sub100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 27.1%

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

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

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

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

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

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

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

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

    1. Initial program 100.0%

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

    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. Taylor expanded in n around inf 0.0%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq -\infty:\\ \;\;\;\;100 \cdot \frac{n \cdot {\left(1 + \frac{i}{n}\right)}^{n} - n}{i}\\ \mathbf{elif}\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} + -1}{\frac{i}{n}} \leq 0:\\ \;\;\;\;100 \cdot \left(n \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} + -1}{\frac{i}{n}} \cdot 100\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{1}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \end{array} \]

Alternative 4: 98.8% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\left(1 + \frac{i}{n}\right)}^{n}\\ t_1 := \frac{t_0 + -1}{\frac{i}{n}}\\ \mathbf{if}\;t_1 \leq -4 \cdot 10^{-6}:\\ \;\;\;\;100 \cdot \frac{n \cdot t_0 - n}{i}\\ \mathbf{elif}\;t_1 \leq 0:\\ \;\;\;\;n \cdot \frac{100 \cdot \mathsf{expm1}\left(n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)\right)}{i}\\ \mathbf{elif}\;t_1 \leq \infty:\\ \;\;\;\;t_1 \cdot 100\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{1}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \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 -4e-6)
     (* 100.0 (/ (- (* n t_0) n) i))
     (if (<= t_1 0.0)
       (* n (/ (* 100.0 (expm1 (* n (log1p (/ i n))))) i))
       (if (<= t_1 INFINITY)
         (* t_1 100.0)
         (* 100.0 (/ 1.0 (+ (* (/ i n) -0.5) (/ 1.0 n)))))))))
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 <= -4e-6) {
		tmp = 100.0 * (((n * t_0) - n) / i);
	} else if (t_1 <= 0.0) {
		tmp = n * ((100.0 * expm1((n * log1p((i / n))))) / i);
	} else if (t_1 <= ((double) INFINITY)) {
		tmp = t_1 * 100.0;
	} else {
		tmp = 100.0 * (1.0 / (((i / n) * -0.5) + (1.0 / n)));
	}
	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 <= -4e-6) {
		tmp = 100.0 * (((n * t_0) - n) / i);
	} else if (t_1 <= 0.0) {
		tmp = n * ((100.0 * Math.expm1((n * Math.log1p((i / n))))) / i);
	} else if (t_1 <= Double.POSITIVE_INFINITY) {
		tmp = t_1 * 100.0;
	} else {
		tmp = 100.0 * (1.0 / (((i / n) * -0.5) + (1.0 / n)));
	}
	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 <= -4e-6:
		tmp = 100.0 * (((n * t_0) - n) / i)
	elif t_1 <= 0.0:
		tmp = n * ((100.0 * math.expm1((n * math.log1p((i / n))))) / i)
	elif t_1 <= math.inf:
		tmp = t_1 * 100.0
	else:
		tmp = 100.0 * (1.0 / (((i / n) * -0.5) + (1.0 / n)))
	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 <= -4e-6)
		tmp = Float64(100.0 * Float64(Float64(Float64(n * t_0) - n) / i));
	elseif (t_1 <= 0.0)
		tmp = Float64(n * Float64(Float64(100.0 * expm1(Float64(n * log1p(Float64(i / n))))) / i));
	elseif (t_1 <= Inf)
		tmp = Float64(t_1 * 100.0);
	else
		tmp = Float64(100.0 * Float64(1.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n))));
	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, -4e-6], N[(100.0 * N[(N[(N[(n * t$95$0), $MachinePrecision] - n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 0.0], N[(n * N[(N[(100.0 * N[(Exp[N[(n * N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, Infinity], N[(t$95$1 * 100.0), $MachinePrecision], N[(100.0 * N[(1.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $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 -4 \cdot 10^{-6}:\\
\;\;\;\;100 \cdot \frac{n \cdot t_0 - n}{i}\\

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

\mathbf{elif}\;t_1 \leq \infty:\\
\;\;\;\;t_1 \cdot 100\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{1}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\


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

    1. Initial program 99.8%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Step-by-step derivation
      1. div-sub99.8%

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

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

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

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

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

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

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

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

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

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

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

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

    if -3.99999999999999982e-6 < (/.f64 (-.f64 (pow.f64 (+.f64 1 (/.f64 i n)) n) 1) (/.f64 i n)) < -0.0

    1. Initial program 26.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    1. Initial program 100.0%

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

    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. Taylor expanded in n around inf 0.0%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 83.9% accurate, 0.9× speedup?

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

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

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

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


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

    1. Initial program 28.4%

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

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

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

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

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

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

    if -2.79999999999999995e-235 < n < 0.97999999999999998

    1. Initial program 39.7%

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
    2. Taylor expanded in i around 0 28.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)} \]
    3. Step-by-step derivation
      1. associate-*r*29.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/29.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-eval29.0%

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

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

        \[\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-+42.5%

        \[\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)}} \]
    6. Applied egg-rr42.5%

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

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

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

          \[\leadsto \frac{\color{blue}{{n}^{2} \cdot 10000}}{n \cdot 100 - 100 \cdot \left(\left(n \cdot i\right) \cdot \left(0.5 + \frac{-0.5}{n}\right)\right)} \]
      4. Simplified87.7%

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

      if 0.97999999999999998 < n

      1. Initial program 30.2%

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.8 \cdot 10^{-235}:\\ \;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \mathbf{elif}\;n \leq 0.98:\\ \;\;\;\;\frac{{n}^{2} \cdot 10000}{n \cdot 100 - 100 \cdot \left(\left(i \cdot n\right) \cdot \left(0.5 + \frac{-0.5}{n}\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \end{array} \]

    Alternative 6: 82.1% accurate, 0.9× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -2.6 \cdot 10^{-239}:\\ \;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \mathbf{elif}\;n \leq 3.8 \cdot 10^{-210}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 7000000000:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 5.8 \cdot 10^{+29}:\\ \;\;\;\;100 \cdot \frac{n \cdot {\left(1 + \frac{i}{n}\right)}^{n} - n}{i}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \end{array} \end{array} \]
    (FPCore (i n)
     :precision binary64
     (if (<= n -2.6e-239)
       (* 100.0 (* n (/ (expm1 i) i)))
       (if (<= n 3.8e-210)
         0.0
         (if (<= n 7000000000.0)
           (* 100.0 (/ i (/ i n)))
           (if (<= n 5.8e+29)
             (* 100.0 (/ (- (* n (pow (+ 1.0 (/ i n)) n)) n) i))
             (* 100.0 (/ n (/ i (expm1 i)))))))))
    double code(double i, double n) {
    	double tmp;
    	if (n <= -2.6e-239) {
    		tmp = 100.0 * (n * (expm1(i) / i));
    	} else if (n <= 3.8e-210) {
    		tmp = 0.0;
    	} else if (n <= 7000000000.0) {
    		tmp = 100.0 * (i / (i / n));
    	} else if (n <= 5.8e+29) {
    		tmp = 100.0 * (((n * pow((1.0 + (i / n)), n)) - n) / i);
    	} else {
    		tmp = 100.0 * (n / (i / expm1(i)));
    	}
    	return tmp;
    }
    
    public static double code(double i, double n) {
    	double tmp;
    	if (n <= -2.6e-239) {
    		tmp = 100.0 * (n * (Math.expm1(i) / i));
    	} else if (n <= 3.8e-210) {
    		tmp = 0.0;
    	} else if (n <= 7000000000.0) {
    		tmp = 100.0 * (i / (i / n));
    	} else if (n <= 5.8e+29) {
    		tmp = 100.0 * (((n * Math.pow((1.0 + (i / n)), n)) - n) / i);
    	} else {
    		tmp = 100.0 * (n / (i / Math.expm1(i)));
    	}
    	return tmp;
    }
    
    def code(i, n):
    	tmp = 0
    	if n <= -2.6e-239:
    		tmp = 100.0 * (n * (math.expm1(i) / i))
    	elif n <= 3.8e-210:
    		tmp = 0.0
    	elif n <= 7000000000.0:
    		tmp = 100.0 * (i / (i / n))
    	elif n <= 5.8e+29:
    		tmp = 100.0 * (((n * math.pow((1.0 + (i / n)), n)) - n) / i)
    	else:
    		tmp = 100.0 * (n / (i / math.expm1(i)))
    	return tmp
    
    function code(i, n)
    	tmp = 0.0
    	if (n <= -2.6e-239)
    		tmp = Float64(100.0 * Float64(n * Float64(expm1(i) / i)));
    	elseif (n <= 3.8e-210)
    		tmp = 0.0;
    	elseif (n <= 7000000000.0)
    		tmp = Float64(100.0 * Float64(i / Float64(i / n)));
    	elseif (n <= 5.8e+29)
    		tmp = Float64(100.0 * Float64(Float64(Float64(n * (Float64(1.0 + Float64(i / n)) ^ n)) - n) / i));
    	else
    		tmp = Float64(100.0 * Float64(n / Float64(i / expm1(i))));
    	end
    	return tmp
    end
    
    code[i_, n_] := If[LessEqual[n, -2.6e-239], N[(100.0 * N[(n * N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.8e-210], 0.0, If[LessEqual[n, 7000000000.0], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.8e+29], N[(100.0 * N[(N[(N[(n * N[Power[N[(1.0 + N[(i / n), $MachinePrecision]), $MachinePrecision], n], $MachinePrecision]), $MachinePrecision] - n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(n / N[(i / N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;n \leq -2.6 \cdot 10^{-239}:\\
    \;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\
    
    \mathbf{elif}\;n \leq 3.8 \cdot 10^{-210}:\\
    \;\;\;\;0\\
    
    \mathbf{elif}\;n \leq 7000000000:\\
    \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
    
    \mathbf{elif}\;n \leq 5.8 \cdot 10^{+29}:\\
    \;\;\;\;100 \cdot \frac{n \cdot {\left(1 + \frac{i}{n}\right)}^{n} - n}{i}\\
    
    \mathbf{else}:\\
    \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 5 regimes
    2. if n < -2.60000000000000003e-239

      1. Initial program 28.4%

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

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

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

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

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

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

      if -2.60000000000000003e-239 < n < 3.80000000000000003e-210

      1. Initial program 69.0%

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

        \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
      3. Taylor expanded in i around 0 94.8%

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

      if 3.80000000000000003e-210 < n < 7e9

      1. Initial program 6.3%

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

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

      if 7e9 < n < 5.7999999999999999e29

      1. Initial program 78.4%

        \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \]
      2. Step-by-step derivation
        1. div-sub78.4%

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

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

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

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

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

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

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

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

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

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

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

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

      if 5.7999999999999999e29 < n

      1. Initial program 25.3%

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.6 \cdot 10^{-239}:\\ \;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \mathbf{elif}\;n \leq 3.8 \cdot 10^{-210}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 7000000000:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 5.8 \cdot 10^{+29}:\\ \;\;\;\;100 \cdot \frac{n \cdot {\left(1 + \frac{i}{n}\right)}^{n} - n}{i}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \end{array} \]

    Alternative 7: 76.8% accurate, 1.0× speedup?

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

      1. Initial program 51.4%

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

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

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

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

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

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

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

      if -2.1999999999999998e-8 < i < 2.5e-175

      1. Initial program 9.2%

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

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

          \[\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/88.1%

          \[\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-eval88.1%

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

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

      if 2.5e-175 < i < 0.00119999999999999989

      1. Initial program 26.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{100}{\frac{i}{\color{blue}{i \cdot n}}} \]
      12. Step-by-step derivation
        1. *-commutative81.0%

          \[\leadsto \frac{100}{\frac{i}{\color{blue}{n \cdot i}}} \]
      13. Simplified81.0%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -2.2 \cdot 10^{-8}:\\ \;\;\;\;100 \cdot \left(\mathsf{expm1}\left(i\right) \cdot \frac{n}{i}\right)\\ \mathbf{elif}\;i \leq 2.5 \cdot 10^{-175}:\\ \;\;\;\;100 \cdot \left(n + \left(i \cdot n\right) \cdot \left(0.5 - \frac{0.5}{n}\right)\right)\\ \mathbf{elif}\;i \leq 0.0012:\\ \;\;\;\;\frac{100}{\frac{i}{i \cdot n}}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \left(\mathsf{expm1}\left(i\right) \cdot \frac{n}{i}\right)\\ \end{array} \]

    Alternative 8: 81.5% accurate, 1.0× speedup?

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

      1. Initial program 27.0%

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

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

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

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

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

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

      if -2.79999999999999986e-236 < n < 4.5e-141

      1. Initial program 55.5%

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

        \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
      3. Taylor expanded in i around 0 87.3%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.8 \cdot 10^{-236} \lor \neg \left(n \leq 4.5 \cdot 10^{-141}\right):\\ \;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

    Alternative 9: 81.5% accurate, 1.0× speedup?

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

      1. Initial program 28.4%

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

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

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

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

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

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

      if -2.79999999999999986e-236 < n < 7.8000000000000003e-144

      1. Initial program 55.5%

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

        \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
      3. Taylor expanded in i around 0 87.3%

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

      if 7.8000000000000003e-144 < n

      1. Initial program 25.8%

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.8 \cdot 10^{-236}:\\ \;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \mathbf{elif}\;n \leq 7.8 \cdot 10^{-144}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{\mathsf{expm1}\left(i\right)}}\\ \end{array} \]

    Alternative 10: 65.6% accurate, 2.1× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left(0.5 + \frac{-0.5}{n}\right) \cdot \left(100 \cdot \left(i \cdot n\right)\right)\\ \mathbf{if}\;n \leq -2.6 \cdot 10^{-236}:\\ \;\;\;\;100 \cdot \frac{1}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \mathbf{elif}\;n \leq 6.5 \cdot 10^{-138}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 6.5 \cdot 10^{+124}:\\ \;\;\;\;\frac{\left(n \cdot 100\right) \cdot \left(n \cdot 100\right) - t_0 \cdot t_0}{n \cdot 100 - t_0}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \end{array} \]
    (FPCore (i n)
     :precision binary64
     (let* ((t_0 (* (+ 0.5 (/ -0.5 n)) (* 100.0 (* i n)))))
       (if (<= n -2.6e-236)
         (* 100.0 (/ 1.0 (+ (* (/ i n) -0.5) (/ 1.0 n))))
         (if (<= n 6.5e-138)
           0.0
           (if (<= n 6.5e+124)
             (/ (- (* (* n 100.0) (* n 100.0)) (* t_0 t_0)) (- (* n 100.0) t_0))
             (* n (+ 100.0 (* i 50.0))))))))
    double code(double i, double n) {
    	double t_0 = (0.5 + (-0.5 / n)) * (100.0 * (i * n));
    	double tmp;
    	if (n <= -2.6e-236) {
    		tmp = 100.0 * (1.0 / (((i / n) * -0.5) + (1.0 / n)));
    	} else if (n <= 6.5e-138) {
    		tmp = 0.0;
    	} else if (n <= 6.5e+124) {
    		tmp = (((n * 100.0) * (n * 100.0)) - (t_0 * t_0)) / ((n * 100.0) - t_0);
    	} 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) :: t_0
        real(8) :: tmp
        t_0 = (0.5d0 + ((-0.5d0) / n)) * (100.0d0 * (i * n))
        if (n <= (-2.6d-236)) then
            tmp = 100.0d0 * (1.0d0 / (((i / n) * (-0.5d0)) + (1.0d0 / n)))
        else if (n <= 6.5d-138) then
            tmp = 0.0d0
        else if (n <= 6.5d+124) then
            tmp = (((n * 100.0d0) * (n * 100.0d0)) - (t_0 * t_0)) / ((n * 100.0d0) - t_0)
        else
            tmp = n * (100.0d0 + (i * 50.0d0))
        end if
        code = tmp
    end function
    
    public static double code(double i, double n) {
    	double t_0 = (0.5 + (-0.5 / n)) * (100.0 * (i * n));
    	double tmp;
    	if (n <= -2.6e-236) {
    		tmp = 100.0 * (1.0 / (((i / n) * -0.5) + (1.0 / n)));
    	} else if (n <= 6.5e-138) {
    		tmp = 0.0;
    	} else if (n <= 6.5e+124) {
    		tmp = (((n * 100.0) * (n * 100.0)) - (t_0 * t_0)) / ((n * 100.0) - t_0);
    	} else {
    		tmp = n * (100.0 + (i * 50.0));
    	}
    	return tmp;
    }
    
    def code(i, n):
    	t_0 = (0.5 + (-0.5 / n)) * (100.0 * (i * n))
    	tmp = 0
    	if n <= -2.6e-236:
    		tmp = 100.0 * (1.0 / (((i / n) * -0.5) + (1.0 / n)))
    	elif n <= 6.5e-138:
    		tmp = 0.0
    	elif n <= 6.5e+124:
    		tmp = (((n * 100.0) * (n * 100.0)) - (t_0 * t_0)) / ((n * 100.0) - t_0)
    	else:
    		tmp = n * (100.0 + (i * 50.0))
    	return tmp
    
    function code(i, n)
    	t_0 = Float64(Float64(0.5 + Float64(-0.5 / n)) * Float64(100.0 * Float64(i * n)))
    	tmp = 0.0
    	if (n <= -2.6e-236)
    		tmp = Float64(100.0 * Float64(1.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n))));
    	elseif (n <= 6.5e-138)
    		tmp = 0.0;
    	elseif (n <= 6.5e+124)
    		tmp = Float64(Float64(Float64(Float64(n * 100.0) * Float64(n * 100.0)) - Float64(t_0 * t_0)) / Float64(Float64(n * 100.0) - t_0));
    	else
    		tmp = Float64(n * Float64(100.0 + Float64(i * 50.0)));
    	end
    	return tmp
    end
    
    function tmp_2 = code(i, n)
    	t_0 = (0.5 + (-0.5 / n)) * (100.0 * (i * n));
    	tmp = 0.0;
    	if (n <= -2.6e-236)
    		tmp = 100.0 * (1.0 / (((i / n) * -0.5) + (1.0 / n)));
    	elseif (n <= 6.5e-138)
    		tmp = 0.0;
    	elseif (n <= 6.5e+124)
    		tmp = (((n * 100.0) * (n * 100.0)) - (t_0 * t_0)) / ((n * 100.0) - t_0);
    	else
    		tmp = n * (100.0 + (i * 50.0));
    	end
    	tmp_2 = tmp;
    end
    
    code[i_, n_] := Block[{t$95$0 = N[(N[(0.5 + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision] * N[(100.0 * N[(i * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -2.6e-236], N[(100.0 * N[(1.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 6.5e-138], 0.0, If[LessEqual[n, 6.5e+124], N[(N[(N[(N[(n * 100.0), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] / N[(N[(n * 100.0), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision], N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \left(0.5 + \frac{-0.5}{n}\right) \cdot \left(100 \cdot \left(i \cdot n\right)\right)\\
    \mathbf{if}\;n \leq -2.6 \cdot 10^{-236}:\\
    \;\;\;\;100 \cdot \frac{1}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\
    
    \mathbf{elif}\;n \leq 6.5 \cdot 10^{-138}:\\
    \;\;\;\;0\\
    
    \mathbf{elif}\;n \leq 6.5 \cdot 10^{+124}:\\
    \;\;\;\;\frac{\left(n \cdot 100\right) \cdot \left(n \cdot 100\right) - t_0 \cdot t_0}{n \cdot 100 - t_0}\\
    
    \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.6e-236

      1. Initial program 28.4%

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

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

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

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

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

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

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

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

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

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

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

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

      if -2.6e-236 < n < 6.4999999999999999e-138

      1. Initial program 54.4%

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

        \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
      3. Taylor expanded in i around 0 85.5%

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

      if 6.4999999999999999e-138 < n < 6.50000000000000008e124

      1. Initial program 26.8%

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

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

          \[\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/60.8%

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

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

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

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

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

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

      if 6.50000000000000008e124 < n

      1. Initial program 25.0%

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.6 \cdot 10^{-236}:\\ \;\;\;\;100 \cdot \frac{1}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \mathbf{elif}\;n \leq 6.5 \cdot 10^{-138}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 6.5 \cdot 10^{+124}:\\ \;\;\;\;\frac{\left(n \cdot 100\right) \cdot \left(n \cdot 100\right) - \left(\left(0.5 + \frac{-0.5}{n}\right) \cdot \left(100 \cdot \left(i \cdot n\right)\right)\right) \cdot \left(\left(0.5 + \frac{-0.5}{n}\right) \cdot \left(100 \cdot \left(i \cdot n\right)\right)\right)}{n \cdot 100 - \left(0.5 + \frac{-0.5}{n}\right) \cdot \left(100 \cdot \left(i \cdot n\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \]

    Alternative 11: 57.0% accurate, 7.4× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -2.4 \cdot 10^{-65}:\\ \;\;\;\;100 \cdot \left(n + i \cdot -0.5\right)\\ \mathbf{elif}\;n \leq -2.8 \cdot 10^{-236}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 2.95 \cdot 10^{-145}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.42 \cdot 10^{+163}:\\ \;\;\;\;n \cdot 100\\ \mathbf{elif}\;n \leq 2.3 \cdot 10^{+193}:\\ \;\;\;\;\left(i \cdot n\right) \cdot 50\\ \mathbf{else}:\\ \;\;\;\;\frac{100}{\frac{1}{n}}\\ \end{array} \end{array} \]
    (FPCore (i n)
     :precision binary64
     (if (<= n -2.4e-65)
       (* 100.0 (+ n (* i -0.5)))
       (if (<= n -2.8e-236)
         (* 100.0 (/ i (/ i n)))
         (if (<= n 2.95e-145)
           0.0
           (if (<= n 1.42e+163)
             (* n 100.0)
             (if (<= n 2.3e+193) (* (* i n) 50.0) (/ 100.0 (/ 1.0 n))))))))
    double code(double i, double n) {
    	double tmp;
    	if (n <= -2.4e-65) {
    		tmp = 100.0 * (n + (i * -0.5));
    	} else if (n <= -2.8e-236) {
    		tmp = 100.0 * (i / (i / n));
    	} else if (n <= 2.95e-145) {
    		tmp = 0.0;
    	} else if (n <= 1.42e+163) {
    		tmp = n * 100.0;
    	} else if (n <= 2.3e+193) {
    		tmp = (i * n) * 50.0;
    	} else {
    		tmp = 100.0 / (1.0 / n);
    	}
    	return tmp;
    }
    
    real(8) function code(i, n)
        real(8), intent (in) :: i
        real(8), intent (in) :: n
        real(8) :: tmp
        if (n <= (-2.4d-65)) then
            tmp = 100.0d0 * (n + (i * (-0.5d0)))
        else if (n <= (-2.8d-236)) then
            tmp = 100.0d0 * (i / (i / n))
        else if (n <= 2.95d-145) then
            tmp = 0.0d0
        else if (n <= 1.42d+163) then
            tmp = n * 100.0d0
        else if (n <= 2.3d+193) then
            tmp = (i * n) * 50.0d0
        else
            tmp = 100.0d0 / (1.0d0 / n)
        end if
        code = tmp
    end function
    
    public static double code(double i, double n) {
    	double tmp;
    	if (n <= -2.4e-65) {
    		tmp = 100.0 * (n + (i * -0.5));
    	} else if (n <= -2.8e-236) {
    		tmp = 100.0 * (i / (i / n));
    	} else if (n <= 2.95e-145) {
    		tmp = 0.0;
    	} else if (n <= 1.42e+163) {
    		tmp = n * 100.0;
    	} else if (n <= 2.3e+193) {
    		tmp = (i * n) * 50.0;
    	} else {
    		tmp = 100.0 / (1.0 / n);
    	}
    	return tmp;
    }
    
    def code(i, n):
    	tmp = 0
    	if n <= -2.4e-65:
    		tmp = 100.0 * (n + (i * -0.5))
    	elif n <= -2.8e-236:
    		tmp = 100.0 * (i / (i / n))
    	elif n <= 2.95e-145:
    		tmp = 0.0
    	elif n <= 1.42e+163:
    		tmp = n * 100.0
    	elif n <= 2.3e+193:
    		tmp = (i * n) * 50.0
    	else:
    		tmp = 100.0 / (1.0 / n)
    	return tmp
    
    function code(i, n)
    	tmp = 0.0
    	if (n <= -2.4e-65)
    		tmp = Float64(100.0 * Float64(n + Float64(i * -0.5)));
    	elseif (n <= -2.8e-236)
    		tmp = Float64(100.0 * Float64(i / Float64(i / n)));
    	elseif (n <= 2.95e-145)
    		tmp = 0.0;
    	elseif (n <= 1.42e+163)
    		tmp = Float64(n * 100.0);
    	elseif (n <= 2.3e+193)
    		tmp = Float64(Float64(i * n) * 50.0);
    	else
    		tmp = Float64(100.0 / Float64(1.0 / n));
    	end
    	return tmp
    end
    
    function tmp_2 = code(i, n)
    	tmp = 0.0;
    	if (n <= -2.4e-65)
    		tmp = 100.0 * (n + (i * -0.5));
    	elseif (n <= -2.8e-236)
    		tmp = 100.0 * (i / (i / n));
    	elseif (n <= 2.95e-145)
    		tmp = 0.0;
    	elseif (n <= 1.42e+163)
    		tmp = n * 100.0;
    	elseif (n <= 2.3e+193)
    		tmp = (i * n) * 50.0;
    	else
    		tmp = 100.0 / (1.0 / n);
    	end
    	tmp_2 = tmp;
    end
    
    code[i_, n_] := If[LessEqual[n, -2.4e-65], N[(100.0 * N[(n + N[(i * -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, -2.8e-236], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.95e-145], 0.0, If[LessEqual[n, 1.42e+163], N[(n * 100.0), $MachinePrecision], If[LessEqual[n, 2.3e+193], N[(N[(i * n), $MachinePrecision] * 50.0), $MachinePrecision], N[(100.0 / N[(1.0 / n), $MachinePrecision]), $MachinePrecision]]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;n \leq -2.4 \cdot 10^{-65}:\\
    \;\;\;\;100 \cdot \left(n + i \cdot -0.5\right)\\
    
    \mathbf{elif}\;n \leq -2.8 \cdot 10^{-236}:\\
    \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
    
    \mathbf{elif}\;n \leq 2.95 \cdot 10^{-145}:\\
    \;\;\;\;0\\
    
    \mathbf{elif}\;n \leq 1.42 \cdot 10^{+163}:\\
    \;\;\;\;n \cdot 100\\
    
    \mathbf{elif}\;n \leq 2.3 \cdot 10^{+193}:\\
    \;\;\;\;\left(i \cdot n\right) \cdot 50\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{100}{\frac{1}{n}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 6 regimes
    2. if n < -2.4000000000000002e-65

      1. Initial program 26.5%

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

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

          \[\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/58.5%

          \[\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-eval58.5%

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

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

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

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

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

      if -2.4000000000000002e-65 < n < -2.79999999999999986e-236

      1. Initial program 33.8%

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

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

      if -2.79999999999999986e-236 < n < 2.9499999999999999e-145

      1. Initial program 55.5%

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

        \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
      3. Taylor expanded in i around 0 87.3%

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

      if 2.9499999999999999e-145 < n < 1.4199999999999999e163

      1. Initial program 26.4%

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

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

          \[\leadsto \color{blue}{n \cdot 100} \]
      4. Simplified60.3%

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

      if 1.4199999999999999e163 < n < 2.30000000000000013e193

      1. Initial program 44.0%

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

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

          \[\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/64.5%

          \[\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-eval64.5%

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

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

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

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

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

          \[\leadsto \left(n \cdot 100\right) \cdot \left(1 + \color{blue}{i \cdot 0.5}\right) \]
      7. Simplified64.5%

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

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

          \[\leadsto 50 \cdot \color{blue}{\left(n \cdot i\right)} \]
      10. Simplified50.6%

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

      if 2.30000000000000013e193 < n

      1. Initial program 15.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{100}{\color{blue}{\frac{1}{n}}} \]
    3. Recombined 6 regimes into one program.
    4. Final simplification63.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.4 \cdot 10^{-65}:\\ \;\;\;\;100 \cdot \left(n + i \cdot -0.5\right)\\ \mathbf{elif}\;n \leq -2.8 \cdot 10^{-236}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 2.95 \cdot 10^{-145}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.42 \cdot 10^{+163}:\\ \;\;\;\;n \cdot 100\\ \mathbf{elif}\;n \leq 2.3 \cdot 10^{+193}:\\ \;\;\;\;\left(i \cdot n\right) \cdot 50\\ \mathbf{else}:\\ \;\;\;\;\frac{100}{\frac{1}{n}}\\ \end{array} \]

    Alternative 12: 64.0% accurate, 7.5× speedup?

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

      1. Initial program 25.9%

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

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

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

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

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

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

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

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

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

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

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

      if -1.22e85 < n < -8.99999999999999997e-236

      1. Initial program 30.3%

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

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

      if -8.99999999999999997e-236 < n < 9.0000000000000001e-145

      1. Initial program 55.5%

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

        \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
      3. Taylor expanded in i around 0 87.3%

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

      if 9.0000000000000001e-145 < n

      1. Initial program 25.8%

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

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

          \[\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/64.6%

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1.22 \cdot 10^{+85}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \mathbf{elif}\;n \leq -9 \cdot 10^{-236}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 9 \cdot 10^{-145}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot 0.5\right)\\ \end{array} \]

    Alternative 13: 64.2% accurate, 7.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -2.6 \cdot 10^{-239}:\\ \;\;\;\;100 \cdot \frac{1}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \mathbf{elif}\;n \leq 1.02 \cdot 10^{-143}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot 0.5\right)\\ \end{array} \end{array} \]
    (FPCore (i n)
     :precision binary64
     (if (<= n -2.6e-239)
       (* 100.0 (/ 1.0 (+ (* (/ i n) -0.5) (/ 1.0 n))))
       (if (<= n 1.02e-143) 0.0 (* (* n 100.0) (+ 1.0 (* i 0.5))))))
    double code(double i, double n) {
    	double tmp;
    	if (n <= -2.6e-239) {
    		tmp = 100.0 * (1.0 / (((i / n) * -0.5) + (1.0 / n)));
    	} else if (n <= 1.02e-143) {
    		tmp = 0.0;
    	} else {
    		tmp = (n * 100.0) * (1.0 + (i * 0.5));
    	}
    	return tmp;
    }
    
    real(8) function code(i, n)
        real(8), intent (in) :: i
        real(8), intent (in) :: n
        real(8) :: tmp
        if (n <= (-2.6d-239)) then
            tmp = 100.0d0 * (1.0d0 / (((i / n) * (-0.5d0)) + (1.0d0 / n)))
        else if (n <= 1.02d-143) then
            tmp = 0.0d0
        else
            tmp = (n * 100.0d0) * (1.0d0 + (i * 0.5d0))
        end if
        code = tmp
    end function
    
    public static double code(double i, double n) {
    	double tmp;
    	if (n <= -2.6e-239) {
    		tmp = 100.0 * (1.0 / (((i / n) * -0.5) + (1.0 / n)));
    	} else if (n <= 1.02e-143) {
    		tmp = 0.0;
    	} else {
    		tmp = (n * 100.0) * (1.0 + (i * 0.5));
    	}
    	return tmp;
    }
    
    def code(i, n):
    	tmp = 0
    	if n <= -2.6e-239:
    		tmp = 100.0 * (1.0 / (((i / n) * -0.5) + (1.0 / n)))
    	elif n <= 1.02e-143:
    		tmp = 0.0
    	else:
    		tmp = (n * 100.0) * (1.0 + (i * 0.5))
    	return tmp
    
    function code(i, n)
    	tmp = 0.0
    	if (n <= -2.6e-239)
    		tmp = Float64(100.0 * Float64(1.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n))));
    	elseif (n <= 1.02e-143)
    		tmp = 0.0;
    	else
    		tmp = Float64(Float64(n * 100.0) * Float64(1.0 + Float64(i * 0.5)));
    	end
    	return tmp
    end
    
    function tmp_2 = code(i, n)
    	tmp = 0.0;
    	if (n <= -2.6e-239)
    		tmp = 100.0 * (1.0 / (((i / n) * -0.5) + (1.0 / n)));
    	elseif (n <= 1.02e-143)
    		tmp = 0.0;
    	else
    		tmp = (n * 100.0) * (1.0 + (i * 0.5));
    	end
    	tmp_2 = tmp;
    end
    
    code[i_, n_] := If[LessEqual[n, -2.6e-239], N[(100.0 * N[(1.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.02e-143], 0.0, N[(N[(n * 100.0), $MachinePrecision] * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;n \leq -2.6 \cdot 10^{-239}:\\
    \;\;\;\;100 \cdot \frac{1}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\
    
    \mathbf{elif}\;n \leq 1.02 \cdot 10^{-143}:\\
    \;\;\;\;0\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot 0.5\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if n < -2.60000000000000003e-239

      1. Initial program 28.4%

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

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

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

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

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

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

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

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

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

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

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

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

      if -2.60000000000000003e-239 < n < 1.02e-143

      1. Initial program 55.5%

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

        \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
      3. Taylor expanded in i around 0 87.3%

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

      if 1.02e-143 < n

      1. Initial program 25.8%

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

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

          \[\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/64.6%

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -2.6 \cdot 10^{-239}:\\ \;\;\;\;100 \cdot \frac{1}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \mathbf{elif}\;n \leq 1.02 \cdot 10^{-143}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot 0.5\right)\\ \end{array} \]

    Alternative 14: 55.8% accurate, 8.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -5.5 \cdot 10^{-197}:\\ \;\;\;\;n \cdot 100\\ \mathbf{elif}\;n \leq 7.5 \cdot 10^{-143}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.35 \cdot 10^{+164} \lor \neg \left(n \leq 1.18 \cdot 10^{+194}\right):\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;\left(i \cdot n\right) \cdot 50\\ \end{array} \end{array} \]
    (FPCore (i n)
     :precision binary64
     (if (<= n -5.5e-197)
       (* n 100.0)
       (if (<= n 7.5e-143)
         0.0
         (if (or (<= n 1.35e+164) (not (<= n 1.18e+194)))
           (* n 100.0)
           (* (* i n) 50.0)))))
    double code(double i, double n) {
    	double tmp;
    	if (n <= -5.5e-197) {
    		tmp = n * 100.0;
    	} else if (n <= 7.5e-143) {
    		tmp = 0.0;
    	} else if ((n <= 1.35e+164) || !(n <= 1.18e+194)) {
    		tmp = n * 100.0;
    	} else {
    		tmp = (i * n) * 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 <= (-5.5d-197)) then
            tmp = n * 100.0d0
        else if (n <= 7.5d-143) then
            tmp = 0.0d0
        else if ((n <= 1.35d+164) .or. (.not. (n <= 1.18d+194))) then
            tmp = n * 100.0d0
        else
            tmp = (i * n) * 50.0d0
        end if
        code = tmp
    end function
    
    public static double code(double i, double n) {
    	double tmp;
    	if (n <= -5.5e-197) {
    		tmp = n * 100.0;
    	} else if (n <= 7.5e-143) {
    		tmp = 0.0;
    	} else if ((n <= 1.35e+164) || !(n <= 1.18e+194)) {
    		tmp = n * 100.0;
    	} else {
    		tmp = (i * n) * 50.0;
    	}
    	return tmp;
    }
    
    def code(i, n):
    	tmp = 0
    	if n <= -5.5e-197:
    		tmp = n * 100.0
    	elif n <= 7.5e-143:
    		tmp = 0.0
    	elif (n <= 1.35e+164) or not (n <= 1.18e+194):
    		tmp = n * 100.0
    	else:
    		tmp = (i * n) * 50.0
    	return tmp
    
    function code(i, n)
    	tmp = 0.0
    	if (n <= -5.5e-197)
    		tmp = Float64(n * 100.0);
    	elseif (n <= 7.5e-143)
    		tmp = 0.0;
    	elseif ((n <= 1.35e+164) || !(n <= 1.18e+194))
    		tmp = Float64(n * 100.0);
    	else
    		tmp = Float64(Float64(i * n) * 50.0);
    	end
    	return tmp
    end
    
    function tmp_2 = code(i, n)
    	tmp = 0.0;
    	if (n <= -5.5e-197)
    		tmp = n * 100.0;
    	elseif (n <= 7.5e-143)
    		tmp = 0.0;
    	elseif ((n <= 1.35e+164) || ~((n <= 1.18e+194)))
    		tmp = n * 100.0;
    	else
    		tmp = (i * n) * 50.0;
    	end
    	tmp_2 = tmp;
    end
    
    code[i_, n_] := If[LessEqual[n, -5.5e-197], N[(n * 100.0), $MachinePrecision], If[LessEqual[n, 7.5e-143], 0.0, If[Or[LessEqual[n, 1.35e+164], N[Not[LessEqual[n, 1.18e+194]], $MachinePrecision]], N[(n * 100.0), $MachinePrecision], N[(N[(i * n), $MachinePrecision] * 50.0), $MachinePrecision]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;n \leq -5.5 \cdot 10^{-197}:\\
    \;\;\;\;n \cdot 100\\
    
    \mathbf{elif}\;n \leq 7.5 \cdot 10^{-143}:\\
    \;\;\;\;0\\
    
    \mathbf{elif}\;n \leq 1.35 \cdot 10^{+164} \lor \neg \left(n \leq 1.18 \cdot 10^{+194}\right):\\
    \;\;\;\;n \cdot 100\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(i \cdot n\right) \cdot 50\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if n < -5.50000000000000037e-197 or 7.5000000000000003e-143 < n < 1.35000000000000003e164 or 1.1799999999999999e194 < n

      1. Initial program 24.9%

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

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

          \[\leadsto \color{blue}{n \cdot 100} \]
      4. Simplified56.6%

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

      if -5.50000000000000037e-197 < n < 7.5000000000000003e-143

      1. Initial program 54.4%

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

        \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
      3. Taylor expanded in i around 0 81.3%

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

      if 1.35000000000000003e164 < n < 1.1799999999999999e194

      1. Initial program 44.0%

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

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

          \[\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/64.5%

          \[\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-eval64.5%

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

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

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

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

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

          \[\leadsto \left(n \cdot 100\right) \cdot \left(1 + \color{blue}{i \cdot 0.5}\right) \]
      7. Simplified64.5%

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

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

          \[\leadsto 50 \cdot \color{blue}{\left(n \cdot i\right)} \]
      10. Simplified50.6%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -5.5 \cdot 10^{-197}:\\ \;\;\;\;n \cdot 100\\ \mathbf{elif}\;n \leq 7.5 \cdot 10^{-143}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 1.35 \cdot 10^{+164} \lor \neg \left(n \leq 1.18 \cdot 10^{+194}\right):\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;\left(i \cdot n\right) \cdot 50\\ \end{array} \]

    Alternative 15: 55.8% accurate, 8.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -5.2 \cdot 10^{-197}:\\ \;\;\;\;n \cdot 100\\ \mathbf{elif}\;n \leq 9 \cdot 10^{-142}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 8.4 \cdot 10^{+163}:\\ \;\;\;\;n \cdot 100\\ \mathbf{elif}\;n \leq 2.05 \cdot 10^{+193}:\\ \;\;\;\;\left(i \cdot n\right) \cdot 50\\ \mathbf{else}:\\ \;\;\;\;\frac{100}{\frac{1}{n}}\\ \end{array} \end{array} \]
    (FPCore (i n)
     :precision binary64
     (if (<= n -5.2e-197)
       (* n 100.0)
       (if (<= n 9e-142)
         0.0
         (if (<= n 8.4e+163)
           (* n 100.0)
           (if (<= n 2.05e+193) (* (* i n) 50.0) (/ 100.0 (/ 1.0 n)))))))
    double code(double i, double n) {
    	double tmp;
    	if (n <= -5.2e-197) {
    		tmp = n * 100.0;
    	} else if (n <= 9e-142) {
    		tmp = 0.0;
    	} else if (n <= 8.4e+163) {
    		tmp = n * 100.0;
    	} else if (n <= 2.05e+193) {
    		tmp = (i * n) * 50.0;
    	} else {
    		tmp = 100.0 / (1.0 / n);
    	}
    	return tmp;
    }
    
    real(8) function code(i, n)
        real(8), intent (in) :: i
        real(8), intent (in) :: n
        real(8) :: tmp
        if (n <= (-5.2d-197)) then
            tmp = n * 100.0d0
        else if (n <= 9d-142) then
            tmp = 0.0d0
        else if (n <= 8.4d+163) then
            tmp = n * 100.0d0
        else if (n <= 2.05d+193) then
            tmp = (i * n) * 50.0d0
        else
            tmp = 100.0d0 / (1.0d0 / n)
        end if
        code = tmp
    end function
    
    public static double code(double i, double n) {
    	double tmp;
    	if (n <= -5.2e-197) {
    		tmp = n * 100.0;
    	} else if (n <= 9e-142) {
    		tmp = 0.0;
    	} else if (n <= 8.4e+163) {
    		tmp = n * 100.0;
    	} else if (n <= 2.05e+193) {
    		tmp = (i * n) * 50.0;
    	} else {
    		tmp = 100.0 / (1.0 / n);
    	}
    	return tmp;
    }
    
    def code(i, n):
    	tmp = 0
    	if n <= -5.2e-197:
    		tmp = n * 100.0
    	elif n <= 9e-142:
    		tmp = 0.0
    	elif n <= 8.4e+163:
    		tmp = n * 100.0
    	elif n <= 2.05e+193:
    		tmp = (i * n) * 50.0
    	else:
    		tmp = 100.0 / (1.0 / n)
    	return tmp
    
    function code(i, n)
    	tmp = 0.0
    	if (n <= -5.2e-197)
    		tmp = Float64(n * 100.0);
    	elseif (n <= 9e-142)
    		tmp = 0.0;
    	elseif (n <= 8.4e+163)
    		tmp = Float64(n * 100.0);
    	elseif (n <= 2.05e+193)
    		tmp = Float64(Float64(i * n) * 50.0);
    	else
    		tmp = Float64(100.0 / Float64(1.0 / n));
    	end
    	return tmp
    end
    
    function tmp_2 = code(i, n)
    	tmp = 0.0;
    	if (n <= -5.2e-197)
    		tmp = n * 100.0;
    	elseif (n <= 9e-142)
    		tmp = 0.0;
    	elseif (n <= 8.4e+163)
    		tmp = n * 100.0;
    	elseif (n <= 2.05e+193)
    		tmp = (i * n) * 50.0;
    	else
    		tmp = 100.0 / (1.0 / n);
    	end
    	tmp_2 = tmp;
    end
    
    code[i_, n_] := If[LessEqual[n, -5.2e-197], N[(n * 100.0), $MachinePrecision], If[LessEqual[n, 9e-142], 0.0, If[LessEqual[n, 8.4e+163], N[(n * 100.0), $MachinePrecision], If[LessEqual[n, 2.05e+193], N[(N[(i * n), $MachinePrecision] * 50.0), $MachinePrecision], N[(100.0 / N[(1.0 / n), $MachinePrecision]), $MachinePrecision]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;n \leq -5.2 \cdot 10^{-197}:\\
    \;\;\;\;n \cdot 100\\
    
    \mathbf{elif}\;n \leq 9 \cdot 10^{-142}:\\
    \;\;\;\;0\\
    
    \mathbf{elif}\;n \leq 8.4 \cdot 10^{+163}:\\
    \;\;\;\;n \cdot 100\\
    
    \mathbf{elif}\;n \leq 2.05 \cdot 10^{+193}:\\
    \;\;\;\;\left(i \cdot n\right) \cdot 50\\
    
    \mathbf{else}:\\
    \;\;\;\;\frac{100}{\frac{1}{n}}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if n < -5.2000000000000003e-197 or 9.00000000000000037e-142 < n < 8.4000000000000001e163

      1. Initial program 26.5%

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

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

          \[\leadsto \color{blue}{n \cdot 100} \]
      4. Simplified57.2%

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

      if -5.2000000000000003e-197 < n < 9.00000000000000037e-142

      1. Initial program 54.4%

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

        \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
      3. Taylor expanded in i around 0 81.3%

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

      if 8.4000000000000001e163 < n < 2.0499999999999999e193

      1. Initial program 44.0%

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

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

          \[\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/64.5%

          \[\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-eval64.5%

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

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

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

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

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

          \[\leadsto \left(n \cdot 100\right) \cdot \left(1 + \color{blue}{i \cdot 0.5}\right) \]
      7. Simplified64.5%

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

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

          \[\leadsto 50 \cdot \color{blue}{\left(n \cdot i\right)} \]
      10. Simplified50.6%

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

      if 2.0499999999999999e193 < n

      1. Initial program 15.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -5.2 \cdot 10^{-197}:\\ \;\;\;\;n \cdot 100\\ \mathbf{elif}\;n \leq 9 \cdot 10^{-142}:\\ \;\;\;\;0\\ \mathbf{elif}\;n \leq 8.4 \cdot 10^{+163}:\\ \;\;\;\;n \cdot 100\\ \mathbf{elif}\;n \leq 2.05 \cdot 10^{+193}:\\ \;\;\;\;\left(i \cdot n\right) \cdot 50\\ \mathbf{else}:\\ \;\;\;\;\frac{100}{\frac{1}{n}}\\ \end{array} \]

    Alternative 16: 63.9% accurate, 8.6× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := n \cdot \left(100 + i \cdot 50\right)\\ \mathbf{if}\;n \leq -3.5 \cdot 10^{+86}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;n \leq -2.75 \cdot 10^{-235}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 1.5 \cdot 10^{-144}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \end{array} \]
    (FPCore (i n)
     :precision binary64
     (let* ((t_0 (* n (+ 100.0 (* i 50.0)))))
       (if (<= n -3.5e+86)
         t_0
         (if (<= n -2.75e-235)
           (* 100.0 (/ i (/ i n)))
           (if (<= n 1.5e-144) 0.0 t_0)))))
    double code(double i, double n) {
    	double t_0 = n * (100.0 + (i * 50.0));
    	double tmp;
    	if (n <= -3.5e+86) {
    		tmp = t_0;
    	} else if (n <= -2.75e-235) {
    		tmp = 100.0 * (i / (i / n));
    	} else if (n <= 1.5e-144) {
    		tmp = 0.0;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    real(8) function code(i, n)
        real(8), intent (in) :: i
        real(8), intent (in) :: n
        real(8) :: t_0
        real(8) :: tmp
        t_0 = n * (100.0d0 + (i * 50.0d0))
        if (n <= (-3.5d+86)) then
            tmp = t_0
        else if (n <= (-2.75d-235)) then
            tmp = 100.0d0 * (i / (i / n))
        else if (n <= 1.5d-144) then
            tmp = 0.0d0
        else
            tmp = t_0
        end if
        code = tmp
    end function
    
    public static double code(double i, double n) {
    	double t_0 = n * (100.0 + (i * 50.0));
    	double tmp;
    	if (n <= -3.5e+86) {
    		tmp = t_0;
    	} else if (n <= -2.75e-235) {
    		tmp = 100.0 * (i / (i / n));
    	} else if (n <= 1.5e-144) {
    		tmp = 0.0;
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    def code(i, n):
    	t_0 = n * (100.0 + (i * 50.0))
    	tmp = 0
    	if n <= -3.5e+86:
    		tmp = t_0
    	elif n <= -2.75e-235:
    		tmp = 100.0 * (i / (i / n))
    	elif n <= 1.5e-144:
    		tmp = 0.0
    	else:
    		tmp = t_0
    	return tmp
    
    function code(i, n)
    	t_0 = Float64(n * Float64(100.0 + Float64(i * 50.0)))
    	tmp = 0.0
    	if (n <= -3.5e+86)
    		tmp = t_0;
    	elseif (n <= -2.75e-235)
    		tmp = Float64(100.0 * Float64(i / Float64(i / n)));
    	elseif (n <= 1.5e-144)
    		tmp = 0.0;
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(i, n)
    	t_0 = n * (100.0 + (i * 50.0));
    	tmp = 0.0;
    	if (n <= -3.5e+86)
    		tmp = t_0;
    	elseif (n <= -2.75e-235)
    		tmp = 100.0 * (i / (i / n));
    	elseif (n <= 1.5e-144)
    		tmp = 0.0;
    	else
    		tmp = t_0;
    	end
    	tmp_2 = tmp;
    end
    
    code[i_, n_] := Block[{t$95$0 = N[(n * N[(100.0 + N[(i * 50.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -3.5e+86], t$95$0, If[LessEqual[n, -2.75e-235], N[(100.0 * N[(i / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.5e-144], 0.0, t$95$0]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := n \cdot \left(100 + i \cdot 50\right)\\
    \mathbf{if}\;n \leq -3.5 \cdot 10^{+86}:\\
    \;\;\;\;t_0\\
    
    \mathbf{elif}\;n \leq -2.75 \cdot 10^{-235}:\\
    \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\
    
    \mathbf{elif}\;n \leq 1.5 \cdot 10^{-144}:\\
    \;\;\;\;0\\
    
    \mathbf{else}:\\
    \;\;\;\;t_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if n < -3.50000000000000019e86 or 1.4999999999999999e-144 < n

      1. Initial program 25.8%

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

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

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

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

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

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

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

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

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

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

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

      if -3.50000000000000019e86 < n < -2.7499999999999999e-235

      1. Initial program 30.3%

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

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

      if -2.7499999999999999e-235 < n < 1.4999999999999999e-144

      1. Initial program 55.5%

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

        \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
      3. Taylor expanded in i around 0 87.3%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -3.5 \cdot 10^{+86}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \mathbf{elif}\;n \leq -2.75 \cdot 10^{-235}:\\ \;\;\;\;100 \cdot \frac{i}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 1.5 \cdot 10^{-144}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;n \cdot \left(100 + i \cdot 50\right)\\ \end{array} \]

    Alternative 17: 64.1% accurate, 8.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -7 \cdot 10^{-236}:\\ \;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \mathbf{elif}\;n \leq 1.25 \cdot 10^{-144}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot 0.5\right)\\ \end{array} \end{array} \]
    (FPCore (i n)
     :precision binary64
     (if (<= n -7e-236)
       (/ 100.0 (+ (* (/ i n) -0.5) (/ 1.0 n)))
       (if (<= n 1.25e-144) 0.0 (* (* n 100.0) (+ 1.0 (* i 0.5))))))
    double code(double i, double n) {
    	double tmp;
    	if (n <= -7e-236) {
    		tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
    	} else if (n <= 1.25e-144) {
    		tmp = 0.0;
    	} else {
    		tmp = (n * 100.0) * (1.0 + (i * 0.5));
    	}
    	return tmp;
    }
    
    real(8) function code(i, n)
        real(8), intent (in) :: i
        real(8), intent (in) :: n
        real(8) :: tmp
        if (n <= (-7d-236)) then
            tmp = 100.0d0 / (((i / n) * (-0.5d0)) + (1.0d0 / n))
        else if (n <= 1.25d-144) then
            tmp = 0.0d0
        else
            tmp = (n * 100.0d0) * (1.0d0 + (i * 0.5d0))
        end if
        code = tmp
    end function
    
    public static double code(double i, double n) {
    	double tmp;
    	if (n <= -7e-236) {
    		tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
    	} else if (n <= 1.25e-144) {
    		tmp = 0.0;
    	} else {
    		tmp = (n * 100.0) * (1.0 + (i * 0.5));
    	}
    	return tmp;
    }
    
    def code(i, n):
    	tmp = 0
    	if n <= -7e-236:
    		tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n))
    	elif n <= 1.25e-144:
    		tmp = 0.0
    	else:
    		tmp = (n * 100.0) * (1.0 + (i * 0.5))
    	return tmp
    
    function code(i, n)
    	tmp = 0.0
    	if (n <= -7e-236)
    		tmp = Float64(100.0 / Float64(Float64(Float64(i / n) * -0.5) + Float64(1.0 / n)));
    	elseif (n <= 1.25e-144)
    		tmp = 0.0;
    	else
    		tmp = Float64(Float64(n * 100.0) * Float64(1.0 + Float64(i * 0.5)));
    	end
    	return tmp
    end
    
    function tmp_2 = code(i, n)
    	tmp = 0.0;
    	if (n <= -7e-236)
    		tmp = 100.0 / (((i / n) * -0.5) + (1.0 / n));
    	elseif (n <= 1.25e-144)
    		tmp = 0.0;
    	else
    		tmp = (n * 100.0) * (1.0 + (i * 0.5));
    	end
    	tmp_2 = tmp;
    end
    
    code[i_, n_] := If[LessEqual[n, -7e-236], N[(100.0 / N[(N[(N[(i / n), $MachinePrecision] * -0.5), $MachinePrecision] + N[(1.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.25e-144], 0.0, N[(N[(n * 100.0), $MachinePrecision] * N[(1.0 + N[(i * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;n \leq -7 \cdot 10^{-236}:\\
    \;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\
    
    \mathbf{elif}\;n \leq 1.25 \cdot 10^{-144}:\\
    \;\;\;\;0\\
    
    \mathbf{else}:\\
    \;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot 0.5\right)\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if n < -6.99999999999999988e-236

      1. Initial program 28.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -6.99999999999999988e-236 < n < 1.2499999999999999e-144

      1. Initial program 55.5%

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

        \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
      3. Taylor expanded in i around 0 87.3%

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

      if 1.2499999999999999e-144 < n

      1. Initial program 25.8%

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

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

          \[\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/64.6%

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

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

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

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

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

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

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

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -7 \cdot 10^{-236}:\\ \;\;\;\;\frac{100}{\frac{i}{n} \cdot -0.5 + \frac{1}{n}}\\ \mathbf{elif}\;n \leq 1.25 \cdot 10^{-144}:\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\left(n \cdot 100\right) \cdot \left(1 + i \cdot 0.5\right)\\ \end{array} \]

    Alternative 18: 56.9% accurate, 16.0× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -4.4 \cdot 10^{-197} \lor \neg \left(n \leq 5.5 \cdot 10^{-145}\right):\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \end{array} \]
    (FPCore (i n)
     :precision binary64
     (if (or (<= n -4.4e-197) (not (<= n 5.5e-145))) (* n 100.0) 0.0))
    double code(double i, double n) {
    	double tmp;
    	if ((n <= -4.4e-197) || !(n <= 5.5e-145)) {
    		tmp = n * 100.0;
    	} else {
    		tmp = 0.0;
    	}
    	return tmp;
    }
    
    real(8) function code(i, n)
        real(8), intent (in) :: i
        real(8), intent (in) :: n
        real(8) :: tmp
        if ((n <= (-4.4d-197)) .or. (.not. (n <= 5.5d-145))) then
            tmp = n * 100.0d0
        else
            tmp = 0.0d0
        end if
        code = tmp
    end function
    
    public static double code(double i, double n) {
    	double tmp;
    	if ((n <= -4.4e-197) || !(n <= 5.5e-145)) {
    		tmp = n * 100.0;
    	} else {
    		tmp = 0.0;
    	}
    	return tmp;
    }
    
    def code(i, n):
    	tmp = 0
    	if (n <= -4.4e-197) or not (n <= 5.5e-145):
    		tmp = n * 100.0
    	else:
    		tmp = 0.0
    	return tmp
    
    function code(i, n)
    	tmp = 0.0
    	if ((n <= -4.4e-197) || !(n <= 5.5e-145))
    		tmp = Float64(n * 100.0);
    	else
    		tmp = 0.0;
    	end
    	return tmp
    end
    
    function tmp_2 = code(i, n)
    	tmp = 0.0;
    	if ((n <= -4.4e-197) || ~((n <= 5.5e-145)))
    		tmp = n * 100.0;
    	else
    		tmp = 0.0;
    	end
    	tmp_2 = tmp;
    end
    
    code[i_, n_] := If[Or[LessEqual[n, -4.4e-197], N[Not[LessEqual[n, 5.5e-145]], $MachinePrecision]], N[(n * 100.0), $MachinePrecision], 0.0]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    \mathbf{if}\;n \leq -4.4 \cdot 10^{-197} \lor \neg \left(n \leq 5.5 \cdot 10^{-145}\right):\\
    \;\;\;\;n \cdot 100\\
    
    \mathbf{else}:\\
    \;\;\;\;0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if n < -4.4000000000000001e-197 or 5.50000000000000015e-145 < n

      1. Initial program 26.2%

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

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

          \[\leadsto \color{blue}{n \cdot 100} \]
      4. Simplified54.0%

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

      if -4.4000000000000001e-197 < n < 5.50000000000000015e-145

      1. Initial program 54.4%

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

        \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
      3. Taylor expanded in i around 0 81.3%

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

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4.4 \cdot 10^{-197} \lor \neg \left(n \leq 5.5 \cdot 10^{-145}\right):\\ \;\;\;\;n \cdot 100\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array} \]

    Alternative 19: 18.1% accurate, 114.0× speedup?

    \[\begin{array}{l} \\ 0 \end{array} \]
    (FPCore (i n) :precision binary64 0.0)
    double code(double i, double n) {
    	return 0.0;
    }
    
    real(8) function code(i, n)
        real(8), intent (in) :: i
        real(8), intent (in) :: n
        code = 0.0d0
    end function
    
    public static double code(double i, double n) {
    	return 0.0;
    }
    
    def code(i, n):
    	return 0.0
    
    function code(i, n)
    	return 0.0
    end
    
    function tmp = code(i, n)
    	tmp = 0.0;
    end
    
    code[i_, n_] := 0.0
    
    \begin{array}{l}
    
    \\
    0
    \end{array}
    
    Derivation
    1. Initial program 31.9%

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

      \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
    3. Taylor expanded in i around 0 21.5%

      \[\leadsto 100 \cdot \color{blue}{0} \]
    4. Final simplification21.5%

      \[\leadsto 0 \]

    Developer target: 34.5% accurate, 0.5× speedup?

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

    Reproduce

    ?
    herbie shell --seed 2023321 
    (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))))