\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 \lor \neg \left(t_0 \leq -845.3025145409939\right) \land \left(t_0 \leq 2.3699023649114968 \cdot 10^{-33} \lor \neg \left(t_0 \leq 2.700355737444232 \cdot 10^{+296}\right)\right):\\
\;\;\;\;\mathsf{fma}\left(x, \frac{y}{z}, x\right)\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\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 (or (<= t_0 (- INFINITY))
(and (not (<= t_0 -845.3025145409939))
(or (<= t_0 2.3699023649114968e-33)
(not (<= t_0 2.700355737444232e+296)))))
(fma x (/ y z) x)
t_0)))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)) || (!(t_0 <= -845.3025145409939) && ((t_0 <= 2.3699023649114968e-33) || !(t_0 <= 2.700355737444232e+296)))) {
tmp = fma(x, (y / z), x);
} else {
tmp = t_0;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 12.4 |
|---|---|
| Target | 3.3 |
| Herbie | 0.3 |
if (/.f64 (*.f64 x (+.f64 y z)) z) < -inf.0 or -845.302514540993911 < (/.f64 (*.f64 x (+.f64 y z)) z) < 2.36990236491149677e-33 or 2.7003557374442319e296 < (/.f64 (*.f64 x (+.f64 y z)) z) Initial program 22.0
Simplified0.3
if -inf.0 < (/.f64 (*.f64 x (+.f64 y z)) z) < -845.302514540993911 or 2.36990236491149677e-33 < (/.f64 (*.f64 x (+.f64 y z)) z) < 2.7003557374442319e296Initial program 0.2
Final simplification0.3
herbie shell --seed 2021313
(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))