\frac{x + y}{1 - \frac{y}{z}}
\begin{array}{l}
t_0 := \frac{x + y}{1 - \frac{y}{z}}\\
\mathbf{if}\;t_0 \leq -3.266669259955589 \cdot 10^{-255} \lor \neg \left(t_0 \leq 0\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;-\mathsf{fma}\left(\frac{x}{y}, z, z\right)\\
\end{array}
(FPCore (x y z) :precision binary64 (/ (+ x y) (- 1.0 (/ y z))))
(FPCore (x y z)
:precision binary64
(let* ((t_0 (/ (+ x y) (- 1.0 (/ y z)))))
(if (or (<= t_0 -3.266669259955589e-255) (not (<= t_0 0.0)))
t_0
(- (fma (/ x y) z z)))))double code(double x, double y, double z) {
return (x + y) / (1.0 - (y / z));
}
double code(double x, double y, double z) {
double t_0 = (x + y) / (1.0 - (y / z));
double tmp;
if ((t_0 <= -3.266669259955589e-255) || !(t_0 <= 0.0)) {
tmp = t_0;
} else {
tmp = -fma((x / y), z, z);
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z
| Original | 7.0 |
|---|---|
| Target | 4.0 |
| Herbie | 0.2 |
if (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < -3.2666692599555891e-255 or -0.0 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) Initial program 0.1
if -3.2666692599555891e-255 < (/.f64 (+.f64 x y) (-.f64 1 (/.f64 y z))) < -0.0Initial program 56.0
Taylor expanded in y around inf 1.6
Simplified9.8
Taylor expanded in z around 0 1.2
Simplified1.2
Final simplification0.2
herbie shell --seed 2021280
(FPCore (x y z)
:name "Graphics.Rendering.Chart.Backend.Diagrams:calcFontMetrics from Chart-diagrams-1.5.1, A"
:precision binary64
:herbie-target
(if (< y -3.7429310762689856e+171) (* (/ (+ y x) (- y)) z) (if (< y 3.5534662456086734e+168) (/ (+ x y) (- 1.0 (/ y z))) (* (/ (+ y x) (- y)) z)))
(/ (+ x y) (- 1.0 (/ y z))))