\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;x \le -8528901247920.4355:\\
\;\;\;\;\frac{1}{z} \cdot \frac{x}{\frac{y - t}{2}}\\
\mathbf{elif}\;x \le -9.0911580313582713 \cdot 10^{-270}:\\
\;\;\;\;\frac{\frac{x}{z}}{\frac{y - t}{2}}\\
\mathbf{elif}\;x \le 3.44910821619298859 \cdot 10^{-68}:\\
\;\;\;\;\frac{x}{\frac{z \cdot \left(y - t\right)}{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{z} \cdot \frac{x}{\frac{y - t}{2}}\\
\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 ((x <= -8528901247920.436)) {
VAR = ((double) (((double) (1.0 / z)) * ((double) (x / ((double) (((double) (y - t)) / 2.0))))));
} else {
double VAR_1;
if ((x <= -9.091158031358271e-270)) {
VAR_1 = ((double) (((double) (x / z)) / ((double) (((double) (y - t)) / 2.0))));
} else {
double VAR_2;
if ((x <= 3.4491082161929886e-68)) {
VAR_2 = ((double) (x / ((double) (((double) (z * ((double) (y - t)))) / 2.0))));
} else {
VAR_2 = ((double) (((double) (1.0 / z)) * ((double) (x / ((double) (((double) (y - t)) / 2.0))))));
}
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 | 7.2 |
|---|---|
| Target | 2.5 |
| Herbie | 2.5 |
if x < -8528901247920.436 or 3.4491082161929886e-68 < x Initial program 10.6
Simplified9.7
rmApplied *-un-lft-identity9.7
Applied times-frac9.7
Applied *-un-lft-identity9.7
Applied times-frac2.5
Simplified2.5
if -8528901247920.436 < x < -9.091158031358271e-270Initial program 3.7
Simplified2.1
rmApplied *-un-lft-identity2.1
Applied times-frac2.1
Applied associate-/r*2.2
Simplified2.2
if -9.091158031358271e-270 < x < 3.4491082161929886e-68Initial program 4.1
Simplified2.8
Final simplification2.5
herbie shell --seed 2020126
(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))))