100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\begin{array}{l}
\mathbf{if}\;i \le -0.004925238971644983407283113763241999549791:\\
\;\;\;\;\frac{100 \cdot \left({\left(\frac{i}{n}\right)}^{n} - 1\right)}{\frac{i}{n}}\\
\mathbf{elif}\;i \le 5.658601216877151786166504652674880498349 \cdot 10^{-101}:\\
\;\;\;\;\frac{100 \cdot \left(\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)\right)}{i} \cdot n\\
\mathbf{elif}\;i \le 6.016226308891130762023549201754330631598 \cdot 10^{-81}:\\
\;\;\;\;\frac{100 \cdot \left(\left(\left(\left(\frac{1}{2} \cdot \left({\left(\log i\right)}^{2} \cdot {n}^{2} + {n}^{2} \cdot {\left(\log n\right)}^{2}\right) + \left(\frac{1}{6} \cdot \left({\left(\log i\right)}^{3} \cdot {n}^{3}\right) + \log i \cdot n\right)\right) + \frac{1}{2} \cdot \left(\log i \cdot \left({n}^{3} \cdot {\left(\log n\right)}^{2}\right)\right)\right) - \log n \cdot \left(\log i \cdot {n}^{2} + n\right)\right) - \left(\frac{1}{2} \cdot \left({\left(\log i\right)}^{2} \cdot \left({n}^{3} \cdot \log n\right)\right) + \frac{1}{6} \cdot \left({n}^{3} \cdot {\left(\log n\right)}^{3}\right)\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;i \le 1.375765293115240280599712497820055847687 \cdot 10^{-33}:\\
\;\;\;\;\frac{100 \cdot \left(\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)\right)}{i} \cdot n\\
\mathbf{elif}\;i \le 1.839157578225845005008058914892445589939 \cdot 10^{175}:\\
\;\;\;\;\frac{100 \cdot \left(\left(\left(\left(\frac{1}{2} \cdot \left({\left(\log i\right)}^{2} \cdot {n}^{2} + {n}^{2} \cdot {\left(\log n\right)}^{2}\right) + \left(\frac{1}{6} \cdot \left({\left(\log i\right)}^{3} \cdot {n}^{3}\right) + \log i \cdot n\right)\right) + \frac{1}{2} \cdot \left(\log i \cdot \left({n}^{3} \cdot {\left(\log n\right)}^{2}\right)\right)\right) - \log n \cdot \left(\log i \cdot {n}^{2} + n\right)\right) - \left(\frac{1}{2} \cdot \left({\left(\log i\right)}^{2} \cdot \left({n}^{3} \cdot \log n\right)\right) + \frac{1}{6} \cdot \left({n}^{3} \cdot {\left(\log n\right)}^{3}\right)\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;i \le 6.730961542171691275593369492599343975653 \cdot 10^{212}:\\
\;\;\;\;\frac{100 \cdot \left({\left(\frac{i}{n}\right)}^{n} - 1\right)}{\frac{i}{n}}\\
\mathbf{elif}\;i \le 1.379305565720718542631518091583665992206 \cdot 10^{276}:\\
\;\;\;\;\frac{100 \cdot \left(\left(\left(\left(\frac{1}{2} \cdot \left({\left(\log i\right)}^{2} \cdot {n}^{2} + {n}^{2} \cdot {\left(\log n\right)}^{2}\right) + \left(\frac{1}{6} \cdot \left({\left(\log i\right)}^{3} \cdot {n}^{3}\right) + \log i \cdot n\right)\right) + \frac{1}{2} \cdot \left(\log i \cdot \left({n}^{3} \cdot {\left(\log n\right)}^{2}\right)\right)\right) - \log n \cdot \left(\log i \cdot {n}^{2} + n\right)\right) - \left(\frac{1}{2} \cdot \left({\left(\log i\right)}^{2} \cdot \left({n}^{3} \cdot \log n\right)\right) + \frac{1}{6} \cdot \left({n}^{3} \cdot {\left(\log n\right)}^{3}\right)\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;i \le 7.987224426181112598166338351215203562955 \cdot 10^{300}:\\
\;\;\;\;\frac{100 \cdot \left({\left(\frac{i}{n}\right)}^{n} - 1\right)}{\frac{i}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{100 \cdot \left(\left(\left(\left(\frac{1}{2} \cdot \left({\left(\log i\right)}^{2} \cdot {n}^{2} + {n}^{2} \cdot {\left(\log n\right)}^{2}\right) + \left(\frac{1}{6} \cdot \left({\left(\log i\right)}^{3} \cdot {n}^{3}\right) + \log i \cdot n\right)\right) + \frac{1}{2} \cdot \left(\log i \cdot \left({n}^{3} \cdot {\left(\log n\right)}^{2}\right)\right)\right) - \log n \cdot \left(\log i \cdot {n}^{2} + n\right)\right) - \left(\frac{1}{2} \cdot \left({\left(\log i\right)}^{2} \cdot \left({n}^{3} \cdot \log n\right)\right) + \frac{1}{6} \cdot \left({n}^{3} \cdot {\left(\log n\right)}^{3}\right)\right)\right)}{\frac{i}{n}}\\
\end{array}double f(double i, double n) {
double r128970 = 100.0;
double r128971 = 1.0;
double r128972 = i;
double r128973 = n;
double r128974 = r128972 / r128973;
double r128975 = r128971 + r128974;
double r128976 = pow(r128975, r128973);
double r128977 = r128976 - r128971;
double r128978 = r128977 / r128974;
double r128979 = r128970 * r128978;
return r128979;
}
double f(double i, double n) {
double r128980 = i;
double r128981 = -0.004925238971644983;
bool r128982 = r128980 <= r128981;
double r128983 = 100.0;
double r128984 = n;
double r128985 = r128980 / r128984;
double r128986 = pow(r128985, r128984);
double r128987 = 1.0;
double r128988 = r128986 - r128987;
double r128989 = r128983 * r128988;
double r128990 = r128989 / r128985;
double r128991 = 5.658601216877152e-101;
bool r128992 = r128980 <= r128991;
double r128993 = r128987 * r128980;
double r128994 = 0.5;
double r128995 = 2.0;
double r128996 = pow(r128980, r128995);
double r128997 = r128994 * r128996;
double r128998 = log(r128987);
double r128999 = r128998 * r128984;
double r129000 = r128997 + r128999;
double r129001 = r128993 + r129000;
double r129002 = r128996 * r128998;
double r129003 = r128994 * r129002;
double r129004 = r129001 - r129003;
double r129005 = r128983 * r129004;
double r129006 = r129005 / r128980;
double r129007 = r129006 * r128984;
double r129008 = 6.016226308891131e-81;
bool r129009 = r128980 <= r129008;
double r129010 = 0.5;
double r129011 = log(r128980);
double r129012 = pow(r129011, r128995);
double r129013 = pow(r128984, r128995);
double r129014 = r129012 * r129013;
double r129015 = log(r128984);
double r129016 = pow(r129015, r128995);
double r129017 = r129013 * r129016;
double r129018 = r129014 + r129017;
double r129019 = r129010 * r129018;
double r129020 = 0.16666666666666666;
double r129021 = 3.0;
double r129022 = pow(r129011, r129021);
double r129023 = pow(r128984, r129021);
double r129024 = r129022 * r129023;
double r129025 = r129020 * r129024;
double r129026 = r129011 * r128984;
double r129027 = r129025 + r129026;
double r129028 = r129019 + r129027;
double r129029 = r129023 * r129016;
double r129030 = r129011 * r129029;
double r129031 = r129010 * r129030;
double r129032 = r129028 + r129031;
double r129033 = r129011 * r129013;
double r129034 = r129033 + r128984;
double r129035 = r129015 * r129034;
double r129036 = r129032 - r129035;
double r129037 = r129023 * r129015;
double r129038 = r129012 * r129037;
double r129039 = r129010 * r129038;
double r129040 = pow(r129015, r129021);
double r129041 = r129023 * r129040;
double r129042 = r129020 * r129041;
double r129043 = r129039 + r129042;
double r129044 = r129036 - r129043;
double r129045 = r128983 * r129044;
double r129046 = r129045 / r128985;
double r129047 = 1.3757652931152403e-33;
bool r129048 = r128980 <= r129047;
double r129049 = 1.839157578225845e+175;
bool r129050 = r128980 <= r129049;
double r129051 = 6.730961542171691e+212;
bool r129052 = r128980 <= r129051;
double r129053 = 1.3793055657207185e+276;
bool r129054 = r128980 <= r129053;
double r129055 = 7.987224426181113e+300;
bool r129056 = r128980 <= r129055;
double r129057 = r129056 ? r128990 : r129046;
double r129058 = r129054 ? r129046 : r129057;
double r129059 = r129052 ? r128990 : r129058;
double r129060 = r129050 ? r129046 : r129059;
double r129061 = r129048 ? r129007 : r129060;
double r129062 = r129009 ? r129046 : r129061;
double r129063 = r128992 ? r129007 : r129062;
double r129064 = r128982 ? r128990 : r129063;
return r129064;
}




Bits error versus i




Bits error versus n
Results
| Original | 42.5 |
|---|---|
| Target | 42.3 |
| Herbie | 19.8 |
if i < -0.004925238971644983 or 1.839157578225845e+175 < i < 6.730961542171691e+212 or 1.3793055657207185e+276 < i < 7.987224426181113e+300Initial program 28.8
rmApplied associate-*r/28.8
Taylor expanded around inf 59.0
Simplified20.4
if -0.004925238971644983 < i < 5.658601216877152e-101 or 6.016226308891131e-81 < i < 1.3757652931152403e-33Initial program 49.9
rmApplied associate-*r/49.9
rmApplied associate-/r/49.5
Taylor expanded around 0 17.4
if 5.658601216877152e-101 < i < 6.016226308891131e-81 or 1.3757652931152403e-33 < i < 1.839157578225845e+175 or 6.730961542171691e+212 < i < 1.3793055657207185e+276 or 7.987224426181113e+300 < i Initial program 37.6
rmApplied associate-*r/37.5
Taylor expanded around inf 38.6
Simplified38.3
Taylor expanded around 0 28.4
Simplified28.4
Final simplification19.8
herbie shell --seed 2019297
(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))))