\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;y \cdot z - t \cdot z = -inf.0:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\
\mathbf{elif}\;y \cdot z - t \cdot z \le -1.3362290482080399 \cdot 10^{-163}:\\
\;\;\;\;\frac{x \cdot 2}{y \cdot z - t \cdot z}\\
\mathbf{elif}\;y \cdot z - t \cdot z \le 0.0:\\
\;\;\;\;\frac{1}{z} \cdot \frac{x}{\frac{y - t}{2}}\\
\mathbf{elif}\;y \cdot z - t \cdot z \le 7.1736477270824495 \cdot 10^{206}:\\
\;\;\;\;\frac{x \cdot 2}{y \cdot z - t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{x}{\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) (y * z)) - ((double) (t * z)))) <= -inf.0)) {
VAR = ((double) (((double) (x / z)) / ((double) (((double) (y - t)) / 2.0))));
} else {
double VAR_1;
if ((((double) (((double) (y * z)) - ((double) (t * z)))) <= -1.3362290482080399e-163)) {
VAR_1 = ((double) (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (t * z))))));
} else {
double VAR_2;
if ((((double) (((double) (y * z)) - ((double) (t * z)))) <= 0.0)) {
VAR_2 = ((double) (((double) (1.0 / z)) * ((double) (x / ((double) (((double) (y - t)) / 2.0))))));
} else {
double VAR_3;
if ((((double) (((double) (y * z)) - ((double) (t * z)))) <= 7.17364772708245e+206)) {
VAR_3 = ((double) (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (t * z))))));
} else {
VAR_3 = ((double) (((double) (1.0 / z)) * ((double) (x / ((double) (((double) (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.8 |
|---|---|
| Target | 2.2 |
| Herbie | 0.4 |
if (- (* y z) (* t z)) < -inf.0Initial program 19.0
Simplified19.0
rmApplied *-un-lft-identity19.0
Applied times-frac18.8
Applied associate-/r*0.1
Simplified0.1
if -inf.0 < (- (* y z) (* t z)) < -1.3362290482080399e-163 or 0.0 < (- (* y z) (* t z)) < 7.1736477270824495e206Initial program 0.3
if -1.3362290482080399e-163 < (- (* y z) (* t z)) < 0.0 or 7.1736477270824495e206 < (- (* y z) (* t z)) Initial program 18.9
Simplified14.0
rmApplied *-un-lft-identity14.0
Applied times-frac14.0
Applied *-un-lft-identity14.0
Applied times-frac0.8
Simplified0.8
Final simplification0.4
herbie shell --seed 2020155
(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))))