\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \le -9.6215115429006899 \cdot 10^{22}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\
\mathbf{elif}\;z \le 4.2497445702391346 \cdot 10^{-67}:\\
\;\;\;\;\frac{x}{\frac{z \cdot \left(y - t\right)}{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{y - t}}{\frac{z}{2}}\\
\end{array}double code(double x, double y, double z, double t) {
return ((double) (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (t * z))))));
}
double code(double x, double y, double z, double t) {
double VAR;
if ((z <= -9.62151154290069e+22)) {
VAR = ((double) (((double) (x / z)) / ((double) (((double) (y - t)) / 2.0))));
} else {
double VAR_1;
if ((z <= 4.2497445702391346e-67)) {
VAR_1 = ((double) (x / ((double) (((double) (z * ((double) (y - t)))) / 2.0))));
} else {
VAR_1 = ((double) (((double) (x / ((double) (y - t)))) / ((double) (z / 2.0))));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 7.0 |
|---|---|
| Target | 2.2 |
| Herbie | 2.3 |
if z < -9.62151154290069e+22Initial program 12.2
Simplified9.9
rmApplied *-un-lft-identity9.9
Applied times-frac9.9
Applied associate-/r*2.1
Simplified2.1
if -9.62151154290069e+22 < z < 4.2497445702391346e-67Initial program 2.5
Simplified2.5
if 4.2497445702391346e-67 < z Initial program 9.0
Simplified7.4
rmApplied *-un-lft-identity7.4
Applied *-commutative7.4
Applied times-frac7.4
Applied associate-/r*2.2
Simplified2.2
Final simplification2.3
herbie shell --seed 2020114 +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))))