Compound Interest

Percentage Accurate: 28.7% → 89.8%
Time: 10.7s
Alternatives: 8
Speedup: N/A×

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));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(i, n)
use fmin_fmax_functions
    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}

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 8 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.7% 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));
}
module fmin_fmax_functions
    implicit none
    private
    public fmax
    public fmin

    interface fmax
        module procedure fmax88
        module procedure fmax44
        module procedure fmax84
        module procedure fmax48
    end interface
    interface fmin
        module procedure fmin88
        module procedure fmin44
        module procedure fmin84
        module procedure fmin48
    end interface
contains
    real(8) function fmax88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(4) function fmax44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, max(x, y), y /= y), x /= x)
    end function
    real(8) function fmax84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, max(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmax48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), max(dble(x), y), y /= y), x /= x)
    end function
    real(8) function fmin88(x, y) result (res)
        real(8), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(4) function fmin44(x, y) result (res)
        real(4), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(y, merge(x, min(x, y), y /= y), x /= x)
    end function
    real(8) function fmin84(x, y) result(res)
        real(8), intent (in) :: x
        real(4), intent (in) :: y
        res = merge(dble(y), merge(x, min(x, dble(y)), y /= y), x /= x)
    end function
    real(8) function fmin48(x, y) result(res)
        real(4), intent (in) :: x
        real(8), intent (in) :: y
        res = merge(y, merge(dble(x), min(dble(x), y), y /= y), x /= x)
    end function
end module

real(8) function code(i, n)
use fmin_fmax_functions
    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: 89.8% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \leq 10^{-242}:\\ \;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n\right)}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right) \cdot n}{i}\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))) 1e-242)
   (* 100.0 (/ (expm1 (* (log1p (/ i n)) n)) (/ i n)))
   (* 100.0 (/ (* (expm1 i) n) i))))
double code(double i, double n) {
	double tmp;
	if ((100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n))) <= 1e-242) {
		tmp = 100.0 * (expm1((log1p((i / n)) * n)) / (i / n));
	} else {
		tmp = 100.0 * ((expm1(i) * n) / i);
	}
	return tmp;
}
public static double code(double i, double n) {
	double tmp;
	if ((100.0 * ((Math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))) <= 1e-242) {
		tmp = 100.0 * (Math.expm1((Math.log1p((i / n)) * n)) / (i / n));
	} else {
		tmp = 100.0 * ((Math.expm1(i) * n) / i);
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if (100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))) <= 1e-242:
		tmp = 100.0 * (math.expm1((math.log1p((i / n)) * n)) / (i / n))
	else:
		tmp = 100.0 * ((math.expm1(i) * n) / i)
	return tmp
function code(i, n)
	tmp = 0.0
	if (Float64(100.0 * Float64(Float64((Float64(1.0 + Float64(i / n)) ^ n) - 1.0) / Float64(i / n))) <= 1e-242)
		tmp = Float64(100.0 * Float64(expm1(Float64(log1p(Float64(i / n)) * n)) / Float64(i / n)));
	else
		tmp = Float64(100.0 * Float64(Float64(expm1(i) * n) / i));
	end
	return tmp
end
code[i_, n_] := If[LessEqual[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], 1e-242], N[(100.0 * N[(N[(Exp[N[(N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision] * n), $MachinePrecision]] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(N[(Exp[i] - 1), $MachinePrecision] * n), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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


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

    1. Initial program 27.2%

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

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

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

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

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

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

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

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

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

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

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

    if 1e-242 < (*.f64 #s(literal 100 binary64) (/.f64 (-.f64 (pow.f64 (+.f64 #s(literal 1 binary64) (/.f64 i n)) n) #s(literal 1 binary64)) (/.f64 i n)))

    1. Initial program 32.8%

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

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

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

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

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

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

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

Alternative 2: 77.1% accurate, N/A× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;i \leq 4.7 \cdot 10^{-203}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n\\

\mathbf{elif}\;i \leq 3.7 \cdot 10^{+115}:\\
\;\;\;\;100 \cdot \frac{\mathsf{expm1}\left(i\right) \cdot n}{i}\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(\mathsf{fma}\left(\log n, -1, \log i\right) \cdot n\right)}{i}\right)\\


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

    1. Initial program 26.3%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{e^{i} - 1}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      6. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{e^{i} - 1}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      7. lower-expm1.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      10. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
      12. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
      13. lower-exp.f6483.0

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
    4. Applied rewrites83.0%

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

    if 4.70000000000000006e-203 < i < 3.70000000000000006e115

    1. Initial program 18.3%

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

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

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

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

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

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

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

    if 3.70000000000000006e115 < i

    1. Initial program 56.5%

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

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

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

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

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

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

Alternative 3: 74.2% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq 1.26 \cdot 10^{+88}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(\mathsf{fma}\left(\log n, -1, \log i\right) \cdot n\right)}{i}\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= i 1.26e+88)
   (* (fma (/ (expm1 i) i) 100.0 (* (/ (* (exp i) i) n) -50.0)) n)
   (* 100.0 (* n (/ (expm1 (* (fma (log n) -1.0 (log i)) n)) i)))))
double code(double i, double n) {
	double tmp;
	if (i <= 1.26e+88) {
		tmp = fma((expm1(i) / i), 100.0, (((exp(i) * i) / n) * -50.0)) * n;
	} else {
		tmp = 100.0 * (n * (expm1((fma(log(n), -1.0, log(i)) * n)) / i));
	}
	return tmp;
}
function code(i, n)
	tmp = 0.0
	if (i <= 1.26e+88)
		tmp = Float64(fma(Float64(expm1(i) / i), 100.0, Float64(Float64(Float64(exp(i) * i) / n) * -50.0)) * n);
	else
		tmp = Float64(100.0 * Float64(n * Float64(expm1(Float64(fma(log(n), -1.0, log(i)) * n)) / i)));
	end
	return tmp
end
code[i_, n_] := If[LessEqual[i, 1.26e+88], N[(N[(N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision] * 100.0 + N[(N[(N[(N[Exp[i], $MachinePrecision] * i), $MachinePrecision] / n), $MachinePrecision] * -50.0), $MachinePrecision]), $MachinePrecision] * n), $MachinePrecision], N[(100.0 * N[(n * N[(N[(Exp[N[(N[(N[Log[n], $MachinePrecision] * -1.0 + N[Log[i], $MachinePrecision]), $MachinePrecision] * n), $MachinePrecision]] - 1), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;i \leq 1.26 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(\mathsf{fma}\left(\log n, -1, \log i\right) \cdot n\right)}{i}\right)\\


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

    1. Initial program 23.5%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{e^{i} - 1}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      6. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{e^{i} - 1}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      7. lower-expm1.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      10. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
      12. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
      13. lower-exp.f6478.3

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
    4. Applied rewrites78.3%

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

    if 1.26e88 < i

    1. Initial program 54.1%

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

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

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

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

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

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

Alternative 4: 73.2% accurate, N/A× speedup?

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

\\
\begin{array}{l}
t_0 := \log n \cdot -1\\
t_1 := \left(n \cdot n\right) \cdot n\\
t_2 := {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}\\
\mathbf{if}\;i \leq 1.26 \cdot 10^{+88}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\mathsf{expm1}\left(\frac{t\_0 \cdot t\_0 - \log i \cdot \log i}{t\_0 - \log i} \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, 0.5, -0.5 \cdot t\_1\right) \cdot t\_2}{i \cdot i}, \frac{t\_2 \cdot t\_1}{i}\right)\right)}{i}\\


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

    1. Initial program 23.5%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{e^{i} - 1}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      6. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{e^{i} - 1}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      7. lower-expm1.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      10. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
      12. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
      13. lower-exp.f6478.3

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
    4. Applied rewrites78.3%

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

    if 1.26e88 < i

    1. Initial program 54.1%

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

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

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{expm1}\left(\mathsf{fma}\left(\log n, -1, \log i\right) \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, \frac{1}{2}, \frac{-1}{2} \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}}{i \cdot i}, \frac{{\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)} \cdot \left(\left(n \cdot n\right) \cdot n\right)}{i}\right)\right)}{i} \]
      2. lift-log.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{expm1}\left(\mathsf{fma}\left(\log n, -1, \log i\right) \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, \frac{1}{2}, \frac{-1}{2} \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}}{i \cdot i}, \frac{{\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)} \cdot \left(\left(n \cdot n\right) \cdot n\right)}{i}\right)\right)}{i} \]
      3. lift-fma.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{expm1}\left(\left(\log n \cdot -1 + \log i\right) \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, \frac{1}{2}, \frac{-1}{2} \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}}{i \cdot i}, \frac{{\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)} \cdot \left(\left(n \cdot n\right) \cdot n\right)}{i}\right)\right)}{i} \]
      4. flip-+N/A

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

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{expm1}\left(\frac{\left(\log n \cdot -1\right) \cdot \left(\log n \cdot -1\right) - \log i \cdot \log i}{\log n \cdot -1 - \log i} \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, \frac{1}{2}, \frac{-1}{2} \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}}{i \cdot i}, \frac{{\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)} \cdot \left(\left(n \cdot n\right) \cdot n\right)}{i}\right)\right)}{i} \]
      6. lower--.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{expm1}\left(\frac{\left(\log n \cdot -1\right) \cdot \left(\log n \cdot -1\right) - \log i \cdot \log i}{\log n \cdot -1 - \log i} \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, \frac{1}{2}, \frac{-1}{2} \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}}{i \cdot i}, \frac{{\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)} \cdot \left(\left(n \cdot n\right) \cdot n\right)}{i}\right)\right)}{i} \]
      7. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{expm1}\left(\frac{\left(\log n \cdot -1\right) \cdot \left(\log n \cdot -1\right) - \log i \cdot \log i}{\log n \cdot -1 - \log i} \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, \frac{1}{2}, \frac{-1}{2} \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}}{i \cdot i}, \frac{{\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)} \cdot \left(\left(n \cdot n\right) \cdot n\right)}{i}\right)\right)}{i} \]
      8. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{expm1}\left(\frac{\left(\log n \cdot -1\right) \cdot \left(\log n \cdot -1\right) - \log i \cdot \log i}{\log n \cdot -1 - \log i} \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, \frac{1}{2}, \frac{-1}{2} \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}}{i \cdot i}, \frac{{\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)} \cdot \left(\left(n \cdot n\right) \cdot n\right)}{i}\right)\right)}{i} \]
      9. lift-log.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{expm1}\left(\frac{\left(\log n \cdot -1\right) \cdot \left(\log n \cdot -1\right) - \log i \cdot \log i}{\log n \cdot -1 - \log i} \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, \frac{1}{2}, \frac{-1}{2} \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}}{i \cdot i}, \frac{{\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)} \cdot \left(\left(n \cdot n\right) \cdot n\right)}{i}\right)\right)}{i} \]
      10. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{expm1}\left(\frac{\left(\log n \cdot -1\right) \cdot \left(\log n \cdot -1\right) - \log i \cdot \log i}{\log n \cdot -1 - \log i} \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, \frac{1}{2}, \frac{-1}{2} \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}}{i \cdot i}, \frac{{\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)} \cdot \left(\left(n \cdot n\right) \cdot n\right)}{i}\right)\right)}{i} \]
      11. lift-log.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{expm1}\left(\frac{\left(\log n \cdot -1\right) \cdot \left(\log n \cdot -1\right) - \log i \cdot \log i}{\log n \cdot -1 - \log i} \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, \frac{1}{2}, \frac{-1}{2} \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}}{i \cdot i}, \frac{{\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)} \cdot \left(\left(n \cdot n\right) \cdot n\right)}{i}\right)\right)}{i} \]
      12. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{expm1}\left(\frac{\left(\log n \cdot -1\right) \cdot \left(\log n \cdot -1\right) - \log i \cdot \log i}{\log n \cdot -1 - \log i} \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, \frac{1}{2}, \frac{-1}{2} \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}}{i \cdot i}, \frac{{\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)} \cdot \left(\left(n \cdot n\right) \cdot n\right)}{i}\right)\right)}{i} \]
      13. lift-log.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{expm1}\left(\frac{\left(\log n \cdot -1\right) \cdot \left(\log n \cdot -1\right) - \log i \cdot \log i}{\log n \cdot -1 - \log i} \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, \frac{1}{2}, \frac{-1}{2} \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}}{i \cdot i}, \frac{{\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)} \cdot \left(\left(n \cdot n\right) \cdot n\right)}{i}\right)\right)}{i} \]
      14. lift-log.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{expm1}\left(\frac{\left(\log n \cdot -1\right) \cdot \left(\log n \cdot -1\right) - \log i \cdot \log i}{\log n \cdot -1 - \log i} \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, \frac{1}{2}, \frac{-1}{2} \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}}{i \cdot i}, \frac{{\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)} \cdot \left(\left(n \cdot n\right) \cdot n\right)}{i}\right)\right)}{i} \]
      15. lower--.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{expm1}\left(\frac{\left(\log n \cdot -1\right) \cdot \left(\log n \cdot -1\right) - \log i \cdot \log i}{\log n \cdot -1 - \log i} \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, \frac{1}{2}, \frac{-1}{2} \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}}{i \cdot i}, \frac{{\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)} \cdot \left(\left(n \cdot n\right) \cdot n\right)}{i}\right)\right)}{i} \]
      16. lower-*.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{expm1}\left(\frac{\left(\log n \cdot -1\right) \cdot \left(\log n \cdot -1\right) - \log i \cdot \log i}{\log n \cdot -1 - \log i} \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, \frac{1}{2}, \frac{-1}{2} \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}}{i \cdot i}, \frac{{\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)} \cdot \left(\left(n \cdot n\right) \cdot n\right)}{i}\right)\right)}{i} \]
      17. lift-log.f64N/A

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{expm1}\left(\frac{\left(\log n \cdot -1\right) \cdot \left(\log n \cdot -1\right) - \log i \cdot \log i}{\log n \cdot -1 - \log i} \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, \frac{1}{2}, \frac{-1}{2} \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}}{i \cdot i}, \frac{{\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)} \cdot \left(\left(n \cdot n\right) \cdot n\right)}{i}\right)\right)}{i} \]
      18. lift-log.f6435.0

        \[\leadsto \frac{\mathsf{fma}\left(\mathsf{expm1}\left(\frac{\left(\log n \cdot -1\right) \cdot \left(\log n \cdot -1\right) - \log i \cdot \log i}{\log n \cdot -1 - \log i} \cdot n\right) \cdot n, 100, 100 \cdot \mathsf{fma}\left(n, \frac{\mathsf{fma}\left({\left(n \cdot n\right)}^{2}, 0.5, -0.5 \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot {\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)}}{i \cdot i}, \frac{{\left(e^{n}\right)}^{\left(\mathsf{fma}\left(\log n, -1, \log i\right)\right)} \cdot \left(\left(n \cdot n\right) \cdot n\right)}{i}\right)\right)}{i} \]
    5. Applied rewrites35.0%

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

Alternative 5: 70.9% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 50 \cdot {n}^{-1}\\ \mathbf{if}\;i \leq 2.8 \cdot 10^{+33}:\\ \;\;\;\;\mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(100, n, i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \left(4.166666666666667 - 25 \cdot {n}^{-1}\right), n \cdot \left(16.666666666666668 - t\_0\right)\right), n \cdot \left(50 - t\_0\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (* 50.0 (pow n -1.0))))
   (if (<= i 2.8e+33)
     (* (fma (/ (expm1 i) i) 100.0 (* (/ (* (exp i) i) n) -50.0)) n)
     (fma
      100.0
      n
      (*
       i
       (fma
        i
        (fma
         i
         (* n (- 4.166666666666667 (* 25.0 (pow n -1.0))))
         (* n (- 16.666666666666668 t_0)))
        (* n (- 50.0 t_0))))))))
double code(double i, double n) {
	double t_0 = 50.0 * pow(n, -1.0);
	double tmp;
	if (i <= 2.8e+33) {
		tmp = fma((expm1(i) / i), 100.0, (((exp(i) * i) / n) * -50.0)) * n;
	} else {
		tmp = fma(100.0, n, (i * fma(i, fma(i, (n * (4.166666666666667 - (25.0 * pow(n, -1.0)))), (n * (16.666666666666668 - t_0))), (n * (50.0 - t_0)))));
	}
	return tmp;
}
function code(i, n)
	t_0 = Float64(50.0 * (n ^ -1.0))
	tmp = 0.0
	if (i <= 2.8e+33)
		tmp = Float64(fma(Float64(expm1(i) / i), 100.0, Float64(Float64(Float64(exp(i) * i) / n) * -50.0)) * n);
	else
		tmp = fma(100.0, n, Float64(i * fma(i, fma(i, Float64(n * Float64(4.166666666666667 - Float64(25.0 * (n ^ -1.0)))), Float64(n * Float64(16.666666666666668 - t_0))), Float64(n * Float64(50.0 - t_0)))));
	end
	return tmp
end
code[i_, n_] := Block[{t$95$0 = N[(50.0 * N[Power[n, -1.0], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, 2.8e+33], N[(N[(N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision] * 100.0 + N[(N[(N[(N[Exp[i], $MachinePrecision] * i), $MachinePrecision] / n), $MachinePrecision] * -50.0), $MachinePrecision]), $MachinePrecision] * n), $MachinePrecision], N[(100.0 * n + N[(i * N[(i * N[(i * N[(n * N[(4.166666666666667 - N[(25.0 * N[Power[n, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(n * N[(16.666666666666668 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(n * N[(50.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 50 \cdot {n}^{-1}\\
\mathbf{if}\;i \leq 2.8 \cdot 10^{+33}:\\
\;\;\;\;\mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(100, n, i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \left(4.166666666666667 - 25 \cdot {n}^{-1}\right), n \cdot \left(16.666666666666668 - t\_0\right)\right), n \cdot \left(50 - t\_0\right)\right)\right)\\


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

    1. Initial program 22.9%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{e^{i} - 1}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      6. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{e^{i} - 1}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      7. lower-expm1.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      10. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
      12. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
      13. lower-exp.f6481.2

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
    4. Applied rewrites81.2%

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

    if 2.8000000000000001e33 < i

    1. Initial program 50.5%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{e^{i} - 1}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      6. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{e^{i} - 1}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      7. lower-expm1.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      10. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
      12. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
      13. lower-exp.f6414.6

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
    4. Applied rewrites14.6%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(100, n, i \cdot \mathsf{fma}\left(i, i \cdot \left(n \cdot \left(\frac{25}{6} - 25 \cdot \frac{1}{n}\right)\right) + n \cdot \left(\frac{50}{3} - 50 \cdot \frac{1}{n}\right), n \cdot \left(50 - 50 \cdot \frac{1}{n}\right)\right)\right) \]
    7. Applied rewrites43.5%

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

Alternative 6: 69.9% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 50 \cdot {n}^{-1}\\ t_1 := \log \left(-{n}^{-1}\right) + \log \left({\left(\frac{-1}{i}\right)}^{-1}\right)\\ \mathbf{if}\;i \leq -7.6 \cdot 10^{+213}:\\ \;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(-100, n \cdot \mathsf{expm1}\left(n \cdot t\_1\right), -100 \cdot \frac{\left(\left(n \cdot n\right) \cdot n\right) \cdot {\left(e^{n}\right)}^{t\_1}}{i}\right)}{i}\\ \mathbf{elif}\;i \leq -0.00031:\\ \;\;\;\;i \cdot \mathsf{fma}\left(-50, e^{i}, 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i \cdot i}\right)\\ \mathbf{else}:\\ \;\;\;\;\mathsf{fma}\left(100, n, i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \left(4.166666666666667 - 25 \cdot {n}^{-1}\right), n \cdot \left(16.666666666666668 - t\_0\right)\right), n \cdot \left(50 - t\_0\right)\right)\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (* 50.0 (pow n -1.0)))
        (t_1 (+ (log (- (pow n -1.0))) (log (pow (/ -1.0 i) -1.0)))))
   (if (<= i -7.6e+213)
     (*
      -1.0
      (/
       (fma
        -100.0
        (* n (expm1 (* n t_1)))
        (* -100.0 (/ (* (* (* n n) n) (pow (exp n) t_1)) i)))
       i))
     (if (<= i -0.00031)
       (* i (fma -50.0 (exp i) (* 100.0 (/ (* n (expm1 i)) (* i i)))))
       (fma
        100.0
        n
        (*
         i
         (fma
          i
          (fma
           i
           (* n (- 4.166666666666667 (* 25.0 (pow n -1.0))))
           (* n (- 16.666666666666668 t_0)))
          (* n (- 50.0 t_0)))))))))
double code(double i, double n) {
	double t_0 = 50.0 * pow(n, -1.0);
	double t_1 = log(-pow(n, -1.0)) + log(pow((-1.0 / i), -1.0));
	double tmp;
	if (i <= -7.6e+213) {
		tmp = -1.0 * (fma(-100.0, (n * expm1((n * t_1))), (-100.0 * ((((n * n) * n) * pow(exp(n), t_1)) / i))) / i);
	} else if (i <= -0.00031) {
		tmp = i * fma(-50.0, exp(i), (100.0 * ((n * expm1(i)) / (i * i))));
	} else {
		tmp = fma(100.0, n, (i * fma(i, fma(i, (n * (4.166666666666667 - (25.0 * pow(n, -1.0)))), (n * (16.666666666666668 - t_0))), (n * (50.0 - t_0)))));
	}
	return tmp;
}
function code(i, n)
	t_0 = Float64(50.0 * (n ^ -1.0))
	t_1 = Float64(log(Float64(-(n ^ -1.0))) + log((Float64(-1.0 / i) ^ -1.0)))
	tmp = 0.0
	if (i <= -7.6e+213)
		tmp = Float64(-1.0 * Float64(fma(-100.0, Float64(n * expm1(Float64(n * t_1))), Float64(-100.0 * Float64(Float64(Float64(Float64(n * n) * n) * (exp(n) ^ t_1)) / i))) / i));
	elseif (i <= -0.00031)
		tmp = Float64(i * fma(-50.0, exp(i), Float64(100.0 * Float64(Float64(n * expm1(i)) / Float64(i * i)))));
	else
		tmp = fma(100.0, n, Float64(i * fma(i, fma(i, Float64(n * Float64(4.166666666666667 - Float64(25.0 * (n ^ -1.0)))), Float64(n * Float64(16.666666666666668 - t_0))), Float64(n * Float64(50.0 - t_0)))));
	end
	return tmp
end
code[i_, n_] := Block[{t$95$0 = N[(50.0 * N[Power[n, -1.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Log[(-N[Power[n, -1.0], $MachinePrecision])], $MachinePrecision] + N[Log[N[Power[N[(-1.0 / i), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[i, -7.6e+213], N[(-1.0 * N[(N[(-100.0 * N[(n * N[(Exp[N[(n * t$95$1), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] + N[(-100.0 * N[(N[(N[(N[(n * n), $MachinePrecision] * n), $MachinePrecision] * N[Power[N[Exp[n], $MachinePrecision], t$95$1], $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, -0.00031], N[(i * N[(-50.0 * N[Exp[i], $MachinePrecision] + N[(100.0 * N[(N[(n * N[(Exp[i] - 1), $MachinePrecision]), $MachinePrecision] / N[(i * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(100.0 * n + N[(i * N[(i * N[(i * N[(n * N[(4.166666666666667 - N[(25.0 * N[Power[n, -1.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(n * N[(16.666666666666668 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(n * N[(50.0 - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 50 \cdot {n}^{-1}\\
t_1 := \log \left(-{n}^{-1}\right) + \log \left({\left(\frac{-1}{i}\right)}^{-1}\right)\\
\mathbf{if}\;i \leq -7.6 \cdot 10^{+213}:\\
\;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(-100, n \cdot \mathsf{expm1}\left(n \cdot t\_1\right), -100 \cdot \frac{\left(\left(n \cdot n\right) \cdot n\right) \cdot {\left(e^{n}\right)}^{t\_1}}{i}\right)}{i}\\

\mathbf{elif}\;i \leq -0.00031:\\
\;\;\;\;i \cdot \mathsf{fma}\left(-50, e^{i}, 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i \cdot i}\right)\\

\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(100, n, i \cdot \mathsf{fma}\left(i, \mathsf{fma}\left(i, n \cdot \left(4.166666666666667 - 25 \cdot {n}^{-1}\right), n \cdot \left(16.666666666666668 - t\_0\right)\right), n \cdot \left(50 - t\_0\right)\right)\right)\\


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

    1. Initial program 90.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \frac{-100 \cdot \left(n \cdot \left(e^{n \cdot \left(\log \left(\mathsf{neg}\left(\frac{1}{n}\right)\right) + -1 \cdot \log \left(\frac{-1}{i}\right)\right)} - 1\right)\right) + -100 \cdot \frac{{n}^{3} \cdot e^{n \cdot \left(\log \left(\mathsf{neg}\left(\frac{1}{n}\right)\right) + -1 \cdot \log \left(\frac{-1}{i}\right)\right)}}{i}}{\color{blue}{i}} \]
    6. Applied rewrites56.9%

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

    if -7.5999999999999995e213 < i < -3.1e-4

    1. Initial program 45.0%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{e^{i} - 1}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      6. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{e^{i} - 1}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      7. lower-expm1.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      10. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
      12. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
      13. lower-exp.f6470.7

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
    4. Applied rewrites70.7%

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

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

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

        \[\leadsto i \cdot \mathsf{fma}\left(-50, e^{i}, 100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{{i}^{2}}\right) \]
      3. lift-exp.f64N/A

        \[\leadsto i \cdot \mathsf{fma}\left(-50, e^{i}, 100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{{i}^{2}}\right) \]
      4. lower-*.f64N/A

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

        \[\leadsto i \cdot \mathsf{fma}\left(-50, e^{i}, 100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{{i}^{2}}\right) \]
      6. lower-*.f64N/A

        \[\leadsto i \cdot \mathsf{fma}\left(-50, e^{i}, 100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{{i}^{2}}\right) \]
      7. lift-expm1.f64N/A

        \[\leadsto i \cdot \mathsf{fma}\left(-50, e^{i}, 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{{i}^{2}}\right) \]
      8. pow2N/A

        \[\leadsto i \cdot \mathsf{fma}\left(-50, e^{i}, 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i \cdot i}\right) \]
      9. lift-*.f6464.2

        \[\leadsto i \cdot \mathsf{fma}\left(-50, e^{i}, 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i \cdot i}\right) \]
    7. Applied rewrites64.2%

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

    if -3.1e-4 < i

    1. Initial program 20.6%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{e^{i} - 1}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      6. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{e^{i} - 1}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      7. lower-expm1.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      10. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
      12. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
      13. lower-exp.f6465.1

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
    4. Applied rewrites65.1%

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

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

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

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

        \[\leadsto \mathsf{fma}\left(100, n, i \cdot \mathsf{fma}\left(i, i \cdot \left(n \cdot \left(\frac{25}{6} - 25 \cdot \frac{1}{n}\right)\right) + n \cdot \left(\frac{50}{3} - 50 \cdot \frac{1}{n}\right), n \cdot \left(50 - 50 \cdot \frac{1}{n}\right)\right)\right) \]
    7. Applied rewrites72.1%

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

Alternative 7: 36.3% accurate, N/A× speedup?

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

\\
\begin{array}{l}
t_0 := i \cdot \mathsf{fma}\left(-50, e^{i}, 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i \cdot i}\right)\\
t_1 := \log \left(-{n}^{-1}\right) + \log \left({\left(\frac{-1}{i}\right)}^{-1}\right)\\
\mathbf{if}\;n \leq -4.9 \cdot 10^{-6}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;n \leq -1.4 \cdot 10^{-303}:\\
\;\;\;\;-1 \cdot \frac{\mathsf{fma}\left(-100, n \cdot \mathsf{expm1}\left(n \cdot t\_1\right), -100 \cdot \frac{\left(\left(n \cdot n\right) \cdot n\right) \cdot {\left(e^{n}\right)}^{t\_1}}{i}\right)}{i}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if n < -4.89999999999999967e-6 or -1.4e-303 < n

    1. Initial program 25.6%

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

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

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

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

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

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

        \[\leadsto \mathsf{fma}\left(\frac{e^{i} - 1}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      6. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{e^{i} - 1}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      7. lower-expm1.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, -50 \cdot \frac{i \cdot e^{i}}{n}\right) \cdot n \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      9. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      10. lower-/.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{i \cdot e^{i}}{n} \cdot -50\right) \cdot n \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
      12. lower-*.f64N/A

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
      13. lower-exp.f6468.8

        \[\leadsto \mathsf{fma}\left(\frac{\mathsf{expm1}\left(i\right)}{i}, 100, \frac{e^{i} \cdot i}{n} \cdot -50\right) \cdot n \]
    4. Applied rewrites68.8%

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

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

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

        \[\leadsto i \cdot \mathsf{fma}\left(-50, e^{i}, 100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{{i}^{2}}\right) \]
      3. lift-exp.f64N/A

        \[\leadsto i \cdot \mathsf{fma}\left(-50, e^{i}, 100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{{i}^{2}}\right) \]
      4. lower-*.f64N/A

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

        \[\leadsto i \cdot \mathsf{fma}\left(-50, e^{i}, 100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{{i}^{2}}\right) \]
      6. lower-*.f64N/A

        \[\leadsto i \cdot \mathsf{fma}\left(-50, e^{i}, 100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{{i}^{2}}\right) \]
      7. lift-expm1.f64N/A

        \[\leadsto i \cdot \mathsf{fma}\left(-50, e^{i}, 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{{i}^{2}}\right) \]
      8. pow2N/A

        \[\leadsto i \cdot \mathsf{fma}\left(-50, e^{i}, 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i \cdot i}\right) \]
      9. lift-*.f6431.7

        \[\leadsto i \cdot \mathsf{fma}\left(-50, e^{i}, 100 \cdot \frac{n \cdot \mathsf{expm1}\left(i\right)}{i \cdot i}\right) \]
    7. Applied rewrites31.7%

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

    if -4.89999999999999967e-6 < n < -1.4e-303

    1. Initial program 42.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto -1 \cdot \frac{-100 \cdot \left(n \cdot \left(e^{n \cdot \left(\log \left(\mathsf{neg}\left(\frac{1}{n}\right)\right) + -1 \cdot \log \left(\frac{-1}{i}\right)\right)} - 1\right)\right) + -100 \cdot \frac{{n}^{3} \cdot e^{n \cdot \left(\log \left(\mathsf{neg}\left(\frac{1}{n}\right)\right) + -1 \cdot \log \left(\frac{-1}{i}\right)\right)}}{i}}{\color{blue}{i}} \]
    6. Applied rewrites55.7%

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

Alternative 8: 13.1% accurate, N/A× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \log \left(-{n}^{-1}\right) + \log \left({\left(\frac{-1}{i}\right)}^{-1}\right)\\ -1 \cdot \frac{\mathsf{fma}\left(-100, n \cdot \mathsf{expm1}\left(n \cdot t\_0\right), -100 \cdot \frac{\left(\left(n \cdot n\right) \cdot n\right) \cdot {\left(e^{n}\right)}^{t\_0}}{i}\right)}{i} \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (+ (log (- (pow n -1.0))) (log (pow (/ -1.0 i) -1.0)))))
   (*
    -1.0
    (/
     (fma
      -100.0
      (* n (expm1 (* n t_0)))
      (* -100.0 (/ (* (* (* n n) n) (pow (exp n) t_0)) i)))
     i))))
double code(double i, double n) {
	double t_0 = log(-pow(n, -1.0)) + log(pow((-1.0 / i), -1.0));
	return -1.0 * (fma(-100.0, (n * expm1((n * t_0))), (-100.0 * ((((n * n) * n) * pow(exp(n), t_0)) / i))) / i);
}
function code(i, n)
	t_0 = Float64(log(Float64(-(n ^ -1.0))) + log((Float64(-1.0 / i) ^ -1.0)))
	return Float64(-1.0 * Float64(fma(-100.0, Float64(n * expm1(Float64(n * t_0))), Float64(-100.0 * Float64(Float64(Float64(Float64(n * n) * n) * (exp(n) ^ t_0)) / i))) / i))
end
code[i_, n_] := Block[{t$95$0 = N[(N[Log[(-N[Power[n, -1.0], $MachinePrecision])], $MachinePrecision] + N[Log[N[Power[N[(-1.0 / i), $MachinePrecision], -1.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, N[(-1.0 * N[(N[(-100.0 * N[(n * N[(Exp[N[(n * t$95$0), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] + N[(-100.0 * N[(N[(N[(N[(n * n), $MachinePrecision] * n), $MachinePrecision] * N[Power[N[Exp[n], $MachinePrecision], t$95$0], $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \log \left(-{n}^{-1}\right) + \log \left({\left(\frac{-1}{i}\right)}^{-1}\right)\\
-1 \cdot \frac{\mathsf{fma}\left(-100, n \cdot \mathsf{expm1}\left(n \cdot t\_0\right), -100 \cdot \frac{\left(\left(n \cdot n\right) \cdot n\right) \cdot {\left(e^{n}\right)}^{t\_0}}{i}\right)}{i}
\end{array}
\end{array}
Derivation
  1. Initial program 28.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto -1 \cdot \frac{-100 \cdot \left(n \cdot \left(e^{n \cdot \left(\log \left(\mathsf{neg}\left(\frac{1}{n}\right)\right) + -1 \cdot \log \left(\frac{-1}{i}\right)\right)} - 1\right)\right) + -100 \cdot \frac{{n}^{3} \cdot e^{n \cdot \left(\log \left(\mathsf{neg}\left(\frac{1}{n}\right)\right) + -1 \cdot \log \left(\frac{-1}{i}\right)\right)}}{i}}{\color{blue}{i}} \]
  6. Applied rewrites13.1%

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

Reproduce

?
herbie shell --seed 2025093 
(FPCore (i n)
  :name "Compound Interest"
  :precision binary64
  (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))