\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \le -4.73813170928079148 \cdot 10^{-39}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\
\mathbf{elif}\;z \le 3.3198145839551466 \cdot 10^{203}:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{2}{y - t}}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{\frac{y - t}{2}}}{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.7381317092807915e-39)) {
VAR = ((double) (((double) (x / z)) / ((double) (((double) (y - t)) / 2.0))));
} else {
double VAR_1;
if ((z <= 3.3198145839551466e+203)) {
VAR_1 = ((double) (x / ((double) (z / ((double) (2.0 / ((double) (y - t))))))));
} else {
VAR_1 = ((double) (((double) (x / ((double) (((double) (y - t)) / 2.0)))) / 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.5 |
|---|---|
| Target | 2.2 |
| Herbie | 3.3 |
if z < -4.73813170928079148e-39Initial program 9.1
Simplified7.2
rmApplied *-un-lft-identity7.2
Applied times-frac7.2
Applied associate-/r*2.0
Simplified2.0
if -4.73813170928079148e-39 < z < 3.3198145839551466e203Initial program 4.2
Simplified3.9
rmApplied associate-/l*4.0
if 3.3198145839551466e203 < z Initial program 14.0
Simplified9.7
rmApplied *-un-lft-identity9.7
Applied times-frac9.7
Applied *-un-lft-identity9.7
Applied times-frac2.8
Simplified2.8
rmApplied associate-*l/2.7
Simplified2.7
Final simplification3.3
herbie shell --seed 2020163
(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))))