\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \le -1.46100128484873637 \cdot 10^{-47} \lor \neg \left(z \le 1.2873642362218381 \cdot 10^{-91}\right):\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{\frac{2}{y - t}}{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 <= -1.4610012848487364e-47) || !(z <= 1.287364236221838e-91))) {
VAR = ((double) (((double) (x / z)) / ((double) (((double) (y - t)) / 2.0))));
} else {
VAR = ((double) (x * ((double) (((double) (2.0 / ((double) (y - t)))) / z))));
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.9 |
|---|---|
| Target | 2.3 |
| Herbie | 2.6 |
if z < -1.4610012848487364e-47 or 1.287364236221838e-91 < z Initial program 8.8
Simplified7.0
rmApplied *-un-lft-identity7.0
Applied times-frac7.0
Applied associate-/r*2.1
Simplified2.1
if -1.4610012848487364e-47 < z < 1.287364236221838e-91Initial program 3.2
Simplified3.2
rmApplied div-inv3.7
Simplified3.7
Final simplification2.6
herbie shell --seed 2020120
(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))))