\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;x \le -5.01776738281857308254796379287654417567 \cdot 10^{-5}:\\
\;\;\;\;\left(y \cdot 2\right) \cdot \frac{x}{x - y}\\
\mathbf{elif}\;x \le 3.62378838658747611836253077264636734886 \cdot 10^{-110}:\\
\;\;\;\;\frac{x \cdot 2}{\frac{x - y}{y}}\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot 2\right) \cdot \frac{x}{x - y}\\
\end{array}double f(double x, double y) {
double r27261185 = x;
double r27261186 = 2.0;
double r27261187 = r27261185 * r27261186;
double r27261188 = y;
double r27261189 = r27261187 * r27261188;
double r27261190 = r27261185 - r27261188;
double r27261191 = r27261189 / r27261190;
return r27261191;
}
double f(double x, double y) {
double r27261192 = x;
double r27261193 = -5.017767382818573e-05;
bool r27261194 = r27261192 <= r27261193;
double r27261195 = y;
double r27261196 = 2.0;
double r27261197 = r27261195 * r27261196;
double r27261198 = r27261192 - r27261195;
double r27261199 = r27261192 / r27261198;
double r27261200 = r27261197 * r27261199;
double r27261201 = 3.623788386587476e-110;
bool r27261202 = r27261192 <= r27261201;
double r27261203 = r27261192 * r27261196;
double r27261204 = r27261198 / r27261195;
double r27261205 = r27261203 / r27261204;
double r27261206 = r27261202 ? r27261205 : r27261200;
double r27261207 = r27261194 ? r27261200 : r27261206;
return r27261207;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.1 |
|---|---|
| Target | 0.3 |
| Herbie | 0.5 |
if x < -5.017767382818573e-05 or 3.623788386587476e-110 < x Initial program 14.4
rmApplied associate-/l*12.7
rmApplied div-inv12.9
Applied times-frac1.0
Simplified0.8
if -5.017767382818573e-05 < x < 3.623788386587476e-110Initial program 16.2
rmApplied associate-/l*0.0
Final simplification0.5
herbie shell --seed 2019169 +o rules:numerics
(FPCore (x y)
:name "Linear.Projection:perspective from linear-1.19.1.3, B"
:herbie-target
(if (< x -1.7210442634149447e+81) (* (/ (* 2.0 x) (- x y)) y) (if (< x 8.364504563556443e+16) (/ (* x 2.0) (/ (- x y) y)) (* (/ (* 2.0 x) (- x y)) y)))
(/ (* (* x 2.0) y) (- x y)))