\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;x \le -3.14721234055145977 \cdot 10^{-143}:\\
\;\;\;\;\frac{\frac{x}{\frac{y - t}{2}}}{z}\\
\mathbf{elif}\;x \le 7.71521568793467103 \cdot 10^{-191}:\\
\;\;\;\;\frac{x}{\frac{z \cdot \left(y - t\right)}{2}}\\
\mathbf{elif}\;x \le 168298582129269047000:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\
\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 ((x <= -3.1472123405514598e-143)) {
VAR = ((double) (((double) (x / ((double) (((double) (y - t)) / 2.0)))) / z));
} else {
double VAR_1;
if ((x <= 7.715215687934671e-191)) {
VAR_1 = ((double) (x / ((double) (((double) (z * ((double) (y - t)))) / 2.0))));
} else {
double VAR_2;
if ((x <= 1.6829858212926905e+20)) {
VAR_2 = ((double) (((double) (x / z)) / ((double) (((double) (y - t)) / 2.0))));
} else {
VAR_2 = ((double) (((double) (x / ((double) (((double) (y - t)) / 2.0)))) / z));
}
VAR_1 = VAR_2;
}
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 | 2.2 |
| Herbie | 2.9 |
if x < -3.1472123405514598e-143 or 1.6829858212926905e+20 < x Initial program 9.9
Simplified8.9
rmApplied *-un-lft-identity8.9
Applied times-frac8.9
Applied *-un-lft-identity8.9
Applied times-frac3.7
Simplified3.7
rmApplied associate-*l/3.6
Simplified3.6
if -3.1472123405514598e-143 < x < 7.715215687934671e-191Initial program 4.0
Simplified2.5
if 7.715215687934671e-191 < x < 1.6829858212926905e+20Initial program 3.0
Simplified1.7
rmApplied *-un-lft-identity1.7
Applied times-frac1.7
Applied associate-/r*1.5
Simplified1.5
Final simplification2.9
herbie shell --seed 2020121
(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))))