\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;y \cdot z - t \cdot z \le -4.25252124024244761 \cdot 10^{295} \lor \neg \left(y \cdot z - t \cdot z \le 2.0161916367536704 \cdot 10^{170}\right):\\
\;\;\;\;\frac{\frac{x}{\frac{y - t}{2}}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{y \cdot z - t \cdot z}\\
\end{array}double code(double x, double y, double z, double t) {
return ((x * 2.0) / ((y * z) - (t * z)));
}
double code(double x, double y, double z, double t) {
double VAR;
if (((((y * z) - (t * z)) <= -4.252521240242448e+295) || !(((y * z) - (t * z)) <= 2.0161916367536704e+170))) {
VAR = ((x / ((y - t) / 2.0)) / z);
} else {
VAR = ((x * 2.0) / ((y * z) - (t * z)));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 7.0 |
|---|---|
| Target | 2.1 |
| Herbie | 1.2 |
if (- (* y z) (* t z)) < -4.252521240242448e+295 or 2.0161916367536704e+170 < (- (* y z) (* t z)) Initial program 17.2
Simplified13.8
rmApplied *-un-lft-identity13.8
Applied times-frac13.8
Applied *-un-lft-identity13.8
Applied times-frac0.4
Simplified0.4
rmApplied associate-*l/0.3
Simplified0.3
if -4.252521240242448e+295 < (- (* y z) (* t z)) < 2.0161916367536704e+170Initial program 1.7
Final simplification1.2
herbie shell --seed 2020100
(FPCore (x y z t)
:name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
:precision binary64
:herbie-target
(if (< (/ (* x 2) (- (* y z) (* t z))) -2.559141628295061e-13) (* (/ x (* (- y t) z)) 2) (if (< (/ (* x 2) (- (* y z) (* t z))) 1.0450278273301259e-269) (/ (* (/ x z) 2) (- y t)) (* (/ x (* (- y t) z)) 2)))
(/ (* x 2) (- (* y z) (* t z))))