100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\begin{array}{l}
\mathbf{if}\;n \le -1.1051279060415901 \cdot 10^{+112}:\\
\;\;\;\;\left(n \cdot \frac{\left(\left(i \cdot i\right) \cdot \frac{1}{2} + \left(\log \left(\sqrt[3]{e^{\left(i \cdot \left(i \cdot i\right)\right) \cdot \frac{1}{6}}} \cdot \sqrt[3]{e^{\left(i \cdot \left(i \cdot i\right)\right) \cdot \frac{1}{6}}}\right) + \log \left(\sqrt[3]{e^{\left(i \cdot \left(i \cdot i\right)\right) \cdot \frac{1}{6}}}\right)\right)\right) + i}{i}\right) \cdot 100\\
\mathbf{elif}\;n \le -1.0933259526011947 \cdot 10^{+64}:\\
\;\;\;\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}} \cdot \frac{100}{i}\\
\mathbf{elif}\;n \le -0.13295556128930017:\\
\;\;\;\;\left(n \cdot \frac{\left(\log \left(\sqrt{e^{\left(i \cdot \left(i \cdot i\right)\right) \cdot \frac{1}{6}}}\right) + \left(\left(i \cdot i\right) \cdot \frac{1}{2} + \log \left(\sqrt{e^{\left(i \cdot \left(i \cdot i\right)\right) \cdot \frac{1}{6}}}\right)\right)\right) + i}{i}\right) \cdot 100\\
\mathbf{elif}\;n \le 4.420752440477652 \cdot 10^{-89}:\\
\;\;\;\;0\\
\mathbf{else}:\\
\;\;\;\;\left(n \cdot \frac{\left(\log \left(\sqrt{e^{\left(i \cdot \left(i \cdot i\right)\right) \cdot \frac{1}{6}}}\right) + \left(\left(i \cdot i\right) \cdot \frac{1}{2} + \log \left(\sqrt{e^{\left(i \cdot \left(i \cdot i\right)\right) \cdot \frac{1}{6}}}\right)\right)\right) + i}{i}\right) \cdot 100\\
\end{array}double f(double i, double n) {
double r2111051 = 100.0;
double r2111052 = 1.0;
double r2111053 = i;
double r2111054 = n;
double r2111055 = r2111053 / r2111054;
double r2111056 = r2111052 + r2111055;
double r2111057 = pow(r2111056, r2111054);
double r2111058 = r2111057 - r2111052;
double r2111059 = r2111058 / r2111055;
double r2111060 = r2111051 * r2111059;
return r2111060;
}
double f(double i, double n) {
double r2111061 = n;
double r2111062 = -1.1051279060415901e+112;
bool r2111063 = r2111061 <= r2111062;
double r2111064 = i;
double r2111065 = r2111064 * r2111064;
double r2111066 = 0.5;
double r2111067 = r2111065 * r2111066;
double r2111068 = r2111064 * r2111065;
double r2111069 = 0.16666666666666666;
double r2111070 = r2111068 * r2111069;
double r2111071 = exp(r2111070);
double r2111072 = cbrt(r2111071);
double r2111073 = r2111072 * r2111072;
double r2111074 = log(r2111073);
double r2111075 = log(r2111072);
double r2111076 = r2111074 + r2111075;
double r2111077 = r2111067 + r2111076;
double r2111078 = r2111077 + r2111064;
double r2111079 = r2111078 / r2111064;
double r2111080 = r2111061 * r2111079;
double r2111081 = 100.0;
double r2111082 = r2111080 * r2111081;
double r2111083 = -1.0933259526011947e+64;
bool r2111084 = r2111061 <= r2111083;
double r2111085 = 1.0;
double r2111086 = r2111064 / r2111061;
double r2111087 = r2111085 + r2111086;
double r2111088 = pow(r2111087, r2111061);
double r2111089 = r2111088 - r2111085;
double r2111090 = r2111085 / r2111061;
double r2111091 = r2111089 / r2111090;
double r2111092 = r2111081 / r2111064;
double r2111093 = r2111091 * r2111092;
double r2111094 = -0.13295556128930017;
bool r2111095 = r2111061 <= r2111094;
double r2111096 = sqrt(r2111071);
double r2111097 = log(r2111096);
double r2111098 = r2111067 + r2111097;
double r2111099 = r2111097 + r2111098;
double r2111100 = r2111099 + r2111064;
double r2111101 = r2111100 / r2111064;
double r2111102 = r2111061 * r2111101;
double r2111103 = r2111102 * r2111081;
double r2111104 = 4.420752440477652e-89;
bool r2111105 = r2111061 <= r2111104;
double r2111106 = 0.0;
double r2111107 = r2111105 ? r2111106 : r2111103;
double r2111108 = r2111095 ? r2111103 : r2111107;
double r2111109 = r2111084 ? r2111093 : r2111108;
double r2111110 = r2111063 ? r2111082 : r2111109;
return r2111110;
}




Bits error versus i




Bits error versus n
Results
| Original | 42.6 |
|---|---|
| Target | 42.3 |
| Herbie | 21.9 |
if n < -1.1051279060415901e+112Initial program 51.0
Taylor expanded around 0 48.3
Simplified48.3
rmApplied associate-/r/25.2
rmApplied add-log-exp25.3
rmApplied add-cube-cbrt25.3
Applied log-prod25.3
if -1.1051279060415901e+112 < n < -1.0933259526011947e+64Initial program 35.7
rmApplied div-inv35.7
Applied *-un-lft-identity35.7
Applied times-frac35.5
Applied associate-*r*35.6
Simplified35.5
if -1.0933259526011947e+64 < n < -0.13295556128930017 or 4.420752440477652e-89 < n Initial program 54.4
Taylor expanded around 0 32.3
Simplified32.3
rmApplied associate-/r/17.9
rmApplied add-log-exp18.1
rmApplied add-sqr-sqrt18.1
Applied log-prod18.1
Applied associate-+r+18.1
if -0.13295556128930017 < n < 4.420752440477652e-89Initial program 28.2
Taylor expanded around 0 21.7
Final simplification21.9
herbie shell --seed 2019153
(FPCore (i n)
:name "Compound Interest"
:herbie-target
(* 100 (/ (- (exp (* n (if (== (+ 1 (/ i n)) 1) (/ i n) (/ (* (/ i n) (log (+ 1 (/ i n)))) (- (+ (/ i n) 1) 1))))) 1) (/ i n)))
(* 100 (/ (- (pow (+ 1 (/ i n)) n) 1) (/ i n))))