x + \frac{y \cdot \left(z - x\right)}{t}
\begin{array}{l}
\mathbf{if}\;t \leq -2.2786730843016057 \cdot 10^{-249}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t}, z - x, x\right)\\
\mathbf{elif}\;t \leq 2.050710958518032 \cdot 10^{+142}:\\
\;\;\;\;\mathsf{fma}\left(1, x, \frac{y \cdot \left(z - x\right)}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;x + \frac{1}{\frac{1}{\sqrt[3]{y} \cdot \sqrt[3]{y}}} \cdot \frac{1}{\frac{\frac{t}{\sqrt[3]{y}}}{z - x}}\\
\end{array}
(FPCore (x y z t) :precision binary64 (+ x (/ (* y (- z x)) t)))
(FPCore (x y z t)
:precision binary64
(if (<= t -2.2786730843016057e-249)
(fma (/ y t) (- z x) x)
(if (<= t 2.050710958518032e+142)
(fma 1.0 x (/ (* y (- z x)) t))
(+
x
(*
(/ 1.0 (/ 1.0 (* (cbrt y) (cbrt y))))
(/ 1.0 (/ (/ t (cbrt y)) (- z x))))))))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 (t <= -2.2786730843016057e-249) {
tmp = fma((y / t), (z - x), x);
} else if (t <= 2.050710958518032e+142) {
tmp = fma(1.0, x, ((y * (z - x)) / t));
} else {
tmp = x + ((1.0 / (1.0 / (cbrt(y) * cbrt(y)))) * (1.0 / ((t / cbrt(y)) / (z - x))));
}
return tmp;
}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t
| Original | 6.6 |
|---|---|
| Target | 2.1 |
| Herbie | 2.3 |
if t < -2.2786730843016057e-249Initial program 6.4
Taylor expanded in x around 0 6.4
Simplified1.7
if -2.2786730843016057e-249 < t < 2.050710958518032e142Initial program 3.7
Applied *-un-lft-identity_binary643.7
Applied fma-def_binary643.7
if 2.050710958518032e142 < t Initial program 12.9
Applied clear-num_binary6412.9
Applied associate-/r*_binary641.5
Applied *-un-lft-identity_binary641.5
Applied add-cube-cbrt_binary641.8
Applied *-un-lft-identity_binary641.8
Applied times-frac_binary641.8
Applied times-frac_binary641.0
Applied *-un-lft-identity_binary641.0
Applied times-frac_binary641.0
Final simplification2.3
herbie shell --seed 2022005
(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)))