100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\begin{array}{l}
\mathbf{if}\;i \le \frac{-3004645614962051}{2251799813685248}:\\
\;\;\;\;100 \cdot \left(\frac{{\left(1 + \frac{i}{n}\right)}^{\left(2 \cdot n\right)}}{\frac{i}{n} \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} + 1\right)} - \frac{\frac{1 \cdot 1}{{\left(1 + \frac{i}{n}\right)}^{n} + 1}}{\frac{i}{n}}\right)\\
\mathbf{elif}\;i \le \frac{-7883338139594251}{1.352433999707303030661989849386282512688 \cdot 10^{272}}:\\
\;\;\;\;100 \cdot \frac{\left(1 \cdot i + \left(\frac{1}{2} \cdot {i}^{2} + \log 1 \cdot n\right)\right) - \frac{1}{2} \cdot \left({i}^{2} \cdot \log 1\right)}{\frac{i}{n}}\\
\mathbf{elif}\;i \le \frac{2454475895511641}{6.575169876935466884051237353600160831938 \cdot 10^{209}}:\\
\;\;\;\;100 \cdot \left(\frac{\frac{\frac{1}{\sqrt[3]{{\left(1 + \frac{i}{n}\right)}^{\left(2 \cdot n\right)} + 1 \cdot 1} \cdot \sqrt[3]{{\left(1 + \frac{i}{n}\right)}^{\left(2 \cdot n\right)} + 1 \cdot 1}}}{1}}{i} \cdot \frac{\frac{\frac{{\left(1 + \frac{i}{n}\right)}^{\left(2 \cdot \left(2 \cdot n\right)\right)} + \left(-\left(1 \cdot 1\right) \cdot \left(1 \cdot 1\right)\right)}{\sqrt[3]{{\left(1 + \frac{i}{n}\right)}^{\left(2 \cdot n\right)} + 1 \cdot 1}}}{{\left(1 + \frac{i}{n}\right)}^{n} + 1}}{\frac{1}{n}}\right)\\
\mathbf{elif}\;i \le \frac{5629288812994619}{65536}:\\
\;\;\;\;100 \cdot \frac{\left(1 \cdot i + \left(\frac{1}{2} \cdot {i}^{2} + \log 1 \cdot n\right)\right) - \frac{1}{2} \cdot \left({i}^{2} \cdot \log 1\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \left(\frac{{\left(1 + \frac{i}{n}\right)}^{\left(2 \cdot n\right)}}{\frac{i}{n} \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} + 1\right)} - \frac{\frac{1 \cdot 1}{{\left(1 + \frac{i}{n}\right)}^{n} + 1}}{\frac{i}{n}}\right)\\
\end{array}double f(double i, double n) {
double r534374 = 100.0;
double r534375 = 1.0;
double r534376 = i;
double r534377 = n;
double r534378 = r534376 / r534377;
double r534379 = r534375 + r534378;
double r534380 = pow(r534379, r534377);
double r534381 = r534380 - r534375;
double r534382 = r534381 / r534378;
double r534383 = r534374 * r534382;
return r534383;
}
double f(double i, double n) {
double r534384 = i;
double r534385 = -3004645614962051.0;
double r534386 = 2251799813685248.0;
double r534387 = r534385 / r534386;
bool r534388 = r534384 <= r534387;
double r534389 = 100.0;
double r534390 = 1.0;
double r534391 = n;
double r534392 = r534384 / r534391;
double r534393 = r534390 + r534392;
double r534394 = 2.0;
double r534395 = r534394 * r534391;
double r534396 = pow(r534393, r534395);
double r534397 = pow(r534393, r534391);
double r534398 = r534397 + r534390;
double r534399 = r534392 * r534398;
double r534400 = r534396 / r534399;
double r534401 = r534390 * r534390;
double r534402 = r534401 / r534398;
double r534403 = r534402 / r534392;
double r534404 = r534400 - r534403;
double r534405 = r534389 * r534404;
double r534406 = -7883338139594251.0;
double r534407 = 1.352433999707303e+272;
double r534408 = r534406 / r534407;
bool r534409 = r534384 <= r534408;
double r534410 = r534390 * r534384;
double r534411 = 2.0;
double r534412 = r534390 / r534411;
double r534413 = pow(r534384, r534394);
double r534414 = r534412 * r534413;
double r534415 = log(r534390);
double r534416 = r534415 * r534391;
double r534417 = r534414 + r534416;
double r534418 = r534410 + r534417;
double r534419 = r534413 * r534415;
double r534420 = r534412 * r534419;
double r534421 = r534418 - r534420;
double r534422 = r534421 / r534392;
double r534423 = r534389 * r534422;
double r534424 = 2454475895511641.0;
double r534425 = 6.575169876935467e+209;
double r534426 = r534424 / r534425;
bool r534427 = r534384 <= r534426;
double r534428 = 1.0;
double r534429 = r534396 + r534401;
double r534430 = cbrt(r534429);
double r534431 = r534430 * r534430;
double r534432 = r534428 / r534431;
double r534433 = r534432 / r534428;
double r534434 = r534433 / r534384;
double r534435 = r534394 * r534395;
double r534436 = pow(r534393, r534435);
double r534437 = r534401 * r534401;
double r534438 = -r534437;
double r534439 = r534436 + r534438;
double r534440 = r534439 / r534430;
double r534441 = r534440 / r534398;
double r534442 = r534428 / r534391;
double r534443 = r534441 / r534442;
double r534444 = r534434 * r534443;
double r534445 = r534389 * r534444;
double r534446 = 5629288812994619.0;
double r534447 = 65536.0;
double r534448 = r534446 / r534447;
bool r534449 = r534384 <= r534448;
double r534450 = r534449 ? r534423 : r534405;
double r534451 = r534427 ? r534445 : r534450;
double r534452 = r534409 ? r534423 : r534451;
double r534453 = r534388 ? r534405 : r534452;
return r534453;
}




Bits error versus i




Bits error versus n
Results
| Original | 42.5 |
|---|---|
| Target | 42.4 |
| Herbie | 33.3 |
if i < -1.3343306970279527 or 85896130569.3759 < i Initial program 28.3
rmApplied flip--28.3
Simplified28.3
rmApplied unsub-neg28.3
Applied div-sub28.3
Applied div-sub28.3
Simplified28.3
if -1.3343306970279527 < i < -5.829000262711808e-257 or 3.7329467397055525e-195 < i < 85896130569.3759Initial program 50.9
Taylor expanded around 0 31.4
Simplified31.4
if -5.829000262711808e-257 < i < 3.7329467397055525e-195Initial program 48.8
rmApplied flip--48.8
Simplified48.8
rmApplied flip-+48.8
Simplified48.8
Simplified48.8
rmApplied div-inv48.8
Applied *-un-lft-identity48.8
Applied add-cube-cbrt48.8
Applied *-un-lft-identity48.8
Applied times-frac48.8
Applied times-frac48.8
Applied times-frac48.2
Final simplification33.3
herbie shell --seed 2019303
(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))))