\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;y \le -1.69107722936919096 \cdot 10^{153}:\\
\;\;\;\;-1\\
\mathbf{elif}\;y \le -1.2814315799774739 \cdot 10^{-150}:\\
\;\;\;\;\frac{1}{\frac{x \cdot x + y \cdot y}{\left(x - y\right) \cdot \left(x + y\right)}}\\
\mathbf{elif}\;y \le 1.04652046448043914 \cdot 10^{-180}:\\
\;\;\;\;1\\
\mathbf{else}:\\
\;\;\;\;\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\\
\end{array}double f(double x, double y) {
double r95065 = x;
double r95066 = y;
double r95067 = r95065 - r95066;
double r95068 = r95065 + r95066;
double r95069 = r95067 * r95068;
double r95070 = r95065 * r95065;
double r95071 = r95066 * r95066;
double r95072 = r95070 + r95071;
double r95073 = r95069 / r95072;
return r95073;
}
double f(double x, double y) {
double r95074 = y;
double r95075 = -1.691077229369191e+153;
bool r95076 = r95074 <= r95075;
double r95077 = -1.0;
double r95078 = -1.281431579977474e-150;
bool r95079 = r95074 <= r95078;
double r95080 = 1.0;
double r95081 = x;
double r95082 = r95081 * r95081;
double r95083 = r95074 * r95074;
double r95084 = r95082 + r95083;
double r95085 = r95081 - r95074;
double r95086 = r95081 + r95074;
double r95087 = r95085 * r95086;
double r95088 = r95084 / r95087;
double r95089 = r95080 / r95088;
double r95090 = 1.0465204644804391e-180;
bool r95091 = r95074 <= r95090;
double r95092 = r95087 / r95084;
double r95093 = r95091 ? r95080 : r95092;
double r95094 = r95079 ? r95089 : r95093;
double r95095 = r95076 ? r95077 : r95094;
return r95095;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.3 |
|---|---|
| Target | 0.1 |
| Herbie | 5.3 |
if y < -1.691077229369191e+153Initial program 63.6
Taylor expanded around 0 0
if -1.691077229369191e+153 < y < -1.281431579977474e-150Initial program 0.0
rmApplied clear-num0.0
if -1.281431579977474e-150 < y < 1.0465204644804391e-180Initial program 28.9
rmApplied clear-num28.9
Taylor expanded around inf 15.4
if 1.0465204644804391e-180 < y Initial program 2.8
Final simplification5.3
herbie shell --seed 2020081
(FPCore (x y)
:name "Kahan p9 Example"
:precision binary64
:pre (and (< 0.0 x 1) (< y 1))
:herbie-target
(if (< 0.5 (fabs (/ x y)) 2) (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) (- 1 (/ 2 (+ 1 (* (/ x y) (/ x y))))))
(/ (* (- x y) (+ x y)) (+ (* x x) (* y y))))