\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;\frac{x \cdot 2}{y \cdot z - z \cdot t} \leq -6.483783439194355 \cdot 10^{+17} \lor \neg \left(\frac{x \cdot 2}{y \cdot z - z \cdot t} \leq 3.592456861058638 \cdot 10^{+144}\right):\\
\;\;\;\;\left(x \cdot \frac{\sqrt[3]{\frac{2}{y - t}} \cdot \sqrt[3]{\frac{2}{y - t}}}{\sqrt[3]{z} \cdot \sqrt[3]{z}}\right) \cdot \frac{\sqrt[3]{\frac{2}{y - t}}}{\sqrt[3]{z}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x}{\frac{z}{2}}}{y - t}\\
\end{array}(FPCore (x y z t) :precision binary64 (/ (* x 2.0) (- (* y z) (* t z))))
(FPCore (x y z t)
:precision binary64
(if (or (<= (/ (* x 2.0) (- (* y z) (* z t))) -6.483783439194355e+17)
(not (<= (/ (* x 2.0) (- (* y z) (* z t))) 3.592456861058638e+144)))
(*
(*
x
(/
(* (cbrt (/ 2.0 (- y t))) (cbrt (/ 2.0 (- y t))))
(* (cbrt z) (cbrt z))))
(/ (cbrt (/ 2.0 (- y t))) (cbrt z)))
(/ (/ x (/ z 2.0)) (- y t))))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 tmp;
if ((((x * 2.0) / ((y * z) - (z * t))) <= -6.483783439194355e+17) || !(((x * 2.0) / ((y * z) - (z * t))) <= 3.592456861058638e+144)) {
tmp = (x * ((cbrt(2.0 / (y - t)) * cbrt(2.0 / (y - t))) / (cbrt(z) * cbrt(z)))) * (cbrt(2.0 / (y - t)) / cbrt(z));
} else {
tmp = (x / (z / 2.0)) / (y - t);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.4 |
|---|---|
| Target | 2.0 |
| Herbie | 2.3 |
if (/.f64 (*.f64 x 2) (-.f64 (*.f64 y z) (*.f64 t z))) < -648378343919435520 or 3.5924568610586377e144 < (/.f64 (*.f64 x 2) (-.f64 (*.f64 y z) (*.f64 t z))) Initial program 10.3
Simplified6.0
rmApplied add-cube-cbrt_binary64_130716.9
Applied add-cube-cbrt_binary64_130717.1
Applied times-frac_binary64_130427.1
Applied associate-*r*_binary64_129762.3
if -648378343919435520 < (/.f64 (*.f64 x 2) (-.f64 (*.f64 y z) (*.f64 t z))) < 3.5924568610586377e144Initial program 5.3
Simplified4.9
rmApplied associate-*r/_binary64_129785.9
rmApplied clear-num_binary64_130356.4
Simplified6.3
rmApplied associate-*r/_binary64_129786.3
Applied associate-/r/_binary64_129822.8
Applied associate-/r*_binary64_129802.4
Simplified2.2
Final simplification2.3
herbie shell --seed 2021043
(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))))