\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \le -5.2975885083579693 \cdot 10^{-23}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\
\mathbf{elif}\;z \le 1.49678783062208739 \cdot 10^{-9}:\\
\;\;\;\;\frac{1}{\frac{\frac{z \cdot \left(y - t\right)}{2}}{x}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{\frac{y - t}{2}}}{z}\\
\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 <= -5.297588508357969e-23)) {
VAR = ((double) (((double) (x / z)) / ((double) (((double) (y - t)) / 2.0))));
} else {
double VAR_1;
if ((z <= 1.4967878306220874e-09)) {
VAR_1 = ((double) (1.0 / ((double) (((double) (((double) (z * ((double) (y - t)))) / 2.0)) / x))));
} else {
VAR_1 = ((double) (((double) (x / ((double) (((double) (y - t)) / 2.0)))) / 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.3 |
|---|---|
| Target | 2.6 |
| Herbie | 2.8 |
if z < -5.297588508357969e-23Initial program 10.2
Simplified8.3
rmApplied *-un-lft-identity8.3
Applied times-frac8.3
Applied associate-/r*2.1
Simplified2.1
if -5.297588508357969e-23 < z < 1.4967878306220874e-09Initial program 3.1
Simplified3.1
rmApplied clear-num3.5
if 1.4967878306220874e-09 < z Initial program 10.9
Simplified9.1
rmApplied *-un-lft-identity9.1
Applied times-frac9.0
Applied *-un-lft-identity9.0
Applied times-frac2.5
Simplified2.5
rmApplied associate-*l/2.4
Simplified2.4
Final simplification2.8
herbie shell --seed 2020123 +o rules:numerics
(FPCore (x y z t)
:name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
:precision binary64
:herbie-target
(if (< (/ (* x 2) (- (* y z) (* t z))) -2.559141628295061e-13) (* (/ x (* (- y t) z)) 2) (if (< (/ (* x 2) (- (* y z) (* t z))) 1.0450278273301259e-269) (/ (* (/ x z) 2) (- y t)) (* (/ x (* (- y t) z)) 2)))
(/ (* x 2) (- (* y z) (* t z))))