\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;x \cdot 2 \le -2.07896827281715923 \cdot 10^{-181}:\\
\;\;\;\;\frac{\frac{x}{y - t}}{\frac{z}{2}}\\
\mathbf{elif}\;x \cdot 2 \le 2.88293000746779607 \cdot 10^{154}:\\
\;\;\;\;\frac{1}{z \cdot \left(y - t\right)} \cdot \left(x \cdot 2\right)\\
\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 ((x * 2.0) / ((y * z) - (t * z)));
}
double code(double x, double y, double z, double t) {
double temp;
if (((x * 2.0) <= -2.0789682728171592e-181)) {
temp = ((x / (y - t)) / (z / 2.0));
} else {
double temp_1;
if (((x * 2.0) <= 2.882930007467796e+154)) {
temp_1 = ((1.0 / (z * (y - t))) * (x * 2.0));
} else {
temp_1 = ((1.0 / z) * (x / ((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.2 |
| Herbie | 3.5 |
if (* x 2.0) < -2.0789682728171592e-181Initial program 8.1
Simplified6.8
rmApplied *-un-lft-identity6.8
Applied *-commutative6.8
Applied times-frac6.8
Applied associate-/r*3.9
Simplified3.9
if -2.0789682728171592e-181 < (* x 2.0) < 2.882930007467796e+154Initial program 4.0
Simplified2.8
rmApplied div-inv2.8
Applied *-un-lft-identity2.8
Applied times-frac3.0
Simplified3.0
if 2.882930007467796e+154 < (* x 2.0) Initial program 16.0
Simplified15.8
rmApplied *-un-lft-identity15.8
Applied times-frac15.7
Applied *-un-lft-identity15.7
Applied times-frac4.4
Simplified4.4
Final simplification3.5
herbie shell --seed 2020066 +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))))