\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \le -7.05106147802875157 \cdot 10^{43} \lor \neg \left(z \le 1.3481499655370494 \cdot 10^{61}\right):\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{\frac{z \cdot \left(y - t\right)}{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 (((z <= -7.051061478028752e+43) || !(z <= 1.3481499655370494e+61))) {
VAR = ((x / z) / ((y - t) / 2.0));
} else {
VAR = (x / ((z * (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.5 |
|---|---|
| Target | 2.2 |
| Herbie | 2.2 |
if z < -7.051061478028752e+43 or 1.3481499655370494e+61 < z Initial program 12.0
Simplified9.8
rmApplied *-un-lft-identity9.8
Applied times-frac9.8
Applied associate-/r*2.3
Simplified2.3
if -7.051061478028752e+43 < z < 1.3481499655370494e+61Initial program 2.2
Simplified2.2
Final simplification2.2
herbie shell --seed 2020092 +o rules:numerics
(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))))