100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\begin{array}{l}
\mathbf{if}\;i \le -0.09568466101685804692245085334434406831861:\\
\;\;\;\;\frac{100 \cdot \left({\left(\frac{i}{n}\right)}^{n} - 1\right)}{\frac{i}{n}}\\
\mathbf{elif}\;i \le 6.433403710498657594142250154269082661313 \cdot 10^{46}:\\
\;\;\;\;\left(\left(\frac{100}{i} \cdot \sqrt[3]{\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) \cdot n}\right) \cdot \sqrt[3]{\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) \cdot n}\right) \cdot \sqrt[3]{\frac{\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}}}\\
\mathbf{elif}\;i \le 1.353418716849568981322833055613312096611 \cdot 10^{183}:\\
\;\;\;\;100 \cdot \frac{n \cdot \left({\left(\frac{i}{n}\right)}^{n} - 1\right)}{i}\\
\mathbf{else}:\\
\;\;\;\;100 \cdot \frac{\left(1 \cdot i + \left(\log 1 \cdot n + 1\right)\right) - 1}{\frac{i}{n}}\\
\end{array}double f(double i, double n) {
double r127146 = 100.0;
double r127147 = 1.0;
double r127148 = i;
double r127149 = n;
double r127150 = r127148 / r127149;
double r127151 = r127147 + r127150;
double r127152 = pow(r127151, r127149);
double r127153 = r127152 - r127147;
double r127154 = r127153 / r127150;
double r127155 = r127146 * r127154;
return r127155;
}
double f(double i, double n) {
double r127156 = i;
double r127157 = -0.09568466101685805;
bool r127158 = r127156 <= r127157;
double r127159 = 100.0;
double r127160 = n;
double r127161 = r127156 / r127160;
double r127162 = pow(r127161, r127160);
double r127163 = 1.0;
double r127164 = r127162 - r127163;
double r127165 = r127159 * r127164;
double r127166 = r127165 / r127161;
double r127167 = 6.433403710498658e+46;
bool r127168 = r127156 <= r127167;
double r127169 = r127159 / r127156;
double r127170 = r127163 * r127156;
double r127171 = 0.5;
double r127172 = 2.0;
double r127173 = pow(r127156, r127172);
double r127174 = r127171 * r127173;
double r127175 = log(r127163);
double r127176 = r127175 * r127160;
double r127177 = r127174 + r127176;
double r127178 = r127170 + r127177;
double r127179 = r127173 * r127175;
double r127180 = r127171 * r127179;
double r127181 = r127178 - r127180;
double r127182 = r127181 * r127160;
double r127183 = cbrt(r127182);
double r127184 = r127169 * r127183;
double r127185 = r127184 * r127183;
double r127186 = 1.0;
double r127187 = r127186 / r127160;
double r127188 = r127181 / r127187;
double r127189 = cbrt(r127188);
double r127190 = r127185 * r127189;
double r127191 = 1.353418716849569e+183;
bool r127192 = r127156 <= r127191;
double r127193 = r127160 * r127164;
double r127194 = r127193 / r127156;
double r127195 = r127159 * r127194;
double r127196 = r127176 + r127186;
double r127197 = r127170 + r127196;
double r127198 = r127197 - r127163;
double r127199 = r127198 / r127161;
double r127200 = r127159 * r127199;
double r127201 = r127192 ? r127195 : r127200;
double r127202 = r127168 ? r127190 : r127201;
double r127203 = r127158 ? r127166 : r127202;
return r127203;
}




Bits error versus i




Bits error versus n
Results
| Original | 42.6 |
|---|---|
| Target | 42.1 |
| Herbie | 20.1 |
if i < -0.09568466101685805Initial program 28.6
rmApplied div-inv28.6
Applied *-un-lft-identity28.6
Applied times-frac29.3
Applied associate-*r*29.3
Simplified29.3
Taylor expanded around inf 64.0
Simplified18.7
if -0.09568466101685805 < i < 6.433403710498658e+46Initial program 49.5
rmApplied div-inv49.5
Applied *-un-lft-identity49.5
Applied times-frac49.2
Applied associate-*r*49.2
Simplified49.2
Taylor expanded around 0 17.8
rmApplied add-cube-cbrt18.4
Applied associate-*r*18.4
Simplified18.4
if 6.433403710498658e+46 < i < 1.353418716849569e+183Initial program 32.0
Taylor expanded around inf 29.2
Simplified32.0
if 1.353418716849569e+183 < i Initial program 33.1
Taylor expanded around 0 32.9
Final simplification20.1
herbie shell --seed 2019326
(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))))