Average Error: 42.7 → 14.6
Time: 25.7s
Precision: 64
\[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
\[\begin{array}{l} \mathbf{if}\;i \le -996.2239743031829:\\ \;\;\;\;\frac{\mathsf{fma}\left(100, e^{\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n}, -100\right)}{i} \cdot n\\ \mathbf{elif}\;i \le 1.6984288167482355 \cdot 10^{-42}:\\ \;\;\;\;\left(\mathsf{fma}\left(100, i, \mathsf{fma}\left(i \cdot \left(i \cdot i\right), \frac{50}{3}, 50 \cdot \left(i \cdot i\right)\right)\right) \cdot n\right) \cdot \frac{1}{i}\\ \mathbf{elif}\;i \le 3.952197478939899 \cdot 10^{-39}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(n \cdot n\right) \cdot 50, \log n \cdot \log n, \mathsf{fma}\left(\log i \cdot \left(\left(\left(n \cdot n\right) \cdot n\right) \cdot \frac{50}{3}\right), \log i \cdot \log i, \mathsf{fma}\left(100 \cdot n, \log i, \mathsf{fma}\left(\left(\log n \cdot \log n\right) \cdot \left(\log i \cdot \left(\left(n \cdot n\right) \cdot n\right)\right), 50, \left(\left(n \cdot n\right) \cdot 50\right) \cdot \left(\log i \cdot \log i\right)\right)\right)\right)\right) - \mathsf{fma}\left(\left(n \cdot n\right) \cdot n, \frac{100}{3} \cdot \left(\left(\log i \cdot \log i\right) \cdot \log n\right), \mathsf{fma}\left(\log i \cdot \left(\left(n \cdot n\right) \cdot \log n\right), 100, \mathsf{fma}\left(\left(\left(n \cdot n\right) \cdot n\right) \cdot \frac{50}{3}, \mathsf{fma}\left(\log n, \log n \cdot \log n, \left(\log i \cdot \log i\right) \cdot \log n\right), \log n \cdot \left(100 \cdot n\right)\right)\right)\right)}{i} \cdot n\\ \mathbf{elif}\;i \le 1.1417957873827229 \cdot 10^{-05}:\\ \;\;\;\;\left(\mathsf{fma}\left(100, i, \mathsf{fma}\left(i \cdot \left(i \cdot i\right), \frac{50}{3}, 50 \cdot \left(i \cdot i\right)\right)\right) \cdot n\right) \cdot \frac{1}{i}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(n \cdot n\right) \cdot 50, \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(\left(n \cdot n\right) \cdot 50\right) \cdot \left(\log i \cdot \log i\right)\right)\right)\right)\right)\right) - \mathsf{fma}\left(\left(\left(n \cdot n\right) \cdot n\right) \cdot \frac{100}{3}, \left(\log i \cdot \log i\right) \cdot \log n, \mathsf{fma}\left(\left(n \cdot n\right) \cdot 50, \log i \cdot \log n, \mathsf{fma}\left(\left(n \cdot n\right) \cdot 50, \log i \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 n \cdot \log n\right) + \left(\log i \cdot \log i\right) \cdot \log n\right) + \log n \cdot \left(100 \cdot n\right)\right)\right)\right)}{\frac{i}{n}}\\ \end{array}\]
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\begin{array}{l}
\mathbf{if}\;i \le -996.2239743031829:\\
\;\;\;\;\frac{\mathsf{fma}\left(100, e^{\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n}, -100\right)}{i} \cdot n\\

\mathbf{elif}\;i \le 1.6984288167482355 \cdot 10^{-42}:\\
\;\;\;\;\left(\mathsf{fma}\left(100, i, \mathsf{fma}\left(i \cdot \left(i \cdot i\right), \frac{50}{3}, 50 \cdot \left(i \cdot i\right)\right)\right) \cdot n\right) \cdot \frac{1}{i}\\

\mathbf{elif}\;i \le 3.952197478939899 \cdot 10^{-39}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(n \cdot n\right) \cdot 50, \log n \cdot \log n, \mathsf{fma}\left(\log i \cdot \left(\left(\left(n \cdot n\right) \cdot n\right) \cdot \frac{50}{3}\right), \log i \cdot \log i, \mathsf{fma}\left(100 \cdot n, \log i, \mathsf{fma}\left(\left(\log n \cdot \log n\right) \cdot \left(\log i \cdot \left(\left(n \cdot n\right) \cdot n\right)\right), 50, \left(\left(n \cdot n\right) \cdot 50\right) \cdot \left(\log i \cdot \log i\right)\right)\right)\right)\right) - \mathsf{fma}\left(\left(n \cdot n\right) \cdot n, \frac{100}{3} \cdot \left(\left(\log i \cdot \log i\right) \cdot \log n\right), \mathsf{fma}\left(\log i \cdot \left(\left(n \cdot n\right) \cdot \log n\right), 100, \mathsf{fma}\left(\left(\left(n \cdot n\right) \cdot n\right) \cdot \frac{50}{3}, \mathsf{fma}\left(\log n, \log n \cdot \log n, \left(\log i \cdot \log i\right) \cdot \log n\right), \log n \cdot \left(100 \cdot n\right)\right)\right)\right)}{i} \cdot n\\

\mathbf{elif}\;i \le 1.1417957873827229 \cdot 10^{-05}:\\
\;\;\;\;\left(\mathsf{fma}\left(100, i, \mathsf{fma}\left(i \cdot \left(i \cdot i\right), \frac{50}{3}, 50 \cdot \left(i \cdot i\right)\right)\right) \cdot n\right) \cdot \frac{1}{i}\\

\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(n \cdot n\right) \cdot 50, \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(\left(n \cdot n\right) \cdot 50\right) \cdot \left(\log i \cdot \log i\right)\right)\right)\right)\right)\right) - \mathsf{fma}\left(\left(\left(n \cdot n\right) \cdot n\right) \cdot \frac{100}{3}, \left(\log i \cdot \log i\right) \cdot \log n, \mathsf{fma}\left(\left(n \cdot n\right) \cdot 50, \log i \cdot \log n, \mathsf{fma}\left(\left(n \cdot n\right) \cdot 50, \log i \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 n \cdot \log n\right) + \left(\log i \cdot \log i\right) \cdot \log n\right) + \log n \cdot \left(100 \cdot n\right)\right)\right)\right)}{\frac{i}{n}}\\

\end{array}
double f(double i, double n) {
        double r2355501 = 100.0;
        double r2355502 = 1.0;
        double r2355503 = i;
        double r2355504 = n;
        double r2355505 = r2355503 / r2355504;
        double r2355506 = r2355502 + r2355505;
        double r2355507 = pow(r2355506, r2355504);
        double r2355508 = r2355507 - r2355502;
        double r2355509 = r2355508 / r2355505;
        double r2355510 = r2355501 * r2355509;
        return r2355510;
}

double f(double i, double n) {
        double r2355511 = i;
        double r2355512 = -996.2239743031829;
        bool r2355513 = r2355511 <= r2355512;
        double r2355514 = 100.0;
        double r2355515 = n;
        double r2355516 = r2355511 / r2355515;
        double r2355517 = log1p(r2355516);
        double r2355518 = r2355517 * r2355515;
        double r2355519 = exp(r2355518);
        double r2355520 = -100.0;
        double r2355521 = fma(r2355514, r2355519, r2355520);
        double r2355522 = r2355521 / r2355511;
        double r2355523 = r2355522 * r2355515;
        double r2355524 = 1.6984288167482355e-42;
        bool r2355525 = r2355511 <= r2355524;
        double r2355526 = r2355511 * r2355511;
        double r2355527 = r2355511 * r2355526;
        double r2355528 = 16.666666666666668;
        double r2355529 = 50.0;
        double r2355530 = r2355529 * r2355526;
        double r2355531 = fma(r2355527, r2355528, r2355530);
        double r2355532 = fma(r2355514, r2355511, r2355531);
        double r2355533 = r2355532 * r2355515;
        double r2355534 = 1.0;
        double r2355535 = r2355534 / r2355511;
        double r2355536 = r2355533 * r2355535;
        double r2355537 = 3.952197478939899e-39;
        bool r2355538 = r2355511 <= r2355537;
        double r2355539 = r2355515 * r2355515;
        double r2355540 = r2355539 * r2355529;
        double r2355541 = log(r2355515);
        double r2355542 = r2355541 * r2355541;
        double r2355543 = log(r2355511);
        double r2355544 = r2355539 * r2355515;
        double r2355545 = r2355544 * r2355528;
        double r2355546 = r2355543 * r2355545;
        double r2355547 = r2355543 * r2355543;
        double r2355548 = r2355514 * r2355515;
        double r2355549 = r2355543 * r2355544;
        double r2355550 = r2355542 * r2355549;
        double r2355551 = r2355540 * r2355547;
        double r2355552 = fma(r2355550, r2355529, r2355551);
        double r2355553 = fma(r2355548, r2355543, r2355552);
        double r2355554 = fma(r2355546, r2355547, r2355553);
        double r2355555 = fma(r2355540, r2355542, r2355554);
        double r2355556 = 33.333333333333336;
        double r2355557 = r2355547 * r2355541;
        double r2355558 = r2355556 * r2355557;
        double r2355559 = r2355539 * r2355541;
        double r2355560 = r2355543 * r2355559;
        double r2355561 = fma(r2355541, r2355542, r2355557);
        double r2355562 = r2355541 * r2355548;
        double r2355563 = fma(r2355545, r2355561, r2355562);
        double r2355564 = fma(r2355560, r2355514, r2355563);
        double r2355565 = fma(r2355544, r2355558, r2355564);
        double r2355566 = r2355555 - r2355565;
        double r2355567 = r2355566 / r2355511;
        double r2355568 = r2355567 * r2355515;
        double r2355569 = 1.1417957873827229e-05;
        bool r2355570 = r2355511 <= r2355569;
        double r2355571 = r2355543 * r2355547;
        double r2355572 = r2355515 * r2355543;
        double r2355573 = fma(r2355528, r2355550, r2355551);
        double r2355574 = fma(r2355556, r2355550, r2355573);
        double r2355575 = fma(r2355572, r2355514, r2355574);
        double r2355576 = fma(r2355545, r2355571, r2355575);
        double r2355577 = fma(r2355540, r2355542, r2355576);
        double r2355578 = r2355544 * r2355556;
        double r2355579 = r2355543 * r2355541;
        double r2355580 = r2355541 * r2355542;
        double r2355581 = r2355580 + r2355557;
        double r2355582 = r2355545 * r2355581;
        double r2355583 = r2355582 + r2355562;
        double r2355584 = fma(r2355540, r2355579, r2355583);
        double r2355585 = fma(r2355540, r2355579, r2355584);
        double r2355586 = fma(r2355578, r2355557, r2355585);
        double r2355587 = r2355577 - r2355586;
        double r2355588 = r2355587 / r2355516;
        double r2355589 = r2355570 ? r2355536 : r2355588;
        double r2355590 = r2355538 ? r2355568 : r2355589;
        double r2355591 = r2355525 ? r2355536 : r2355590;
        double r2355592 = r2355513 ? r2355523 : r2355591;
        return r2355592;
}

Error

Bits error versus i

Bits error versus n

Target

Original42.7
Target41.8
Herbie14.6
\[100 \cdot \frac{e^{n \cdot \begin{array}{l} \mathbf{if}\;1 + \frac{i}{n} = 1:\\ \;\;\;\;\frac{i}{n}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{i}{n} \cdot \log \left(1 + \frac{i}{n}\right)}{\left(\frac{i}{n} + 1\right) - 1}\\ \end{array}} - 1}{\frac{i}{n}}\]

Derivation

  1. Split input into 4 regimes
  2. if i < -996.2239743031829

    1. Initial program 29.0

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
    2. Simplified29.0

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{\frac{i}{n}}}\]
    3. Using strategy rm
    4. Applied add-exp-log29.1

      \[\leadsto \frac{\mathsf{fma}\left(100, {\color{blue}{\left(e^{\log \left(1 + \frac{i}{n}\right)}\right)}}^{n}, -100\right)}{\frac{i}{n}}\]
    5. Applied pow-exp29.1

      \[\leadsto \frac{\mathsf{fma}\left(100, \color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}}, -100\right)}{\frac{i}{n}}\]
    6. Simplified5.6

      \[\leadsto \frac{\mathsf{fma}\left(100, e^{\color{blue}{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}}, -100\right)}{\frac{i}{n}}\]
    7. Using strategy rm
    8. Applied associate-/r/6.2

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(100, e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, -100\right)}{i} \cdot n}\]

    if -996.2239743031829 < i < 1.6984288167482355e-42 or 3.952197478939899e-39 < i < 1.1417957873827229e-05

    1. Initial program 49.9

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
    2. Simplified49.9

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{\frac{i}{n}}}\]
    3. Using strategy rm
    4. Applied add-exp-log49.9

      \[\leadsto \frac{\mathsf{fma}\left(100, {\color{blue}{\left(e^{\log \left(1 + \frac{i}{n}\right)}\right)}}^{n}, -100\right)}{\frac{i}{n}}\]
    5. Applied pow-exp49.9

      \[\leadsto \frac{\mathsf{fma}\left(100, \color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}}, -100\right)}{\frac{i}{n}}\]
    6. Simplified48.8

      \[\leadsto \frac{\mathsf{fma}\left(100, e^{\color{blue}{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}}, -100\right)}{\frac{i}{n}}\]
    7. Using strategy rm
    8. Applied div-inv48.8

      \[\leadsto \frac{\mathsf{fma}\left(100, e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, -100\right)}{\color{blue}{i \cdot \frac{1}{n}}}\]
    9. Applied *-un-lft-identity48.8

      \[\leadsto \frac{\color{blue}{1 \cdot \mathsf{fma}\left(100, e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, -100\right)}}{i \cdot \frac{1}{n}}\]
    10. Applied times-frac49.0

      \[\leadsto \color{blue}{\frac{1}{i} \cdot \frac{\mathsf{fma}\left(100, e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, -100\right)}{\frac{1}{n}}}\]
    11. Simplified49.0

      \[\leadsto \frac{1}{i} \cdot \color{blue}{\left(\mathsf{fma}\left(100, e^{\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n}, -100\right) \cdot n\right)}\]
    12. Taylor expanded around 0 16.1

      \[\leadsto \frac{1}{i} \cdot \left(\color{blue}{\left(100 \cdot i + \left(50 \cdot {i}^{2} + \frac{50}{3} \cdot {i}^{3}\right)\right)} \cdot n\right)\]
    13. Simplified16.1

      \[\leadsto \frac{1}{i} \cdot \left(\color{blue}{\mathsf{fma}\left(100, i, \mathsf{fma}\left(i \cdot \left(i \cdot i\right), \frac{50}{3}, \left(i \cdot i\right) \cdot 50\right)\right)} \cdot n\right)\]

    if 1.6984288167482355e-42 < i < 3.952197478939899e-39

    1. Initial program 46.6

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
    2. Simplified46.6

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{\frac{i}{n}}}\]
    3. Using strategy rm
    4. Applied add-exp-log46.6

      \[\leadsto \frac{\mathsf{fma}\left(100, {\color{blue}{\left(e^{\log \left(1 + \frac{i}{n}\right)}\right)}}^{n}, -100\right)}{\frac{i}{n}}\]
    5. Applied pow-exp46.6

      \[\leadsto \frac{\mathsf{fma}\left(100, \color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}}, -100\right)}{\frac{i}{n}}\]
    6. Simplified46.6

      \[\leadsto \frac{\mathsf{fma}\left(100, e^{\color{blue}{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}}, -100\right)}{\frac{i}{n}}\]
    7. Using strategy rm
    8. Applied associate-/r/46.6

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(100, e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, -100\right)}{i} \cdot n}\]
    9. Taylor expanded around 0 38.3

      \[\leadsto \frac{\color{blue}{\left(50 \cdot \left({n}^{2} \cdot {\left(\log n\right)}^{2}\right) + \left(\frac{50}{3} \cdot \left({n}^{3} \cdot {\left(\log i\right)}^{3}\right) + \left(100 \cdot \left(n \cdot \log i\right) + \left(\frac{100}{3} \cdot \left({n}^{3} \cdot \left({\left(\log n\right)}^{2} \cdot \log i\right)\right) + \left(\frac{50}{3} \cdot \left({n}^{3} \cdot \left(\log i \cdot {\left(\log n\right)}^{2}\right)\right) + 50 \cdot \left({n}^{2} \cdot {\left(\log i\right)}^{2}\right)\right)\right)\right)\right)\right) - \left(\frac{100}{3} \cdot \left({n}^{3} \cdot \left({\left(\log i\right)}^{2} \cdot \log n\right)\right) + \left(50 \cdot \left({n}^{2} \cdot \left(\log n \cdot \log i\right)\right) + \left(50 \cdot \left({n}^{2} \cdot \left(\log i \cdot \log n\right)\right) + \left(\frac{50}{3} \cdot \left({n}^{3} \cdot {\left(\log n\right)}^{3}\right) + \left(\frac{50}{3} \cdot \left({n}^{3} \cdot \left(\log n \cdot {\left(\log i\right)}^{2}\right)\right) + 100 \cdot \left(n \cdot \log n\right)\right)\right)\right)\right)\right)}}{i} \cdot n\]
    10. Simplified38.3

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(\left(n \cdot n\right) \cdot 50, \log n \cdot \log n, \mathsf{fma}\left(\left(\frac{50}{3} \cdot \left(n \cdot \left(n \cdot n\right)\right)\right) \cdot \log i, \log i \cdot \log i, \mathsf{fma}\left(100 \cdot n, \log i, \mathsf{fma}\left(\left(\log i \cdot \left(n \cdot \left(n \cdot n\right)\right)\right) \cdot \left(\log n \cdot \log n\right), 50, \left(\log i \cdot \log i\right) \cdot \left(\left(n \cdot n\right) \cdot 50\right)\right)\right)\right)\right) - \mathsf{fma}\left(n \cdot \left(n \cdot n\right), \left(\left(\log i \cdot \log i\right) \cdot \log n\right) \cdot \frac{100}{3}, \mathsf{fma}\left(\left(\left(n \cdot n\right) \cdot \log n\right) \cdot \log i, 100, \mathsf{fma}\left(\frac{50}{3} \cdot \left(n \cdot \left(n \cdot n\right)\right), \mathsf{fma}\left(\log n, \log n \cdot \log n, \left(\log i \cdot \log i\right) \cdot \log n\right), \left(100 \cdot n\right) \cdot \log n\right)\right)\right)}}{i} \cdot n\]

    if 1.1417957873827229e-05 < i

    1. Initial program 32.3

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
    2. Simplified32.3

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{\frac{i}{n}}}\]
    3. Using strategy rm
    4. Applied add-exp-log51.0

      \[\leadsto \frac{\mathsf{fma}\left(100, {\color{blue}{\left(e^{\log \left(1 + \frac{i}{n}\right)}\right)}}^{n}, -100\right)}{\frac{i}{n}}\]
    5. Applied pow-exp51.0

      \[\leadsto \frac{\mathsf{fma}\left(100, \color{blue}{e^{\log \left(1 + \frac{i}{n}\right) \cdot n}}, -100\right)}{\frac{i}{n}}\]
    6. Simplified49.1

      \[\leadsto \frac{\mathsf{fma}\left(100, e^{\color{blue}{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}}, -100\right)}{\frac{i}{n}}\]
    7. Taylor expanded around 0 21.2

      \[\leadsto \frac{\color{blue}{\left(50 \cdot \left({n}^{2} \cdot {\left(\log n\right)}^{2}\right) + \left(\frac{50}{3} \cdot \left({n}^{3} \cdot {\left(\log i\right)}^{3}\right) + \left(100 \cdot \left(n \cdot \log i\right) + \left(\frac{100}{3} \cdot \left({n}^{3} \cdot \left({\left(\log n\right)}^{2} \cdot \log i\right)\right) + \left(\frac{50}{3} \cdot \left({n}^{3} \cdot \left(\log i \cdot {\left(\log n\right)}^{2}\right)\right) + 50 \cdot \left({n}^{2} \cdot {\left(\log i\right)}^{2}\right)\right)\right)\right)\right)\right) - \left(\frac{100}{3} \cdot \left({n}^{3} \cdot \left({\left(\log i\right)}^{2} \cdot \log n\right)\right) + \left(50 \cdot \left({n}^{2} \cdot \left(\log n \cdot \log i\right)\right) + \left(50 \cdot \left({n}^{2} \cdot \left(\log i \cdot \log n\right)\right) + \left(\frac{50}{3} \cdot \left({n}^{3} \cdot {\left(\log n\right)}^{3}\right) + \left(\frac{50}{3} \cdot \left({n}^{3} \cdot \left(\log n \cdot {\left(\log i\right)}^{2}\right)\right) + 100 \cdot \left(n \cdot \log n\right)\right)\right)\right)\right)\right)}}{\frac{i}{n}}\]
    8. Simplified21.2

      \[\leadsto \frac{\color{blue}{\mathsf{fma}\left(50 \cdot \left(n \cdot n\right), \log n \cdot \log n, \mathsf{fma}\left(\frac{50}{3} \cdot \left(\left(n \cdot n\right) \cdot n\right), \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(\left(\left(n \cdot n\right) \cdot n\right) \cdot \log i\right) \cdot \left(\log n \cdot \log n\right), \mathsf{fma}\left(\frac{50}{3}, \left(\left(\left(n \cdot n\right) \cdot n\right) \cdot \log i\right) \cdot \left(\log n \cdot \log n\right), \left(\log i \cdot \log i\right) \cdot \left(\left(n \cdot n\right) \cdot 50\right)\right)\right)\right)\right)\right) - \mathsf{fma}\left(\frac{100}{3} \cdot \left(\left(n \cdot n\right) \cdot n\right), \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(\frac{50}{3} \cdot \left(\left(n \cdot n\right) \cdot n\right)\right) \cdot \left(\left(\log n \cdot \log n\right) \cdot \log n + \log n \cdot \left(\log i \cdot \log i\right)\right) + \left(100 \cdot n\right) \cdot \log n\right)\right)\right)}}{\frac{i}{n}}\]
  3. Recombined 4 regimes into one program.
  4. Final simplification14.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \le -996.2239743031829:\\ \;\;\;\;\frac{\mathsf{fma}\left(100, e^{\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n}, -100\right)}{i} \cdot n\\ \mathbf{elif}\;i \le 1.6984288167482355 \cdot 10^{-42}:\\ \;\;\;\;\left(\mathsf{fma}\left(100, i, \mathsf{fma}\left(i \cdot \left(i \cdot i\right), \frac{50}{3}, 50 \cdot \left(i \cdot i\right)\right)\right) \cdot n\right) \cdot \frac{1}{i}\\ \mathbf{elif}\;i \le 3.952197478939899 \cdot 10^{-39}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(n \cdot n\right) \cdot 50, \log n \cdot \log n, \mathsf{fma}\left(\log i \cdot \left(\left(\left(n \cdot n\right) \cdot n\right) \cdot \frac{50}{3}\right), \log i \cdot \log i, \mathsf{fma}\left(100 \cdot n, \log i, \mathsf{fma}\left(\left(\log n \cdot \log n\right) \cdot \left(\log i \cdot \left(\left(n \cdot n\right) \cdot n\right)\right), 50, \left(\left(n \cdot n\right) \cdot 50\right) \cdot \left(\log i \cdot \log i\right)\right)\right)\right)\right) - \mathsf{fma}\left(\left(n \cdot n\right) \cdot n, \frac{100}{3} \cdot \left(\left(\log i \cdot \log i\right) \cdot \log n\right), \mathsf{fma}\left(\log i \cdot \left(\left(n \cdot n\right) \cdot \log n\right), 100, \mathsf{fma}\left(\left(\left(n \cdot n\right) \cdot n\right) \cdot \frac{50}{3}, \mathsf{fma}\left(\log n, \log n \cdot \log n, \left(\log i \cdot \log i\right) \cdot \log n\right), \log n \cdot \left(100 \cdot n\right)\right)\right)\right)}{i} \cdot n\\ \mathbf{elif}\;i \le 1.1417957873827229 \cdot 10^{-05}:\\ \;\;\;\;\left(\mathsf{fma}\left(100, i, \mathsf{fma}\left(i \cdot \left(i \cdot i\right), \frac{50}{3}, 50 \cdot \left(i \cdot i\right)\right)\right) \cdot n\right) \cdot \frac{1}{i}\\ \mathbf{else}:\\ \;\;\;\;\frac{\mathsf{fma}\left(\left(n \cdot n\right) \cdot 50, \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(\left(n \cdot n\right) \cdot 50\right) \cdot \left(\log i \cdot \log i\right)\right)\right)\right)\right)\right) - \mathsf{fma}\left(\left(\left(n \cdot n\right) \cdot n\right) \cdot \frac{100}{3}, \left(\log i \cdot \log i\right) \cdot \log n, \mathsf{fma}\left(\left(n \cdot n\right) \cdot 50, \log i \cdot \log n, \mathsf{fma}\left(\left(n \cdot n\right) \cdot 50, \log i \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 n \cdot \log n\right) + \left(\log i \cdot \log i\right) \cdot \log n\right) + \log n \cdot \left(100 \cdot n\right)\right)\right)\right)}{\frac{i}{n}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019155 +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))))