\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \le -9.984365809073703929848708018230154758947 \cdot 10^{82} \lor \neg \left(y \le 6.617810863587314615453058275008041291286 \cdot 10^{-52}\right):\\
\;\;\;\;\frac{x \cdot 2}{-1 + \frac{x}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{x - y} \cdot y\\
\end{array}double f(double x, double y) {
double r417916 = x;
double r417917 = 2.0;
double r417918 = r417916 * r417917;
double r417919 = y;
double r417920 = r417918 * r417919;
double r417921 = r417916 - r417919;
double r417922 = r417920 / r417921;
return r417922;
}
double f(double x, double y) {
double r417923 = y;
double r417924 = -9.984365809073704e+82;
bool r417925 = r417923 <= r417924;
double r417926 = 6.6178108635873146e-52;
bool r417927 = r417923 <= r417926;
double r417928 = !r417927;
bool r417929 = r417925 || r417928;
double r417930 = x;
double r417931 = 2.0;
double r417932 = r417930 * r417931;
double r417933 = -1.0;
double r417934 = r417930 / r417923;
double r417935 = r417933 + r417934;
double r417936 = r417932 / r417935;
double r417937 = r417930 - r417923;
double r417938 = r417932 / r417937;
double r417939 = r417938 * r417923;
double r417940 = r417929 ? r417936 : r417939;
return r417940;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.2 |
|---|---|
| Target | 0.3 |
| Herbie | 0.4 |
if y < -9.984365809073704e+82 or 6.6178108635873146e-52 < y Initial program 16.4
rmApplied associate-/l*0.5
Taylor expanded around 0 0.5
Simplified0.5
if -9.984365809073704e+82 < y < 6.6178108635873146e-52Initial program 14.1
rmApplied associate-/l*13.1
rmApplied associate-/r/0.4
Final simplification0.4
herbie shell --seed 2019303 +o rules:numerics
(FPCore (x y)
:name "Linear.Projection:perspective from linear-1.19.1.3, B"
:precision binary64
:herbie-target
(if (< x -1.7210442634149447e81) (* (/ (* 2 x) (- x y)) y) (if (< x 83645045635564432) (/ (* x 2) (/ (- x y) y)) (* (/ (* 2 x) (- x y)) y)))
(/ (* (* x 2) y) (- x y)))