Compound Interest

Percentage Accurate: 28.3% → 93.7%
Time: 10.3s
Alternatives: 16
Speedup: 24.3×

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}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

Herbie found 16 alternatives:

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

Initial Program: 28.3% 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: 93.7% accurate, 0.3× speedup?

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

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

\mathbf{elif}\;t\_0 \leq \infty:\\
\;\;\;\;t\_0\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 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))) < 0.0

    1. Initial program 29.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{expm1}\left(\color{blue}{\mathsf{log1p}\left(\frac{i}{n}\right)} \cdot n\right)}{i} \cdot \left(n \cdot 100\right) \]
      16. lower-*.f6496.8

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

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

    if 0.0 < (*.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))) < +inf.0

    1. Initial program 99.9%

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

    if +inf.0 < (*.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 0.0%

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

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

        \[\leadsto \color{blue}{100 \cdot n} \]
    5. Applied rewrites85.6%

      \[\leadsto \color{blue}{100 \cdot n} \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 2: 91.4% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \leq \infty:\\ \;\;\;\;\frac{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n\right)}{\frac{i}{n}} \cdot 100\\ \mathbf{else}:\\ \;\;\;\;100 \cdot n\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))) INFINITY)
   (* (/ (expm1 (* (log1p (/ i n)) n)) (/ i n)) 100.0)
   (* 100.0 n)))
double code(double i, double n) {
	double tmp;
	if ((100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n))) <= ((double) INFINITY)) {
		tmp = (expm1((log1p((i / n)) * n)) / (i / n)) * 100.0;
	} else {
		tmp = 100.0 * n;
	}
	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))) <= Double.POSITIVE_INFINITY) {
		tmp = (Math.expm1((Math.log1p((i / n)) * n)) / (i / n)) * 100.0;
	} else {
		tmp = 100.0 * n;
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if (100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))) <= math.inf:
		tmp = (math.expm1((math.log1p((i / n)) * n)) / (i / n)) * 100.0
	else:
		tmp = 100.0 * n
	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))) <= Inf)
		tmp = Float64(Float64(expm1(Float64(log1p(Float64(i / n)) * n)) / Float64(i / n)) * 100.0);
	else
		tmp = Float64(100.0 * n);
	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], Infinity], N[(N[(N[(Exp[N[(N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision] * n), $MachinePrecision]] - 1), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision] * 100.0), $MachinePrecision], N[(100.0 * n), $MachinePrecision]]
\begin{array}{l}

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

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


\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))) < +inf.0

    1. Initial program 34.6%

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

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

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

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

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

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

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

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

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

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

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

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

    if +inf.0 < (*.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 0.0%

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

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

        \[\leadsto \color{blue}{100 \cdot n} \]
    5. Applied rewrites85.6%

      \[\leadsto \color{blue}{100 \cdot n} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 3: 90.6% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \leq \infty:\\ \;\;\;\;\frac{\mathsf{expm1}\left(\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n\right) \cdot 100}{i} \cdot n\\ \mathbf{else}:\\ \;\;\;\;100 \cdot n\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (if (<= (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))) INFINITY)
   (* (/ (* (expm1 (* (log1p (/ i n)) n)) 100.0) i) n)
   (* 100.0 n)))
double code(double i, double n) {
	double tmp;
	if ((100.0 * ((pow((1.0 + (i / n)), n) - 1.0) / (i / n))) <= ((double) INFINITY)) {
		tmp = ((expm1((log1p((i / n)) * n)) * 100.0) / i) * n;
	} else {
		tmp = 100.0 * n;
	}
	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))) <= Double.POSITIVE_INFINITY) {
		tmp = ((Math.expm1((Math.log1p((i / n)) * n)) * 100.0) / i) * n;
	} else {
		tmp = 100.0 * n;
	}
	return tmp;
}
def code(i, n):
	tmp = 0
	if (100.0 * ((math.pow((1.0 + (i / n)), n) - 1.0) / (i / n))) <= math.inf:
		tmp = ((math.expm1((math.log1p((i / n)) * n)) * 100.0) / i) * n
	else:
		tmp = 100.0 * n
	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))) <= Inf)
		tmp = Float64(Float64(Float64(expm1(Float64(log1p(Float64(i / n)) * n)) * 100.0) / i) * n);
	else
		tmp = Float64(100.0 * n);
	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], Infinity], N[(N[(N[(N[(Exp[N[(N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision] * n), $MachinePrecision]] - 1), $MachinePrecision] * 100.0), $MachinePrecision] / i), $MachinePrecision] * n), $MachinePrecision], N[(100.0 * n), $MachinePrecision]]
\begin{array}{l}

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

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


\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))) < +inf.0

    1. Initial program 34.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \frac{\mathsf{expm1}\left(\log \color{blue}{\left(1 + \frac{i}{n}\right)} \cdot n\right) \cdot 100}{i} \cdot n \]
      16. lower-log1p.f6495.2

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

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

    if +inf.0 < (*.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 0.0%

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

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

        \[\leadsto \color{blue}{100 \cdot n} \]
    5. Applied rewrites85.6%

      \[\leadsto \color{blue}{100 \cdot n} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 90.5% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{\mathsf{expm1}\left(i\right)}{i}\\ \mathbf{if}\;n \leq -440:\\ \;\;\;\;\left(t\_0 \cdot 100\right) \cdot n\\ \mathbf{elif}\;n \leq 2.85 \cdot 10^{-16}:\\ \;\;\;\;\left(100 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n\right)\right) \cdot \frac{n}{i}\\ \mathbf{else}:\\ \;\;\;\;t\_0 \cdot \left(100 \cdot n\right)\\ \end{array} \end{array} \]
(FPCore (i n)
 :precision binary64
 (let* ((t_0 (/ (expm1 i) i)))
   (if (<= n -440.0)
     (* (* t_0 100.0) n)
     (if (<= n 2.85e-16)
       (* (* 100.0 (expm1 (* (log1p (/ i n)) n))) (/ n i))
       (* t_0 (* 100.0 n))))))
double code(double i, double n) {
	double t_0 = expm1(i) / i;
	double tmp;
	if (n <= -440.0) {
		tmp = (t_0 * 100.0) * n;
	} else if (n <= 2.85e-16) {
		tmp = (100.0 * expm1((log1p((i / n)) * n))) * (n / i);
	} else {
		tmp = t_0 * (100.0 * n);
	}
	return tmp;
}
public static double code(double i, double n) {
	double t_0 = Math.expm1(i) / i;
	double tmp;
	if (n <= -440.0) {
		tmp = (t_0 * 100.0) * n;
	} else if (n <= 2.85e-16) {
		tmp = (100.0 * Math.expm1((Math.log1p((i / n)) * n))) * (n / i);
	} else {
		tmp = t_0 * (100.0 * n);
	}
	return tmp;
}
def code(i, n):
	t_0 = math.expm1(i) / i
	tmp = 0
	if n <= -440.0:
		tmp = (t_0 * 100.0) * n
	elif n <= 2.85e-16:
		tmp = (100.0 * math.expm1((math.log1p((i / n)) * n))) * (n / i)
	else:
		tmp = t_0 * (100.0 * n)
	return tmp
function code(i, n)
	t_0 = Float64(expm1(i) / i)
	tmp = 0.0
	if (n <= -440.0)
		tmp = Float64(Float64(t_0 * 100.0) * n);
	elseif (n <= 2.85e-16)
		tmp = Float64(Float64(100.0 * expm1(Float64(log1p(Float64(i / n)) * n))) * Float64(n / i));
	else
		tmp = Float64(t_0 * Float64(100.0 * n));
	end
	return tmp
end
code[i_, n_] := Block[{t$95$0 = N[(N[(Exp[i] - 1), $MachinePrecision] / i), $MachinePrecision]}, If[LessEqual[n, -440.0], N[(N[(t$95$0 * 100.0), $MachinePrecision] * n), $MachinePrecision], If[LessEqual[n, 2.85e-16], N[(N[(100.0 * N[(Exp[N[(N[Log[1 + N[(i / n), $MachinePrecision]], $MachinePrecision] * n), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision] * N[(n / i), $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[(100.0 * n), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \frac{\mathsf{expm1}\left(i\right)}{i}\\
\mathbf{if}\;n \leq -440:\\
\;\;\;\;\left(t\_0 \cdot 100\right) \cdot n\\

\mathbf{elif}\;n \leq 2.85 \cdot 10^{-16}:\\
\;\;\;\;\left(100 \cdot \mathsf{expm1}\left(\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n\right)\right) \cdot \frac{n}{i}\\

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


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

    1. Initial program 29.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -440 < n < 2.85e-16

    1. Initial program 33.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 2.85e-16 < n

    1. Initial program 22.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 81.7% accurate, 0.6× speedup?

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

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

\mathbf{elif}\;n \leq -4 \cdot 10^{-310}:\\
\;\;\;\;\left(\left(\frac{\log \left(-i\right) - \log \left(-n\right)}{i} \cdot n\right) \cdot n\right) \cdot 100\\

\mathbf{elif}\;n \leq 2.55 \cdot 10^{-52}:\\
\;\;\;\;100 \cdot \left(\left(n \cdot n\right) \cdot \frac{\log i - \log n}{i}\right)\\

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


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

    1. Initial program 26.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.1999999999999999e-79 < n < -3.999999999999988e-310

    1. Initial program 50.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \left(\left(n \cdot n\right) \cdot \color{blue}{\frac{\log i + -1 \cdot \log n}{i}}\right) \cdot 100 \]
      6. fp-cancel-sign-sub-invN/A

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

        \[\leadsto \left(\left(n \cdot n\right) \cdot \frac{\log i - \color{blue}{1} \cdot \log n}{i}\right) \cdot 100 \]
      8. *-lft-identityN/A

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

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

        \[\leadsto \left(\left(n \cdot n\right) \cdot \frac{\color{blue}{\log i} - \log n}{i}\right) \cdot 100 \]
      11. lower-log.f640.0

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

      \[\leadsto \color{blue}{\left(\left(n \cdot n\right) \cdot \frac{\log i - \log n}{i}\right)} \cdot 100 \]
    8. Step-by-step derivation
      1. Applied rewrites49.5%

        \[\leadsto \left(\left(\frac{\log \left(\frac{i}{n}\right)}{i} \cdot n\right) \cdot \color{blue}{n}\right) \cdot 100 \]
      2. Step-by-step derivation
        1. Applied rewrites71.5%

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

        if -3.999999999999988e-310 < n < 2.54999999999999995e-52

        1. Initial program 32.9%

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

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

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

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

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

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

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

            \[\leadsto 100 \cdot \left(\left(n \cdot n\right) \cdot \frac{\log i + \color{blue}{\left(\mathsf{neg}\left(1\right)\right)} \cdot \log n}{i}\right) \]
          7. fp-cancel-sub-sign-invN/A

            \[\leadsto 100 \cdot \left(\left(n \cdot n\right) \cdot \frac{\color{blue}{\log i - 1 \cdot \log n}}{i}\right) \]
          8. *-lft-identityN/A

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

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

            \[\leadsto 100 \cdot \left(\left(n \cdot n\right) \cdot \frac{\color{blue}{\log i} - \log n}{i}\right) \]
          11. lower-log.f6462.2

            \[\leadsto 100 \cdot \left(\left(n \cdot n\right) \cdot \frac{\log i - \color{blue}{\log n}}{i}\right) \]
        5. Applied rewrites62.2%

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

        if 2.54999999999999995e-52 < n

        1. Initial program 20.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4.2 \cdot 10^{-79}:\\ \;\;\;\;\left(\frac{\mathsf{expm1}\left(i\right)}{i} \cdot 100\right) \cdot n\\ \mathbf{elif}\;n \leq -4 \cdot 10^{-310}:\\ \;\;\;\;\left(\left(\frac{\log \left(-i\right) - \log \left(-n\right)}{i} \cdot n\right) \cdot n\right) \cdot 100\\ \mathbf{elif}\;n \leq 2.55 \cdot 10^{-52}:\\ \;\;\;\;100 \cdot \left(\left(n \cdot n\right) \cdot \frac{\log i - \log n}{i}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{expm1}\left(i\right)}{i} \cdot \left(100 \cdot n\right)\\ \end{array} \]
      5. Add Preprocessing

      Alternative 6: 80.5% accurate, 1.1× speedup?

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

        1. Initial program 22.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

        if -4.0999999999999998e-168 < n < 1.6500000000000001e-93

        1. Initial program 55.9%

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

          \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
        4. Step-by-step derivation
          1. Applied rewrites67.5%

            \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
          2. Step-by-step derivation
            1. lift-*.f64N/A

              \[\leadsto \color{blue}{100 \cdot \frac{1 - 1}{\frac{i}{n}}} \]
            2. *-commutativeN/A

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

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

              \[\leadsto \frac{1 - 1}{\color{blue}{\frac{i}{n}}} \cdot 100 \]
            5. associate-/r/N/A

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

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

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

              \[\leadsto \color{blue}{\frac{1 - 1}{i}} \cdot \left(n \cdot 100\right) \]
            9. lower-*.f6467.5

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

            \[\leadsto \color{blue}{\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)} \]
        5. Recombined 2 regimes into one program.
        6. Final simplification81.5%

          \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -4.1 \cdot 10^{-168} \lor \neg \left(n \leq 1.65 \cdot 10^{-93}\right):\\ \;\;\;\;\left(\frac{\mathsf{expm1}\left(i\right)}{i} \cdot 100\right) \cdot n\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\ \end{array} \]
        7. Add Preprocessing

        Alternative 7: 80.5% accurate, 1.1× speedup?

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

          1. Initial program 25.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

          if -4.0999999999999998e-168 < n < 1.6500000000000001e-93

          1. Initial program 55.9%

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

            \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
          4. Step-by-step derivation
            1. Applied rewrites67.5%

              \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
            2. Step-by-step derivation
              1. lift-*.f64N/A

                \[\leadsto \color{blue}{100 \cdot \frac{1 - 1}{\frac{i}{n}}} \]
              2. *-commutativeN/A

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

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

                \[\leadsto \frac{1 - 1}{\color{blue}{\frac{i}{n}}} \cdot 100 \]
              5. associate-/r/N/A

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

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

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

                \[\leadsto \color{blue}{\frac{1 - 1}{i}} \cdot \left(n \cdot 100\right) \]
              9. lower-*.f6467.5

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

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

            if 1.6500000000000001e-93 < n

            1. Initial program 19.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

          Alternative 8: 65.2% accurate, 1.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -5.3 \cdot 10^{-148} \lor \neg \left(n \leq 1.65 \cdot 10^{-93}\right):\\ \;\;\;\;100 \cdot \mathsf{fma}\left(\mathsf{fma}\left(n \cdot i, \left(\frac{0.3333333333333333}{n \cdot n} + 0.16666666666666666\right) - \frac{0.5}{n}, \left(0.5 - \frac{0.5}{n}\right) \cdot n\right), i, n\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\ \end{array} \end{array} \]
          (FPCore (i n)
           :precision binary64
           (if (or (<= n -5.3e-148) (not (<= n 1.65e-93)))
             (*
              100.0
              (fma
               (fma
                (* n i)
                (- (+ (/ 0.3333333333333333 (* n n)) 0.16666666666666666) (/ 0.5 n))
                (* (- 0.5 (/ 0.5 n)) n))
               i
               n))
             (* (/ (- 1.0 1.0) i) (* n 100.0))))
          double code(double i, double n) {
          	double tmp;
          	if ((n <= -5.3e-148) || !(n <= 1.65e-93)) {
          		tmp = 100.0 * fma(fma((n * i), (((0.3333333333333333 / (n * n)) + 0.16666666666666666) - (0.5 / n)), ((0.5 - (0.5 / n)) * n)), i, n);
          	} else {
          		tmp = ((1.0 - 1.0) / i) * (n * 100.0);
          	}
          	return tmp;
          }
          
          function code(i, n)
          	tmp = 0.0
          	if ((n <= -5.3e-148) || !(n <= 1.65e-93))
          		tmp = Float64(100.0 * fma(fma(Float64(n * i), Float64(Float64(Float64(0.3333333333333333 / Float64(n * n)) + 0.16666666666666666) - Float64(0.5 / n)), Float64(Float64(0.5 - Float64(0.5 / n)) * n)), i, n));
          	else
          		tmp = Float64(Float64(Float64(1.0 - 1.0) / i) * Float64(n * 100.0));
          	end
          	return tmp
          end
          
          code[i_, n_] := If[Or[LessEqual[n, -5.3e-148], N[Not[LessEqual[n, 1.65e-93]], $MachinePrecision]], N[(100.0 * N[(N[(N[(n * i), $MachinePrecision] * N[(N[(N[(0.3333333333333333 / N[(n * n), $MachinePrecision]), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] + N[(N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] * n), $MachinePrecision]), $MachinePrecision] * i + n), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - 1.0), $MachinePrecision] / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;n \leq -5.3 \cdot 10^{-148} \lor \neg \left(n \leq 1.65 \cdot 10^{-93}\right):\\
          \;\;\;\;100 \cdot \mathsf{fma}\left(\mathsf{fma}\left(n \cdot i, \left(\frac{0.3333333333333333}{n \cdot n} + 0.16666666666666666\right) - \frac{0.5}{n}, \left(0.5 - \frac{0.5}{n}\right) \cdot n\right), i, n\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 2 regimes
          2. if n < -5.29999999999999995e-148 or 1.6500000000000001e-93 < n

            1. Initial program 22.0%

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

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

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

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

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

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

            if -5.29999999999999995e-148 < n < 1.6500000000000001e-93

            1. Initial program 55.7%

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

              \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
            4. Step-by-step derivation
              1. Applied rewrites66.4%

                \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
              2. Step-by-step derivation
                1. lift-*.f64N/A

                  \[\leadsto \color{blue}{100 \cdot \frac{1 - 1}{\frac{i}{n}}} \]
                2. *-commutativeN/A

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

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

                  \[\leadsto \frac{1 - 1}{\color{blue}{\frac{i}{n}}} \cdot 100 \]
                5. associate-/r/N/A

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

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

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

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

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

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

              \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -5.3 \cdot 10^{-148} \lor \neg \left(n \leq 1.65 \cdot 10^{-93}\right):\\ \;\;\;\;100 \cdot \mathsf{fma}\left(\mathsf{fma}\left(n \cdot i, \left(\frac{0.3333333333333333}{n \cdot n} + 0.16666666666666666\right) - \frac{0.5}{n}, \left(0.5 - \frac{0.5}{n}\right) \cdot n\right), i, n\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\ \end{array} \]
            7. Add Preprocessing

            Alternative 9: 65.2% accurate, 1.8× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -5.3 \cdot 10^{-148} \lor \neg \left(n \leq 1.65 \cdot 10^{-93}\right):\\ \;\;\;\;\mathsf{fma}\left(0.5 + \mathsf{fma}\left(\left(\frac{0.3333333333333333}{n \cdot n} + 0.16666666666666666\right) - \frac{0.5}{n}, i, \frac{-0.5}{n}\right), i, 1\right) \cdot \left(n \cdot 100\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\ \end{array} \end{array} \]
            (FPCore (i n)
             :precision binary64
             (if (or (<= n -5.3e-148) (not (<= n 1.65e-93)))
               (*
                (fma
                 (+
                  0.5
                  (fma
                   (- (+ (/ 0.3333333333333333 (* n n)) 0.16666666666666666) (/ 0.5 n))
                   i
                   (/ -0.5 n)))
                 i
                 1.0)
                (* n 100.0))
               (* (/ (- 1.0 1.0) i) (* n 100.0))))
            double code(double i, double n) {
            	double tmp;
            	if ((n <= -5.3e-148) || !(n <= 1.65e-93)) {
            		tmp = fma((0.5 + fma((((0.3333333333333333 / (n * n)) + 0.16666666666666666) - (0.5 / n)), i, (-0.5 / n))), i, 1.0) * (n * 100.0);
            	} else {
            		tmp = ((1.0 - 1.0) / i) * (n * 100.0);
            	}
            	return tmp;
            }
            
            function code(i, n)
            	tmp = 0.0
            	if ((n <= -5.3e-148) || !(n <= 1.65e-93))
            		tmp = Float64(fma(Float64(0.5 + fma(Float64(Float64(Float64(0.3333333333333333 / Float64(n * n)) + 0.16666666666666666) - Float64(0.5 / n)), i, Float64(-0.5 / n))), i, 1.0) * Float64(n * 100.0));
            	else
            		tmp = Float64(Float64(Float64(1.0 - 1.0) / i) * Float64(n * 100.0));
            	end
            	return tmp
            end
            
            code[i_, n_] := If[Or[LessEqual[n, -5.3e-148], N[Not[LessEqual[n, 1.65e-93]], $MachinePrecision]], N[(N[(N[(0.5 + N[(N[(N[(N[(0.3333333333333333 / N[(n * n), $MachinePrecision]), $MachinePrecision] + 0.16666666666666666), $MachinePrecision] - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] * i + N[(-0.5 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * i + 1.0), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - 1.0), $MachinePrecision] / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            \mathbf{if}\;n \leq -5.3 \cdot 10^{-148} \lor \neg \left(n \leq 1.65 \cdot 10^{-93}\right):\\
            \;\;\;\;\mathsf{fma}\left(0.5 + \mathsf{fma}\left(\left(\frac{0.3333333333333333}{n \cdot n} + 0.16666666666666666\right) - \frac{0.5}{n}, i, \frac{-0.5}{n}\right), i, 1\right) \cdot \left(n \cdot 100\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 2 regimes
            2. if n < -5.29999999999999995e-148 or 1.6500000000000001e-93 < n

              1. Initial program 22.0%

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

                \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
              4. Step-by-step derivation
                1. Applied rewrites4.2%

                  \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
                2. Step-by-step derivation
                  1. lift-*.f64N/A

                    \[\leadsto \color{blue}{100 \cdot \frac{1 - 1}{\frac{i}{n}}} \]
                  2. *-commutativeN/A

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

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

                    \[\leadsto \frac{1 - 1}{\color{blue}{\frac{i}{n}}} \cdot 100 \]
                  5. associate-/r/N/A

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

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

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

                    \[\leadsto \color{blue}{\frac{1 - 1}{i}} \cdot \left(n \cdot 100\right) \]
                  9. lower-*.f644.5

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

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

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

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

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

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

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

                if -5.29999999999999995e-148 < n < 1.6500000000000001e-93

                1. Initial program 55.7%

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

                  \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
                4. Step-by-step derivation
                  1. Applied rewrites66.4%

                    \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
                  2. Step-by-step derivation
                    1. lift-*.f64N/A

                      \[\leadsto \color{blue}{100 \cdot \frac{1 - 1}{\frac{i}{n}}} \]
                    2. *-commutativeN/A

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

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

                      \[\leadsto \frac{1 - 1}{\color{blue}{\frac{i}{n}}} \cdot 100 \]
                    5. associate-/r/N/A

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

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

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

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

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

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

                  \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -5.3 \cdot 10^{-148} \lor \neg \left(n \leq 1.65 \cdot 10^{-93}\right):\\ \;\;\;\;\mathsf{fma}\left(0.5 + \mathsf{fma}\left(\left(\frac{0.3333333333333333}{n \cdot n} + 0.16666666666666666\right) - \frac{0.5}{n}, i, \frac{-0.5}{n}\right), i, 1\right) \cdot \left(n \cdot 100\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\ \end{array} \]
                7. Add Preprocessing

                Alternative 10: 64.0% accurate, 2.3× speedup?

                \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -4.1 \cdot 10^{+39}:\\ \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\ \mathbf{elif}\;i \leq 5 \cdot 10^{-10}:\\ \;\;\;\;100 \cdot n\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, i, 0.16666666666666666\right), i, 0.5\right), i, 1\right) \cdot i}{\frac{i}{n}}\\ \end{array} \end{array} \]
                (FPCore (i n)
                 :precision binary64
                 (if (<= i -4.1e+39)
                   (* (/ (- 1.0 1.0) i) (* n 100.0))
                   (if (<= i 5e-10)
                     (* 100.0 n)
                     (*
                      100.0
                      (/
                       (*
                        (fma
                         (fma (fma 0.041666666666666664 i 0.16666666666666666) i 0.5)
                         i
                         1.0)
                        i)
                       (/ i n))))))
                double code(double i, double n) {
                	double tmp;
                	if (i <= -4.1e+39) {
                		tmp = ((1.0 - 1.0) / i) * (n * 100.0);
                	} else if (i <= 5e-10) {
                		tmp = 100.0 * n;
                	} else {
                		tmp = 100.0 * ((fma(fma(fma(0.041666666666666664, i, 0.16666666666666666), i, 0.5), i, 1.0) * i) / (i / n));
                	}
                	return tmp;
                }
                
                function code(i, n)
                	tmp = 0.0
                	if (i <= -4.1e+39)
                		tmp = Float64(Float64(Float64(1.0 - 1.0) / i) * Float64(n * 100.0));
                	elseif (i <= 5e-10)
                		tmp = Float64(100.0 * n);
                	else
                		tmp = Float64(100.0 * Float64(Float64(fma(fma(fma(0.041666666666666664, i, 0.16666666666666666), i, 0.5), i, 1.0) * i) / Float64(i / n)));
                	end
                	return tmp
                end
                
                code[i_, n_] := If[LessEqual[i, -4.1e+39], N[(N[(N[(1.0 - 1.0), $MachinePrecision] / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 5e-10], N[(100.0 * n), $MachinePrecision], N[(100.0 * N[(N[(N[(N[(N[(0.041666666666666664 * i + 0.16666666666666666), $MachinePrecision] * i + 0.5), $MachinePrecision] * i + 1.0), $MachinePrecision] * i), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                
                \begin{array}{l}
                
                \\
                \begin{array}{l}
                \mathbf{if}\;i \leq -4.1 \cdot 10^{+39}:\\
                \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\
                
                \mathbf{elif}\;i \leq 5 \cdot 10^{-10}:\\
                \;\;\;\;100 \cdot n\\
                
                \mathbf{else}:\\
                \;\;\;\;100 \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, i, 0.16666666666666666\right), i, 0.5\right), i, 1\right) \cdot i}{\frac{i}{n}}\\
                
                
                \end{array}
                \end{array}
                
                Derivation
                1. Split input into 3 regimes
                2. if i < -4.10000000000000004e39

                  1. Initial program 69.2%

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

                    \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
                  4. Step-by-step derivation
                    1. Applied rewrites32.8%

                      \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
                    2. Step-by-step derivation
                      1. lift-*.f64N/A

                        \[\leadsto \color{blue}{100 \cdot \frac{1 - 1}{\frac{i}{n}}} \]
                      2. *-commutativeN/A

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

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

                        \[\leadsto \frac{1 - 1}{\color{blue}{\frac{i}{n}}} \cdot 100 \]
                      5. associate-/r/N/A

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

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

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

                        \[\leadsto \color{blue}{\frac{1 - 1}{i}} \cdot \left(n \cdot 100\right) \]
                      9. lower-*.f6432.8

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

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

                    if -4.10000000000000004e39 < i < 5.00000000000000031e-10

                    1. Initial program 10.6%

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

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

                        \[\leadsto \color{blue}{100 \cdot n} \]
                    5. Applied rewrites84.2%

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

                    if 5.00000000000000031e-10 < i

                    1. Initial program 41.3%

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

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

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

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

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

                        \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(\mathsf{fma}\left(0.041666666666666664, i, 0.16666666666666666\right), i, 0.5\right), i, 1\right) \cdot \color{blue}{i}}{\frac{i}{n}} \]
                    8. Recombined 3 regimes into one program.
                    9. Add Preprocessing

                    Alternative 11: 63.5% accurate, 2.6× speedup?

                    \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -4.1 \cdot 10^{+39}:\\ \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\ \mathbf{elif}\;i \leq 2.8 \cdot 10^{-16}:\\ \;\;\;\;100 \cdot n\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, i, 0.5\right), i, 1\right) \cdot i}{\frac{i}{n}}\\ \end{array} \end{array} \]
                    (FPCore (i n)
                     :precision binary64
                     (if (<= i -4.1e+39)
                       (* (/ (- 1.0 1.0) i) (* n 100.0))
                       (if (<= i 2.8e-16)
                         (* 100.0 n)
                         (* 100.0 (/ (* (fma (fma 0.16666666666666666 i 0.5) i 1.0) i) (/ i n))))))
                    double code(double i, double n) {
                    	double tmp;
                    	if (i <= -4.1e+39) {
                    		tmp = ((1.0 - 1.0) / i) * (n * 100.0);
                    	} else if (i <= 2.8e-16) {
                    		tmp = 100.0 * n;
                    	} else {
                    		tmp = 100.0 * ((fma(fma(0.16666666666666666, i, 0.5), i, 1.0) * i) / (i / n));
                    	}
                    	return tmp;
                    }
                    
                    function code(i, n)
                    	tmp = 0.0
                    	if (i <= -4.1e+39)
                    		tmp = Float64(Float64(Float64(1.0 - 1.0) / i) * Float64(n * 100.0));
                    	elseif (i <= 2.8e-16)
                    		tmp = Float64(100.0 * n);
                    	else
                    		tmp = Float64(100.0 * Float64(Float64(fma(fma(0.16666666666666666, i, 0.5), i, 1.0) * i) / Float64(i / n)));
                    	end
                    	return tmp
                    end
                    
                    code[i_, n_] := If[LessEqual[i, -4.1e+39], N[(N[(N[(1.0 - 1.0), $MachinePrecision] / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 2.8e-16], N[(100.0 * n), $MachinePrecision], N[(100.0 * N[(N[(N[(N[(0.16666666666666666 * i + 0.5), $MachinePrecision] * i + 1.0), $MachinePrecision] * i), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                    
                    \begin{array}{l}
                    
                    \\
                    \begin{array}{l}
                    \mathbf{if}\;i \leq -4.1 \cdot 10^{+39}:\\
                    \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\
                    
                    \mathbf{elif}\;i \leq 2.8 \cdot 10^{-16}:\\
                    \;\;\;\;100 \cdot n\\
                    
                    \mathbf{else}:\\
                    \;\;\;\;100 \cdot \frac{\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, i, 0.5\right), i, 1\right) \cdot i}{\frac{i}{n}}\\
                    
                    
                    \end{array}
                    \end{array}
                    
                    Derivation
                    1. Split input into 3 regimes
                    2. if i < -4.10000000000000004e39

                      1. Initial program 69.2%

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

                        \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
                      4. Step-by-step derivation
                        1. Applied rewrites32.8%

                          \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
                        2. Step-by-step derivation
                          1. lift-*.f64N/A

                            \[\leadsto \color{blue}{100 \cdot \frac{1 - 1}{\frac{i}{n}}} \]
                          2. *-commutativeN/A

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

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

                            \[\leadsto \frac{1 - 1}{\color{blue}{\frac{i}{n}}} \cdot 100 \]
                          5. associate-/r/N/A

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

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

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

                            \[\leadsto \color{blue}{\frac{1 - 1}{i}} \cdot \left(n \cdot 100\right) \]
                          9. lower-*.f6432.8

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

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

                        if -4.10000000000000004e39 < i < 2.8000000000000001e-16

                        1. Initial program 10.6%

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

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

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

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

                        if 2.8000000000000001e-16 < i

                        1. Initial program 40.7%

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

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

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

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

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

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

                        Alternative 12: 63.9% accurate, 2.6× speedup?

                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -0.68:\\ \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\ \mathbf{elif}\;i \leq 7.6 \cdot 10^{+15}:\\ \;\;\;\;\frac{\mathsf{fma}\left(0.5, i, 1\right) \cdot i}{i} \cdot \left(100 \cdot n\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{\mathsf{fma}\left(i \cdot i, 0.16666666666666666 \cdot i, i\right)}{\frac{i}{n}}\\ \end{array} \end{array} \]
                        (FPCore (i n)
                         :precision binary64
                         (if (<= i -0.68)
                           (* (/ (- 1.0 1.0) i) (* n 100.0))
                           (if (<= i 7.6e+15)
                             (* (/ (* (fma 0.5 i 1.0) i) i) (* 100.0 n))
                             (* 100.0 (/ (fma (* i i) (* 0.16666666666666666 i) i) (/ i n))))))
                        double code(double i, double n) {
                        	double tmp;
                        	if (i <= -0.68) {
                        		tmp = ((1.0 - 1.0) / i) * (n * 100.0);
                        	} else if (i <= 7.6e+15) {
                        		tmp = ((fma(0.5, i, 1.0) * i) / i) * (100.0 * n);
                        	} else {
                        		tmp = 100.0 * (fma((i * i), (0.16666666666666666 * i), i) / (i / n));
                        	}
                        	return tmp;
                        }
                        
                        function code(i, n)
                        	tmp = 0.0
                        	if (i <= -0.68)
                        		tmp = Float64(Float64(Float64(1.0 - 1.0) / i) * Float64(n * 100.0));
                        	elseif (i <= 7.6e+15)
                        		tmp = Float64(Float64(Float64(fma(0.5, i, 1.0) * i) / i) * Float64(100.0 * n));
                        	else
                        		tmp = Float64(100.0 * Float64(fma(Float64(i * i), Float64(0.16666666666666666 * i), i) / Float64(i / n)));
                        	end
                        	return tmp
                        end
                        
                        code[i_, n_] := If[LessEqual[i, -0.68], N[(N[(N[(1.0 - 1.0), $MachinePrecision] / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[i, 7.6e+15], N[(N[(N[(N[(0.5 * i + 1.0), $MachinePrecision] * i), $MachinePrecision] / i), $MachinePrecision] * N[(100.0 * n), $MachinePrecision]), $MachinePrecision], N[(100.0 * N[(N[(N[(i * i), $MachinePrecision] * N[(0.16666666666666666 * i), $MachinePrecision] + i), $MachinePrecision] / N[(i / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
                        
                        \begin{array}{l}
                        
                        \\
                        \begin{array}{l}
                        \mathbf{if}\;i \leq -0.68:\\
                        \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\
                        
                        \mathbf{elif}\;i \leq 7.6 \cdot 10^{+15}:\\
                        \;\;\;\;\frac{\mathsf{fma}\left(0.5, i, 1\right) \cdot i}{i} \cdot \left(100 \cdot n\right)\\
                        
                        \mathbf{else}:\\
                        \;\;\;\;100 \cdot \frac{\mathsf{fma}\left(i \cdot i, 0.16666666666666666 \cdot i, i\right)}{\frac{i}{n}}\\
                        
                        
                        \end{array}
                        \end{array}
                        
                        Derivation
                        1. Split input into 3 regimes
                        2. if i < -0.680000000000000049

                          1. Initial program 66.6%

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

                            \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
                          4. Step-by-step derivation
                            1. Applied rewrites31.6%

                              \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
                            2. Step-by-step derivation
                              1. lift-*.f64N/A

                                \[\leadsto \color{blue}{100 \cdot \frac{1 - 1}{\frac{i}{n}}} \]
                              2. *-commutativeN/A

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

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

                                \[\leadsto \frac{1 - 1}{\color{blue}{\frac{i}{n}}} \cdot 100 \]
                              5. associate-/r/N/A

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

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

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

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

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

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

                            if -0.680000000000000049 < i < 7.6e15

                            1. Initial program 11.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \frac{\mathsf{fma}\left(\frac{1}{2}, i, 1\right) \cdot i}{i} \cdot \left(100 \cdot n\right) \]
                            9. Step-by-step derivation
                              1. Applied rewrites83.4%

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

                              if 7.6e15 < i

                              1. Initial program 42.3%

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

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

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

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

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

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

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

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

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

                                \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i \cdot i, \frac{\frac{1}{3} \cdot i + n \cdot \left(\left(\frac{-1}{2} \cdot i + n \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot i\right)\right) - \frac{1}{2}\right)}{\color{blue}{{n}^{2}}}, i\right)}{\frac{i}{n}} \]
                              7. Step-by-step derivation
                                1. Applied rewrites16.8%

                                  \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i \cdot i, \frac{\mathsf{fma}\left(\mathsf{fma}\left(-0.5, i, \mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, i, 0.5\right), n, -0.5\right)\right), n, 0.3333333333333333 \cdot i\right)}{\color{blue}{n \cdot n}}, i\right)}{\frac{i}{n}} \]
                                2. Taylor expanded in i around inf

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

                                    \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i \cdot i, \frac{\mathsf{fma}\left(\mathsf{fma}\left(0.16666666666666666, n, -0.5\right), n, 0.3333333333333333\right)}{n} \cdot \frac{i}{\color{blue}{n}}, i\right)}{\frac{i}{n}} \]
                                  2. Taylor expanded in n around inf

                                    \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i \cdot i, \frac{1}{6} \cdot i, i\right)}{\frac{i}{n}} \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites45.4%

                                      \[\leadsto 100 \cdot \frac{\mathsf{fma}\left(i \cdot i, 0.16666666666666666 \cdot i, i\right)}{\frac{i}{n}} \]
                                  4. Recombined 3 regimes into one program.
                                  5. Add Preprocessing

                                  Alternative 13: 63.7% accurate, 3.2× speedup?

                                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -5.3 \cdot 10^{-148} \lor \neg \left(n \leq 1.65 \cdot 10^{-93}\right):\\ \;\;\;\;\frac{\mathsf{fma}\left(0.5, i, 1\right) \cdot i}{i} \cdot \left(100 \cdot n\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\ \end{array} \end{array} \]
                                  (FPCore (i n)
                                   :precision binary64
                                   (if (or (<= n -5.3e-148) (not (<= n 1.65e-93)))
                                     (* (/ (* (fma 0.5 i 1.0) i) i) (* 100.0 n))
                                     (* (/ (- 1.0 1.0) i) (* n 100.0))))
                                  double code(double i, double n) {
                                  	double tmp;
                                  	if ((n <= -5.3e-148) || !(n <= 1.65e-93)) {
                                  		tmp = ((fma(0.5, i, 1.0) * i) / i) * (100.0 * n);
                                  	} else {
                                  		tmp = ((1.0 - 1.0) / i) * (n * 100.0);
                                  	}
                                  	return tmp;
                                  }
                                  
                                  function code(i, n)
                                  	tmp = 0.0
                                  	if ((n <= -5.3e-148) || !(n <= 1.65e-93))
                                  		tmp = Float64(Float64(Float64(fma(0.5, i, 1.0) * i) / i) * Float64(100.0 * n));
                                  	else
                                  		tmp = Float64(Float64(Float64(1.0 - 1.0) / i) * Float64(n * 100.0));
                                  	end
                                  	return tmp
                                  end
                                  
                                  code[i_, n_] := If[Or[LessEqual[n, -5.3e-148], N[Not[LessEqual[n, 1.65e-93]], $MachinePrecision]], N[(N[(N[(N[(0.5 * i + 1.0), $MachinePrecision] * i), $MachinePrecision] / i), $MachinePrecision] * N[(100.0 * n), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - 1.0), $MachinePrecision] / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision]]
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  \begin{array}{l}
                                  \mathbf{if}\;n \leq -5.3 \cdot 10^{-148} \lor \neg \left(n \leq 1.65 \cdot 10^{-93}\right):\\
                                  \;\;\;\;\frac{\mathsf{fma}\left(0.5, i, 1\right) \cdot i}{i} \cdot \left(100 \cdot n\right)\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 2 regimes
                                  2. if n < -5.29999999999999995e-148 or 1.6500000000000001e-93 < n

                                    1. Initial program 22.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \frac{\mathsf{fma}\left(\frac{1}{2}, i, 1\right) \cdot i}{i} \cdot \left(100 \cdot n\right) \]
                                    9. Step-by-step derivation
                                      1. Applied rewrites63.7%

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

                                      if -5.29999999999999995e-148 < n < 1.6500000000000001e-93

                                      1. Initial program 55.7%

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

                                        \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
                                      4. Step-by-step derivation
                                        1. Applied rewrites66.4%

                                          \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
                                        2. Step-by-step derivation
                                          1. lift-*.f64N/A

                                            \[\leadsto \color{blue}{100 \cdot \frac{1 - 1}{\frac{i}{n}}} \]
                                          2. *-commutativeN/A

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

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

                                            \[\leadsto \frac{1 - 1}{\color{blue}{\frac{i}{n}}} \cdot 100 \]
                                          5. associate-/r/N/A

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

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

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

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

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

                                          \[\leadsto \color{blue}{\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)} \]
                                      5. Recombined 2 regimes into one program.
                                      6. Final simplification64.3%

                                        \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -5.3 \cdot 10^{-148} \lor \neg \left(n \leq 1.65 \cdot 10^{-93}\right):\\ \;\;\;\;\frac{\mathsf{fma}\left(0.5, i, 1\right) \cdot i}{i} \cdot \left(100 \cdot n\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\ \end{array} \]
                                      7. Add Preprocessing

                                      Alternative 14: 62.5% accurate, 3.4× speedup?

                                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq -5.3 \cdot 10^{-148} \lor \neg \left(n \leq 1.65 \cdot 10^{-93}\right):\\ \;\;\;\;100 \cdot \mathsf{fma}\left(\left(0.5 - \frac{0.5}{n}\right) \cdot n, i, n\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\ \end{array} \end{array} \]
                                      (FPCore (i n)
                                       :precision binary64
                                       (if (or (<= n -5.3e-148) (not (<= n 1.65e-93)))
                                         (* 100.0 (fma (* (- 0.5 (/ 0.5 n)) n) i n))
                                         (* (/ (- 1.0 1.0) i) (* n 100.0))))
                                      double code(double i, double n) {
                                      	double tmp;
                                      	if ((n <= -5.3e-148) || !(n <= 1.65e-93)) {
                                      		tmp = 100.0 * fma(((0.5 - (0.5 / n)) * n), i, n);
                                      	} else {
                                      		tmp = ((1.0 - 1.0) / i) * (n * 100.0);
                                      	}
                                      	return tmp;
                                      }
                                      
                                      function code(i, n)
                                      	tmp = 0.0
                                      	if ((n <= -5.3e-148) || !(n <= 1.65e-93))
                                      		tmp = Float64(100.0 * fma(Float64(Float64(0.5 - Float64(0.5 / n)) * n), i, n));
                                      	else
                                      		tmp = Float64(Float64(Float64(1.0 - 1.0) / i) * Float64(n * 100.0));
                                      	end
                                      	return tmp
                                      end
                                      
                                      code[i_, n_] := If[Or[LessEqual[n, -5.3e-148], N[Not[LessEqual[n, 1.65e-93]], $MachinePrecision]], N[(100.0 * N[(N[(N[(0.5 - N[(0.5 / n), $MachinePrecision]), $MachinePrecision] * n), $MachinePrecision] * i + n), $MachinePrecision]), $MachinePrecision], N[(N[(N[(1.0 - 1.0), $MachinePrecision] / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision]]
                                      
                                      \begin{array}{l}
                                      
                                      \\
                                      \begin{array}{l}
                                      \mathbf{if}\;n \leq -5.3 \cdot 10^{-148} \lor \neg \left(n \leq 1.65 \cdot 10^{-93}\right):\\
                                      \;\;\;\;100 \cdot \mathsf{fma}\left(\left(0.5 - \frac{0.5}{n}\right) \cdot n, i, n\right)\\
                                      
                                      \mathbf{else}:\\
                                      \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\
                                      
                                      
                                      \end{array}
                                      \end{array}
                                      
                                      Derivation
                                      1. Split input into 2 regimes
                                      2. if n < -5.29999999999999995e-148 or 1.6500000000000001e-93 < n

                                        1. Initial program 22.0%

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

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

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

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

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

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

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

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

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

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

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

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

                                        if -5.29999999999999995e-148 < n < 1.6500000000000001e-93

                                        1. Initial program 55.7%

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

                                          \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
                                        4. Step-by-step derivation
                                          1. Applied rewrites66.4%

                                            \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
                                          2. Step-by-step derivation
                                            1. lift-*.f64N/A

                                              \[\leadsto \color{blue}{100 \cdot \frac{1 - 1}{\frac{i}{n}}} \]
                                            2. *-commutativeN/A

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

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

                                              \[\leadsto \frac{1 - 1}{\color{blue}{\frac{i}{n}}} \cdot 100 \]
                                            5. associate-/r/N/A

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

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

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

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

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

                                            \[\leadsto \color{blue}{\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)} \]
                                        5. Recombined 2 regimes into one program.
                                        6. Final simplification63.8%

                                          \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -5.3 \cdot 10^{-148} \lor \neg \left(n \leq 1.65 \cdot 10^{-93}\right):\\ \;\;\;\;100 \cdot \mathsf{fma}\left(\left(0.5 - \frac{0.5}{n}\right) \cdot n, i, n\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\ \end{array} \]
                                        7. Add Preprocessing

                                        Alternative 15: 59.3% accurate, 3.9× speedup?

                                        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;i \leq -4.1 \cdot 10^{+39} \lor \neg \left(i \leq 1650000\right):\\ \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot n\\ \end{array} \end{array} \]
                                        (FPCore (i n)
                                         :precision binary64
                                         (if (or (<= i -4.1e+39) (not (<= i 1650000.0)))
                                           (* (/ (- 1.0 1.0) i) (* n 100.0))
                                           (* 100.0 n)))
                                        double code(double i, double n) {
                                        	double tmp;
                                        	if ((i <= -4.1e+39) || !(i <= 1650000.0)) {
                                        		tmp = ((1.0 - 1.0) / i) * (n * 100.0);
                                        	} else {
                                        		tmp = 100.0 * n;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        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
                                            real(8) :: tmp
                                            if ((i <= (-4.1d+39)) .or. (.not. (i <= 1650000.0d0))) then
                                                tmp = ((1.0d0 - 1.0d0) / i) * (n * 100.0d0)
                                            else
                                                tmp = 100.0d0 * n
                                            end if
                                            code = tmp
                                        end function
                                        
                                        public static double code(double i, double n) {
                                        	double tmp;
                                        	if ((i <= -4.1e+39) || !(i <= 1650000.0)) {
                                        		tmp = ((1.0 - 1.0) / i) * (n * 100.0);
                                        	} else {
                                        		tmp = 100.0 * n;
                                        	}
                                        	return tmp;
                                        }
                                        
                                        def code(i, n):
                                        	tmp = 0
                                        	if (i <= -4.1e+39) or not (i <= 1650000.0):
                                        		tmp = ((1.0 - 1.0) / i) * (n * 100.0)
                                        	else:
                                        		tmp = 100.0 * n
                                        	return tmp
                                        
                                        function code(i, n)
                                        	tmp = 0.0
                                        	if ((i <= -4.1e+39) || !(i <= 1650000.0))
                                        		tmp = Float64(Float64(Float64(1.0 - 1.0) / i) * Float64(n * 100.0));
                                        	else
                                        		tmp = Float64(100.0 * n);
                                        	end
                                        	return tmp
                                        end
                                        
                                        function tmp_2 = code(i, n)
                                        	tmp = 0.0;
                                        	if ((i <= -4.1e+39) || ~((i <= 1650000.0)))
                                        		tmp = ((1.0 - 1.0) / i) * (n * 100.0);
                                        	else
                                        		tmp = 100.0 * n;
                                        	end
                                        	tmp_2 = tmp;
                                        end
                                        
                                        code[i_, n_] := If[Or[LessEqual[i, -4.1e+39], N[Not[LessEqual[i, 1650000.0]], $MachinePrecision]], N[(N[(N[(1.0 - 1.0), $MachinePrecision] / i), $MachinePrecision] * N[(n * 100.0), $MachinePrecision]), $MachinePrecision], N[(100.0 * n), $MachinePrecision]]
                                        
                                        \begin{array}{l}
                                        
                                        \\
                                        \begin{array}{l}
                                        \mathbf{if}\;i \leq -4.1 \cdot 10^{+39} \lor \neg \left(i \leq 1650000\right):\\
                                        \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\
                                        
                                        \mathbf{else}:\\
                                        \;\;\;\;100 \cdot n\\
                                        
                                        
                                        \end{array}
                                        \end{array}
                                        
                                        Derivation
                                        1. Split input into 2 regimes
                                        2. if i < -4.10000000000000004e39 or 1.65e6 < i

                                          1. Initial program 54.8%

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

                                            \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
                                          4. Step-by-step derivation
                                            1. Applied rewrites28.4%

                                              \[\leadsto 100 \cdot \frac{\color{blue}{1} - 1}{\frac{i}{n}} \]
                                            2. Step-by-step derivation
                                              1. lift-*.f64N/A

                                                \[\leadsto \color{blue}{100 \cdot \frac{1 - 1}{\frac{i}{n}}} \]
                                              2. *-commutativeN/A

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

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

                                                \[\leadsto \frac{1 - 1}{\color{blue}{\frac{i}{n}}} \cdot 100 \]
                                              5. associate-/r/N/A

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

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

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

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

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

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

                                            if -4.10000000000000004e39 < i < 1.65e6

                                            1. Initial program 10.5%

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

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

                                                \[\leadsto \color{blue}{100 \cdot n} \]
                                            5. Applied rewrites83.3%

                                              \[\leadsto \color{blue}{100 \cdot n} \]
                                          5. Recombined 2 regimes into one program.
                                          6. Final simplification59.9%

                                            \[\leadsto \begin{array}{l} \mathbf{if}\;i \leq -4.1 \cdot 10^{+39} \lor \neg \left(i \leq 1650000\right):\\ \;\;\;\;\frac{1 - 1}{i} \cdot \left(n \cdot 100\right)\\ \mathbf{else}:\\ \;\;\;\;100 \cdot n\\ \end{array} \]
                                          7. Add Preprocessing

                                          Alternative 16: 49.6% accurate, 24.3× speedup?

                                          \[\begin{array}{l} \\ 100 \cdot n \end{array} \]
                                          (FPCore (i n) :precision binary64 (* 100.0 n))
                                          double code(double i, double n) {
                                          	return 100.0 * 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 * n
                                          end function
                                          
                                          public static double code(double i, double n) {
                                          	return 100.0 * n;
                                          }
                                          
                                          def code(i, n):
                                          	return 100.0 * n
                                          
                                          function code(i, n)
                                          	return Float64(100.0 * n)
                                          end
                                          
                                          function tmp = code(i, n)
                                          	tmp = 100.0 * n;
                                          end
                                          
                                          code[i_, n_] := N[(100.0 * n), $MachinePrecision]
                                          
                                          \begin{array}{l}
                                          
                                          \\
                                          100 \cdot n
                                          \end{array}
                                          
                                          Derivation
                                          1. Initial program 29.4%

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

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

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

                                            \[\leadsto \color{blue}{100 \cdot n} \]
                                          6. Add Preprocessing

                                          Developer Target 1: 34.2% accurate, 0.5× speedup?

                                          \[\begin{array}{l} \\ \begin{array}{l} t_0 := 1 + \frac{i}{n}\\ 100 \cdot \frac{e^{n \cdot \begin{array}{l} \mathbf{if}\;t\_0 = 1:\\ \;\;\;\;\frac{i}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{i}{n} \cdot \log t\_0}{\left(\frac{i}{n} + 1\right) - 1}\\ \end{array}} - 1}{\frac{i}{n}} \end{array} \end{array} \]
                                          (FPCore (i n)
                                           :precision binary64
                                           (let* ((t_0 (+ 1.0 (/ i n))))
                                             (*
                                              100.0
                                              (/
                                               (-
                                                (exp
                                                 (*
                                                  n
                                                  (if (== t_0 1.0)
                                                    (/ i n)
                                                    (/ (* (/ i n) (log t_0)) (- (+ (/ i n) 1.0) 1.0)))))
                                                1.0)
                                               (/ i n)))))
                                          double code(double i, double n) {
                                          	double t_0 = 1.0 + (i / n);
                                          	double tmp;
                                          	if (t_0 == 1.0) {
                                          		tmp = i / n;
                                          	} else {
                                          		tmp = ((i / n) * log(t_0)) / (((i / n) + 1.0) - 1.0);
                                          	}
                                          	return 100.0 * ((exp((n * tmp)) - 1.0) / (i / n));
                                          }
                                          
                                          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
                                              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 2025017 
                                          (FPCore (i n)
                                            :name "Compound Interest"
                                            :precision binary64
                                          
                                            :alt
                                            (! :herbie-platform default (let ((lnbase (if (== (+ 1 (/ i n)) 1) (/ i n) (/ (* (/ i n) (log (+ 1 (/ i n)))) (- (+ (/ i n) 1) 1))))) (* 100 (/ (- (exp (* n lnbase)) 1) (/ i n)))))
                                          
                                            (* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))