\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}\begin{array}{l}
\mathbf{if}\;\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y} \le 714.34766:\\
\;\;\;\;\log \left(e^{\frac{\left(x - y\right) \cdot \left(x + y\right)}{x \cdot x + y \cdot y}}\right)\\
\mathbf{else}:\\
\;\;\;\;-1\\
\end{array}double code(double x, double y) {
return ((double) (((double) (((double) (x - y)) * ((double) (x + y)))) / ((double) (((double) (x * x)) + ((double) (y * y))))));
}
double code(double x, double y) {
double VAR;
if ((((double) (((double) (((double) (x - y)) * ((double) (x + y)))) / ((double) (((double) (x * x)) + ((double) (y * y)))))) <= 714.34765625)) {
VAR = ((double) log(((double) exp(((double) (((double) (((double) (x - y)) * ((double) (x + y)))) / ((double) (((double) (x * x)) + ((double) (y * y))))))))));
} else {
VAR = -1.0;
}
return VAR;
}




Bits error versus x




Bits error versus y
Results
| Original | 20.2 |
|---|---|
| Target | 0.1 |
| Herbie | 5.1 |
if (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) < 714.34765625Initial program 0.0
rmApplied add-log-exp0.0
if 714.34765625 < (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) Initial program 64.0
Taylor expanded around 0 16.0
Final simplification5.1
herbie shell --seed 2020148
(FPCore (x y)
:name "Kahan p9 Example"
:precision binary64
:pre (and (< 0.0 x 1.0) (< y 1.0))
:herbie-target
(if (< 0.5 (fabs (/ x y)) 2.0) (/ (* (- x y) (+ x y)) (+ (* x x) (* y y))) (- 1.0 (/ 2.0 (+ 1.0 (* (/ x y) (/ x y))))))
(/ (* (- x y) (+ x y)) (+ (* x x) (* y y))))