\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \le -4.19232077706326539 \cdot 10^{94}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\
\mathbf{elif}\;z \le 5.5114979619320889 \cdot 10^{-97}:\\
\;\;\;\;x \cdot \frac{2}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2}{y - t} \cdot x}{z}\\
\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 <= -4.1923207770632654e+94)) {
VAR = ((double) (((double) (x / z)) / ((double) (((double) (y - t)) / 2.0))));
} else {
double VAR_1;
if ((z <= 5.511497961932089e-97)) {
VAR_1 = ((double) (x * ((double) (2.0 / ((double) (z * ((double) (y - t))))))));
} else {
VAR_1 = ((double) (((double) (((double) (2.0 / ((double) (y - t)))) * x)) / z));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.7 |
|---|---|
| Target | 2.1 |
| Herbie | 2.8 |
if z < -4.19232077706326539e94Initial program 13.0
Simplified10.2
rmApplied *-un-lft-identity10.2
Applied times-frac10.2
Applied associate-/r*2.6
Simplified2.6
if -4.19232077706326539e94 < z < 5.5114979619320889e-97Initial program 2.9
Simplified2.9
rmApplied div-inv3.2
Simplified3.2
if 5.5114979619320889e-97 < z Initial program 8.3
Simplified6.2
rmApplied div-inv6.3
Simplified6.3
rmApplied *-un-lft-identity6.3
Applied times-frac5.7
rmApplied associate-*l/5.7
Applied associate-*r/2.5
Simplified2.5
Final simplification2.8
herbie shell --seed 2020177
(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))))