\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;y \cdot z - z \cdot t \leq -2.6959315728345433 \cdot 10^{+279}:\\
\;\;\;\;\frac{x \cdot \frac{2}{z}}{y - t}\\
\mathbf{elif}\;y \cdot z - z \cdot t \leq -6.506340873445863 \cdot 10^{-142}:\\
\;\;\;\;\frac{x \cdot 2}{y \cdot z - z \cdot t}\\
\mathbf{elif}\;y \cdot z - z \cdot t \leq 1.1600846731921496 \cdot 10^{-273}:\\
\;\;\;\;\frac{1}{z \cdot \frac{y - t}{x \cdot 2}}\\
\mathbf{elif}\;y \cdot z - z \cdot t \leq 1.0796196230071177 \cdot 10^{+249}:\\
\;\;\;\;\frac{x \cdot 2}{y \cdot z - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{2}{z}}{y - t}\\
\end{array}double code(double x, double y, double z, double t) {
return (((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) (z * t)))) <= -2.6959315728345433e+279)) {
VAR = (((double) (x * (2.0 / z))) / ((double) (y - t)));
} else {
double VAR_1;
if ((((double) (((double) (y * z)) - ((double) (z * t)))) <= -6.506340873445863e-142)) {
VAR_1 = (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (z * t)))));
} else {
double VAR_2;
if ((((double) (((double) (y * z)) - ((double) (z * t)))) <= 1.1600846731921496e-273)) {
VAR_2 = (1.0 / ((double) (z * (((double) (y - t)) / ((double) (x * 2.0))))));
} else {
double VAR_3;
if ((((double) (((double) (y * z)) - ((double) (z * t)))) <= 1.0796196230071177e+249)) {
VAR_3 = (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (z * t)))));
} else {
VAR_3 = (((double) (x * (2.0 / z))) / ((double) (y - t)));
}
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.2 |
| Herbie | 0.4 |
if (- (* y z) (* t z)) < -2.6959315728345433e279 or 1.0796196230071177e249 < (- (* y z) (* t z)) Initial program Error: 19.8 bits
SimplifiedError: 16.1 bits
rmApplied associate-/r*Error: 15.0 bits
rmApplied associate-*r/Error: 0.2 bits
if -2.6959315728345433e279 < (- (* y z) (* t z)) < -6.5063408734458633e-142 or 1.1600846731921496e-273 < (- (* y z) (* t z)) < 1.0796196230071177e249Initial program Error: 0.3 bits
if -6.5063408734458633e-142 < (- (* y z) (* t z)) < 1.1600846731921496e-273Initial program Error: 17.1 bits
SimplifiedError: 18.7 bits
rmApplied associate-/r*Error: 18.8 bits
rmApplied associate-*r/Error: 2.5 bits
rmApplied clear-numError: 2.6 bits
SimplifiedError: 3.4 bits
Final simplificationError: 0.4 bits
herbie shell --seed 2020200
(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))))