\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;y \cdot z - z \cdot t \leq -\infty:\\
\;\;\;\;\frac{x}{z} \cdot \frac{2}{y - t}\\
\mathbf{elif}\;y \cdot z - z \cdot t \leq 1.9602188562953434 \cdot 10^{+290}:\\
\;\;\;\;\frac{x \cdot 2}{y \cdot z - z \cdot t}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot 2}{y - t}}{z}\\
\end{array}(FPCore (x y z t) :precision binary64 (/ (* x 2.0) (- (* y z) (* t z))))
(FPCore (x y z t)
:precision binary64
(if (<= (- (* y z) (* z t)) (- INFINITY))
(* (/ x z) (/ 2.0 (- y t)))
(if (<= (- (* y z) (* z t)) 1.9602188562953434e+290)
(/ (* x 2.0) (- (* y z) (* z t)))
(/ (/ (* x 2.0) (- y t)) z))))double code(double x, double y, double z, double t) {
return (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (t * z)))));
}
double code(double x, double y, double z, double t) {
double tmp;
if ((((double) (((double) (y * z)) - ((double) (z * t)))) <= ((double) -(((double) INFINITY))))) {
tmp = ((double) ((x / z) * (2.0 / ((double) (y - t)))));
} else {
double tmp_1;
if ((((double) (((double) (y * z)) - ((double) (z * t)))) <= 1.9602188562953434e+290)) {
tmp_1 = (((double) (x * 2.0)) / ((double) (((double) (y * z)) - ((double) (z * t)))));
} else {
tmp_1 = ((((double) (x * 2.0)) / ((double) (y - t))) / z);
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.6 |
|---|---|
| Target | 2.1 |
| Herbie | 1.2 |
if (-.f64 (*.f64 y z) (*.f64 t z)) < -inf.0Initial program 19.7
Simplified17.7
rmApplied *-un-lft-identity_binary6417.7
Applied *-un-lft-identity_binary6417.7
Applied add-sqr-sqrt_binary6417.7
Applied times-frac_binary6417.7
Applied times-frac_binary6417.7
Applied associate-*r*_binary6417.7
Simplified17.7
rmApplied pow1_binary6417.7
Applied pow1_binary6417.7
Applied pow1_binary6417.7
Applied pow-prod-down_binary6417.7
Applied pow-prod-down_binary6417.7
Simplified0.1
if -inf.0 < (-.f64 (*.f64 y z) (*.f64 t z)) < 1.9602188562953434e290Initial program 1.5
if 1.9602188562953434e290 < (-.f64 (*.f64 y z) (*.f64 t z)) Initial program 25.5
Simplified15.8
rmApplied *-un-lft-identity_binary6415.8
Applied *-un-lft-identity_binary6415.8
Applied add-sqr-sqrt_binary6415.9
Applied times-frac_binary6415.9
Applied times-frac_binary6415.9
Applied associate-*r*_binary6415.9
Simplified15.9
rmApplied associate-*r/_binary640.3
Simplified0.1
Final simplification1.2
herbie shell --seed 2020205
(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))))