\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;x \cdot 2 \le -2.81976873589677169 \cdot 10^{79}:\\
\;\;\;\;\left(x \cdot 2\right) \cdot \frac{\frac{1}{z}}{y - t}\\
\mathbf{elif}\;x \cdot 2 \le 28.497285745122717:\\
\;\;\;\;\frac{\frac{x \cdot 2}{z}}{y - t}\\
\mathbf{else}:\\
\;\;\;\;\frac{2}{\frac{z}{\frac{x}{y - t}}}\\
\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 ((((double) (x * 2.0)) <= -2.8197687358967717e+79)) {
VAR = ((double) (((double) (x * 2.0)) * ((double) (((double) (1.0 / z)) / ((double) (y - t))))));
} else {
double VAR_1;
if ((((double) (x * 2.0)) <= 28.497285745122717)) {
VAR_1 = ((double) (((double) (((double) (x * 2.0)) / z)) / ((double) (y - t))));
} else {
VAR_1 = ((double) (2.0 / ((double) (z / ((double) (x / ((double) (y - t))))))));
}
VAR = VAR_1;
}
return VAR;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.7 |
|---|---|
| Target | 1.9 |
| Herbie | 3.7 |
if (* x 2.0) < -2.8197687358967717e+79Initial program 13.6
rmApplied div-inv13.7
Simplified11.6
if -2.8197687358967717e+79 < (* x 2.0) < 28.497285745122717Initial program 3.1
rmApplied div-inv3.4
Simplified2.3
rmApplied associate-*r/2.0
Simplified1.9
if 28.497285745122717 < (* x 2.0) Initial program 11.2
rmApplied *-commutative11.2
Applied associate-/l*11.3
Simplified2.6
Final simplification3.7
herbie shell --seed 2020113 +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))))