\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \le -5.69801363483779798 \cdot 10^{44}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{x}{\frac{y - t}{2}}\\
\mathbf{elif}\;z \le 1.26255554836431083 \cdot 10^{-207}:\\
\;\;\;\;\frac{x}{\frac{y - t}{2} \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{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 temp;
if ((z <= -5.698013634837798e+44)) {
temp = ((1.0 / z) * (x / ((y - t) / 2.0)));
} else {
double temp_1;
if ((z <= 1.2625555483643108e-207)) {
temp_1 = (x / (((y - t) / 2.0) * z));
} else {
temp_1 = ((x / z) / ((y - t) / 2.0));
}
temp = temp_1;
}
return temp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.8 |
|---|---|
| Target | 2.2 |
| Herbie | 3.3 |
if z < -5.698013634837798e+44Initial program 12.4
Simplified9.9
rmApplied *-un-lft-identity9.9
Applied times-frac9.9
Applied *-un-lft-identity9.9
Applied times-frac2.4
Simplified2.4
if -5.698013634837798e+44 < z < 1.2625555483643108e-207Initial program 3.0
Simplified3.0
rmApplied *-un-lft-identity3.0
Applied times-frac3.0
Applied associate-/r*11.1
Simplified11.1
rmApplied div-inv11.1
Applied associate-/l*3.1
Simplified3.0
if 1.2625555483643108e-207 < z Initial program 6.7
Simplified5.5
rmApplied *-un-lft-identity5.5
Applied times-frac5.4
Applied associate-/r*4.0
Simplified4.0
Final simplification3.3
herbie shell --seed 2020053
(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))))