\frac{x + y}{\left(x \cdot 2\right) \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -5.819157750295796344692295718235260807105 \cdot 10^{-37} \lor \neg \left(y \le 3.126349286155401959304305196339847373255 \cdot 10^{-87}\right):\\
\;\;\;\;\frac{\frac{1 + \frac{x}{y}}{2}}{x}\\
\mathbf{else}:\\
\;\;\;\;\frac{\frac{1}{2}}{y} \cdot \frac{x + y}{x}\\
\end{array}double f(double x, double y) {
double r337635 = x;
double r337636 = y;
double r337637 = r337635 + r337636;
double r337638 = 2.0;
double r337639 = r337635 * r337638;
double r337640 = r337639 * r337636;
double r337641 = r337637 / r337640;
return r337641;
}
double f(double x, double y) {
double r337642 = y;
double r337643 = -5.819157750295796e-37;
bool r337644 = r337642 <= r337643;
double r337645 = 3.126349286155402e-87;
bool r337646 = r337642 <= r337645;
double r337647 = !r337646;
bool r337648 = r337644 || r337647;
double r337649 = 1.0;
double r337650 = x;
double r337651 = r337650 / r337642;
double r337652 = r337649 + r337651;
double r337653 = 2.0;
double r337654 = r337652 / r337653;
double r337655 = r337654 / r337650;
double r337656 = r337649 / r337653;
double r337657 = r337656 / r337642;
double r337658 = r337650 + r337642;
double r337659 = r337658 / r337650;
double r337660 = r337657 * r337659;
double r337661 = r337648 ? r337655 : r337660;
return r337661;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.1 |
|---|---|
| Target | 0.0 |
| Herbie | 0.5 |
if y < -5.819157750295796e-37 or 3.126349286155402e-87 < y Initial program 13.3
Simplified13.3
rmApplied associate-/r*0.8
Simplified0.7
Taylor expanded around 0 0.7
if -5.819157750295796e-37 < y < 3.126349286155402e-87Initial program 18.0
Simplified18.0
rmApplied *-un-lft-identity18.0
Applied times-frac0.1
Simplified0.1
Simplified0.1
Final simplification0.5
herbie shell --seed 2019179 +o rules:numerics
(FPCore (x y)
:name "Linear.Projection:inversePerspective from linear-1.19.1.3, C"
:herbie-target
(+ (/ 0.5 x) (/ 0.5 y))
(/ (+ x y) (* (* x 2.0) y)))