\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}{x - y}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x \cdot 2\right) \cdot y}{x - y}\\
\end{array}double f(double x, double y) {
double r363885 = x;
double r363886 = 2.0;
double r363887 = r363885 * r363886;
double r363888 = y;
double r363889 = r363887 * r363888;
double r363890 = r363885 - r363888;
double r363891 = r363889 / r363890;
return r363891;
}
double f(double x, double y) {
double r363892 = x;
double r363893 = 2.0;
double r363894 = r363892 * r363893;
double r363895 = y;
double r363896 = r363894 * r363895;
double r363897 = r363892 - r363895;
double r363898 = r363896 / r363897;
double r363899 = -120878309475402.03;
bool r363900 = r363898 <= r363899;
double r363901 = -5.5452861653375714e-303;
bool r363902 = r363898 <= r363901;
double r363903 = 0.0;
bool r363904 = r363898 <= r363903;
double r363905 = !r363904;
double r363906 = 8.162914331366078e-36;
bool r363907 = r363898 <= r363906;
bool r363908 = r363905 && r363907;
bool r363909 = r363902 || r363908;
double r363910 = !r363909;
bool r363911 = r363900 || r363910;
double r363912 = r363895 / r363897;
double r363913 = expm1(r363912);
double r363914 = log1p(r363913);
double r363915 = r363894 * r363914;
double r363916 = r363911 ? r363915 : r363898;
return r363916;
}




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 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)))