\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot 2}{y \cdot z - t \cdot z} \le -2.90895328456766833 \cdot 10^{-267}:\\
\;\;\;\;\frac{x \cdot 2}{y \cdot z - t \cdot z}\\
\mathbf{elif}\;\frac{x \cdot 2}{y \cdot z - t \cdot z} \le -0.0:\\
\;\;\;\;\frac{\frac{x}{\frac{y - t}{2}}}{z}\\
\mathbf{elif}\;\frac{x \cdot 2}{y \cdot z - t \cdot z} \le 1.713371553179363 \cdot 10^{268}:\\
\;\;\;\;\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 ((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) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (t * z)))))) <= -2.9089532845676683e-267)) {
VAR = ((double) (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (t * z))))));
} else {
double VAR_1;
if ((((double) (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (t * z)))))) <= -0.0)) {
VAR_1 = ((double) (((double) (x / ((double) (((double) (y - t)) / 2.0)))) / z));
} else {
double VAR_2;
if ((((double) (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (t * z)))))) <= 1.713371553179363e+268)) {
VAR_2 = ((double) (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (t * z))))));
} 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 | 6.8 |
|---|---|
| Target | 2.3 |
| Herbie | 1.6 |
if (/ (* x 2.0) (- (* y z) (* t z))) < -2.90895328456766833e-267 or -0.0 < (/ (* x 2.0) (- (* y z) (* t z))) < 1.713371553179363e268Initial program 1.1
if -2.90895328456766833e-267 < (/ (* x 2.0) (- (* y z) (* t z))) < -0.0Initial program 12.0
Simplified12.0
rmApplied *-un-lft-identity12.0
Applied times-frac12.0
Applied *-un-lft-identity12.0
Applied times-frac1.3
Simplified1.3
rmApplied associate-*l/1.2
Simplified1.2
if 1.713371553179363e268 < (/ (* x 2.0) (- (* y z) (* t z))) Initial program 46.9
Simplified22.7
rmApplied *-un-lft-identity22.7
Applied times-frac22.7
Applied associate-/r*10.9
Simplified10.9
Final simplification1.6
herbie shell --seed 2020174
(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))))