\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \leq -1.2678525880262989 \cdot 10^{+64} \lor \neg \left(z \leq -6.187154742046292 \cdot 10^{-207}\right):\\
\;\;\;\;\left(x \cdot \frac{2}{y - t}\right) \cdot \frac{1}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{z \cdot \left(y - t\right)}\\
\end{array}(FPCore (x y z t) :precision binary64 (/ (* x 2.0) (- (* y z) (* t z))))
(FPCore (x y z t) :precision binary64 (if (or (<= z -1.2678525880262989e+64) (not (<= z -6.187154742046292e-207))) (* (* x (/ 2.0 (- y t))) (/ 1.0 z)) (/ (* x 2.0) (* z (- y t)))))
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 tmp;
if ((z <= -1.2678525880262989e+64) || !(z <= -6.187154742046292e-207)) {
tmp = (x * (2.0 / (y - t))) * (1.0 / z);
} else {
tmp = (x * 2.0) / (z * (y - t));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.7 |
|---|---|
| Target | 2.2 |
| Herbie | 4.7 |
if z < -1.2678525880262989e64 or -6.1871547420462918e-207 < z Initial program 8.2
Simplified6.6
rmApplied div-inv_binary646.6
Applied associate-*r*_binary645.5
if -1.2678525880262989e64 < z < -6.1871547420462918e-207Initial program 1.6
Simplified1.7
rmApplied associate-*r/_binary644.7
rmApplied associate-*r/_binary644.7
Applied associate-/l/_binary641.6
Simplified1.6
Final simplification4.7
herbie shell --seed 2020253
(FPCore (x y z t)
:name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
:precision binary64
:herbie-target
(if (< (/ (* x 2.0) (- (* y z) (* t z))) -2.559141628295061e-13) (* (/ x (* (- y t) z)) 2.0) (if (< (/ (* x 2.0) (- (* y z) (* t z))) 1.0450278273301259e-269) (/ (* (/ x z) 2.0) (- y t)) (* (/ x (* (- y t) z)) 2.0)))
(/ (* x 2.0) (- (* y z) (* t z))))