\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;x \le -812775362484110256794557743104 \lor \neg \left(x \le 3.77258026262028000276346495510928850917 \cdot 10^{-75}\right):\\
\;\;\;\;\frac{x \cdot 2}{x - y} \cdot y\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{-1 + \frac{x}{y}}\\
\end{array}double f(double x, double y) {
double r434890 = x;
double r434891 = 2.0;
double r434892 = r434890 * r434891;
double r434893 = y;
double r434894 = r434892 * r434893;
double r434895 = r434890 - r434893;
double r434896 = r434894 / r434895;
return r434896;
}
double f(double x, double y) {
double r434897 = x;
double r434898 = -8.127753624841103e+29;
bool r434899 = r434897 <= r434898;
double r434900 = 3.77258026262028e-75;
bool r434901 = r434897 <= r434900;
double r434902 = !r434901;
bool r434903 = r434899 || r434902;
double r434904 = 2.0;
double r434905 = r434897 * r434904;
double r434906 = y;
double r434907 = r434897 - r434906;
double r434908 = r434905 / r434907;
double r434909 = r434908 * r434906;
double r434910 = -1.0;
double r434911 = r434897 / r434906;
double r434912 = r434910 + r434911;
double r434913 = r434905 / r434912;
double r434914 = r434903 ? r434909 : r434913;
return r434914;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.0 |
|---|---|
| Target | 0.3 |
| Herbie | 0.3 |
if x < -8.127753624841103e+29 or 3.77258026262028e-75 < x Initial program 15.2
rmApplied associate-/l*12.9
rmApplied associate-/r/0.5
if -8.127753624841103e+29 < x < 3.77258026262028e-75Initial program 14.7
rmApplied associate-/l*0.1
Taylor expanded around 0 0.1
Simplified0.1
Final simplification0.3
herbie shell --seed 2019306 +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)))