x + \frac{e^{y \cdot \log \left(\frac{y}{z + y}\right)}}{y}
\begin{array}{l}
t_0 := x + \frac{e^{-z}}{y}\\
\mathbf{if}\;y \leq -2.491957138022311 \cdot 10^{+19}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;y \leq 1.700010920851912 \cdot 10^{-9}:\\
\;\;\;\;x + \frac{1}{y}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
(FPCore (x y z) :precision binary64 (+ x (/ (exp (* y (log (/ y (+ z y))))) y)))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (+ x (/ (exp (- z)) y))))
(if (<= y -2.491957138022311e+19)
t_0
(if (<= y 1.700010920851912e-9) (+ x (/ 1.0 y)) t_0))))double code(double x, double y, double z) {
return x + (exp(y * log(y / (z + y))) / y);
}
double code(double x, double y, double z) {
double t_0 = x + (exp(-z) / y);
double tmp;
if (y <= -2.491957138022311e+19) {
tmp = t_0;
} else if (y <= 1.700010920851912e-9) {
tmp = x + (1.0 / y);
} else {
tmp = t_0;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 6.6 |
|---|---|
| Target | 1.3 |
| Herbie | 0.2 |
if y < -24919571380223111200 or 1.70001092085191204e-9 < y Initial program 2.5
Simplified2.5
Taylor expanded in y around inf 0.2
if -24919571380223111200 < y < 1.70001092085191204e-9Initial program 11.1
Simplified11.1
Taylor expanded in y around 0 0.3
Final simplification0.2
herbie shell --seed 2022097
(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.11541576e-315) (+ x (/ (exp (/ -1.0 z)) y)) (+ x (/ (exp (log (pow (/ y (+ y z)) y))) y)))
(+ x (/ (exp (* y (log (/ y (+ z y))))) y)))