\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \le -1.1834878622195064 \cdot 10^{103}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\
\mathbf{elif}\;z \le 2.727970289051773 \cdot 10^{121}:\\
\;\;\;\;\frac{x}{\frac{z \cdot \left(y - t\right)}{2}}\\
\mathbf{elif}\;z \le 1.5000263552966557 \cdot 10^{248}:\\
\;\;\;\;\frac{x}{y - t} \cdot \frac{2}{z}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{2}{\left(y - t\right) \cdot 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.1834878622195064e+103)) {
VAR = ((double) (((double) (x / z)) / ((double) (((double) (y - t)) / 2.0))));
} else {
double VAR_1;
if ((z <= 2.7279702890517728e+121)) {
VAR_1 = ((double) (x / ((double) (((double) (z * ((double) (y - t)))) / 2.0))));
} else {
double VAR_2;
if ((z <= 1.5000263552966557e+248)) {
VAR_2 = ((double) (((double) (x / ((double) (y - t)))) * ((double) (2.0 / z))));
} else {
VAR_2 = ((double) (x * ((double) (2.0 / ((double) (((double) (y - t)) * z))))));
}
VAR_1 = VAR_2;
}
VAR = VAR_1;
}
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 | 3.1 |
if z < -1.1834878622195064e103Initial program 13.4
Simplified10.1
rmApplied *-un-lft-identity10.1
Applied times-frac10.1
Applied associate-/r*2.1
Simplified2.1
if -1.1834878622195064e103 < z < 2.727970289051773e121Initial program 3.2
Simplified3.2
if 2.727970289051773e121 < z < 1.5000263552966557e248Initial program 13.4
Simplified11.2
rmApplied div-inv11.2
Simplified10.3
rmApplied div-inv10.3
Applied associate-/l*11.3
Simplified11.2
rmApplied *-un-lft-identity11.2
Applied times-frac10.4
Applied associate-*r*2.2
Simplified2.2
if 1.5000263552966557e248 < z Initial program 14.3
Simplified8.4
rmApplied div-inv8.4
Simplified7.8
rmApplied div-inv7.8
Applied associate-/l*8.4
Simplified8.4
Final simplification3.1
herbie shell --seed 2020152
(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))))