\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \le -2.037157504084274034815349795281714872542 \cdot 10^{-36}:\\
\;\;\;\;\frac{\frac{x \cdot 2}{z}}{y - t}\\
\mathbf{elif}\;z \le 3.818366843617034597316373479678641130316 \cdot 10^{83}:\\
\;\;\;\;\frac{x \cdot 2}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot \frac{2}{y - t}}{z}\\
\end{array}double f(double x, double y, double z, double t) {
double r392054 = x;
double r392055 = 2.0;
double r392056 = r392054 * r392055;
double r392057 = y;
double r392058 = z;
double r392059 = r392057 * r392058;
double r392060 = t;
double r392061 = r392060 * r392058;
double r392062 = r392059 - r392061;
double r392063 = r392056 / r392062;
return r392063;
}
double f(double x, double y, double z, double t) {
double r392064 = z;
double r392065 = -2.037157504084274e-36;
bool r392066 = r392064 <= r392065;
double r392067 = x;
double r392068 = 2.0;
double r392069 = r392067 * r392068;
double r392070 = r392069 / r392064;
double r392071 = y;
double r392072 = t;
double r392073 = r392071 - r392072;
double r392074 = r392070 / r392073;
double r392075 = 3.8183668436170346e+83;
bool r392076 = r392064 <= r392075;
double r392077 = r392064 * r392073;
double r392078 = r392069 / r392077;
double r392079 = r392068 / r392073;
double r392080 = r392067 * r392079;
double r392081 = r392080 / r392064;
double r392082 = r392076 ? r392078 : r392081;
double r392083 = r392066 ? r392074 : r392082;
return r392083;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.6 |
|---|---|
| Target | 2.2 |
| Herbie | 2.4 |
if z < -2.037157504084274e-36Initial program 9.3
Simplified7.6
rmApplied associate-/r*2.2
if -2.037157504084274e-36 < z < 3.8183668436170346e+83Initial program 2.5
Simplified2.5
rmApplied div-inv2.9
rmApplied add-cube-cbrt2.9
Applied times-frac2.9
Simplified2.9
Simplified2.9
rmApplied frac-times2.9
Applied associate-*r/2.5
Simplified2.5
if 3.8183668436170346e+83 < z Initial program 12.9
Simplified10.2
rmApplied div-inv10.3
rmApplied add-cube-cbrt10.3
Applied times-frac9.6
Simplified9.6
Simplified9.6
rmApplied associate-*l/9.6
Applied associate-*r/2.5
Simplified2.5
Final simplification2.4
herbie shell --seed 2019323
(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.045027827330126e-269) (/ (* (/ x z) 2) (- y t)) (* (/ x (* (- y t) z)) 2)))
(/ (* x 2) (- (* y z) (* t z))))