x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;z \leq -5.7190163307483135 \cdot 10^{-77}:\\
\;\;\;\;x + \frac{y}{t} \cdot \left(z - x\right)\\
\mathbf{elif}\;z \leq -6.611843170999734 \cdot 10^{-264}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{t} - \frac{x}{t}, x\right)\\
\mathbf{else}:\\
\;\;\;\;\begin{array}{l}
t_1 := \mathsf{fma}\left(\frac{y}{t}, z - x, x\right)\\
\mathbf{if}\;z \leq 1.7432692600882257 \cdot 10^{-152}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.1627240810470034 \cdot 10^{-97}:\\
\;\;\;\;\begin{array}{l}
t_2 := \sqrt[3]{y \cdot \frac{x}{t}}\\
\left(x + \frac{z \cdot y}{t}\right) - t_2 \cdot \left(t_2 \cdot t_2\right)
\end{array}\\
\mathbf{elif}\;z \leq 6.146152116507481 \cdot 10^{-87}:\\
\;\;\;\;x + \frac{y \cdot \left(z - x\right)}{t}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}\\
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
:precision binary64
(if (<= z -5.7190163307483135e-77)
(+ x (* (/ y t) (- z x)))
(if (<= z -6.611843170999734e-264)
(fma y (- (/ z t) (/ x t)) x)
(let* ((t_1 (fma (/ y t) (- z x) x)))
(if (<= z 1.7432692600882257e-152)
t_1
(if (<= z 1.1627240810470034e-97)
(let* ((t_2 (cbrt (* y (/ x t)))))
(- (+ x (/ (* z y) t)) (* t_2 (* t_2 t_2))))
(if (<= z 6.146152116507481e-87)
(+ x (/ (* y (- z x)) t))
t_1)))))))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 tmp;
if (z <= -5.7190163307483135e-77) {
tmp = x + ((y / t) * (z - x));
} else if (z <= -6.611843170999734e-264) {
tmp = fma(y, ((z / t) - (x / t)), x);
} else {
double t_1 = fma((y / t), (z - x), x);
double tmp_1;
if (z <= 1.7432692600882257e-152) {
tmp_1 = t_1;
} else if (z <= 1.1627240810470034e-97) {
double t_2 = cbrt(y * (x / t));
tmp_1 = (x + ((z * y) / t)) - (t_2 * (t_2 * t_2));
} else if (z <= 6.146152116507481e-87) {
tmp_1 = x + ((y * (z - x)) / t);
} else {
tmp_1 = t_1;
}
tmp = tmp_1;
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 6.8 |
|---|---|
| Target | 1.9 |
| Herbie | 2.1 |
if z < -5.71901633074831347e-77Initial program 8.3
Simplified7.4
Taylor expanded in y around 0 8.3
Simplified1.2
Applied fma-udef_binary641.2
if -5.71901633074831347e-77 < z < -6.6118431709997337e-264Initial program 4.9
Simplified4.4
Taylor expanded in z around 0 4.4
if -6.6118431709997337e-264 < z < 1.7432692600882257e-152 or 6.14615211650748113e-87 < z Initial program 6.9
Simplified6.5
Taylor expanded in y around 0 6.9
Simplified1.7
if 1.7432692600882257e-152 < z < 1.16272408104700338e-97Initial program 4.0
Simplified3.5
Taylor expanded in y around 0 4.0
Applied add-cube-cbrt_binary644.1
Simplified6.3
Simplified3.8
if 1.16272408104700338e-97 < z < 6.14615211650748113e-87Initial program 2.7
Final simplification2.1
herbie shell --seed 2021280
(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)))