100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\begin{array}{l}
\mathbf{if}\;n \le -6.246516767500982 \cdot 10^{+112}:\\
\;\;\;\;\frac{\mathsf{fma}\left(50, i \cdot i, \mathsf{fma}\left(\frac{50}{3} \cdot i, i \cdot i, i \cdot 100\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;n \le -1.0933259526011947 \cdot 10^{+64}:\\
\;\;\;\;\frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i} \cdot n\\
\mathbf{elif}\;n \le -0.13295556128930017:\\
\;\;\;\;\frac{\mathsf{fma}\left(50, i \cdot i, \mathsf{fma}\left(\frac{50}{3} \cdot i, i \cdot i, i \cdot 100\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;n \le -1.7065727457962 \cdot 10^{-312}:\\
\;\;\;\;\frac{1}{i} \cdot \left(\mathsf{fma}\left(100, e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, -100\right) \cdot n\right)\\
\mathbf{elif}\;n \le 5.811229823508011 \cdot 10^{-78}:\\
\;\;\;\;\frac{\mathsf{fma}\left(50 \cdot \left(n \cdot n\right), \log n \cdot \log n, \mathsf{fma}\left(\left(\left(n \cdot n\right) \cdot n\right) \cdot \frac{50}{3}, \log i \cdot \left(\log i \cdot \log i\right), \mathsf{fma}\left(n \cdot \log i, 100, \mathsf{fma}\left(\frac{100}{3}, \left(\log n \cdot \log n\right) \cdot \left(\log i \cdot \left(\left(n \cdot n\right) \cdot n\right)\right), \mathsf{fma}\left(\frac{50}{3}, \left(\log n \cdot \log n\right) \cdot \left(\log i \cdot \left(\left(n \cdot n\right) \cdot n\right)\right), \left(\log i \cdot \log i\right) \cdot \left(50 \cdot \left(n \cdot n\right)\right)\right)\right)\right)\right)\right) - \mathsf{fma}\left(\left(\left(n \cdot n\right) \cdot n\right) \cdot \frac{100}{3}, \log n \cdot \left(\log i \cdot \log i\right), \mathsf{fma}\left(50 \cdot \left(n \cdot n\right), \log n \cdot \log i, \mathsf{fma}\left(50 \cdot \left(n \cdot n\right), \log n \cdot \log i, \left(n \cdot 100\right) \cdot \log n + \left(\left(\left(n \cdot n\right) \cdot n\right) \cdot \frac{50}{3}\right) \cdot \left(\log n \cdot \left(\log i \cdot \log i\right) + \left(\log n \cdot \log n\right) \cdot \log n\right)\right)\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;n \le 2.5555363937413246 \cdot 10^{+221}:\\
\;\;\;\;\frac{\mathsf{fma}\left(50, i \cdot i, \mathsf{fma}\left(\frac{50}{3} \cdot i, i \cdot i, i \cdot 100\right)\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt[3]{\mathsf{fma}\left(100, e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, -100\right)} \cdot \sqrt[3]{\mathsf{fma}\left(100, e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, -100\right)}}{\sqrt[3]{\frac{i}{n}} \cdot \left(\sqrt[3]{\sqrt[3]{\frac{i}{n}} \cdot \sqrt[3]{\frac{i}{n}}} \cdot \sqrt[3]{\sqrt[3]{\sqrt[3]{\frac{i}{n}}} \cdot \left(\sqrt[3]{\sqrt[3]{\frac{i}{n}}} \cdot \sqrt[3]{\sqrt[3]{\frac{i}{n}}}\right)}\right)} \cdot \frac{\sqrt[3]{\mathsf{fma}\left(100, e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, -100\right)}}{\sqrt[3]{\frac{i}{n}}}\\
\end{array}double f(double i, double n) {
double r2164698 = 100.0;
double r2164699 = 1.0;
double r2164700 = i;
double r2164701 = n;
double r2164702 = r2164700 / r2164701;
double r2164703 = r2164699 + r2164702;
double r2164704 = pow(r2164703, r2164701);
double r2164705 = r2164704 - r2164699;
double r2164706 = r2164705 / r2164702;
double r2164707 = r2164698 * r2164706;
return r2164707;
}
double f(double i, double n) {
double r2164708 = n;
double r2164709 = -6.246516767500982e+112;
bool r2164710 = r2164708 <= r2164709;
double r2164711 = 50.0;
double r2164712 = i;
double r2164713 = r2164712 * r2164712;
double r2164714 = 16.666666666666668;
double r2164715 = r2164714 * r2164712;
double r2164716 = 100.0;
double r2164717 = r2164712 * r2164716;
double r2164718 = fma(r2164715, r2164713, r2164717);
double r2164719 = fma(r2164711, r2164713, r2164718);
double r2164720 = r2164712 / r2164708;
double r2164721 = r2164719 / r2164720;
double r2164722 = -1.0933259526011947e+64;
bool r2164723 = r2164708 <= r2164722;
double r2164724 = 1.0;
double r2164725 = r2164724 + r2164720;
double r2164726 = pow(r2164725, r2164708);
double r2164727 = -100.0;
double r2164728 = fma(r2164716, r2164726, r2164727);
double r2164729 = r2164728 / r2164712;
double r2164730 = r2164729 * r2164708;
double r2164731 = -0.13295556128930017;
bool r2164732 = r2164708 <= r2164731;
double r2164733 = -1.7065727457962e-312;
bool r2164734 = r2164708 <= r2164733;
double r2164735 = r2164724 / r2164712;
double r2164736 = log1p(r2164720);
double r2164737 = r2164708 * r2164736;
double r2164738 = exp(r2164737);
double r2164739 = fma(r2164716, r2164738, r2164727);
double r2164740 = r2164739 * r2164708;
double r2164741 = r2164735 * r2164740;
double r2164742 = 5.811229823508011e-78;
bool r2164743 = r2164708 <= r2164742;
double r2164744 = r2164708 * r2164708;
double r2164745 = r2164711 * r2164744;
double r2164746 = log(r2164708);
double r2164747 = r2164746 * r2164746;
double r2164748 = r2164744 * r2164708;
double r2164749 = r2164748 * r2164714;
double r2164750 = log(r2164712);
double r2164751 = r2164750 * r2164750;
double r2164752 = r2164750 * r2164751;
double r2164753 = r2164708 * r2164750;
double r2164754 = 33.333333333333336;
double r2164755 = r2164750 * r2164748;
double r2164756 = r2164747 * r2164755;
double r2164757 = r2164751 * r2164745;
double r2164758 = fma(r2164714, r2164756, r2164757);
double r2164759 = fma(r2164754, r2164756, r2164758);
double r2164760 = fma(r2164753, r2164716, r2164759);
double r2164761 = fma(r2164749, r2164752, r2164760);
double r2164762 = fma(r2164745, r2164747, r2164761);
double r2164763 = r2164748 * r2164754;
double r2164764 = r2164746 * r2164751;
double r2164765 = r2164746 * r2164750;
double r2164766 = r2164708 * r2164716;
double r2164767 = r2164766 * r2164746;
double r2164768 = r2164747 * r2164746;
double r2164769 = r2164764 + r2164768;
double r2164770 = r2164749 * r2164769;
double r2164771 = r2164767 + r2164770;
double r2164772 = fma(r2164745, r2164765, r2164771);
double r2164773 = fma(r2164745, r2164765, r2164772);
double r2164774 = fma(r2164763, r2164764, r2164773);
double r2164775 = r2164762 - r2164774;
double r2164776 = r2164775 / r2164720;
double r2164777 = 2.5555363937413246e+221;
bool r2164778 = r2164708 <= r2164777;
double r2164779 = cbrt(r2164739);
double r2164780 = r2164779 * r2164779;
double r2164781 = cbrt(r2164720);
double r2164782 = r2164781 * r2164781;
double r2164783 = cbrt(r2164782);
double r2164784 = cbrt(r2164781);
double r2164785 = r2164784 * r2164784;
double r2164786 = r2164784 * r2164785;
double r2164787 = cbrt(r2164786);
double r2164788 = r2164783 * r2164787;
double r2164789 = r2164781 * r2164788;
double r2164790 = r2164780 / r2164789;
double r2164791 = r2164779 / r2164781;
double r2164792 = r2164790 * r2164791;
double r2164793 = r2164778 ? r2164721 : r2164792;
double r2164794 = r2164743 ? r2164776 : r2164793;
double r2164795 = r2164734 ? r2164741 : r2164794;
double r2164796 = r2164732 ? r2164721 : r2164795;
double r2164797 = r2164723 ? r2164730 : r2164796;
double r2164798 = r2164710 ? r2164721 : r2164797;
return r2164798;
}




Bits error versus i




Bits error versus n
| Original | 42.6 |
|---|---|
| Target | 42.3 |
| Herbie | 29.6 |
if n < -6.246516767500982e+112 or -1.0933259526011947e+64 < n < -0.13295556128930017 or 5.811229823508011e-78 < n < 2.5555363937413246e+221Initial program 52.3
Simplified52.3
Taylor expanded around 0 36.0
Simplified36.0
if -6.246516767500982e+112 < n < -1.0933259526011947e+64Initial program 35.9
Simplified35.9
rmApplied associate-/r/35.8
if -0.13295556128930017 < n < -1.7065727457962e-312Initial program 16.5
Simplified16.5
rmApplied add-exp-log16.5
Applied pow-exp16.5
Simplified16.5
rmApplied div-inv16.5
Applied *-un-lft-identity16.5
Applied times-frac17.2
Simplified17.2
if -1.7065727457962e-312 < n < 5.811229823508011e-78Initial program 46.8
Simplified46.8
rmApplied add-exp-log46.8
Applied pow-exp46.8
Simplified46.8
Taylor expanded around 0 20.9
Simplified20.9
if 2.5555363937413246e+221 < n Initial program 59.6
Simplified59.6
rmApplied add-exp-log59.6
Applied pow-exp59.6
Simplified41.5
rmApplied add-cube-cbrt41.8
Applied add-cube-cbrt41.7
Applied times-frac41.7
rmApplied add-cube-cbrt41.8
Applied cbrt-prod41.8
rmApplied add-cube-cbrt41.8
Final simplification29.6
herbie shell --seed 2019153 +o rules:numerics
(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))))