x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}\begin{array}{l}
\mathbf{if}\;y \le 6.7189951102485793 \cdot 10^{-26}:\\
\;\;\;\;x + \frac{e^{y \cdot 0}}{y}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{e^{-1 \cdot z}}{y}\\
\end{array}double f(double x, double y, double z) {
double r321696 = x;
double r321697 = y;
double r321698 = z;
double r321699 = r321698 + r321697;
double r321700 = r321697 / r321699;
double r321701 = log(r321700);
double r321702 = r321697 * r321701;
double r321703 = exp(r321702);
double r321704 = r321703 / r321697;
double r321705 = r321696 + r321704;
return r321705;
}
double f(double x, double y, double z) {
double r321706 = y;
double r321707 = 6.718995110248579e-26;
bool r321708 = r321706 <= r321707;
double r321709 = x;
double r321710 = 0.0;
double r321711 = r321706 * r321710;
double r321712 = exp(r321711);
double r321713 = r321712 / r321706;
double r321714 = r321709 + r321713;
double r321715 = -1.0;
double r321716 = z;
double r321717 = r321715 * r321716;
double r321718 = exp(r321717);
double r321719 = r321718 / r321706;
double r321720 = r321709 + r321719;
double r321721 = r321708 ? r321714 : r321720;
return r321721;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 6.1 |
|---|---|
| Target | 1.0 |
| Herbie | 0.9 |
if y < 6.718995110248579e-26Initial program 8.3
Taylor expanded around inf 0.9
if 6.718995110248579e-26 < y Initial program 1.6
Taylor expanded around inf 1.0
Final simplification0.9
herbie shell --seed 2020018 +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)))