Average Error: 42.8 → 22.1
Time: 30.6s
Precision: 64
\[100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\]
\[\begin{array}{l} \mathbf{if}\;n \le -6.142887410522617750964470107151729366347 \cdot 10^{122}:\\ \;\;\;\;\frac{\frac{n}{\frac{\sqrt[3]{i} \cdot \sqrt[3]{i}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)}}}}{\frac{\frac{\sqrt[3]{i}}{100}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(1, i, {i}^{2} \cdot 0.5\right)\right) - \left({i}^{2} \cdot \log 1\right) \cdot 0.5}}}\\ \mathbf{elif}\;n \le -8.238753264410919988214239002998485354106 \cdot 10^{106}:\\ \;\;\;\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \cdot 100\\ \mathbf{elif}\;n \le -857793591555007499471484354560:\\ \;\;\;\;\frac{\frac{n}{\frac{\sqrt[3]{i} \cdot \sqrt[3]{i}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)}}}}{\frac{\frac{\sqrt[3]{i}}{100}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(1, i, {i}^{2} \cdot 0.5\right)\right) - \left({i}^{2} \cdot \log 1\right) \cdot 0.5}}}\\ \mathbf{elif}\;n \le -1.236859886325671599702305472643862473619 \cdot 10^{-310}:\\ \;\;\;\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \cdot 100\\ \mathbf{elif}\;n \le 5.768185076220756264364043290256755539771 \cdot 10^{-118} \lor \neg \left(n \le 6.309945584301677363866091685128909802323 \cdot 10^{-71}\right) \land n \le 2.01721655864651905827273355448106916988 \cdot 10^{-14}:\\ \;\;\;\;\mathsf{fma}\left(\frac{{n}^{4} \cdot \left(\log i \cdot {\left(\log n\right)}^{2}\right)}{i}, 33.3333333333333285963817615993320941925, \mathsf{fma}\left(16.66666666666666429819088079966604709625, \frac{{n}^{4} \cdot \left(\log i \cdot {\left(\log n\right)}^{2}\right)}{i}, \mathsf{fma}\left(16.66666666666666429819088079966604709625, \frac{{n}^{4}}{\frac{i}{{\left(\log i\right)}^{3}}}, \mathsf{fma}\left(100, \frac{n \cdot n}{\frac{i}{\log i}}, \left(\frac{{n}^{3}}{\frac{i}{{\left(\log i\right)}^{2}}} + \frac{{n}^{3}}{\frac{i}{{\left(\log n\right)}^{2}}}\right) \cdot 50\right)\right)\right) - \mathsf{fma}\left(\frac{{n}^{4}}{\frac{i}{{\left(\log n\right)}^{3}}}, 16.66666666666666429819088079966604709625, \mathsf{fma}\left(16.66666666666666429819088079966604709625, \frac{\log n \cdot \left({n}^{4} \cdot {\left(\log i\right)}^{2}\right)}{i}, \mathsf{fma}\left(\frac{{n}^{3}}{\frac{i}{\log n \cdot \log i}}, 50, \mathsf{fma}\left(\frac{\log n \cdot \left({n}^{4} \cdot {\left(\log i\right)}^{2}\right)}{i}, 33.3333333333333285963817615993320941925, \mathsf{fma}\left(50, \frac{{n}^{3}}{\frac{i}{\log n \cdot \log i}}, \frac{\left(\log n \cdot \left(n \cdot n\right)\right) \cdot 100}{i}\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{n}{\frac{\sqrt[3]{i} \cdot \sqrt[3]{i}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)}}}}{\frac{\frac{\sqrt[3]{i}}{100}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(1, i, {i}^{2} \cdot 0.5\right)\right) - \left({i}^{2} \cdot \log 1\right) \cdot 0.5}}}\\ \end{array}\]
100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}
\begin{array}{l}
\mathbf{if}\;n \le -6.142887410522617750964470107151729366347 \cdot 10^{122}:\\
\;\;\;\;\frac{\frac{n}{\frac{\sqrt[3]{i} \cdot \sqrt[3]{i}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)}}}}{\frac{\frac{\sqrt[3]{i}}{100}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(1, i, {i}^{2} \cdot 0.5\right)\right) - \left({i}^{2} \cdot \log 1\right) \cdot 0.5}}}\\

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

\mathbf{elif}\;n \le -857793591555007499471484354560:\\
\;\;\;\;\frac{\frac{n}{\frac{\sqrt[3]{i} \cdot \sqrt[3]{i}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)}}}}{\frac{\frac{\sqrt[3]{i}}{100}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(1, i, {i}^{2} \cdot 0.5\right)\right) - \left({i}^{2} \cdot \log 1\right) \cdot 0.5}}}\\

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

\mathbf{elif}\;n \le 5.768185076220756264364043290256755539771 \cdot 10^{-118} \lor \neg \left(n \le 6.309945584301677363866091685128909802323 \cdot 10^{-71}\right) \land n \le 2.01721655864651905827273355448106916988 \cdot 10^{-14}:\\
\;\;\;\;\mathsf{fma}\left(\frac{{n}^{4} \cdot \left(\log i \cdot {\left(\log n\right)}^{2}\right)}{i}, 33.3333333333333285963817615993320941925, \mathsf{fma}\left(16.66666666666666429819088079966604709625, \frac{{n}^{4} \cdot \left(\log i \cdot {\left(\log n\right)}^{2}\right)}{i}, \mathsf{fma}\left(16.66666666666666429819088079966604709625, \frac{{n}^{4}}{\frac{i}{{\left(\log i\right)}^{3}}}, \mathsf{fma}\left(100, \frac{n \cdot n}{\frac{i}{\log i}}, \left(\frac{{n}^{3}}{\frac{i}{{\left(\log i\right)}^{2}}} + \frac{{n}^{3}}{\frac{i}{{\left(\log n\right)}^{2}}}\right) \cdot 50\right)\right)\right) - \mathsf{fma}\left(\frac{{n}^{4}}{\frac{i}{{\left(\log n\right)}^{3}}}, 16.66666666666666429819088079966604709625, \mathsf{fma}\left(16.66666666666666429819088079966604709625, \frac{\log n \cdot \left({n}^{4} \cdot {\left(\log i\right)}^{2}\right)}{i}, \mathsf{fma}\left(\frac{{n}^{3}}{\frac{i}{\log n \cdot \log i}}, 50, \mathsf{fma}\left(\frac{\log n \cdot \left({n}^{4} \cdot {\left(\log i\right)}^{2}\right)}{i}, 33.3333333333333285963817615993320941925, \mathsf{fma}\left(50, \frac{{n}^{3}}{\frac{i}{\log n \cdot \log i}}, \frac{\left(\log n \cdot \left(n \cdot n\right)\right) \cdot 100}{i}\right)\right)\right)\right)\right)\right)\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{n}{\frac{\sqrt[3]{i} \cdot \sqrt[3]{i}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)}}}}{\frac{\frac{\sqrt[3]{i}}{100}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(1, i, {i}^{2} \cdot 0.5\right)\right) - \left({i}^{2} \cdot \log 1\right) \cdot 0.5}}}\\

\end{array}
double f(double i, double n) {
        double r126193 = 100.0;
        double r126194 = 1.0;
        double r126195 = i;
        double r126196 = n;
        double r126197 = r126195 / r126196;
        double r126198 = r126194 + r126197;
        double r126199 = pow(r126198, r126196);
        double r126200 = r126199 - r126194;
        double r126201 = r126200 / r126197;
        double r126202 = r126193 * r126201;
        return r126202;
}

double f(double i, double n) {
        double r126203 = n;
        double r126204 = -6.142887410522618e+122;
        bool r126205 = r126203 <= r126204;
        double r126206 = i;
        double r126207 = cbrt(r126206);
        double r126208 = r126207 * r126207;
        double r126209 = 1.0;
        double r126210 = log(r126209);
        double r126211 = r126206 * r126206;
        double r126212 = 0.5;
        double r126213 = r126206 * r126209;
        double r126214 = fma(r126211, r126212, r126213);
        double r126215 = fma(r126210, r126203, r126214);
        double r126216 = r126212 * r126211;
        double r126217 = r126210 * r126216;
        double r126218 = r126215 - r126217;
        double r126219 = cbrt(r126218);
        double r126220 = r126219 * r126219;
        double r126221 = r126208 / r126220;
        double r126222 = r126203 / r126221;
        double r126223 = 100.0;
        double r126224 = r126207 / r126223;
        double r126225 = 2.0;
        double r126226 = pow(r126206, r126225);
        double r126227 = r126226 * r126212;
        double r126228 = fma(r126209, r126206, r126227);
        double r126229 = fma(r126210, r126203, r126228);
        double r126230 = r126226 * r126210;
        double r126231 = r126230 * r126212;
        double r126232 = r126229 - r126231;
        double r126233 = cbrt(r126232);
        double r126234 = r126224 / r126233;
        double r126235 = r126222 / r126234;
        double r126236 = -8.23875326441092e+106;
        bool r126237 = r126203 <= r126236;
        double r126238 = r126206 / r126203;
        double r126239 = r126209 + r126238;
        double r126240 = pow(r126239, r126203);
        double r126241 = r126240 - r126209;
        double r126242 = r126241 / r126238;
        double r126243 = r126242 * r126223;
        double r126244 = -8.577935915550075e+29;
        bool r126245 = r126203 <= r126244;
        double r126246 = -1.23685988632567e-310;
        bool r126247 = r126203 <= r126246;
        double r126248 = 5.768185076220756e-118;
        bool r126249 = r126203 <= r126248;
        double r126250 = 6.309945584301677e-71;
        bool r126251 = r126203 <= r126250;
        double r126252 = !r126251;
        double r126253 = 2.017216558646519e-14;
        bool r126254 = r126203 <= r126253;
        bool r126255 = r126252 && r126254;
        bool r126256 = r126249 || r126255;
        double r126257 = 4.0;
        double r126258 = pow(r126203, r126257);
        double r126259 = log(r126206);
        double r126260 = log(r126203);
        double r126261 = pow(r126260, r126225);
        double r126262 = r126259 * r126261;
        double r126263 = r126258 * r126262;
        double r126264 = r126263 / r126206;
        double r126265 = 33.33333333333333;
        double r126266 = 16.666666666666664;
        double r126267 = 3.0;
        double r126268 = pow(r126259, r126267);
        double r126269 = r126206 / r126268;
        double r126270 = r126258 / r126269;
        double r126271 = r126203 * r126203;
        double r126272 = r126206 / r126259;
        double r126273 = r126271 / r126272;
        double r126274 = pow(r126203, r126267);
        double r126275 = pow(r126259, r126225);
        double r126276 = r126206 / r126275;
        double r126277 = r126274 / r126276;
        double r126278 = r126206 / r126261;
        double r126279 = r126274 / r126278;
        double r126280 = r126277 + r126279;
        double r126281 = 50.0;
        double r126282 = r126280 * r126281;
        double r126283 = fma(r126223, r126273, r126282);
        double r126284 = fma(r126266, r126270, r126283);
        double r126285 = fma(r126266, r126264, r126284);
        double r126286 = pow(r126260, r126267);
        double r126287 = r126206 / r126286;
        double r126288 = r126258 / r126287;
        double r126289 = r126258 * r126275;
        double r126290 = r126260 * r126289;
        double r126291 = r126290 / r126206;
        double r126292 = r126260 * r126259;
        double r126293 = r126206 / r126292;
        double r126294 = r126274 / r126293;
        double r126295 = r126260 * r126271;
        double r126296 = r126295 * r126223;
        double r126297 = r126296 / r126206;
        double r126298 = fma(r126281, r126294, r126297);
        double r126299 = fma(r126291, r126265, r126298);
        double r126300 = fma(r126294, r126281, r126299);
        double r126301 = fma(r126266, r126291, r126300);
        double r126302 = fma(r126288, r126266, r126301);
        double r126303 = r126285 - r126302;
        double r126304 = fma(r126264, r126265, r126303);
        double r126305 = r126256 ? r126304 : r126235;
        double r126306 = r126247 ? r126243 : r126305;
        double r126307 = r126245 ? r126235 : r126306;
        double r126308 = r126237 ? r126243 : r126307;
        double r126309 = r126205 ? r126235 : r126308;
        return r126309;
}

Error

Bits error versus i

Bits error versus n

Target

Original42.8
Target42.8
Herbie22.1
\[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 3 regimes
  2. if n < -6.142887410522618e+122 or -8.23875326441092e+106 < n < -8.577935915550075e+29 or 5.768185076220756e-118 < n < 6.309945584301677e-71 or 2.017216558646519e-14 < n

    1. Initial program 53.1

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

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

      \[\leadsto \frac{n}{\frac{\frac{i}{100}}{\color{blue}{\left(\log 1 \cdot n + \left(1 \cdot i + 0.5 \cdot {i}^{2}\right)\right) - 0.5 \cdot \left(\log 1 \cdot {i}^{2}\right)}}}\]
    4. Simplified21.6

      \[\leadsto \frac{n}{\frac{\frac{i}{100}}{\color{blue}{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(1, i, 0.5 \cdot {i}^{2}\right)\right) - 0.5 \cdot \left(\log 1 \cdot {i}^{2}\right)}}}\]
    5. Using strategy rm
    6. Applied add-cube-cbrt22.4

      \[\leadsto \frac{n}{\frac{\frac{i}{100}}{\color{blue}{\left(\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(1, i, 0.5 \cdot {i}^{2}\right)\right) - 0.5 \cdot \left(\log 1 \cdot {i}^{2}\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(1, i, 0.5 \cdot {i}^{2}\right)\right) - 0.5 \cdot \left(\log 1 \cdot {i}^{2}\right)}\right) \cdot \sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(1, i, 0.5 \cdot {i}^{2}\right)\right) - 0.5 \cdot \left(\log 1 \cdot {i}^{2}\right)}}}}\]
    7. Applied *-un-lft-identity22.4

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

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

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

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

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

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

    if -6.142887410522618e+122 < n < -8.23875326441092e+106 or -8.577935915550075e+29 < n < -1.23685988632567e-310

    1. Initial program 19.6

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

    if -1.23685988632567e-310 < n < 5.768185076220756e-118 or 6.309945584301677e-71 < n < 2.017216558646519e-14

    1. Initial program 48.3

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

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

      \[\leadsto \color{blue}{\left(33.3333333333333285963817615993320941925 \cdot \frac{{n}^{4} \cdot \left({\left(\log n\right)}^{2} \cdot \log i\right)}{i} + \left(16.66666666666666429819088079966604709625 \cdot \frac{{n}^{4} \cdot \left(\log i \cdot {\left(\log n\right)}^{2}\right)}{i} + \left(16.66666666666666429819088079966604709625 \cdot \frac{{n}^{4} \cdot {\left(\log i\right)}^{3}}{i} + \left(100 \cdot \frac{{n}^{2} \cdot \log i}{i} + \left(50 \cdot \frac{{n}^{3} \cdot {\left(\log i\right)}^{2}}{i} + 50 \cdot \frac{{n}^{3} \cdot {\left(\log n\right)}^{2}}{i}\right)\right)\right)\right)\right) - \left(16.66666666666666429819088079966604709625 \cdot \frac{{n}^{4} \cdot {\left(\log n\right)}^{3}}{i} + \left(16.66666666666666429819088079966604709625 \cdot \frac{{n}^{4} \cdot \left(\log n \cdot {\left(\log i\right)}^{2}\right)}{i} + \left(50 \cdot \frac{{n}^{3} \cdot \left(\log n \cdot \log i\right)}{i} + \left(33.3333333333333285963817615993320941925 \cdot \frac{{n}^{4} \cdot \left({\left(\log i\right)}^{2} \cdot \log n\right)}{i} + \left(100 \cdot \frac{{n}^{2} \cdot \log n}{i} + 50 \cdot \frac{{n}^{3} \cdot \left(\log i \cdot \log n\right)}{i}\right)\right)\right)\right)\right)}\]
    4. Simplified27.5

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;n \le -6.142887410522617750964470107151729366347 \cdot 10^{122}:\\ \;\;\;\;\frac{\frac{n}{\frac{\sqrt[3]{i} \cdot \sqrt[3]{i}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)}}}}{\frac{\frac{\sqrt[3]{i}}{100}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(1, i, {i}^{2} \cdot 0.5\right)\right) - \left({i}^{2} \cdot \log 1\right) \cdot 0.5}}}\\ \mathbf{elif}\;n \le -8.238753264410919988214239002998485354106 \cdot 10^{106}:\\ \;\;\;\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \cdot 100\\ \mathbf{elif}\;n \le -857793591555007499471484354560:\\ \;\;\;\;\frac{\frac{n}{\frac{\sqrt[3]{i} \cdot \sqrt[3]{i}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)}}}}{\frac{\frac{\sqrt[3]{i}}{100}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(1, i, {i}^{2} \cdot 0.5\right)\right) - \left({i}^{2} \cdot \log 1\right) \cdot 0.5}}}\\ \mathbf{elif}\;n \le -1.236859886325671599702305472643862473619 \cdot 10^{-310}:\\ \;\;\;\;\frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}} \cdot 100\\ \mathbf{elif}\;n \le 5.768185076220756264364043290256755539771 \cdot 10^{-118} \lor \neg \left(n \le 6.309945584301677363866091685128909802323 \cdot 10^{-71}\right) \land n \le 2.01721655864651905827273355448106916988 \cdot 10^{-14}:\\ \;\;\;\;\mathsf{fma}\left(\frac{{n}^{4} \cdot \left(\log i \cdot {\left(\log n\right)}^{2}\right)}{i}, 33.3333333333333285963817615993320941925, \mathsf{fma}\left(16.66666666666666429819088079966604709625, \frac{{n}^{4} \cdot \left(\log i \cdot {\left(\log n\right)}^{2}\right)}{i}, \mathsf{fma}\left(16.66666666666666429819088079966604709625, \frac{{n}^{4}}{\frac{i}{{\left(\log i\right)}^{3}}}, \mathsf{fma}\left(100, \frac{n \cdot n}{\frac{i}{\log i}}, \left(\frac{{n}^{3}}{\frac{i}{{\left(\log i\right)}^{2}}} + \frac{{n}^{3}}{\frac{i}{{\left(\log n\right)}^{2}}}\right) \cdot 50\right)\right)\right) - \mathsf{fma}\left(\frac{{n}^{4}}{\frac{i}{{\left(\log n\right)}^{3}}}, 16.66666666666666429819088079966604709625, \mathsf{fma}\left(16.66666666666666429819088079966604709625, \frac{\log n \cdot \left({n}^{4} \cdot {\left(\log i\right)}^{2}\right)}{i}, \mathsf{fma}\left(\frac{{n}^{3}}{\frac{i}{\log n \cdot \log i}}, 50, \mathsf{fma}\left(\frac{\log n \cdot \left({n}^{4} \cdot {\left(\log i\right)}^{2}\right)}{i}, 33.3333333333333285963817615993320941925, \mathsf{fma}\left(50, \frac{{n}^{3}}{\frac{i}{\log n \cdot \log i}}, \frac{\left(\log n \cdot \left(n \cdot n\right)\right) \cdot 100}{i}\right)\right)\right)\right)\right)\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{n}{\frac{\sqrt[3]{i} \cdot \sqrt[3]{i}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)} \cdot \sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(i \cdot i, 0.5, i \cdot 1\right)\right) - \log 1 \cdot \left(0.5 \cdot \left(i \cdot i\right)\right)}}}}{\frac{\frac{\sqrt[3]{i}}{100}}{\sqrt[3]{\mathsf{fma}\left(\log 1, n, \mathsf{fma}\left(1, i, {i}^{2} \cdot 0.5\right)\right) - \left({i}^{2} \cdot \log 1\right) \cdot 0.5}}}\\ \end{array}\]

Reproduce

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