\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;x \le -1.73735157607842638 \cdot 10^{-55} \lor \neg \left(x \le 2.31015467420133914 \cdot 10^{-42}\right):\\
\;\;\;\;\frac{x}{x - y} \cdot \left(2 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\
\end{array}double f(double x, double y) {
double r446838 = x;
double r446839 = 2.0;
double r446840 = r446838 * r446839;
double r446841 = y;
double r446842 = r446840 * r446841;
double r446843 = r446838 - r446841;
double r446844 = r446842 / r446843;
return r446844;
}
double f(double x, double y) {
double r446845 = x;
double r446846 = -1.7373515760784264e-55;
bool r446847 = r446845 <= r446846;
double r446848 = 2.310154674201339e-42;
bool r446849 = r446845 <= r446848;
double r446850 = !r446849;
bool r446851 = r446847 || r446850;
double r446852 = y;
double r446853 = r446845 - r446852;
double r446854 = r446845 / r446853;
double r446855 = 2.0;
double r446856 = r446855 * r446852;
double r446857 = r446854 * r446856;
double r446858 = r446845 * r446855;
double r446859 = r446853 / r446852;
double r446860 = r446858 / r446859;
double r446861 = r446851 ? r446857 : r446860;
return r446861;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.1 |
|---|---|
| Target | 0.4 |
| Herbie | 0.2 |
if x < -1.7373515760784264e-55 or 2.310154674201339e-42 < x Initial program 13.7
rmApplied associate-/l*13.3
rmApplied div-inv13.4
Applied times-frac0.5
Simplified0.4
if -1.7373515760784264e-55 < x < 2.310154674201339e-42Initial program 17.0
rmApplied associate-/l*0.0
Final simplification0.2
herbie shell --seed 2020046 +o rules:numerics
(FPCore (x y)
:name "Linear.Projection:perspective from linear-1.19.1.3, B"
:precision binary64
:herbie-target
(if (< x -1.7210442634149447e+81) (* (/ (* 2 x) (- x y)) y) (if (< x 83645045635564432) (/ (* x 2) (/ (- x y) y)) (* (/ (* 2 x) (- x y)) y)))
(/ (* (* x 2) y) (- x y)))