\frac{x \cdot \left(y + z\right)}{z}\begin{array}{l}
\mathbf{if}\;x \leq -7.161731230796641 \cdot 10^{+48} \lor \neg \left(x \leq 2.3321824048372046 \cdot 10^{-101}\right):\\
\;\;\;\;x + x \cdot \frac{y}{z}\\
\mathbf{else}:\\
\;\;\;\;x + \left(x \cdot y\right) \cdot \frac{1}{z}\\
\end{array}double code(double x, double y, double z) {
return (((double) (x * ((double) (y + z)))) / z);
}
double code(double x, double y, double z) {
double VAR;
if (((x <= -7.161731230796641e+48) || !(x <= 2.3321824048372046e-101))) {
VAR = ((double) (x + ((double) (x * (y / z)))));
} else {
VAR = ((double) (x + ((double) (((double) (x * y)) * (1.0 / z)))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z
Results
| Original | 12.4 |
|---|---|
| Target | 3.0 |
| Herbie | 1.7 |
if x < -7.161731230796641e48 or 2.33218240483720457e-101 < x Initial program 20.5
Simplified0.5
if -7.161731230796641e48 < x < 2.33218240483720457e-101Initial program 5.3
Simplified5.6
rmApplied div-inv5.6
Applied associate-*r*2.7
Final simplification1.7
herbie shell --seed 2020196
(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))