\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;y \cdot z - t \cdot z \le -2.0148370340377071 \cdot 10^{171}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\
\mathbf{elif}\;y \cdot z - t \cdot z \le -4.723901171503675 \cdot 10^{-94}:\\
\;\;\;\;x \cdot \frac{\frac{2}{y - t}}{z}\\
\mathbf{elif}\;y \cdot z - t \cdot z \le 9.15232862407595114 \cdot 10^{-285}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\
\mathbf{elif}\;y \cdot z - t \cdot z \le 1.16814661386677839 \cdot 10^{214}:\\
\;\;\;\;\frac{x \cdot 2}{y \cdot z - t \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 VAR;
if ((((y * z) - (t * z)) <= -2.014837034037707e+171)) {
VAR = ((x / z) / ((y - t) / 2.0));
} else {
double VAR_1;
if ((((y * z) - (t * z)) <= -4.723901171503675e-94)) {
VAR_1 = (x * ((2.0 / (y - t)) / z));
} else {
double VAR_2;
if ((((y * z) - (t * z)) <= 9.152328624075951e-285)) {
VAR_2 = ((x / z) / ((y - t) / 2.0));
} else {
double VAR_3;
if ((((y * z) - (t * z)) <= 1.1681466138667784e+214)) {
VAR_3 = ((x * 2.0) / ((y * z) - (t * z)));
} else {
VAR_3 = ((x / z) / ((y - t) / 2.0));
}
VAR_2 = VAR_3;
}
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 | 6.9 |
|---|---|
| Target | 2.3 |
| Herbie | 0.9 |
if (- (* y z) (* t z)) < -2.014837034037707e+171 or -4.723901171503675e-94 < (- (* y z) (* t z)) < 9.152328624075951e-285 or 1.1681466138667784e+214 < (- (* y z) (* t z)) Initial program 14.4
Simplified11.9
rmApplied *-un-lft-identity11.9
Applied times-frac11.9
Applied associate-/r*1.6
Simplified1.6
if -2.014837034037707e+171 < (- (* y z) (* t z)) < -4.723901171503675e-94Initial program 0.2
Simplified0.2
rmApplied div-inv0.3
Simplified0.3
if 9.152328624075951e-285 < (- (* y z) (* t z)) < 1.1681466138667784e+214Initial program 0.2
Final simplification0.9
herbie shell --seed 2020091
(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))))