\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \le -2.6425573559360607 \cdot 10^{-262}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{x}{\frac{y - t}{2}}\\
\mathbf{elif}\;z \le 1.828976759401009 \cdot 10^{110}:\\
\;\;\;\;\frac{x}{\frac{z}{\frac{2}{y - t}}}\\
\mathbf{elif}\;z \le 9.1079890621173428 \cdot 10^{255}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{x}{\frac{y - t}{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{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 <= -2.6425573559360607e-262)) {
VAR = ((double) (((double) (1.0 / z)) * ((double) (x / ((double) (((double) (y - t)) / 2.0))))));
} else {
double VAR_1;
if ((z <= 1.828976759401009e+110)) {
VAR_1 = ((double) (x / ((double) (z / ((double) (2.0 / ((double) (y - t))))))));
} else {
double VAR_2;
if ((z <= 9.107989062117343e+255)) {
VAR_2 = ((double) (((double) (1.0 / z)) * ((double) (x / ((double) (((double) (y - t)) / 2.0))))));
} else {
VAR_2 = ((double) (((double) (x / z)) / ((double) (((double) (y - t)) / 2.0))));
}
VAR_1 = VAR_2;
}
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.3 |
| Herbie | 3.8 |
if z < -2.6425573559360607e-262 or 1.828976759401009e110 < z < 9.1079890621173428e255Initial program 8.5
Simplified7.2
rmApplied *-un-lft-identity7.2
Applied times-frac7.1
Applied *-un-lft-identity7.1
Applied times-frac4.2
Simplified4.2
if -2.6425573559360607e-262 < z < 1.828976759401009e110Initial program 3.5
Simplified3.4
rmApplied associate-/l*3.4
if 9.1079890621173428e255 < z Initial program 14.1
Simplified10.2
rmApplied *-un-lft-identity10.2
Applied times-frac10.2
Applied associate-/r*2.0
Simplified2.0
Final simplification3.8
herbie shell --seed 2020173
(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))))