x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
t_1 := x + \frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{if}\;t_1 \leq -9.239986894949125 \cdot 10^{+269}:\\
\;\;\;\;x + \left(z - x\right) \cdot \frac{y}{t}\\
\mathbf{elif}\;t_1 \leq 2.053381617302707 \cdot 10^{+261}:\\
\;\;\;\;x + \frac{\mathsf{fma}\left(y, z, y \cdot \left(-x\right)\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{z - x}{\frac{t}{y}}\\
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
:precision binary64
(let* ((t_1 (+ x (/ (* y (- z x)) t))))
(if (<= t_1 -9.239986894949125e+269)
(+ x (* (- z x) (/ y t)))
(if (<= t_1 2.053381617302707e+261)
(+ x (/ (fma y z (* y (- x))) t))
(+ x (/ (- z x) (/ t y)))))))double code(double x, double y, double z, double t) {
return x + ((y * (z - x)) / t);
}
double code(double x, double y, double z, double t) {
double t_1 = x + ((y * (z - x)) / t);
double tmp;
if (t_1 <= -9.239986894949125e+269) {
tmp = x + ((z - x) * (y / t));
} else if (t_1 <= 2.053381617302707e+261) {
tmp = x + (fma(y, z, (y * -x)) / t);
} else {
tmp = x + ((z - x) / (t / y));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 6.2 |
|---|---|
| Target | 2.2 |
| Herbie | 1.0 |
if (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < -9.23998689494912477e269Initial program 34.5
Applied egg-rr2.9
if -9.23998689494912477e269 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) < 2.053381617302707e261Initial program 0.8
Applied egg-rr0.8
if 2.053381617302707e261 < (+.f64 x (/.f64 (*.f64 y (-.f64 z x)) t)) Initial program 34.2
Applied egg-rr2.3
Applied egg-rr2.0
Final simplification1.0
herbie shell --seed 2022130
(FPCore (x y z t)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, D"
:precision binary64
:herbie-target
(- x (+ (* x (/ y t)) (* (- z) (/ y t))))
(+ x (/ (* y (- z x)) t)))