\frac{x - y}{\left(x \cdot 2\right) \cdot y}\begin{array}{l}
\mathbf{if}\;x \le -3.988741544918683514691243360830679767552 \cdot 10^{-57} \lor \neg \left(x \le 2.652081687524138675796576957148481763096 \cdot 10^{-25}\right):\\
\;\;\;\;\frac{\frac{x - y}{x \cdot 2}}{y}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{x} \cdot \frac{\frac{x - y}{2}}{y}\\
\end{array}double f(double x, double y) {
double r362722 = x;
double r362723 = y;
double r362724 = r362722 - r362723;
double r362725 = 2.0;
double r362726 = r362722 * r362725;
double r362727 = r362726 * r362723;
double r362728 = r362724 / r362727;
return r362728;
}
double f(double x, double y) {
double r362729 = x;
double r362730 = -3.9887415449186835e-57;
bool r362731 = r362729 <= r362730;
double r362732 = 2.6520816875241387e-25;
bool r362733 = r362729 <= r362732;
double r362734 = !r362733;
bool r362735 = r362731 || r362734;
double r362736 = y;
double r362737 = r362729 - r362736;
double r362738 = 2.0;
double r362739 = r362729 * r362738;
double r362740 = r362737 / r362739;
double r362741 = r362740 / r362736;
double r362742 = 1.0;
double r362743 = r362742 / r362729;
double r362744 = r362737 / r362738;
double r362745 = r362744 / r362736;
double r362746 = r362743 * r362745;
double r362747 = r362735 ? r362741 : r362746;
return r362747;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.2 |
|---|---|
| Target | 0.0 |
| Herbie | 0.2 |
if x < -3.9887415449186835e-57 or 2.6520816875241387e-25 < x Initial program 13.8
rmApplied associate-/r*0.3
if -3.9887415449186835e-57 < x < 2.6520816875241387e-25Initial program 17.0
rmApplied associate-/r*18.1
rmApplied *-un-lft-identity18.1
Applied *-un-lft-identity18.1
Applied times-frac18.1
Applied times-frac0.1
Simplified0.1
Final simplification0.2
herbie shell --seed 2019325 +o rules:numerics
(FPCore (x y)
:name "Linear.Projection:inversePerspective from linear-1.19.1.3, B"
:precision binary64
:herbie-target
(- (/ 0.5 y) (/ 0.5 x))
(/ (- x y) (* (* x 2) y)))