?

Average Error: 75.07% → 21.45%
Time: 17.8s
Precision: binary64
Cost: 13768

?

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

\mathbf{elif}\;n \leq 3 \cdot 10^{-280}:\\
\;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(n \cdot \log \left(\frac{i}{n}\right)\right)}{i}\right)\\

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

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Target

Original75.07%
Target74.01%
Herbie21.45%
\[100 \cdot \frac{e^{n \cdot \begin{array}{l} \mathbf{if}\;1 + \frac{i}{n} = 1:\\ \;\;\;\;\frac{i}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{i}{n} \cdot \log \left(1 + \frac{i}{n}\right)}{\left(\frac{i}{n} + 1\right) - 1}\\ \end{array}} - 1}{\frac{i}{n}} \]

Derivation?

  1. Split input into 4 regimes
  2. if n < -5.4999999999999998e-110

    1. Initial program 72.95

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

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

      [Start]72.95

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

      associate-/r/ [=>]72.72

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

      *-commutative [=>]72.72

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

      *-rgt-identity [<=]72.72

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

      associate-*l* [=>]72.72

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

      *-lft-identity [=>]72.72

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

      sub-neg [=>]72.72

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

      metadata-eval [=>]72.72

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

      \[\leadsto \color{blue}{100 \cdot \frac{n \cdot \left(e^{i} - 1\right)}{i}} \]
    4. Simplified19.75

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

      [Start]71.96

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

      associate-*r/ [=>]72.04

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

      associate-/l* [=>]71.79

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

      expm1-def [=>]19.75

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

    if -5.4999999999999998e-110 < n < 2.99999999999999987e-280

    1. Initial program 44.36

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

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

      [Start]44.36

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

      associate-/r/ [=>]45.28

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

      *-commutative [=>]45.28

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

      *-rgt-identity [<=]45.28

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

      associate-*l* [=>]45.28

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

      *-lft-identity [=>]45.28

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

      sub-neg [=>]45.28

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

      metadata-eval [=>]45.28

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

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

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

      [Start]50.82

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

      expm1-def [=>]39.52

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

      +-commutative [=>]39.52

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

      mul-1-neg [=>]39.52

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

      unsub-neg [=>]39.52

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

      distribute-neg-frac [=>]39.52

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

      metadata-eval [=>]39.52

      \[ 100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(n \cdot \left(\log \left(\frac{\color{blue}{-1}}{n}\right) - \log \left(\frac{-1}{i}\right)\right)\right)}{i}\right) \]
    5. Applied egg-rr34.43

      \[\leadsto 100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(n \cdot \color{blue}{\left(0 + \log \left(\frac{1}{n} \cdot i\right)\right)}\right)}{i}\right) \]
    6. Simplified34.35

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

      [Start]34.43

      \[ 100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(n \cdot \left(0 + \log \left(\frac{1}{n} \cdot i\right)\right)\right)}{i}\right) \]

      +-lft-identity [=>]34.43

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

      associate-*l/ [=>]34.35

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

      *-lft-identity [=>]34.35

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

    if 2.99999999999999987e-280 < n < 6.00000000000000054e-42

    1. Initial program 77.21

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

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

      [Start]77.21

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

      associate-/r/ [=>]77.21

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

      *-commutative [=>]77.21

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

      *-rgt-identity [<=]77.21

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

      associate-*l* [=>]77.21

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

      *-lft-identity [=>]77.21

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

      sub-neg [=>]77.21

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

      metadata-eval [=>]77.21

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

      \[\leadsto 100 \cdot \left(n \cdot \frac{\color{blue}{e^{i} - 1}}{i}\right) \]
    4. Simplified58.82

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

      [Start]90.42

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

      expm1-def [=>]58.82

      \[ 100 \cdot \left(n \cdot \frac{\color{blue}{\mathsf{expm1}\left(i\right)}}{i}\right) \]
    5. Applied egg-rr58.89

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

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

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

      [Start]38.28

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

      *-commutative [=>]38.28

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

    if 6.00000000000000054e-42 < n

    1. Initial program 94.7

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

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

      [Start]94.7

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

      associate-/r/ [=>]94.11

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

      *-commutative [=>]94.11

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

      *-rgt-identity [<=]94.11

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

      associate-*l* [=>]94.11

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

      *-lft-identity [=>]94.11

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

      sub-neg [=>]94.11

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

      metadata-eval [=>]94.11

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

      \[\leadsto 100 \cdot \left(n \cdot \frac{\color{blue}{e^{i} - 1}}{i}\right) \]
    4. Simplified5.54

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

      [Start]78.62

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

      expm1-def [=>]5.54

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -5.5 \cdot 10^{-110}:\\ \;\;\;\;\frac{100}{\frac{i}{n \cdot \mathsf{expm1}\left(i\right)}}\\ \mathbf{elif}\;n \leq 3 \cdot 10^{-280}:\\ \;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(n \cdot \log \left(\frac{i}{n}\right)\right)}{i}\right)\\ \mathbf{elif}\;n \leq 6 \cdot 10^{-42}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \end{array} \]

Alternatives

Alternative 1
Error17.83%
Cost21768
\[\begin{array}{l} t_0 := {\left(\frac{i}{n} + 1\right)}^{n} + -1\\ t_1 := \frac{t_0}{\frac{i}{n}}\\ \mathbf{if}\;t_1 \leq 0:\\ \;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \mathbf{elif}\;t_1 \leq 10000000000:\\ \;\;\;\;\frac{n \cdot t_0}{\frac{i}{100}}\\ \mathbf{else}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \end{array} \]
Alternative 2
Error17.91%
Cost21640
\[\begin{array}{l} t_0 := \frac{{\left(\frac{i}{n} + 1\right)}^{n} + -1}{\frac{i}{n}}\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \mathbf{elif}\;t_0 \leq 10000000000:\\ \;\;\;\;100 \cdot \left(n \cdot \frac{-1 + {\left(\frac{i}{n}\right)}^{n}}{i}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \end{array} \]
Alternative 3
Error19.59%
Cost7244
\[\begin{array}{l} t_0 := 100 \cdot \left(n \cdot \frac{\mathsf{expm1}\left(i\right)}{i}\right)\\ \mathbf{if}\;n \leq -1.95 \cdot 10^{-181}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;n \leq 3.6 \cdot 10^{-265}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{elif}\;n \leq 6 \cdot 10^{-42}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error30.53%
Cost836
\[\begin{array}{l} \mathbf{if}\;n \leq -1.95 \cdot 10^{-181}:\\ \;\;\;\;\frac{100}{\frac{1}{n} + \frac{i}{n} \cdot -0.5}\\ \mathbf{elif}\;n \leq 3.6 \cdot 10^{-265}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \end{array} \]
Alternative 5
Error30.61%
Cost713
\[\begin{array}{l} \mathbf{if}\;n \leq -2.3 \cdot 10^{-181} \lor \neg \left(n \leq 2 \cdot 10^{-265}\right):\\ \;\;\;\;\frac{n}{0.01 + i \cdot -0.005}\\ \mathbf{else}:\\ \;\;\;\;\frac{0}{\frac{i}{n}}\\ \end{array} \]
Alternative 6
Error42.11%
Cost712
\[\begin{array}{l} \mathbf{if}\;n \leq -2.7 \cdot 10^{-241}:\\ \;\;\;\;n \cdot 100\\ \mathbf{elif}\;n \leq 1.1 \cdot 10^{-265}:\\ \;\;\;\;n \cdot \left(\left(i \cdot i\right) \cdot 16.666666666666668\right)\\ \mathbf{else}:\\ \;\;\;\;n \cdot 100\\ \end{array} \]
Alternative 7
Error42.3%
Cost712
\[\begin{array}{l} \mathbf{if}\;n \leq -1 \cdot 10^{-248}:\\ \;\;\;\;n \cdot 100\\ \mathbf{elif}\;n \leq 3.6 \cdot 10^{-265}:\\ \;\;\;\;n \cdot \left(\left(i \cdot i\right) \cdot 16.666666666666668\right)\\ \mathbf{else}:\\ \;\;\;\;n \cdot 100 + i \cdot -50\\ \end{array} \]
Alternative 8
Error42.42%
Cost712
\[\begin{array}{l} \mathbf{if}\;n \leq -2.35 \cdot 10^{-276}:\\ \;\;\;\;n \cdot 100\\ \mathbf{elif}\;n \leq 3.1 \cdot 10^{-266}:\\ \;\;\;\;\frac{100}{\frac{i}{n \cdot i}}\\ \mathbf{else}:\\ \;\;\;\;n \cdot 100 + i \cdot -50\\ \end{array} \]
Alternative 9
Error42.34%
Cost584
\[\begin{array}{l} \mathbf{if}\;n \leq -1.35 \cdot 10^{-277}:\\ \;\;\;\;n \cdot 100\\ \mathbf{elif}\;n \leq 2.7 \cdot 10^{-267}:\\ \;\;\;\;\left(n \cdot i\right) \cdot 50\\ \mathbf{else}:\\ \;\;\;\;n \cdot 100\\ \end{array} \]
Alternative 10
Error32.83%
Cost448
\[\frac{n}{0.01 + i \cdot -0.005} \]
Alternative 11
Error43.56%
Cost192
\[n \cdot 100 \]

Error

Reproduce?

herbie shell --seed 2023121 
(FPCore (i n)
  :name "Compound Interest"
  :precision binary64

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

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