\frac{x \cdot 2}{y \cdot z - t \cdot z}\begin{array}{l}
\mathbf{if}\;x \le -3.003813290600453366675533312675622490873 \cdot 10^{-64}:\\
\;\;\;\;\frac{\frac{2 \cdot x}{y - t}}{z}\\
\mathbf{elif}\;x \le 3.776987495373950477434401189617111597882 \cdot 10^{-260}:\\
\;\;\;\;\frac{2 \cdot x}{z \cdot \left(y - t\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{2 \cdot x}{y - t}}{z}\\
\end{array}double f(double x, double y, double z, double t) {
double r22503746 = x;
double r22503747 = 2.0;
double r22503748 = r22503746 * r22503747;
double r22503749 = y;
double r22503750 = z;
double r22503751 = r22503749 * r22503750;
double r22503752 = t;
double r22503753 = r22503752 * r22503750;
double r22503754 = r22503751 - r22503753;
double r22503755 = r22503748 / r22503754;
return r22503755;
}
double f(double x, double y, double z, double t) {
double r22503756 = x;
double r22503757 = -3.0038132906004534e-64;
bool r22503758 = r22503756 <= r22503757;
double r22503759 = 2.0;
double r22503760 = r22503759 * r22503756;
double r22503761 = y;
double r22503762 = t;
double r22503763 = r22503761 - r22503762;
double r22503764 = r22503760 / r22503763;
double r22503765 = z;
double r22503766 = r22503764 / r22503765;
double r22503767 = 3.7769874953739505e-260;
bool r22503768 = r22503756 <= r22503767;
double r22503769 = r22503765 * r22503763;
double r22503770 = r22503760 / r22503769;
double r22503771 = r22503768 ? r22503770 : r22503766;
double r22503772 = r22503758 ? r22503766 : r22503771;
return r22503772;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
Results
| Original | 6.8 |
|---|---|
| Target | 2.1 |
| Herbie | 3.5 |
if x < -3.0038132906004534e-64 or 3.7769874953739505e-260 < x Initial program 8.0
Simplified6.9
rmApplied div-inv7.0
Applied associate-*l*4.5
Simplified4.5
rmApplied *-un-lft-identity4.5
Applied times-frac4.4
rmApplied associate-*l/4.3
Simplified4.0
if -3.0038132906004534e-64 < x < 3.7769874953739505e-260Initial program 3.4
Simplified2.8
rmApplied div-inv2.9
Applied associate-*l*10.6
Simplified10.6
rmApplied *-un-lft-identity10.6
Applied times-frac10.3
rmApplied associate-*l/10.2
Simplified9.6
rmApplied div-inv9.7
Applied associate-/l*2.0
Simplified2.0
Final simplification3.5
herbie shell --seed 2019172 +o rules:numerics
(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))))