\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;x \le -6.5010644488975887 \cdot 10^{94} \lor \neg \left(x \le 3.8619926413929668 \cdot 10^{-62}\right):\\
\;\;\;\;\frac{x}{y - t} \cdot \left(\frac{1}{z} \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;1 \cdot \frac{x}{\frac{z \cdot \left(y - t\right)}{2}}\\
\end{array}double code(double x, double y, double z, double t) {
return ((x * 2.0) / ((y * z) - (t * z)));
}
double code(double x, double y, double z, double t) {
double VAR;
if (((x <= -6.501064448897589e+94) || !(x <= 3.861992641392967e-62))) {
VAR = ((x / (y - t)) * ((1.0 / z) * 2.0));
} else {
VAR = (1.0 * (x / ((z * (y - t)) / 2.0)));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.8 |
|---|---|
| Target | 2.1 |
| Herbie | 2.6 |
if x < -6.501064448897589e+94 or 3.861992641392967e-62 < x Initial program 10.9
Simplified10.1
rmApplied *-un-lft-identity10.1
Applied times-frac10.1
Applied associate-/r*10.8
Simplified10.8
rmApplied div-inv10.8
Applied div-inv10.9
Applied times-frac3.1
Simplified3.1
if -6.501064448897589e+94 < x < 3.861992641392967e-62Initial program 3.7
Simplified2.3
rmApplied *-un-lft-identity2.3
Applied *-un-lft-identity2.3
Applied times-frac2.3
Simplified2.3
Final simplification2.6
herbie shell --seed 2020078 +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))))