Average Error: 42.2 → 26.6
Time: 34.4s
Precision: 64
\[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
\[\begin{array}{l} \mathbf{if}\;i \le -5.642265308759161 \cdot 10^{-06}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, 100, -100\right)}{i}}{\frac{1}{n}}\\ \mathbf{elif}\;i \le -3.088990014014521 \cdot 10^{-147}:\\ \;\;\;\;\frac{\mathsf{fma}\left(100, i, \left(i \cdot i\right) \cdot \left(50 + i \cdot \frac{50}{3}\right)\right)}{\frac{i}{n}}\\ \mathbf{elif}\;i \le -1.0135127503428662 \cdot 10^{-166}:\\ \;\;\;\;\left(\mathsf{fma}\left(e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, 100, -100\right) \cdot \sqrt{\frac{1}{\frac{i}{n}}}\right) \cdot \sqrt{\frac{1}{\frac{i}{n}}}\\ \mathbf{elif}\;i \le -3.0864902391323963 \cdot 10^{-260}:\\ \;\;\;\;\frac{\mathsf{fma}\left(100, i, \left(i \cdot i\right) \cdot \left(50 + i \cdot \frac{50}{3}\right)\right)}{\frac{i}{n}}\\ \mathbf{elif}\;i \le 3.1626526043984503 \cdot 10^{-260}:\\ \;\;\;\;\frac{\mathsf{fma}\left(e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, 100, -100\right)}{\sqrt[3]{\frac{1}{n}} \cdot \sqrt[3]{\frac{1}{n}}} \cdot \frac{\frac{1}{i}}{\sqrt[3]{\frac{1}{n}}}\\ \mathbf{elif}\;i \le 0.07034960194177167:\\ \;\;\;\;\frac{\mathsf{fma}\left(100, i, \left(i \cdot i\right) \cdot \left(50 + i \cdot \frac{50}{3}\right)\right)}{\frac{i}{n}}\\ \mathbf{elif}\;i \le 2.6398510549660955 \cdot 10^{+147}:\\ \;\;\;\;\frac{\mathsf{fma}\left(50 \cdot \left(n \cdot n\right), \log n \cdot \log n, \mathsf{fma}\left(\frac{50}{3}, \left(\log i \cdot \left(\log i \cdot \log i\right)\right) \cdot \left(\left(n \cdot n\right) \cdot n\right), \mathsf{fma}\left(100 \cdot n, \log i, \mathsf{fma}\left(\frac{100}{3}, \left(\log i \cdot \left(\log n \cdot \log n\right)\right) \cdot \left(\left(n \cdot n\right) \cdot n\right), \mathsf{fma}\left(\frac{50}{3}, \left(\log i \cdot \left(\log n \cdot \log n\right)\right) \cdot \left(\left(n \cdot n\right) \cdot n\right), \left(\log i \cdot \log i\right) \cdot \left(50 \cdot \left(n \cdot n\right)\right)\right)\right)\right)\right) - \mathsf{fma}\left(\left(\left(\log i \cdot \log i\right) \cdot \log n\right) \cdot \left(\left(n \cdot n\right) \cdot n\right), \frac{100}{3}, \mathsf{fma}\left(n \cdot \left(\left(n \cdot n\right) \cdot \frac{50}{3}\right), \left(\log n \cdot \log n\right) \cdot \log n, \mathsf{fma}\left(\frac{50}{3}, \left(\left(\log i \cdot \log i\right) \cdot \log n\right) \cdot \left(\left(n \cdot n\right) \cdot n\right), \left(\log n \cdot 100\right) \cdot n\right)\right) + \left(\left(n \cdot n\right) \cdot \left(\log i \cdot \log n\right)\right) \cdot 100\right)\right)}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + -100}{\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 -5.642265308759161 \cdot 10^{-06}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, 100, -100\right)}{i}}{\frac{1}{n}}\\

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

\mathbf{elif}\;i \le -1.0135127503428662 \cdot 10^{-166}:\\
\;\;\;\;\left(\mathsf{fma}\left(e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, 100, -100\right) \cdot \sqrt{\frac{1}{\frac{i}{n}}}\right) \cdot \sqrt{\frac{1}{\frac{i}{n}}}\\

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

\mathbf{elif}\;i \le 3.1626526043984503 \cdot 10^{-260}:\\
\;\;\;\;\frac{\mathsf{fma}\left(e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, 100, -100\right)}{\sqrt[3]{\frac{1}{n}} \cdot \sqrt[3]{\frac{1}{n}}} \cdot \frac{\frac{1}{i}}{\sqrt[3]{\frac{1}{n}}}\\

\mathbf{elif}\;i \le 0.07034960194177167:\\
\;\;\;\;\frac{\mathsf{fma}\left(100, i, \left(i \cdot i\right) \cdot \left(50 + i \cdot \frac{50}{3}\right)\right)}{\frac{i}{n}}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + -100}{\frac{i}{n}}\\

\end{array}
double f(double i, double n) {
        double r4072985 = 100.0;
        double r4072986 = 1.0;
        double r4072987 = i;
        double r4072988 = n;
        double r4072989 = r4072987 / r4072988;
        double r4072990 = r4072986 + r4072989;
        double r4072991 = pow(r4072990, r4072988);
        double r4072992 = r4072991 - r4072986;
        double r4072993 = r4072992 / r4072989;
        double r4072994 = r4072985 * r4072993;
        return r4072994;
}

double f(double i, double n) {
        double r4072995 = i;
        double r4072996 = -5.642265308759161e-06;
        bool r4072997 = r4072995 <= r4072996;
        double r4072998 = n;
        double r4072999 = r4072995 / r4072998;
        double r4073000 = log1p(r4072999);
        double r4073001 = r4072998 * r4073000;
        double r4073002 = exp(r4073001);
        double r4073003 = 100.0;
        double r4073004 = -100.0;
        double r4073005 = fma(r4073002, r4073003, r4073004);
        double r4073006 = r4073005 / r4072995;
        double r4073007 = 1.0;
        double r4073008 = r4073007 / r4072998;
        double r4073009 = r4073006 / r4073008;
        double r4073010 = -3.088990014014521e-147;
        bool r4073011 = r4072995 <= r4073010;
        double r4073012 = r4072995 * r4072995;
        double r4073013 = 50.0;
        double r4073014 = 16.666666666666668;
        double r4073015 = r4072995 * r4073014;
        double r4073016 = r4073013 + r4073015;
        double r4073017 = r4073012 * r4073016;
        double r4073018 = fma(r4073003, r4072995, r4073017);
        double r4073019 = r4073018 / r4072999;
        double r4073020 = -1.0135127503428662e-166;
        bool r4073021 = r4072995 <= r4073020;
        double r4073022 = r4073007 / r4072999;
        double r4073023 = sqrt(r4073022);
        double r4073024 = r4073005 * r4073023;
        double r4073025 = r4073024 * r4073023;
        double r4073026 = -3.0864902391323963e-260;
        bool r4073027 = r4072995 <= r4073026;
        double r4073028 = 3.1626526043984503e-260;
        bool r4073029 = r4072995 <= r4073028;
        double r4073030 = cbrt(r4073008);
        double r4073031 = r4073030 * r4073030;
        double r4073032 = r4073005 / r4073031;
        double r4073033 = r4073007 / r4072995;
        double r4073034 = r4073033 / r4073030;
        double r4073035 = r4073032 * r4073034;
        double r4073036 = 0.07034960194177167;
        bool r4073037 = r4072995 <= r4073036;
        double r4073038 = 2.6398510549660955e+147;
        bool r4073039 = r4072995 <= r4073038;
        double r4073040 = r4072998 * r4072998;
        double r4073041 = r4073013 * r4073040;
        double r4073042 = log(r4072998);
        double r4073043 = r4073042 * r4073042;
        double r4073044 = log(r4072995);
        double r4073045 = r4073044 * r4073044;
        double r4073046 = r4073044 * r4073045;
        double r4073047 = r4073040 * r4072998;
        double r4073048 = r4073046 * r4073047;
        double r4073049 = r4073003 * r4072998;
        double r4073050 = 33.333333333333336;
        double r4073051 = r4073044 * r4073043;
        double r4073052 = r4073051 * r4073047;
        double r4073053 = r4073045 * r4073041;
        double r4073054 = fma(r4073014, r4073052, r4073053);
        double r4073055 = fma(r4073050, r4073052, r4073054);
        double r4073056 = fma(r4073049, r4073044, r4073055);
        double r4073057 = fma(r4073014, r4073048, r4073056);
        double r4073058 = r4073045 * r4073042;
        double r4073059 = r4073058 * r4073047;
        double r4073060 = r4073040 * r4073014;
        double r4073061 = r4072998 * r4073060;
        double r4073062 = r4073043 * r4073042;
        double r4073063 = r4073042 * r4073003;
        double r4073064 = r4073063 * r4072998;
        double r4073065 = fma(r4073014, r4073059, r4073064);
        double r4073066 = fma(r4073061, r4073062, r4073065);
        double r4073067 = r4073044 * r4073042;
        double r4073068 = r4073040 * r4073067;
        double r4073069 = r4073068 * r4073003;
        double r4073070 = r4073066 + r4073069;
        double r4073071 = fma(r4073059, r4073050, r4073070);
        double r4073072 = r4073057 - r4073071;
        double r4073073 = fma(r4073041, r4073043, r4073072);
        double r4073074 = r4073073 / r4072999;
        double r4073075 = r4073007 + r4072999;
        double r4073076 = pow(r4073075, r4072998);
        double r4073077 = r4073003 * r4073076;
        double r4073078 = r4073077 + r4073004;
        double r4073079 = r4073078 / r4072999;
        double r4073080 = r4073039 ? r4073074 : r4073079;
        double r4073081 = r4073037 ? r4073019 : r4073080;
        double r4073082 = r4073029 ? r4073035 : r4073081;
        double r4073083 = r4073027 ? r4073019 : r4073082;
        double r4073084 = r4073021 ? r4073025 : r4073083;
        double r4073085 = r4073011 ? r4073019 : r4073084;
        double r4073086 = r4072997 ? r4073009 : r4073085;
        return r4073086;
}

Error

Bits error versus i

Bits error versus n

Target

Original42.2
Target42.0
Herbie26.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 6 regimes
  2. if i < -5.642265308759161e-06

    1. Initial program 28.3

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

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

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, 100, -100\right)}{\color{blue}{i \cdot \frac{1}{n}}}\]
    9. Applied associate-/r*6.3

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

    if -5.642265308759161e-06 < i < -3.088990014014521e-147 or -1.0135127503428662e-166 < i < -3.0864902391323963e-260 or 3.1626526043984503e-260 < i < 0.07034960194177167

    1. Initial program 50.4

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

      \[\leadsto \color{blue}{\frac{\mathsf{fma}\left({\left(1 + \frac{i}{n}\right)}^{n}, 100, -100\right)}{\frac{i}{n}}}\]
    3. Taylor expanded around 0 30.9

      \[\leadsto \frac{\color{blue}{100 \cdot i + \left(50 \cdot {i}^{2} + \frac{50}{3} \cdot {i}^{3}\right)}}{\frac{i}{n}}\]
    4. Simplified30.9

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

    if -3.088990014014521e-147 < i < -1.0135127503428662e-166

    1. Initial program 47.1

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

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

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

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

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

      \[\leadsto \color{blue}{\mathsf{fma}\left(e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, 100, -100\right) \cdot \frac{1}{\frac{i}{n}}}\]
    9. Using strategy rm
    10. Applied add-sqr-sqrt47.1

      \[\leadsto \mathsf{fma}\left(e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, 100, -100\right) \cdot \color{blue}{\left(\sqrt{\frac{1}{\frac{i}{n}}} \cdot \sqrt{\frac{1}{\frac{i}{n}}}\right)}\]
    11. Applied associate-*r*47.1

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

    if -3.0864902391323963e-260 < i < 3.1626526043984503e-260

    1. Initial program 49.3

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

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

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

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

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

      \[\leadsto \frac{\mathsf{fma}\left(e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, 100, -100\right)}{\color{blue}{i \cdot \frac{1}{n}}}\]
    9. Applied associate-/r*49.6

      \[\leadsto \color{blue}{\frac{\frac{\mathsf{fma}\left(e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, 100, -100\right)}{i}}{\frac{1}{n}}}\]
    10. Using strategy rm
    11. Applied add-cube-cbrt49.6

      \[\leadsto \frac{\frac{\mathsf{fma}\left(e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, 100, -100\right)}{i}}{\color{blue}{\left(\sqrt[3]{\frac{1}{n}} \cdot \sqrt[3]{\frac{1}{n}}\right) \cdot \sqrt[3]{\frac{1}{n}}}}\]
    12. Applied div-inv49.6

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

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

    if 0.07034960194177167 < i < 2.6398510549660955e+147

    1. Initial program 30.7

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

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

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

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

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

      \[\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. Simplified13.8

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

    if 2.6398510549660955e+147 < i

    1. Initial program 30.9

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

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

      \[\leadsto \frac{\color{blue}{{\left(1 + \frac{i}{n}\right)}^{n} \cdot 100 + -100}}{\frac{i}{n}}\]
  3. Recombined 6 regimes into one program.
  4. Final simplification26.6

    \[\leadsto \begin{array}{l} \mathbf{if}\;i \le -5.642265308759161 \cdot 10^{-06}:\\ \;\;\;\;\frac{\frac{\mathsf{fma}\left(e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, 100, -100\right)}{i}}{\frac{1}{n}}\\ \mathbf{elif}\;i \le -3.088990014014521 \cdot 10^{-147}:\\ \;\;\;\;\frac{\mathsf{fma}\left(100, i, \left(i \cdot i\right) \cdot \left(50 + i \cdot \frac{50}{3}\right)\right)}{\frac{i}{n}}\\ \mathbf{elif}\;i \le -1.0135127503428662 \cdot 10^{-166}:\\ \;\;\;\;\left(\mathsf{fma}\left(e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, 100, -100\right) \cdot \sqrt{\frac{1}{\frac{i}{n}}}\right) \cdot \sqrt{\frac{1}{\frac{i}{n}}}\\ \mathbf{elif}\;i \le -3.0864902391323963 \cdot 10^{-260}:\\ \;\;\;\;\frac{\mathsf{fma}\left(100, i, \left(i \cdot i\right) \cdot \left(50 + i \cdot \frac{50}{3}\right)\right)}{\frac{i}{n}}\\ \mathbf{elif}\;i \le 3.1626526043984503 \cdot 10^{-260}:\\ \;\;\;\;\frac{\mathsf{fma}\left(e^{n \cdot \mathsf{log1p}\left(\frac{i}{n}\right)}, 100, -100\right)}{\sqrt[3]{\frac{1}{n}} \cdot \sqrt[3]{\frac{1}{n}}} \cdot \frac{\frac{1}{i}}{\sqrt[3]{\frac{1}{n}}}\\ \mathbf{elif}\;i \le 0.07034960194177167:\\ \;\;\;\;\frac{\mathsf{fma}\left(100, i, \left(i \cdot i\right) \cdot \left(50 + i \cdot \frac{50}{3}\right)\right)}{\frac{i}{n}}\\ \mathbf{elif}\;i \le 2.6398510549660955 \cdot 10^{+147}:\\ \;\;\;\;\frac{\mathsf{fma}\left(50 \cdot \left(n \cdot n\right), \log n \cdot \log n, \mathsf{fma}\left(\frac{50}{3}, \left(\log i \cdot \left(\log i \cdot \log i\right)\right) \cdot \left(\left(n \cdot n\right) \cdot n\right), \mathsf{fma}\left(100 \cdot n, \log i, \mathsf{fma}\left(\frac{100}{3}, \left(\log i \cdot \left(\log n \cdot \log n\right)\right) \cdot \left(\left(n \cdot n\right) \cdot n\right), \mathsf{fma}\left(\frac{50}{3}, \left(\log i \cdot \left(\log n \cdot \log n\right)\right) \cdot \left(\left(n \cdot n\right) \cdot n\right), \left(\log i \cdot \log i\right) \cdot \left(50 \cdot \left(n \cdot n\right)\right)\right)\right)\right)\right) - \mathsf{fma}\left(\left(\left(\log i \cdot \log i\right) \cdot \log n\right) \cdot \left(\left(n \cdot n\right) \cdot n\right), \frac{100}{3}, \mathsf{fma}\left(n \cdot \left(\left(n \cdot n\right) \cdot \frac{50}{3}\right), \left(\log n \cdot \log n\right) \cdot \log n, \mathsf{fma}\left(\frac{50}{3}, \left(\left(\log i \cdot \log i\right) \cdot \log n\right) \cdot \left(\left(n \cdot n\right) \cdot n\right), \left(\log n \cdot 100\right) \cdot n\right)\right) + \left(\left(n \cdot n\right) \cdot \left(\log i \cdot \log n\right)\right) \cdot 100\right)\right)}{\frac{i}{n}}\\ \mathbf{else}:\\ \;\;\;\;\frac{100 \cdot {\left(1 + \frac{i}{n}\right)}^{n} + -100}{\frac{i}{n}}\\ \end{array}\]

Reproduce

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