100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\begin{array}{l}
\mathbf{if}\;i \le -0.09568466101685804692245085334434406831861:\\
\;\;\;\;\frac{100 \cdot \left({\left(\frac{i}{n}\right)}^{n} - 1\right)}{\frac{i}{n}}\\
\mathbf{elif}\;i \le 6.433403710498657594142250154269082661313 \cdot 10^{46}:\\
\;\;\;\;\left(\left(\frac{100}{i} \cdot \sqrt[3]{\left(\left(1 \cdot i + \left(0.5 \cdot {i}^{2} + \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)\right) \cdot n}\right) \cdot \sqrt[3]{\left(\left(1 \cdot i + \left(0.5 \cdot {i}^{2} + \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)\right) \cdot n}\right) \cdot \sqrt[3]{\frac{\left(1 \cdot i + \left(0.5 \cdot {i}^{2} + \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}{\frac{1}{n}}}\\
\mathbf{elif}\;i \le 1.353418716849568981322833055613312096611 \cdot 10^{183}:\\
\;\;\;\;100 \cdot \frac{n \cdot \left({\left(\frac{i}{n}\right)}^{n} - 1\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{\left(1 \cdot i + \left(\log 1 \cdot n + 1\right)\right) - 1}{\frac{i}{n}}\\
\end{array}double f(double i, double n) {
double r119209 = 100.0;
double r119210 = 1.0;
double r119211 = i;
double r119212 = n;
double r119213 = r119211 / r119212;
double r119214 = r119210 + r119213;
double r119215 = pow(r119214, r119212);
double r119216 = r119215 - r119210;
double r119217 = r119216 / r119213;
double r119218 = r119209 * r119217;
return r119218;
}
double f(double i, double n) {
double r119219 = i;
double r119220 = -0.09568466101685805;
bool r119221 = r119219 <= r119220;
double r119222 = 100.0;
double r119223 = n;
double r119224 = r119219 / r119223;
double r119225 = pow(r119224, r119223);
double r119226 = 1.0;
double r119227 = r119225 - r119226;
double r119228 = r119222 * r119227;
double r119229 = r119228 / r119224;
double r119230 = 6.433403710498658e+46;
bool r119231 = r119219 <= r119230;
double r119232 = r119222 / r119219;
double r119233 = r119226 * r119219;
double r119234 = 0.5;
double r119235 = 2.0;
double r119236 = pow(r119219, r119235);
double r119237 = r119234 * r119236;
double r119238 = log(r119226);
double r119239 = r119238 * r119223;
double r119240 = r119237 + r119239;
double r119241 = r119233 + r119240;
double r119242 = r119236 * r119238;
double r119243 = r119234 * r119242;
double r119244 = r119241 - r119243;
double r119245 = r119244 * r119223;
double r119246 = cbrt(r119245);
double r119247 = r119232 * r119246;
double r119248 = r119247 * r119246;
double r119249 = 1.0;
double r119250 = r119249 / r119223;
double r119251 = r119244 / r119250;
double r119252 = cbrt(r119251);
double r119253 = r119248 * r119252;
double r119254 = 1.353418716849569e+183;
bool r119255 = r119219 <= r119254;
double r119256 = r119223 * r119227;
double r119257 = r119256 / r119219;
double r119258 = r119222 * r119257;
double r119259 = r119239 + r119249;
double r119260 = r119233 + r119259;
double r119261 = r119260 - r119226;
double r119262 = r119261 / r119224;
double r119263 = r119222 * r119262;
double r119264 = r119255 ? r119258 : r119263;
double r119265 = r119231 ? r119253 : r119264;
double r119266 = r119221 ? r119229 : r119265;
return r119266;
}




Bits error versus i




Bits error versus n
Results
| Original | 42.6 |
|---|---|
| Target | 42.1 |
| Herbie | 20.1 |
if i < -0.09568466101685805Initial program 28.6
rmApplied div-inv28.6
Applied *-un-lft-identity28.6
Applied times-frac29.3
Applied associate-*r*29.3
Simplified29.3
Taylor expanded around inf 64.0
Simplified18.7
if -0.09568466101685805 < i < 6.433403710498658e+46Initial program 49.5
rmApplied div-inv49.5
Applied *-un-lft-identity49.5
Applied times-frac49.2
Applied associate-*r*49.2
Simplified49.2
Taylor expanded around 0 17.8
rmApplied add-cube-cbrt18.4
Applied associate-*r*18.4
Simplified18.4
if 6.433403710498658e+46 < i < 1.353418716849569e+183Initial program 32.0
Taylor expanded around inf 29.2
Simplified32.0
if 1.353418716849569e+183 < i Initial program 33.1
Taylor expanded around 0 32.9
Final simplification20.1
herbie shell --seed 2019326
(FPCore (i n)
:name "Compound Interest"
:precision binary64
: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))))