\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \le -1.4988469650336908 \cdot 10^{67}:\\
\;\;\;\;\frac{1}{\frac{\frac{z}{\sqrt{2}}}{\sqrt[3]{x} \cdot \sqrt[3]{x}} \cdot \frac{\frac{y - t}{\sqrt{2}}}{\sqrt[3]{x}}}\\
\mathbf{elif}\;z \le 2.51302619308367974 \cdot 10^{-42}:\\
\;\;\;\;1 \cdot \frac{x}{\frac{z \cdot \left(y - t\right)}{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{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 temp;
if ((z <= -1.4988469650336908e+67)) {
temp = (1.0 / (((z / sqrt(2.0)) / (cbrt(x) * cbrt(x))) * (((y - t) / sqrt(2.0)) / cbrt(x))));
} else {
double temp_1;
if ((z <= 2.5130261930836797e-42)) {
temp_1 = (1.0 * (x / ((z * (y - t)) / 2.0)));
} else {
temp_1 = ((x / z) / ((y - t) / 2.0));
}
temp = temp_1;
}
return temp;
}




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.3 |
if z < -1.4988469650336908e+67Initial program 11.9
Simplified9.5
rmApplied clear-num9.8
rmApplied add-cube-cbrt10.2
Applied add-sqr-sqrt10.2
Applied times-frac10.2
Applied times-frac2.2
if -1.4988469650336908e+67 < z < 2.5130261930836797e-42Initial program 2.5
Simplified2.5
rmApplied clear-num2.8
rmApplied *-un-lft-identity2.8
Applied *-un-lft-identity2.8
Applied times-frac2.8
Applied add-sqr-sqrt2.8
Applied times-frac2.8
Simplified2.8
Simplified2.5
if 2.5130261930836797e-42 < z Initial program 9.8
Simplified8.0
rmApplied *-un-lft-identity8.0
Applied times-frac8.0
Applied associate-/r*2.1
Simplified2.1
Final simplification2.3
herbie shell --seed 2020058 +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))))