\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 -5.86067368974230986 \cdot 10^{-307}:\\
\;\;\;\;\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}{z}}{\frac{y - t}{2}}\\
\mathbf{elif}\;\frac{x \cdot 2}{y \cdot z - t \cdot z} \le 4.81479739857195564 \cdot 10^{241}:\\
\;\;\;\;x \cdot \frac{\frac{2}{z}}{y - t}\\
\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)))))) <= -5.86067368974231e-307)) {
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 / z)) / ((double) (((double) (y - t)) / 2.0))));
} else {
double VAR_2;
if ((((double) (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (t * z)))))) <= 4.8147973985719556e+241)) {
VAR_2 = ((double) (x * ((double) (((double) (2.0 / z)) / ((double) (y - t))))));
} 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.2 |
| Herbie | 1.4 |
if (/ (* x 2.0) (- (* y z) (* t z))) < -5.86067368974230986e-307Initial program 1.8
if -5.86067368974230986e-307 < (/ (* x 2.0) (- (* y z) (* t z))) < -0.0 or 4.81479739857195564e241 < (/ (* x 2.0) (- (* y z) (* t z))) Initial program 17.3
Simplified14.1
rmApplied *-un-lft-identity14.1
Applied times-frac14.0
Applied associate-/r*1.9
Simplified1.9
if -0.0 < (/ (* x 2.0) (- (* y z) (* t z))) < 4.81479739857195564e241Initial program 0.3
Simplified0.3
rmApplied div-inv0.5
Simplified0.5
rmApplied associate-/r*0.5
Final simplification1.4
herbie shell --seed 2020162
(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))))