Average Error: 42.6 → 21.2
Time: 33.7s
Precision: 64
\[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
\[\begin{array}{l} \mathbf{if}\;i \le -0.09568466101685804692245085334434406831861:\\ \;\;\;\;\frac{\left({\left(\frac{i}{n}\right)}^{n} - 1\right) \cdot 100}{\frac{i}{n}}\\ \mathbf{elif}\;i \le 4.636828096634822172894426601649853756376 \cdot 10^{-231}:\\ \;\;\;\;\left(\left(\sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)} \cdot \sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}\right) \cdot \frac{100}{i}\right) \cdot \frac{\sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {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 2.421886781167336491233076084341835921918 \cdot 10^{-182}:\\ \;\;\;\;\frac{100}{i} \cdot \sqrt[3]{{\left(\left(\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)\right) \cdot n\right)}^{3}}\\ \mathbf{elif}\;i \le 6.433403710498657594142250154269082661313 \cdot 10^{46}:\\ \;\;\;\;100 \cdot \left(\frac{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}{i} \cdot n\right)\\ \mathbf{elif}\;i \le 1.353418716849568981322833055613312096611 \cdot 10^{183}:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{{\left(\frac{i}{n}\right)}^{n} - 1}}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{\mathsf{fma}\left(1, i, \mathsf{fma}\left(\log 1, n, 1\right)\right) - 1}{\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 -0.09568466101685804692245085334434406831861:\\
\;\;\;\;\frac{\left({\left(\frac{i}{n}\right)}^{n} - 1\right) \cdot 100}{\frac{i}{n}}\\

\mathbf{elif}\;i \le 4.636828096634822172894426601649853756376 \cdot 10^{-231}:\\
\;\;\;\;\left(\left(\sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)} \cdot \sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}\right) \cdot \frac{100}{i}\right) \cdot \frac{\sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {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 2.421886781167336491233076084341835921918 \cdot 10^{-182}:\\
\;\;\;\;\frac{100}{i} \cdot \sqrt[3]{{\left(\left(\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)\right) \cdot n\right)}^{3}}\\

\mathbf{elif}\;i \le 6.433403710498657594142250154269082661313 \cdot 10^{46}:\\
\;\;\;\;100 \cdot \left(\frac{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}{i} \cdot n\right)\\

\mathbf{elif}\;i \le 1.353418716849568981322833055613312096611 \cdot 10^{183}:\\
\;\;\;\;100 \cdot \frac{n}{\frac{i}{{\left(\frac{i}{n}\right)}^{n} - 1}}\\

\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{\mathsf{fma}\left(1, i, \mathsf{fma}\left(\log 1, n, 1\right)\right) - 1}{\frac{i}{n}}\\

\end{array}
double f(double i, double n) {
        double r155848 = 100.0;
        double r155849 = 1.0;
        double r155850 = i;
        double r155851 = n;
        double r155852 = r155850 / r155851;
        double r155853 = r155849 + r155852;
        double r155854 = pow(r155853, r155851);
        double r155855 = r155854 - r155849;
        double r155856 = r155855 / r155852;
        double r155857 = r155848 * r155856;
        return r155857;
}

double f(double i, double n) {
        double r155858 = i;
        double r155859 = -0.09568466101685805;
        bool r155860 = r155858 <= r155859;
        double r155861 = n;
        double r155862 = r155858 / r155861;
        double r155863 = pow(r155862, r155861);
        double r155864 = 1.0;
        double r155865 = r155863 - r155864;
        double r155866 = 100.0;
        double r155867 = r155865 * r155866;
        double r155868 = r155867 / r155862;
        double r155869 = 4.636828096634822e-231;
        bool r155870 = r155858 <= r155869;
        double r155871 = 0.5;
        double r155872 = 2.0;
        double r155873 = pow(r155858, r155872);
        double r155874 = log(r155864);
        double r155875 = r155874 * r155861;
        double r155876 = fma(r155871, r155873, r155875);
        double r155877 = fma(r155864, r155858, r155876);
        double r155878 = r155873 * r155874;
        double r155879 = r155871 * r155878;
        double r155880 = r155877 - r155879;
        double r155881 = cbrt(r155880);
        double r155882 = r155881 * r155881;
        double r155883 = r155866 / r155858;
        double r155884 = r155882 * r155883;
        double r155885 = 1.0;
        double r155886 = r155885 / r155861;
        double r155887 = r155881 / r155886;
        double r155888 = r155884 * r155887;
        double r155889 = 2.4218867811673365e-182;
        bool r155890 = r155858 <= r155889;
        double r155891 = r155880 * r155861;
        double r155892 = 3.0;
        double r155893 = pow(r155891, r155892);
        double r155894 = cbrt(r155893);
        double r155895 = r155883 * r155894;
        double r155896 = 6.433403710498658e+46;
        bool r155897 = r155858 <= r155896;
        double r155898 = r155880 / r155858;
        double r155899 = r155898 * r155861;
        double r155900 = r155866 * r155899;
        double r155901 = 1.353418716849569e+183;
        bool r155902 = r155858 <= r155901;
        double r155903 = r155858 / r155865;
        double r155904 = r155861 / r155903;
        double r155905 = r155866 * r155904;
        double r155906 = fma(r155874, r155861, r155885);
        double r155907 = fma(r155864, r155858, r155906);
        double r155908 = r155907 - r155864;
        double r155909 = r155908 / r155862;
        double r155910 = r155866 * r155909;
        double r155911 = r155902 ? r155905 : r155910;
        double r155912 = r155897 ? r155900 : r155911;
        double r155913 = r155890 ? r155895 : r155912;
        double r155914 = r155870 ? r155888 : r155913;
        double r155915 = r155860 ? r155868 : r155914;
        return r155915;
}

Error

Bits error versus i

Bits error versus n

Target

Original42.6
Target42.1
Herbie21.2
\[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 6 regimes
  2. if i < -0.09568466101685805

    1. Initial program 28.6

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
    2. Using strategy rm
    3. Applied div-inv28.6

      \[\leadsto 100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\color{blue}{i \cdot \frac{1}{n}}}\]
    4. Applied *-un-lft-identity28.6

      \[\leadsto 100 \cdot \frac{\color{blue}{1 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}}{i \cdot \frac{1}{n}}\]
    5. Applied times-frac29.3

      \[\leadsto 100 \cdot \color{blue}{\left(\frac{1}{i} \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}}\right)}\]
    6. Applied associate-*r*29.3

      \[\leadsto \color{blue}{\left(100 \cdot \frac{1}{i}\right) \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}}}\]
    7. Simplified29.3

      \[\leadsto \color{blue}{\frac{100}{i}} \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}}\]
    8. Taylor expanded around inf 64.0

      \[\leadsto \color{blue}{100 \cdot \frac{\left(e^{\left(\log \left(\frac{1}{n}\right) - \log \left(\frac{1}{i}\right)\right) \cdot n} - 1\right) \cdot n}{i}}\]
    9. Simplified18.7

      \[\leadsto \color{blue}{\frac{\left({\left(\frac{i}{n}\right)}^{n} - 1\right) \cdot 100}{\frac{i}{n}}}\]

    if -0.09568466101685805 < i < 4.636828096634822e-231

    1. Initial program 49.2

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
    2. Using strategy rm
    3. Applied div-inv49.2

      \[\leadsto 100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\color{blue}{i \cdot \frac{1}{n}}}\]
    4. Applied *-un-lft-identity49.2

      \[\leadsto 100 \cdot \frac{\color{blue}{1 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}}{i \cdot \frac{1}{n}}\]
    5. Applied times-frac48.8

      \[\leadsto 100 \cdot \color{blue}{\left(\frac{1}{i} \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}}\right)}\]
    6. Applied associate-*r*48.9

      \[\leadsto \color{blue}{\left(100 \cdot \frac{1}{i}\right) \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}}}\]
    7. Simplified48.9

      \[\leadsto \color{blue}{\frac{100}{i}} \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}}\]
    8. Taylor expanded around 0 17.2

      \[\leadsto \frac{100}{i} \cdot \frac{\color{blue}{\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}}\]
    9. Simplified17.2

      \[\leadsto \frac{100}{i} \cdot \frac{\color{blue}{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}}{\frac{1}{n}}\]
    10. Using strategy rm
    11. Applied *-un-lft-identity17.2

      \[\leadsto \frac{100}{i} \cdot \frac{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}{\frac{1}{\color{blue}{1 \cdot n}}}\]
    12. Applied add-cube-cbrt17.2

      \[\leadsto \frac{100}{i} \cdot \frac{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}{\frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{1 \cdot n}}\]
    13. Applied times-frac17.2

      \[\leadsto \frac{100}{i} \cdot \frac{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}{\color{blue}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{n}}}\]
    14. Applied add-cube-cbrt17.8

      \[\leadsto \frac{100}{i} \cdot \frac{\color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)} \cdot \sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}}}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1} \cdot \frac{\sqrt[3]{1}}{n}}\]
    15. Applied times-frac17.8

      \[\leadsto \frac{100}{i} \cdot \color{blue}{\left(\frac{\sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)} \cdot \sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1}} \cdot \frac{\sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}}{\frac{\sqrt[3]{1}}{n}}\right)}\]
    16. Applied associate-*r*18.6

      \[\leadsto \color{blue}{\left(\frac{100}{i} \cdot \frac{\sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)} \cdot \sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}}{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{1}}\right) \cdot \frac{\sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}}{\frac{\sqrt[3]{1}}{n}}}\]
    17. Simplified18.6

      \[\leadsto \color{blue}{\left(\left(\sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)} \cdot \sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}\right) \cdot \frac{100}{i}\right)} \cdot \frac{\sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}}{\frac{\sqrt[3]{1}}{n}}\]

    if 4.636828096634822e-231 < i < 2.4218867811673365e-182

    1. Initial program 48.3

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
    2. Using strategy rm
    3. Applied div-inv48.3

      \[\leadsto 100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\color{blue}{i \cdot \frac{1}{n}}}\]
    4. Applied *-un-lft-identity48.3

      \[\leadsto 100 \cdot \frac{\color{blue}{1 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}}{i \cdot \frac{1}{n}}\]
    5. Applied times-frac47.8

      \[\leadsto 100 \cdot \color{blue}{\left(\frac{1}{i} \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}}\right)}\]
    6. Applied associate-*r*47.8

      \[\leadsto \color{blue}{\left(100 \cdot \frac{1}{i}\right) \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}}}\]
    7. Simplified47.8

      \[\leadsto \color{blue}{\frac{100}{i}} \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}}\]
    8. Taylor expanded around 0 16.9

      \[\leadsto \frac{100}{i} \cdot \frac{\color{blue}{\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}}\]
    9. Simplified16.9

      \[\leadsto \frac{100}{i} \cdot \frac{\color{blue}{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}}{\frac{1}{n}}\]
    10. Using strategy rm
    11. Applied add-cbrt-cube39.9

      \[\leadsto \frac{100}{i} \cdot \frac{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}{\frac{1}{\color{blue}{\sqrt[3]{\left(n \cdot n\right) \cdot n}}}}\]
    12. Applied add-cbrt-cube39.9

      \[\leadsto \frac{100}{i} \cdot \frac{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}{\frac{\color{blue}{\sqrt[3]{\left(1 \cdot 1\right) \cdot 1}}}{\sqrt[3]{\left(n \cdot n\right) \cdot n}}}\]
    13. Applied cbrt-undiv39.9

      \[\leadsto \frac{100}{i} \cdot \frac{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}{\color{blue}{\sqrt[3]{\frac{\left(1 \cdot 1\right) \cdot 1}{\left(n \cdot n\right) \cdot n}}}}\]
    14. Applied add-cbrt-cube48.3

      \[\leadsto \frac{100}{i} \cdot \frac{\color{blue}{\sqrt[3]{\left(\left(\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)\right) \cdot \left(\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)\right)\right) \cdot \left(\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)\right)}}}{\sqrt[3]{\frac{\left(1 \cdot 1\right) \cdot 1}{\left(n \cdot n\right) \cdot n}}}\]
    15. Applied cbrt-undiv48.3

      \[\leadsto \frac{100}{i} \cdot \color{blue}{\sqrt[3]{\frac{\left(\left(\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)\right) \cdot \left(\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)\right)\right) \cdot \left(\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)\right)}{\frac{\left(1 \cdot 1\right) \cdot 1}{\left(n \cdot n\right) \cdot n}}}}\]
    16. Simplified24.7

      \[\leadsto \frac{100}{i} \cdot \sqrt[3]{\color{blue}{{\left(\left(\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)\right) \cdot n\right)}^{3}}}\]

    if 2.4218867811673365e-182 < i < 6.433403710498658e+46

    1. Initial program 50.3

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
    2. Using strategy rm
    3. Applied div-inv50.3

      \[\leadsto 100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\color{blue}{i \cdot \frac{1}{n}}}\]
    4. Applied *-un-lft-identity50.3

      \[\leadsto 100 \cdot \frac{\color{blue}{1 \cdot \left({\left(1 + \frac{i}{n}\right)}^{n} - 1\right)}}{i \cdot \frac{1}{n}}\]
    5. Applied times-frac50.2

      \[\leadsto 100 \cdot \color{blue}{\left(\frac{1}{i} \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}}\right)}\]
    6. Applied associate-*r*50.2

      \[\leadsto \color{blue}{\left(100 \cdot \frac{1}{i}\right) \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}}}\]
    7. Simplified50.2

      \[\leadsto \color{blue}{\frac{100}{i}} \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{1}{n}}\]
    8. Taylor expanded around 0 19.3

      \[\leadsto \frac{100}{i} \cdot \frac{\color{blue}{\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}}\]
    9. Simplified19.3

      \[\leadsto \frac{100}{i} \cdot \frac{\color{blue}{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}}{\frac{1}{n}}\]
    10. Using strategy rm
    11. Applied div-inv19.3

      \[\leadsto \color{blue}{\left(100 \cdot \frac{1}{i}\right)} \cdot \frac{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}{\frac{1}{n}}\]
    12. Applied associate-*l*19.2

      \[\leadsto \color{blue}{100 \cdot \left(\frac{1}{i} \cdot \frac{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}{\frac{1}{n}}\right)}\]
    13. Simplified21.5

      \[\leadsto 100 \cdot \color{blue}{\left(\frac{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}{i} \cdot n\right)}\]

    if 6.433403710498658e+46 < i < 1.353418716849569e+183

    1. Initial program 32.0

      \[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
    2. Taylor expanded around inf 29.2

      \[\leadsto 100 \cdot \color{blue}{\frac{\left(e^{\left(\log \left(\frac{1}{n}\right) - \log \left(\frac{1}{i}\right)\right) \cdot n} - 1\right) \cdot n}{i}}\]
    3. Simplified32.0

      \[\leadsto 100 \cdot \color{blue}{\frac{n}{\frac{i}{{\left(\frac{i}{n}\right)}^{n} - 1}}}\]

    if 1.353418716849569e+183 < i

    1. Initial program 33.1

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

      \[\leadsto 100 \cdot \frac{\color{blue}{\left(1 \cdot i + \left(\log 1 \cdot n + 1\right)\right)} - 1}{\frac{i}{n}}\]
    3. Simplified32.9

      \[\leadsto 100 \cdot \frac{\color{blue}{\mathsf{fma}\left(1, i, \mathsf{fma}\left(\log 1, n, 1\right)\right)} - 1}{\frac{i}{n}}\]
  3. Recombined 6 regimes into one program.
  4. Final simplification21.2

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \le -0.09568466101685804692245085334434406831861:\\ \;\;\;\;\frac{\left({\left(\frac{i}{n}\right)}^{n} - 1\right) \cdot 100}{\frac{i}{n}}\\ \mathbf{elif}\;i \le 4.636828096634822172894426601649853756376 \cdot 10^{-231}:\\ \;\;\;\;\left(\left(\sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)} \cdot \sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}\right) \cdot \frac{100}{i}\right) \cdot \frac{\sqrt[3]{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {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 2.421886781167336491233076084341835921918 \cdot 10^{-182}:\\ \;\;\;\;\frac{100}{i} \cdot \sqrt[3]{{\left(\left(\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)\right) \cdot n\right)}^{3}}\\ \mathbf{elif}\;i \le 6.433403710498657594142250154269082661313 \cdot 10^{46}:\\ \;\;\;\;100 \cdot \left(\frac{\mathsf{fma}\left(1, i, \mathsf{fma}\left(0.5, {i}^{2}, \log 1 \cdot n\right)\right) - 0.5 \cdot \left({i}^{2} \cdot \log 1\right)}{i} \cdot n\right)\\ \mathbf{elif}\;i \le 1.353418716849568981322833055613312096611 \cdot 10^{183}:\\ \;\;\;\;100 \cdot \frac{n}{\frac{i}{{\left(\frac{i}{n}\right)}^{n} - 1}}\\ \mathbf{else}:\\ \;\;\;\;100 \cdot \frac{\mathsf{fma}\left(1, i, \mathsf{fma}\left(\log 1, n, 1\right)\right) - 1}{\frac{i}{n}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019326 +o rules:numerics
(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))))