\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;y \cdot z - z \cdot t \leq -2.2887889102874485 \cdot 10^{+227}:\\
\;\;\;\;\frac{\frac{x \cdot 2}{y - t}}{z}\\
\mathbf{elif}\;y \cdot z - z \cdot t \leq -1.0002813918728466 \cdot 10^{-176}:\\
\;\;\;\;\frac{x \cdot 2}{y \cdot z - z \cdot t}\\
\mathbf{elif}\;y \cdot z - z \cdot t \leq 2.9226969921444667 \cdot 10^{-241}:\\
\;\;\;\;\frac{\frac{x \cdot 2}{y - t}}{z}\\
\mathbf{elif}\;y \cdot z - z \cdot t \leq 5.059772897437438 \cdot 10^{+137}:\\
\;\;\;\;\frac{x \cdot 2}{y \cdot z - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2 \cdot \frac{x}{z}}{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 (<= (- (* y z) (* z t)) -2.2887889102874485e+227)
(/ (/ (* x 2.0) (- y t)) z)
(if (<= (- (* y z) (* z t)) -1.0002813918728466e-176)
(/ (* x 2.0) (- (* y z) (* z t)))
(if (<= (- (* y z) (* z t)) 2.9226969921444667e-241)
(/ (/ (* x 2.0) (- y t)) z)
(if (<= (- (* y z) (* z t)) 5.059772897437438e+137)
(/ (* x 2.0) (- (* y z) (* z t)))
(/ (* 2.0 (/ x z)) (- 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) (((double) (y * z)) - ((double) (z * t)))) <= -2.2887889102874485e+227)) {
tmp = ((((double) (x * 2.0)) / ((double) (y - t))) / z);
} else {
double tmp_1;
if ((((double) (((double) (y * z)) - ((double) (z * t)))) <= -1.0002813918728466e-176)) {
tmp_1 = (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (z * t)))));
} else {
double tmp_2;
if ((((double) (((double) (y * z)) - ((double) (z * t)))) <= 2.9226969921444667e-241)) {
tmp_2 = ((((double) (x * 2.0)) / ((double) (y - t))) / z);
} else {
double tmp_3;
if ((((double) (((double) (y * z)) - ((double) (z * t)))) <= 5.059772897437438e+137)) {
tmp_3 = (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (z * t)))));
} else {
tmp_3 = (((double) (2.0 * (x / z))) / ((double) (y - t)));
}
tmp_2 = tmp_3;
}
tmp_1 = tmp_2;
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 7.0 |
|---|---|
| Target | 2.1 |
| Herbie | 0.6 |
if (- (* y z) (* t z)) < -2.28878891028744855e227 or -1.0002813918728466e-176 < (- (* y z) (* t z)) < 2.9226969921444667e-241Initial program Error: 14.7 bits
SimplifiedError: 15.2 bits
rmApplied *-un-lft-identityError: 15.2 bits
Applied times-fracError: 14.4 bits
Applied associate-*r*Error: 0.9 bits
SimplifiedError: 0.8 bits
rmApplied associate-*l/Error: 0.7 bits
rmApplied associate-*r/Error: 0.6 bits
if -2.28878891028744855e227 < (- (* y z) (* t z)) < -1.0002813918728466e-176 or 2.9226969921444667e-241 < (- (* y z) (* t z)) < 5.0597728974374384e137Initial program Error: 0.3 bits
if 5.0597728974374384e137 < (- (* y z) (* t z)) Initial program Error: 14.1 bits
SimplifiedError: 10.1 bits
rmApplied *-un-lft-identityError: 10.1 bits
Applied times-fracError: 9.4 bits
Applied associate-*r*Error: 1.4 bits
SimplifiedError: 1.4 bits
rmApplied associate-*r/Error: 1.3 bits
Final simplificationError: 0.6 bits
herbie shell --seed 2020204
(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))))