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(\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) + \left(i \cdot i\right) \cdot \frac{1}{2}\right) + \log \left(\sqrt[3]{e^{\left(i \cdot \left(i \cdot i\right)\right) \cdot \frac{1}{6}}}\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 r2469670 = 100.0;
double r2469671 = 1.0;
double r2469672 = i;
double r2469673 = n;
double r2469674 = r2469672 / r2469673;
double r2469675 = r2469671 + r2469674;
double r2469676 = pow(r2469675, r2469673);
double r2469677 = r2469676 - r2469671;
double r2469678 = r2469677 / r2469674;
double r2469679 = r2469670 * r2469678;
return r2469679;
}
double f(double i, double n) {
double r2469680 = n;
double r2469681 = -1.1051279060415901e+112;
bool r2469682 = r2469680 <= r2469681;
double r2469683 = i;
double r2469684 = r2469683 * r2469683;
double r2469685 = r2469683 * r2469684;
double r2469686 = 0.16666666666666666;
double r2469687 = r2469685 * r2469686;
double r2469688 = exp(r2469687);
double r2469689 = cbrt(r2469688);
double r2469690 = r2469689 * r2469689;
double r2469691 = log(r2469690);
double r2469692 = 0.5;
double r2469693 = r2469684 * r2469692;
double r2469694 = r2469691 + r2469693;
double r2469695 = log(r2469689);
double r2469696 = r2469694 + r2469695;
double r2469697 = r2469696 + r2469683;
double r2469698 = r2469697 / r2469683;
double r2469699 = r2469680 * r2469698;
double r2469700 = 100.0;
double r2469701 = r2469699 * r2469700;
double r2469702 = -1.0933259526011947e+64;
bool r2469703 = r2469680 <= r2469702;
double r2469704 = 1.0;
double r2469705 = r2469683 / r2469680;
double r2469706 = r2469704 + r2469705;
double r2469707 = pow(r2469706, r2469680);
double r2469708 = r2469707 - r2469704;
double r2469709 = r2469704 / r2469680;
double r2469710 = r2469708 / r2469709;
double r2469711 = r2469700 / r2469683;
double r2469712 = r2469710 * r2469711;
double r2469713 = -0.13295556128930017;
bool r2469714 = r2469680 <= r2469713;
double r2469715 = sqrt(r2469688);
double r2469716 = log(r2469715);
double r2469717 = r2469693 + r2469716;
double r2469718 = r2469716 + r2469717;
double r2469719 = r2469718 + r2469683;
double r2469720 = r2469719 / r2469683;
double r2469721 = r2469680 * r2469720;
double r2469722 = r2469721 * r2469700;
double r2469723 = 4.420752440477652e-89;
bool r2469724 = r2469680 <= r2469723;
double r2469725 = 0.0;
double r2469726 = r2469724 ? r2469725 : r2469722;
double r2469727 = r2469714 ? r2469722 : r2469726;
double r2469728 = r2469703 ? r2469712 : r2469727;
double r2469729 = r2469682 ? r2469701 : r2469728;
return r2469729;
}




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
Applied associate-+r+25.3
if -1.1051279060415901e+112 < n < -1.0933259526011947e+64Initial program 35.7
rmApplied div-inv35.7
Applied *-un-lft-identity35.7
Applied *-un-lft-identity35.7
Applied distribute-lft-out--35.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))))