\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \le -8.03674886647843618 \cdot 10^{-44}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{2}{y - t}\\
\mathbf{elif}\;z \le 5.78063545109346623 \cdot 10^{54}:\\
\;\;\;\;\frac{x \cdot 2}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{z}{x} \cdot \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 ((z <= -8.036748866478436e-44)) {
VAR = ((double) (((double) (x / z)) * ((double) (2.0 / ((double) (y - t))))));
} else {
double VAR_1;
if ((z <= 5.780635451093466e+54)) {
VAR_1 = ((double) (((double) (x * 2.0)) / ((double) (z * ((double) (y - t))))));
} else {
VAR_1 = ((double) (1.0 / ((double) (((double) (z / x)) * ((double) (((double) (y - t)) / 2.0))))));
}
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.1 |
| Herbie | 2.6 |
if z < -8.03674886647843618e-44Initial program 9.6
Simplified7.7
rmApplied *-un-lft-identity7.7
Applied times-frac7.3
Applied associate-*r*2.1
Simplified2.1
if -8.03674886647843618e-44 < z < 5.78063545109346623e54Initial program 2.5
Simplified3.0
rmApplied associate-*r/2.5
if 5.78063545109346623e54 < z Initial program 12.5
Simplified9.8
rmApplied associate-*r/9.8
rmApplied clear-num10.2
Simplified3.3
Final simplification2.6
herbie shell --seed 2020185
(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))))