\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -120878309475402.03125 \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le -5.545286165337571374349144190718927055493 \cdot 10^{-303} \lor \neg \left(\frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 0.0\right) \land \frac{\left(x \cdot 2\right) \cdot y}{x - y} \le 8.162914331366078273047657170137319920997 \cdot 10^{-36}\right):\\
\;\;\;\;\left(x \cdot 2\right) \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\frac{-y}{-\left(x - y\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\
\end{array}double f(double x, double y) {
double r364752 = x;
double r364753 = 2.0;
double r364754 = r364752 * r364753;
double r364755 = y;
double r364756 = r364754 * r364755;
double r364757 = r364752 - r364755;
double r364758 = r364756 / r364757;
return r364758;
}
double f(double x, double y) {
double r364759 = x;
double r364760 = 2.0;
double r364761 = r364759 * r364760;
double r364762 = y;
double r364763 = r364761 * r364762;
double r364764 = r364759 - r364762;
double r364765 = r364763 / r364764;
double r364766 = -120878309475402.03;
bool r364767 = r364765 <= r364766;
double r364768 = -5.5452861653375714e-303;
bool r364769 = r364765 <= r364768;
double r364770 = 0.0;
bool r364771 = r364765 <= r364770;
double r364772 = !r364771;
double r364773 = 8.162914331366078e-36;
bool r364774 = r364765 <= r364773;
bool r364775 = r364772 && r364774;
bool r364776 = r364769 || r364775;
double r364777 = !r364776;
bool r364778 = r364767 || r364777;
double r364779 = -r364762;
double r364780 = -r364764;
double r364781 = r364779 / r364780;
double r364782 = expm1(r364781);
double r364783 = log1p(r364782);
double r364784 = r364761 * r364783;
double r364785 = r364778 ? r364784 : r364765;
return r364785;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.3 |
|---|---|
| Target | 0.3 |
| Herbie | 0.6 |
if (/ (* (* x 2.0) y) (- x y)) < -120878309475402.03 or -5.5452861653375714e-303 < (/ (* (* x 2.0) y) (- x y)) < 0.0 or 8.162914331366078e-36 < (/ (* (* x 2.0) y) (- x y)) Initial program 34.9
rmApplied *-un-lft-identity34.9
Applied times-frac0.6
Simplified0.6
rmApplied frac-2neg0.6
rmApplied log1p-expm1-u0.7
if -120878309475402.03 < (/ (* (* x 2.0) y) (- x y)) < -5.5452861653375714e-303 or 0.0 < (/ (* (* x 2.0) y) (- x y)) < 8.162914331366078e-36Initial program 5.8
Final simplification0.6
herbie shell --seed 2019323 +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)))