\frac{\left(x \cdot 2\right) \cdot y}{x - y}\begin{array}{l}
\mathbf{if}\;y \leq -128989.54692959297:\\
\;\;\;\;\frac{x \cdot 2}{\frac{x}{y} + -1}\\
\mathbf{elif}\;y \leq 1.0804958672835222 \cdot 10^{-12}:\\
\;\;\;\;y \cdot \frac{x \cdot 2}{x - y}\\
\mathbf{else}:\\
\;\;\;\;x \cdot \frac{y \cdot 2}{x - y}\\
\end{array}(FPCore (x y) :precision binary64 (/ (* (* x 2.0) y) (- x y)))
(FPCore (x y)
:precision binary64
(if (<= y -128989.54692959297)
(/ (* x 2.0) (+ (/ x y) -1.0))
(if (<= y 1.0804958672835222e-12)
(* y (/ (* x 2.0) (- x y)))
(* x (/ (* y 2.0) (- x y))))))double code(double x, double y) {
return ((x * 2.0) * y) / (x - y);
}
double code(double x, double y) {
double tmp;
if (y <= -128989.54692959297) {
tmp = (x * 2.0) / ((x / y) + -1.0);
} else if (y <= 1.0804958672835222e-12) {
tmp = y * ((x * 2.0) / (x - y));
} else {
tmp = x * ((y * 2.0) / (x - y));
}
return tmp;
}




Bits error versus x




Bits error versus y
Results
| Original | 15.0 |
|---|---|
| Target | 0.3 |
| Herbie | 0.1 |
if y < -128989.54692959297Initial program 16.6
Simplified0.2
rmApplied pow1_binary64_96870.2
Applied pow1_binary64_96870.2
Applied pow-prod-down_binary64_96970.2
Simplified0.1
if -128989.54692959297 < y < 1.0804958672835222e-12Initial program 13.8
Simplified0.1
if 1.0804958672835222e-12 < y Initial program 15.8
Simplified0.1
Final simplification0.1
herbie shell --seed 2021176
(FPCore (x y)
:name "Linear.Projection:perspective from linear-1.19.1.3, B"
:precision binary64
: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)))