\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \le -3.37468781690926404 \cdot 10^{-60}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\
\mathbf{elif}\;z \le 1.7252484947847566 \cdot 10^{-40}:\\
\;\;\;\;\frac{x}{\frac{z \cdot \left(y - t\right)}{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{y - t}}{\frac{\frac{z}{x}}{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 <= -3.374687816909264e-60)) {
VAR = ((double) (((double) (x / z)) / ((double) (((double) (y - t)) / 2.0))));
} else {
double VAR_1;
if ((z <= 1.7252484947847566e-40)) {
VAR_1 = ((double) (x / ((double) (((double) (z * ((double) (y - t)))) / 2.0))));
} else {
VAR_1 = ((double) (((double) (1.0 / ((double) (y - t)))) / ((double) (((double) (z / x)) / 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 | 7.2 |
|---|---|
| Target | 1.9 |
| Herbie | 2.1 |
if z < -3.37468781690926404e-60Initial program 9.9
Simplified7.8
rmApplied *-un-lft-identity7.8
Applied times-frac7.7
Applied associate-/r*1.9
Simplified1.9
if -3.37468781690926404e-60 < z < 1.7252484947847566e-40Initial program 2.6
Simplified2.7
if 1.7252484947847566e-40 < z Initial program 10.0
Simplified8.0
rmApplied *-un-lft-identity8.0
Applied times-frac8.0
Applied *-un-lft-identity8.0
Applied times-frac2.2
Simplified2.2
rmApplied associate-*l/2.2
Simplified2.2
rmApplied div-inv2.2
Applied *-un-lft-identity2.2
Applied times-frac2.2
Applied associate-/l*1.6
Simplified1.7
Final simplification2.1
herbie shell --seed 2020147
(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))))