\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \leq -7.066722543898828 \cdot 10^{-27} \lor \neg \left(z \leq 2.814061237892244 \cdot 10^{-40}\right):\\
\;\;\;\;\frac{\frac{2 \cdot x}{y - t}}{z}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot x}{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 -7.066722543898828e-27) (not (<= z 2.814061237892244e-40))) (/ (/ (* 2.0 x) (- y t)) z) (/ (* 2.0 x) (* 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 <= -7.066722543898828e-27) || !(z <= 2.814061237892244e-40)) {
tmp = ((2.0 * x) / (y - t)) / z;
} else {
tmp = (2.0 * x) / (z * (y - t));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.8 |
|---|---|
| Target | 2.3 |
| Herbie | 2.4 |
if z < -7.06681e-27 or 2.81409e-40 < z Initial program 9.6
Simplified7.2
rmApplied associate-*r/_binary64_19192.2
rmApplied associate-*r/_binary64_19192.1
Simplified2.1
if -7.06681e-27 < z < 2.81409e-40Initial program 2.8
Simplified3.1
rmApplied associate-*r/_binary64_191910.7
rmApplied associate-*r/_binary64_191910.7
Applied associate-/l/_binary64_19242.8
Final simplification2.4
herbie shell --seed 2020231
(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))))