\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 r355808 = x;
double r355809 = y;
double r355810 = r355808 - r355809;
double r355811 = 2.0;
double r355812 = r355808 * r355811;
double r355813 = r355812 * r355809;
double r355814 = r355810 / r355813;
return r355814;
}
double f(double x, double y) {
double r355815 = x;
double r355816 = -3.9887415449186835e-57;
bool r355817 = r355815 <= r355816;
double r355818 = 2.6520816875241387e-25;
bool r355819 = r355815 <= r355818;
double r355820 = !r355819;
bool r355821 = r355817 || r355820;
double r355822 = y;
double r355823 = r355815 - r355822;
double r355824 = 2.0;
double r355825 = r355815 * r355824;
double r355826 = r355823 / r355825;
double r355827 = r355826 / r355822;
double r355828 = 1.0;
double r355829 = r355828 / r355815;
double r355830 = r355823 / r355824;
double r355831 = r355830 / r355822;
double r355832 = r355829 * r355831;
double r355833 = r355821 ? r355827 : r355832;
return r355833;
}




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
(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)))