\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;z \le -879582645775952851454505447842129578557400:\\
\;\;\;\;\frac{\frac{x \cdot 2}{z}}{y - t}\\
\mathbf{elif}\;z \le 5.968128368805632124167463283042718481054 \cdot 10^{-47}:\\
\;\;\;\;\frac{x \cdot 2}{\left(y - t\right) \cdot z}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{x \cdot 2}{z}}{y - t}\\
\end{array}double f(double x, double y, double z, double t) {
double r24954878 = x;
double r24954879 = 2.0;
double r24954880 = r24954878 * r24954879;
double r24954881 = y;
double r24954882 = z;
double r24954883 = r24954881 * r24954882;
double r24954884 = t;
double r24954885 = r24954884 * r24954882;
double r24954886 = r24954883 - r24954885;
double r24954887 = r24954880 / r24954886;
return r24954887;
}
double f(double x, double y, double z, double t) {
double r24954888 = z;
double r24954889 = -8.795826457759529e+41;
bool r24954890 = r24954888 <= r24954889;
double r24954891 = x;
double r24954892 = 2.0;
double r24954893 = r24954891 * r24954892;
double r24954894 = r24954893 / r24954888;
double r24954895 = y;
double r24954896 = t;
double r24954897 = r24954895 - r24954896;
double r24954898 = r24954894 / r24954897;
double r24954899 = 5.968128368805632e-47;
bool r24954900 = r24954888 <= r24954899;
double r24954901 = r24954897 * r24954888;
double r24954902 = r24954893 / r24954901;
double r24954903 = r24954900 ? r24954902 : r24954898;
double r24954904 = r24954890 ? r24954898 : r24954903;
return r24954904;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.7 |
|---|---|
| Target | 2.2 |
| Herbie | 2.3 |
if z < -8.795826457759529e+41 or 5.968128368805632e-47 < z Initial program 10.2
Simplified2.1
rmApplied add-cube-cbrt2.6
Applied *-un-lft-identity2.6
Applied times-frac2.6
Applied associate-*r*5.3
Simplified5.3
rmApplied associate-*l/2.6
Simplified2.0
if -8.795826457759529e+41 < z < 5.968128368805632e-47Initial program 2.7
Simplified10.5
rmApplied add-cube-cbrt11.4
Applied *-un-lft-identity11.4
Applied times-frac11.4
Applied associate-*r*4.6
Simplified4.6
rmApplied associate-*l/11.4
Simplified10.5
rmApplied div-inv10.6
Applied associate-/l*2.8
Simplified2.7
Final simplification2.3
herbie shell --seed 2019179
(FPCore (x y z t)
:name "Linear.Projection:infinitePerspective from linear-1.19.1.3, A"
: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.045027827330126e-269) (/ (* (/ x z) 2.0) (- y t)) (* (/ x (* (- y t) z)) 2.0)))
(/ (* x 2.0) (- (* y z) (* t z))))