\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;y \cdot z - t \cdot z \le -4.0313494744927904 \cdot 10^{265}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\
\mathbf{elif}\;y \cdot z - t \cdot z \le 5.1938306984253621 \cdot 10^{229}:\\
\;\;\;\;\frac{x \cdot 2}{y \cdot z - t \cdot z}\\
\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 ((((double) (((double) (y * z)) - ((double) (t * z)))) <= -4.0313494744927904e+265)) {
VAR = ((double) (((double) (x / z)) / ((double) (((double) (y - t)) / 2.0))));
} else {
double VAR_1;
if ((((double) (((double) (y * z)) - ((double) (t * z)))) <= 5.193830698425362e+229)) {
VAR_1 = ((double) (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (t * z))))));
} 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.7 |
|---|---|
| Target | 2.1 |
| Herbie | 1.1 |
if (- (* y z) (* t z)) < -4.0313494744927904e265Initial program 15.8
Simplified15.8
rmApplied *-un-lft-identity15.8
Applied times-frac15.8
Applied associate-/r*0.1
Simplified0.1
if -4.0313494744927904e265 < (- (* y z) (* t z)) < 5.1938306984253621e229Initial program 1.5
if 5.1938306984253621e229 < (- (* y z) (* t z)) Initial program 19.5
Simplified14.0
rmApplied *-un-lft-identity14.0
Applied times-frac14.0
Applied *-un-lft-identity14.0
Applied times-frac0.4
Simplified0.4
rmApplied associate-*l/0.4
Simplified0.4
Final simplification1.1
herbie shell --seed 2020153
(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))))