x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\begin{array}{l}
\mathbf{if}\;\frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y} \le 0.0:\\
\;\;\;\;x + \frac{e^{y \cdot \left(2 \cdot \log \left(\frac{\sqrt[3]{y}}{\sqrt[3]{z + y}}\right) + \log \left(\frac{\sqrt[3]{y}}{\sqrt[3]{z + y}}\right)\right)}}{y}\\
\mathbf{elif}\;\frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y} \le 1.4696829624869402 \cdot 10^{-78}:\\
\;\;\;\;1 \cdot \left(x + \frac{e^{-1 \cdot z}}{y}\right)\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \mathsf{fma}\left(\frac{{\left(\frac{y}{z + y}\right)}^{y}}{y}, 1, x\right)\\
\end{array}double code(double x, double y, double z) {
return ((double) (x + ((double) (((double) exp(((double) (y * ((double) log(((double) (y / ((double) (z + y)))))))))) / y))));
}
double code(double x, double y, double z) {
double VAR;
if ((((double) (((double) exp(((double) (y * ((double) log(((double) (y / ((double) (z + y)))))))))) / y)) <= 0.0)) {
VAR = ((double) (x + ((double) (((double) exp(((double) (y * ((double) (((double) (2.0 * ((double) log(((double) (((double) cbrt(y)) / ((double) cbrt(((double) (z + y)))))))))) + ((double) log(((double) (((double) cbrt(y)) / ((double) cbrt(((double) (z + y)))))))))))))) / y))));
} else {
double VAR_1;
if ((((double) (((double) exp(((double) (y * ((double) log(((double) (y / ((double) (z + y)))))))))) / y)) <= 1.4696829624869402e-78)) {
VAR_1 = ((double) (1.0 * ((double) (x + ((double) (((double) exp(((double) (-1.0 * z)))) / y))))));
} else {
VAR_1 = ((double) (1.0 * ((double) fma(((double) (((double) pow(((double) (y / ((double) (z + y)))), y)) / y)), 1.0, x))));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 6.0 |
|---|---|
| Target | 1.1 |
| Herbie | 0.7 |
if (/ (exp (* y (log (/ y (+ z y))))) y) < 0.0Initial program 9.5
rmApplied add-cube-cbrt23.6
Applied add-cube-cbrt9.5
Applied times-frac9.5
Applied log-prod2.9
Simplified0.9
if 0.0 < (/ (exp (* y (log (/ y (+ z y))))) y) < 1.4696829624869402e-78Initial program 2.5
rmApplied *-un-lft-identity2.5
Applied *-un-lft-identity2.5
Applied distribute-lft-out2.5
Simplified2.5
Taylor expanded around inf 0.0
Simplified0.0
if 1.4696829624869402e-78 < (/ (exp (* y (log (/ y (+ z y))))) y) Initial program 0.5
rmApplied *-un-lft-identity0.5
Applied *-un-lft-identity0.5
Applied distribute-lft-out0.5
Simplified0.5
Final simplification0.7
herbie shell --seed 2020114 +o rules:numerics
(FPCore (x y z)
:name "Numeric.SpecFunctions:invIncompleteBetaWorker from math-functions-0.1.5.2, G"
:precision binary64
:herbie-target
(if (< (/ y (+ z y)) 7.1154157597908e-315) (+ x (/ (exp (/ -1 z)) y)) (+ x (/ (exp (log (pow (/ y (+ y z)) y))) y)))
(+ x (/ (exp (* y (log (/ y (+ z y))))) y)))