\frac{\left(x \cdot 2\right) \cdot y}{x - y}
\begin{array}{l}
t_0 := \frac{\left(x \cdot 2\right) \cdot y}{x - y}\\
\mathbf{if}\;t_0 \leq -1.3542256305448586 \cdot 10^{-31}:\\
\;\;\;\;\frac{x}{\mathsf{fma}\left(0.5, \frac{x}{y}, -0.5\right)}\\
\mathbf{elif}\;t_0 \leq -1.0227884392421375 \cdot 10^{-307}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \left(x \cdot 2\right) \cdot \frac{y}{x - y}\\
\mathbf{if}\;t_0 \leq 5.12291751958135 \cdot 10^{-306}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_0 \leq 1.0237315575092723 \cdot 10^{-53}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}\\
\end{array}
(FPCore (x y) :precision binary64 (/ (* (* x 2.0) y) (- x y)))
(FPCore (x y)
:precision binary64
(let* ((t_0 (/ (* (* x 2.0) y) (- x y))))
(if (<= t_0 -1.3542256305448586e-31)
(/ x (fma 0.5 (/ x y) -0.5))
(if (<= t_0 -1.0227884392421375e-307)
t_0
(let* ((t_1 (* (* x 2.0) (/ y (- x y)))))
(if (<= t_0 5.12291751958135e-306)
t_1
(if (<= t_0 1.0237315575092723e-53) t_0 t_1)))))))double code(double x, double y) {
return ((x * 2.0) * y) / (x - y);
}
double code(double x, double y) {
double t_0 = ((x * 2.0) * y) / (x - y);
double tmp;
if (t_0 <= -1.3542256305448586e-31) {
tmp = x / fma(0.5, (x / y), -0.5);
} else if (t_0 <= -1.0227884392421375e-307) {
tmp = t_0;
} else {
double t_1 = (x * 2.0) * (y / (x - y));
double tmp_1;
if (t_0 <= 5.12291751958135e-306) {
tmp_1 = t_1;
} else if (t_0 <= 1.0237315575092723e-53) {
tmp_1 = t_0;
} else {
tmp_1 = t_1;
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y
| Original | 14.5 |
|---|---|
| Target | 0.3 |
| Herbie | 0.7 |
if (/.f64 (*.f64 (*.f64 x 2) y) (-.f64 x y)) < -1.3542256305448586e-31Initial program 27.0
Simplified0.2
if -1.3542256305448586e-31 < (/.f64 (*.f64 (*.f64 x 2) y) (-.f64 x y)) < -1.0227884392421375e-307 or 5.1229175195813498e-306 < (/.f64 (*.f64 (*.f64 x 2) y) (-.f64 x y)) < 1.02373155750927235e-53Initial program 0.7
if -1.0227884392421375e-307 < (/.f64 (*.f64 (*.f64 x 2) y) (-.f64 x y)) < 5.1229175195813498e-306 or 1.02373155750927235e-53 < (/.f64 (*.f64 (*.f64 x 2) y) (-.f64 x y)) Initial program 35.6
Applied *-un-lft-identity_binary6435.6
Applied times-frac_binary640.8
Simplified0.8
Final simplification0.7
herbie shell --seed 2022076
(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 83645045635564430.0) (/ (* x 2.0) (/ (- x y) y)) (* (/ (* 2.0 x) (- x y)) y)))
(/ (* (* x 2.0) y) (- x y)))