\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;x \cdot 2 \leq -2.4530713635096856 \cdot 10^{-36}:\\
\;\;\;\;\frac{\frac{x \cdot 2}{y - t}}{z}\\
\mathbf{elif}\;x \cdot 2 \leq 2.956819744716004 \cdot 10^{+227} \lor \neg \left(x \cdot 2 \leq 1.122968697172558 \cdot 10^{+289}\right):\\
\;\;\;\;\frac{x \cdot 2}{\left(y - t\right) \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{z}{x \cdot \frac{2}{y - t}}}\\
\end{array}(FPCore (x y z t) :precision binary64 (/ (* x 2.0) (- (* y z) (* t z))))
(FPCore (x y z t)
:precision binary64
(if (<= (* x 2.0) -2.4530713635096856e-36)
(/ (/ (* x 2.0) (- y t)) z)
(if (or (<= (* x 2.0) 2.956819744716004e+227)
(not (<= (* x 2.0) 1.122968697172558e+289)))
(/ (* x 2.0) (* (- y t) z))
(/ 1.0 (/ z (* x (/ 2.0 (- y t))))))))double code(double x, double y, double z, double t) {
return (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (t * z)))));
}
double code(double x, double y, double z, double t) {
double tmp;
if ((((double) (x * 2.0)) <= -2.4530713635096856e-36)) {
tmp = ((((double) (x * 2.0)) / ((double) (y - t))) / z);
} else {
double tmp_1;
if (((((double) (x * 2.0)) <= 2.956819744716004e+227) || !(((double) (x * 2.0)) <= 1.122968697172558e+289))) {
tmp_1 = (((double) (x * 2.0)) / ((double) (((double) (y - t)) * z)));
} else {
tmp_1 = (1.0 / (z / ((double) (x * (2.0 / ((double) (y - t)))))));
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.7 |
|---|---|
| Target | 2.1 |
| Herbie | 3.4 |
if (*.f64 x 2.0) < -2.4530713635096856e-36Initial program 9.7
Simplified8.2
rmApplied associate-*r/_binary642.1
rmApplied associate-*r/_binary642.0
if -2.4530713635096856e-36 < (*.f64 x 2.0) < 2.95681974471600386e227 or 1.122968697172558e289 < (*.f64 x 2.0) Initial program 5.0
Simplified3.8
rmApplied associate-*r/_binary646.5
rmApplied associate-*r/_binary646.5
Applied associate-/l/_binary643.8
Simplified3.8
if 2.95681974471600386e227 < (*.f64 x 2.0) < 1.122968697172558e289Initial program 17.8
Simplified15.9
rmApplied associate-*r/_binary644.1
rmApplied clear-num_binary644.4
Final simplification3.4
herbie shell --seed 2020210
(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))))