\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \le -1.4073254993549903 \cdot 10^{154}:\\
\;\;\;\;\frac{x}{z} \cdot \frac{2}{y - t}\\
\mathbf{elif}\;z \le 6731197093309.67871:\\
\;\;\;\;\frac{x \cdot 2}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\sqrt{z}} \cdot \left(\frac{2}{y - t} \cdot \frac{x}{\sqrt{z}}\right)\\
\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 <= -1.4073254993549903e+154)) {
VAR = ((double) (((double) (x / z)) * ((double) (2.0 / ((double) (y - t))))));
} else {
double VAR_1;
if ((z <= 6731197093309.679)) {
VAR_1 = ((double) (((double) (x * 2.0)) / ((double) (z * ((double) (y - t))))));
} else {
VAR_1 = ((double) (((double) (1.0 / ((double) sqrt(z)))) * ((double) (((double) (2.0 / ((double) (y - t)))) * ((double) (x / ((double) sqrt(z))))))));
}
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.4 |
| Herbie | 2.7 |
if z < -1.4073254993549903e154Initial program 15.2
Simplified11.6
rmApplied *-un-lft-identity11.6
Applied times-frac11.1
Applied associate-*r*2.7
Simplified2.6
if -1.4073254993549903e154 < z < 6731197093309.67871Initial program 3.3
Simplified3.5
rmApplied associate-*r/3.3
if 6731197093309.67871 < z Initial program 11.1
Simplified8.8
rmApplied *-un-lft-identity8.8
Applied times-frac8.0
Applied associate-*r*1.8
Simplified1.7
rmApplied add-sqr-sqrt1.9
Applied *-un-lft-identity1.9
Applied times-frac1.9
Applied associate-*l*1.3
Simplified1.3
Final simplification2.7
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))))