\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;y \cdot z - t \cdot z \le -3.3845513883943168 \cdot 10^{205}:\\
\;\;\;\;\frac{x \cdot \frac{2}{y - t}}{z}\\
\mathbf{elif}\;y \cdot z - t \cdot z \le 4.94822690605444123 \cdot 10^{203}:\\
\;\;\;\;\frac{x \cdot 2}{y \cdot z - t \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{2}{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) (t * z)))) <= -3.384551388394317e+205)) {
VAR = (((double) (x * (2.0 / ((double) (y - t))))) / z);
} else {
double VAR_1;
if ((((double) (((double) (y * z)) - ((double) (t * z)))) <= 4.948226906054441e+203)) {
VAR_1 = (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (t * z)))));
} else {
VAR_1 = ((double) ((x / z) * (2.0 / ((double) (y - t)))));
}
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 | 1.4 |
if (- (* y z) (* t z)) < -3.3845513883943168e205Initial program 11.7
Simplified11.7
rmApplied times-frac0.5
rmApplied associate-*l/0.5
if -3.3845513883943168e205 < (- (* y z) (* t z)) < 4.94822690605444123e203Initial program 1.9
if 4.94822690605444123e203 < (- (* y z) (* t z)) Initial program 17.9
Simplified11.7
rmApplied times-frac0.5
Final simplification1.4
herbie shell --seed 2020181
(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))))