\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot \left(y + z\right)}{z} = -\infty \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le -2.7194741518624336 \cdot 10^{47} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 8.79726082501112596 \cdot 10^{-144} \lor \neg \left(\frac{x \cdot \left(y + z\right)}{z} \le 1.912706477262822 \cdot 10^{267}\right)\right)\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{z}, x, x\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \left(y + z\right)}{z}\\
\end{array}double code(double x, double y, double z) {
return ((double) (((double) (x * ((double) (y + z)))) / z));
}
double code(double x, double y, double z) {
double VAR;
if (((((double) (((double) (x * ((double) (y + z)))) / z)) <= -inf.0) || !((((double) (((double) (x * ((double) (y + z)))) / z)) <= -2.7194741518624336e+47) || !((((double) (((double) (x * ((double) (y + z)))) / z)) <= 8.797260825011126e-144) || !(((double) (((double) (x * ((double) (y + z)))) / z)) <= 1.912706477262822e+267))))) {
VAR = ((double) fma(((double) (y / z)), x, x));
} else {
VAR = ((double) (((double) (x * ((double) (y + z)))) / z));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.8 |
|---|---|
| Target | 3.0 |
| Herbie | 0.6 |
if (/ (* x (+ y z)) z) < -inf.0 or -2.7194741518624336e+47 < (/ (* x (+ y z)) z) < 8.797260825011126e-144 or 1.912706477262822e+267 < (/ (* x (+ y z)) z) Initial program 23.8
Simplified0.8
if -inf.0 < (/ (* x (+ y z)) z) < -2.7194741518624336e+47 or 8.797260825011126e-144 < (/ (* x (+ y z)) z) < 1.912706477262822e+267Initial program 0.3
Final simplification0.6
herbie shell --seed 2020122 +o rules:numerics
(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))