\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;y \cdot z - z \cdot t \leq -8.092130891572425 \cdot 10^{+289}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{2}{y - t}\\
\mathbf{elif}\;y \cdot z - z \cdot t \leq 6.123476084055259 \cdot 10^{+242}:\\
\;\;\;\;\frac{x \cdot 2}{y \cdot z - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z} \cdot 2}{y - t}\\
\end{array}(FPCore (x y z t) :precision binary64 (/ (* x 2.0) (- (* y z) (* t z))))
(FPCore (x y z t)
:precision binary64
(if (<= (- (* y z) (* z t)) -8.092130891572425e+289)
(* (/ x z) (/ 2.0 (- y t)))
(if (<= (- (* y z) (* z t)) 6.123476084055259e+242)
(/ (* x 2.0) (- (* y z) (* z t)))
(/ (* (/ x z) 2.0) (- 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 (((y * z) - (z * t)) <= -8.092130891572425e+289) {
tmp = (x / z) * (2.0 / (y - t));
} else if (((y * z) - (z * t)) <= 6.123476084055259e+242) {
tmp = (x * 2.0) / ((y * z) - (z * t));
} else {
tmp = ((x / z) * 2.0) / (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 | 1.2 |
if (-.f64 (*.f64 y z) (*.f64 t z)) < -8.09213089157242499e289Initial program 18.2
rmApplied distribute-rgt-out--_binary64_744718.2
Applied times-frac_binary64_74970.1
if -8.09213089157242499e289 < (-.f64 (*.f64 y z) (*.f64 t z)) < 6.12347608405525864e242Initial program 1.6
if 6.12347608405525864e242 < (-.f64 (*.f64 y z) (*.f64 t z)) Initial program 21.1
rmApplied distribute-rgt-out--_binary64_744714.9
Applied associate-/r*_binary64_74370.2
Simplified0.2
Final simplification1.2
herbie shell --seed 2020281
(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))))