\frac{x \cdot \left(y + z\right)}{z}
\begin{array}{l}
t_0 := \frac{x \cdot \left(y + z\right)}{z}\\
\mathbf{if}\;t_0 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(\frac{x}{z}, y, x\right)\\
\mathbf{elif}\;t_0 \leq -6.0939414944138854 \cdot 10^{+26}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;t_0 \leq 3.3002802206311174 \cdot 10^{+30}:\\
\;\;\;\;\frac{x}{\frac{z}{y + z}}\\
\mathbf{elif}\;t_0 \leq 8.894138492345838 \cdot 10^{+298}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{z}, x\right)\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (* x (+ y z)) z))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (* x (+ y z)) z)))
(if (<= t_0 (- INFINITY))
(fma (/ x z) y x)
(if (<= t_0 -6.0939414944138854e+26)
t_0
(if (<= t_0 3.3002802206311174e+30)
(/ x (/ z (+ y z)))
(if (<= t_0 8.894138492345838e+298) t_0 (fma x (/ y z) x)))))))double code(double x, double y, double z) {
return (x * (y + z)) / z;
}
double code(double x, double y, double z) {
double t_0 = (x * (y + z)) / z;
double tmp;
if (t_0 <= -((double) INFINITY)) {
tmp = fma((x / z), y, x);
} else if (t_0 <= -6.0939414944138854e+26) {
tmp = t_0;
} else if (t_0 <= 3.3002802206311174e+30) {
tmp = x / (z / (y + z));
} else if (t_0 <= 8.894138492345838e+298) {
tmp = t_0;
} else {
tmp = fma(x, (y / z), x);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 12.6 |
|---|---|
| Target | 3.2 |
| Herbie | 0.2 |
if (/.f64 (*.f64 x (+.f64 y z)) z) < -inf.0Initial program 64.0
Taylor expanded in y around 0 21.2
Simplified0.0
if -inf.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < -6.09394149441388545e26 or 3.30028022063111741e30 < (/.f64 (*.f64 x (+.f64 y z)) z) < 8.8941384923458379e298Initial program 0.2
if -6.09394149441388545e26 < (/.f64 (*.f64 x (+.f64 y z)) z) < 3.30028022063111741e30Initial program 5.8
Applied associate-/l*_binary640.1
if 8.8941384923458379e298 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 60.3
Simplified0.9
Final simplification0.2
herbie shell --seed 2021275
(FPCore (x y z)
:name "Numeric.SpecFunctions:choose from math-functions-0.1.5.2"
:precision binary64
:herbie-target
(/ x (/ z (+ y z)))
(/ (* x (+ y z)) z))