100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\begin{array}{l}
\mathbf{if}\;n \le -2.813114393619137495994961909777216500149 \cdot 10^{175}:\\
\;\;\;\;100 \cdot \frac{\left(\left(i \cdot i\right) \cdot \left(0.5 - \log 1 \cdot 0.5\right) + \left(i \cdot 1 + \log 1 \cdot n\right)\right) \cdot n}{i}\\
\mathbf{elif}\;n \le -1.421989441319127851613951560151701461699 \cdot 10^{58}:\\
\;\;\;\;\sqrt{100} \cdot \left(\left(n \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)\right) \cdot \frac{\sqrt{100}}{i}\right)\\
\mathbf{elif}\;n \le -1.995072885870678103259479030384682118893:\\
\;\;\;\;\frac{\left(n \cdot n\right) \cdot \left(100 \cdot \log 1\right)}{i} + \left(50 \cdot \left(i \cdot n\right) + \left(100 \cdot n - \left(i \cdot n\right) \cdot \left(\log 1 \cdot 50\right)\right)\right)\\
\mathbf{elif}\;n \le -4.586926552796907742204996293991418623461 \cdot 10^{-267}:\\
\;\;\;\;\frac{100}{i} \cdot \frac{\frac{\left({\left(1 + \frac{i}{n}\right)}^{n} \cdot {\left(1 + \frac{i}{n}\right)}^{n}\right) \cdot {\left(1 + \frac{i}{n}\right)}^{n} - 1 \cdot \left(1 \cdot 1\right)}{\left({\left(1 + \frac{i}{n}\right)}^{n} \cdot 1 + 1 \cdot 1\right) + {\left(1 + \frac{i}{n}\right)}^{n} \cdot {\left(1 + \frac{i}{n}\right)}^{n}}}{\frac{1}{n}}\\
\mathbf{elif}\;n \le 8.765996428721520261943646244564954658781 \cdot 10^{-223}:\\
\;\;\;\;100 \cdot \frac{\left(\left(i \cdot 1 + 1\right) + \log 1 \cdot n\right) - 1}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(\left(i \cdot i\right) \cdot \left(0.5 - \log 1 \cdot 0.5\right) + \left(i \cdot 1 + \log 1 \cdot n\right)\right) \cdot \frac{100}{i}}{\frac{1}{n}}\\
\end{array}double f(double i, double n) {
double r9903469 = 100.0;
double r9903470 = 1.0;
double r9903471 = i;
double r9903472 = n;
double r9903473 = r9903471 / r9903472;
double r9903474 = r9903470 + r9903473;
double r9903475 = pow(r9903474, r9903472);
double r9903476 = r9903475 - r9903470;
double r9903477 = r9903476 / r9903473;
double r9903478 = r9903469 * r9903477;
return r9903478;
}
double f(double i, double n) {
double r9903479 = n;
double r9903480 = -2.8131143936191375e+175;
bool r9903481 = r9903479 <= r9903480;
double r9903482 = 100.0;
double r9903483 = i;
double r9903484 = r9903483 * r9903483;
double r9903485 = 0.5;
double r9903486 = 1.0;
double r9903487 = log(r9903486);
double r9903488 = r9903487 * r9903485;
double r9903489 = r9903485 - r9903488;
double r9903490 = r9903484 * r9903489;
double r9903491 = r9903483 * r9903486;
double r9903492 = r9903487 * r9903479;
double r9903493 = r9903491 + r9903492;
double r9903494 = r9903490 + r9903493;
double r9903495 = r9903494 * r9903479;
double r9903496 = r9903495 / r9903483;
double r9903497 = r9903482 * r9903496;
double r9903498 = -1.4219894413191279e+58;
bool r9903499 = r9903479 <= r9903498;
double r9903500 = sqrt(r9903482);
double r9903501 = r9903483 / r9903479;
double r9903502 = r9903486 + r9903501;
double r9903503 = pow(r9903502, r9903479);
double r9903504 = r9903503 - r9903486;
double r9903505 = r9903479 * r9903504;
double r9903506 = r9903500 / r9903483;
double r9903507 = r9903505 * r9903506;
double r9903508 = r9903500 * r9903507;
double r9903509 = -1.995072885870678;
bool r9903510 = r9903479 <= r9903509;
double r9903511 = r9903479 * r9903479;
double r9903512 = r9903482 * r9903487;
double r9903513 = r9903511 * r9903512;
double r9903514 = r9903513 / r9903483;
double r9903515 = 50.0;
double r9903516 = r9903483 * r9903479;
double r9903517 = r9903515 * r9903516;
double r9903518 = r9903482 * r9903479;
double r9903519 = r9903487 * r9903515;
double r9903520 = r9903516 * r9903519;
double r9903521 = r9903518 - r9903520;
double r9903522 = r9903517 + r9903521;
double r9903523 = r9903514 + r9903522;
double r9903524 = -4.586926552796908e-267;
bool r9903525 = r9903479 <= r9903524;
double r9903526 = r9903482 / r9903483;
double r9903527 = r9903503 * r9903503;
double r9903528 = r9903527 * r9903503;
double r9903529 = r9903486 * r9903486;
double r9903530 = r9903486 * r9903529;
double r9903531 = r9903528 - r9903530;
double r9903532 = r9903503 * r9903486;
double r9903533 = r9903532 + r9903529;
double r9903534 = r9903533 + r9903527;
double r9903535 = r9903531 / r9903534;
double r9903536 = 1.0;
double r9903537 = r9903536 / r9903479;
double r9903538 = r9903535 / r9903537;
double r9903539 = r9903526 * r9903538;
double r9903540 = 8.76599642872152e-223;
bool r9903541 = r9903479 <= r9903540;
double r9903542 = r9903491 + r9903536;
double r9903543 = r9903542 + r9903492;
double r9903544 = r9903543 - r9903486;
double r9903545 = r9903544 / r9903501;
double r9903546 = r9903482 * r9903545;
double r9903547 = r9903494 * r9903526;
double r9903548 = r9903547 / r9903537;
double r9903549 = r9903541 ? r9903546 : r9903548;
double r9903550 = r9903525 ? r9903539 : r9903549;
double r9903551 = r9903510 ? r9903523 : r9903550;
double r9903552 = r9903499 ? r9903508 : r9903551;
double r9903553 = r9903481 ? r9903497 : r9903552;
return r9903553;
}




Bits error versus i




Bits error versus n
Results
| Original | 42.9 |
|---|---|
| Target | 42.9 |
| Herbie | 23.8 |
if n < -2.8131143936191375e+175Initial program 53.6
rmApplied div-inv53.6
Applied *-un-lft-identity53.6
Applied times-frac53.1
Applied associate-*r*53.1
Simplified53.1
Taylor expanded around 0 25.5
Simplified25.5
rmApplied div-inv25.5
Applied associate-*l*25.2
Simplified25.1
if -2.8131143936191375e+175 < n < -1.4219894413191279e+58Initial program 41.0
rmApplied div-inv41.0
Applied *-un-lft-identity41.0
Applied times-frac40.7
Applied associate-*r*40.7
Simplified40.7
rmApplied *-un-lft-identity40.7
Applied add-sqr-sqrt40.7
Applied times-frac40.7
Applied associate-*l*40.7
Simplified40.7
if -1.4219894413191279e+58 < n < -1.995072885870678Initial program 35.7
rmApplied div-inv35.7
Applied *-un-lft-identity35.7
Applied times-frac35.7
Applied associate-*r*35.7
Simplified35.7
Taylor expanded around 0 28.8
Simplified28.8
rmApplied div-inv28.8
Applied associate-*l*28.4
Simplified28.3
Taylor expanded around 0 28.1
Simplified28.1
if -1.995072885870678 < n < -4.586926552796908e-267Initial program 16.2
rmApplied div-inv16.2
Applied *-un-lft-identity16.2
Applied times-frac16.8
Applied associate-*r*17.0
Simplified17.0
rmApplied flip3--17.0
Simplified17.0
if -4.586926552796908e-267 < n < 8.76599642872152e-223Initial program 29.9
Taylor expanded around 0 14.8
if 8.76599642872152e-223 < n Initial program 57.6
rmApplied div-inv57.6
Applied *-un-lft-identity57.6
Applied times-frac57.3
Applied associate-*r*57.3
Simplified57.3
Taylor expanded around 0 27.7
Simplified27.7
rmApplied associate-*r/22.6
Simplified22.6
Final simplification23.8
herbie shell --seed 2019170
(FPCore (i n)
:name "Compound Interest"
:herbie-target
(* 100.0 (/ (- (exp (* n (if (== (+ 1.0 (/ i n)) 1.0) (/ i n) (/ (* (/ i n) (log (+ 1.0 (/ i n)))) (- (+ (/ i n) 1.0) 1.0))))) 1.0) (/ i n)))
(* 100.0 (/ (- (pow (+ 1.0 (/ i n)) n) 1.0) (/ i n))))