\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot 2}{y \cdot z - t \cdot z} \le -4.94066 \cdot 10^{-324} \lor \neg \left(\frac{x \cdot 2}{y \cdot z - t \cdot z} \le 0.0 \lor \neg \left(\frac{x \cdot 2}{y \cdot z - t \cdot z} \le 1.6145410396546016 \cdot 10^{223}\right)\right):\\
\;\;\;\;\frac{x \cdot 2}{y \cdot z - t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{x}{\frac{y - t}{2}}\\
\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 (((((x * 2.0) / ((y * z) - (t * z))) <= -4.9406564584125e-324) || !((((x * 2.0) / ((y * z) - (t * z))) <= 0.0) || !(((x * 2.0) / ((y * z) - (t * z))) <= 1.6145410396546016e+223)))) {
VAR = ((x * 2.0) / ((y * z) - (t * z)));
} else {
VAR = ((1.0 / z) * (x / ((y - t) / 2.0)));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.7 |
|---|---|
| Target | 2.2 |
| Herbie | 0.9 |
if (/ (* x 2.0) (- (* y z) (* t z))) < -4.9406564584125e-324 or 0.0 < (/ (* x 2.0) (- (* y z) (* t z))) < 1.6145410396546016e+223Initial program 1.1
if -4.9406564584125e-324 < (/ (* x 2.0) (- (* y z) (* t z))) < 0.0 or 1.6145410396546016e+223 < (/ (* x 2.0) (- (* y z) (* t z))) Initial program 16.4
Simplified13.1
rmApplied *-un-lft-identity13.1
Applied times-frac13.1
Applied *-un-lft-identity13.1
Applied times-frac0.6
Simplified0.6
Final simplification0.9
herbie shell --seed 2020079
(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))))