\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;x \le -9.265176501060393527459433738249772183337 \cdot 10^{-8} \lor \neg \left(x \le 1.380838334167765802158493056540698774022 \cdot 10^{61}\right):\\
\;\;\;\;\frac{x}{x - y} \cdot \left(2 \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2\right) \cdot \frac{y}{x - y}\\
\end{array}double f(double x, double y) {
double r295008 = x;
double r295009 = 2.0;
double r295010 = r295008 * r295009;
double r295011 = y;
double r295012 = r295010 * r295011;
double r295013 = r295008 - r295011;
double r295014 = r295012 / r295013;
return r295014;
}
double f(double x, double y) {
double r295015 = x;
double r295016 = -9.265176501060394e-08;
bool r295017 = r295015 <= r295016;
double r295018 = 1.3808383341677658e+61;
bool r295019 = r295015 <= r295018;
double r295020 = !r295019;
bool r295021 = r295017 || r295020;
double r295022 = y;
double r295023 = r295015 - r295022;
double r295024 = r295015 / r295023;
double r295025 = 2.0;
double r295026 = r295025 * r295022;
double r295027 = r295024 * r295026;
double r295028 = r295015 * r295025;
double r295029 = r295022 / r295023;
double r295030 = r295028 * r295029;
double r295031 = r295021 ? r295027 : r295030;
return r295031;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.3 |
|---|---|
| Target | 0.4 |
| Herbie | 0.2 |
if x < -9.265176501060394e-08 or 1.3808383341677658e+61 < x Initial program 17.4
rmApplied associate-/l*15.8
rmApplied div-inv16.0
Applied times-frac0.2
Simplified0.1
if -9.265176501060394e-08 < x < 1.3808383341677658e+61Initial program 13.5
rmApplied associate-/l*0.3
rmApplied div-inv0.4
Simplified0.3
Final simplification0.2
herbie shell --seed 2019304 +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)))