100 \cdot \frac{{\left(1 + \frac{i}{n}\right)}^{n} - 1}{\frac{i}{n}}\begin{array}{l}
\mathbf{if}\;i \le -1.1676448974447302 \cdot 10^{-14}:\\
\;\;\;\;\frac{\sqrt[3]{-100 + e^{\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n} \cdot 100} \cdot \sqrt[3]{-100 + e^{\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n} \cdot 100}}{\frac{\frac{i}{n}}{\sqrt[3]{-100 + e^{\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n} \cdot 100}}}\\
\mathbf{elif}\;i \le -4.745225464100608 \cdot 10^{-198}:\\
\;\;\;\;\frac{\mathsf{fma}\left(50, i \cdot i, \mathsf{fma}\left(i \cdot \frac{50}{3}, i \cdot i, 100 \cdot i\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;i \le -5.102830896109795 \cdot 10^{-218}:\\
\;\;\;\;\frac{\sqrt[3]{-100 + e^{\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n} \cdot 100} \cdot \sqrt[3]{-100 + e^{\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n} \cdot 100}}{\frac{\frac{i}{n}}{\sqrt[3]{-100 + e^{\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n} \cdot 100}}}\\
\mathbf{elif}\;i \le 8.045186793396293 \cdot 10^{-206}:\\
\;\;\;\;\frac{\mathsf{fma}\left(50, i \cdot i, \mathsf{fma}\left(i \cdot \frac{50}{3}, i \cdot i, 100 \cdot i\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;i \le 1.2043330665713129 \cdot 10^{-191}:\\
\;\;\;\;\frac{\sqrt[3]{-100 + e^{\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n} \cdot 100} \cdot \sqrt[3]{-100 + e^{\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n} \cdot 100}}{\frac{\frac{i}{n}}{\sqrt[3]{-100 + e^{\mathsf{log1p}\left(\frac{i}{n}\right) \cdot n} \cdot 100}}}\\
\mathbf{elif}\;i \le 0.06286762942468366:\\
\;\;\;\;\frac{\mathsf{fma}\left(50, i \cdot i, \mathsf{fma}\left(i \cdot \frac{50}{3}, i \cdot i, 100 \cdot i\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;i \le 2.1565169088621677 \cdot 10^{+254}:\\
\;\;\;\;\frac{\mathsf{fma}\left(50 \cdot \left(n \cdot n\right), \log n \cdot \log n, \mathsf{fma}\left(\left(n \cdot \left(n \cdot n\right)\right) \cdot \frac{50}{3}, \log i \cdot \left(\log i \cdot \log i\right), \mathsf{fma}\left(\log i \cdot n, 100, \mathsf{fma}\left(\frac{100}{3}, \left(\log n \cdot \log n\right) \cdot \left(\log i \cdot \left(n \cdot \left(n \cdot n\right)\right)\right), \mathsf{fma}\left(\frac{50}{3}, \left(\log n \cdot \log n\right) \cdot \left(\log i \cdot \left(n \cdot \left(n \cdot n\right)\right)\right), \left(\log i \cdot \log i\right) \cdot \left(50 \cdot \left(n \cdot n\right)\right)\right)\right)\right)\right)\right) - \mathsf{fma}\left(\left(n \cdot \left(n \cdot n\right)\right) \cdot \frac{100}{3}, \log n \cdot \left(\log i \cdot \log i\right), \mathsf{fma}\left(50 \cdot \left(n \cdot n\right), \log n \cdot \log i, \mathsf{fma}\left(50 \cdot \left(n \cdot n\right), \log n \cdot \log i, \left(100 \cdot n\right) \cdot \log n + \left(\left(n \cdot \left(n \cdot n\right)\right) \cdot \frac{50}{3}\right) \cdot \left(\log n \cdot \left(\log i \cdot \log i\right) + \left(\log n \cdot \log n\right) \cdot \log n\right)\right)\right)\right)}{\frac{i}{n}}\\
\mathbf{elif}\;i \le 1.3330696406606884 \cdot 10^{+297}:\\
\;\;\;\;\frac{\frac{\mathsf{fma}\left(100, {\left(1 + \frac{i}{n}\right)}^{n}, -100\right)}{i}}{\frac{1}{n}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(50 \cdot \left(n \cdot n\right), \log n \cdot \log n, \mathsf{fma}\left(\left(n \cdot \left(n \cdot n\right)\right) \cdot \frac{50}{3}, \log i \cdot \left(\log i \cdot \log i\right), \mathsf{fma}\left(\log i \cdot n, 100, \mathsf{fma}\left(\frac{100}{3}, \left(\log n \cdot \log n\right) \cdot \left(\log i \cdot \left(n \cdot \left(n \cdot n\right)\right)\right), \mathsf{fma}\left(\frac{50}{3}, \left(\log n \cdot \log n\right) \cdot \left(\log i \cdot \left(n \cdot \left(n \cdot n\right)\right)\right), \left(\log i \cdot \log i\right) \cdot \left(50 \cdot \left(n \cdot n\right)\right)\right)\right)\right)\right)\right) - \mathsf{fma}\left(\left(n \cdot \left(n \cdot n\right)\right) \cdot \frac{100}{3}, \log n \cdot \left(\log i \cdot \log i\right), \mathsf{fma}\left(50 \cdot \left(n \cdot n\right), \log n \cdot \log i, \mathsf{fma}\left(50 \cdot \left(n \cdot n\right), \log n \cdot \log i, \left(100 \cdot n\right) \cdot \log n + \left(\left(n \cdot \left(n \cdot n\right)\right) \cdot \frac{50}{3}\right) \cdot \left(\log n \cdot \left(\log i \cdot \log i\right) + \left(\log n \cdot \log n\right) \cdot \log n\right)\right)\right)\right)}{\frac{i}{n}}\\
\end{array}double f(double i, double n) {
double r2432149 = 100.0;
double r2432150 = 1.0;
double r2432151 = i;
double r2432152 = n;
double r2432153 = r2432151 / r2432152;
double r2432154 = r2432150 + r2432153;
double r2432155 = pow(r2432154, r2432152);
double r2432156 = r2432155 - r2432150;
double r2432157 = r2432156 / r2432153;
double r2432158 = r2432149 * r2432157;
return r2432158;
}
double f(double i, double n) {
double r2432159 = i;
double r2432160 = -1.1676448974447302e-14;
bool r2432161 = r2432159 <= r2432160;
double r2432162 = -100.0;
double r2432163 = n;
double r2432164 = r2432159 / r2432163;
double r2432165 = log1p(r2432164);
double r2432166 = r2432165 * r2432163;
double r2432167 = exp(r2432166);
double r2432168 = 100.0;
double r2432169 = r2432167 * r2432168;
double r2432170 = r2432162 + r2432169;
double r2432171 = cbrt(r2432170);
double r2432172 = r2432171 * r2432171;
double r2432173 = r2432164 / r2432171;
double r2432174 = r2432172 / r2432173;
double r2432175 = -4.745225464100608e-198;
bool r2432176 = r2432159 <= r2432175;
double r2432177 = 50.0;
double r2432178 = r2432159 * r2432159;
double r2432179 = 16.666666666666668;
double r2432180 = r2432159 * r2432179;
double r2432181 = r2432168 * r2432159;
double r2432182 = fma(r2432180, r2432178, r2432181);
double r2432183 = fma(r2432177, r2432178, r2432182);
double r2432184 = r2432183 / r2432164;
double r2432185 = -5.102830896109795e-218;
bool r2432186 = r2432159 <= r2432185;
double r2432187 = 8.045186793396293e-206;
bool r2432188 = r2432159 <= r2432187;
double r2432189 = 1.2043330665713129e-191;
bool r2432190 = r2432159 <= r2432189;
double r2432191 = 0.06286762942468366;
bool r2432192 = r2432159 <= r2432191;
double r2432193 = 2.1565169088621677e+254;
bool r2432194 = r2432159 <= r2432193;
double r2432195 = r2432163 * r2432163;
double r2432196 = r2432177 * r2432195;
double r2432197 = log(r2432163);
double r2432198 = r2432197 * r2432197;
double r2432199 = r2432163 * r2432195;
double r2432200 = r2432199 * r2432179;
double r2432201 = log(r2432159);
double r2432202 = r2432201 * r2432201;
double r2432203 = r2432201 * r2432202;
double r2432204 = r2432201 * r2432163;
double r2432205 = 33.333333333333336;
double r2432206 = r2432201 * r2432199;
double r2432207 = r2432198 * r2432206;
double r2432208 = r2432202 * r2432196;
double r2432209 = fma(r2432179, r2432207, r2432208);
double r2432210 = fma(r2432205, r2432207, r2432209);
double r2432211 = fma(r2432204, r2432168, r2432210);
double r2432212 = fma(r2432200, r2432203, r2432211);
double r2432213 = fma(r2432196, r2432198, r2432212);
double r2432214 = r2432199 * r2432205;
double r2432215 = r2432197 * r2432202;
double r2432216 = r2432197 * r2432201;
double r2432217 = r2432168 * r2432163;
double r2432218 = r2432217 * r2432197;
double r2432219 = r2432198 * r2432197;
double r2432220 = r2432215 + r2432219;
double r2432221 = r2432200 * r2432220;
double r2432222 = r2432218 + r2432221;
double r2432223 = fma(r2432196, r2432216, r2432222);
double r2432224 = fma(r2432196, r2432216, r2432223);
double r2432225 = fma(r2432214, r2432215, r2432224);
double r2432226 = r2432213 - r2432225;
double r2432227 = r2432226 / r2432164;
double r2432228 = 1.3330696406606884e+297;
bool r2432229 = r2432159 <= r2432228;
double r2432230 = 1.0;
double r2432231 = r2432230 + r2432164;
double r2432232 = pow(r2432231, r2432163);
double r2432233 = fma(r2432168, r2432232, r2432162);
double r2432234 = r2432233 / r2432159;
double r2432235 = r2432230 / r2432163;
double r2432236 = r2432234 / r2432235;
double r2432237 = r2432229 ? r2432236 : r2432227;
double r2432238 = r2432194 ? r2432227 : r2432237;
double r2432239 = r2432192 ? r2432184 : r2432238;
double r2432240 = r2432190 ? r2432174 : r2432239;
double r2432241 = r2432188 ? r2432184 : r2432240;
double r2432242 = r2432186 ? r2432174 : r2432241;
double r2432243 = r2432176 ? r2432184 : r2432242;
double r2432244 = r2432161 ? r2432174 : r2432243;
return r2432244;
}




Bits error versus i




Bits error versus n
| Original | 42.7 |
|---|---|
| Target | 42.3 |
| Herbie | 25.6 |
if i < -1.1676448974447302e-14 or -4.745225464100608e-198 < i < -5.102830896109795e-218 or 8.045186793396293e-206 < i < 1.2043330665713129e-191Initial program 31.8
Simplified31.8
rmApplied add-exp-log31.8
Applied pow-exp31.8
Simplified12.1
rmApplied fma-udef12.2
rmApplied add-cube-cbrt12.7
Applied associate-/l*12.8
if -1.1676448974447302e-14 < i < -4.745225464100608e-198 or -5.102830896109795e-218 < i < 8.045186793396293e-206 or 1.2043330665713129e-191 < i < 0.06286762942468366Initial program 49.7
Simplified49.7
Taylor expanded around 0 32.9
Simplified32.9
if 0.06286762942468366 < i < 2.1565169088621677e+254 or 1.3330696406606884e+297 < i Initial program 34.0
Simplified33.9
rmApplied add-exp-log49.1
Applied pow-exp49.1
Simplified48.2
Taylor expanded around 0 16.8
Simplified16.7
if 2.1565169088621677e+254 < i < 1.3330696406606884e+297Initial program 31.2
Simplified31.2
rmApplied div-inv31.2
Applied associate-/r*31.2
Final simplification25.6
herbie shell --seed 2019156 +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))))