(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (- z t))))
(if (<= t_1 -2.404461501901897e+254)
(fma (- z t) (* y (/ 1.0 a)) x)
(if (<= t_1 1.8220340511756164e+236)
(+ x (/ t_1 a))
(+ x (* y (/ (- z t) a)))))))double code(double x, double y, double z, double t, double a) {
return x + ((y * (z - t)) / a);
}
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -2.404461501901897e+254) {
tmp = fma((z - t), (y * (1.0 / a)), x);
} else if (t_1 <= 1.8220340511756164e+236) {
tmp = x + (t_1 / a);
} else {
tmp = x + (y * ((z - t) / a));
}
return tmp;
}
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y * Float64(z - t)) / a)) end
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z - t)) tmp = 0.0 if (t_1 <= -2.404461501901897e+254) tmp = fma(Float64(z - t), Float64(y * Float64(1.0 / a)), x); elseif (t_1 <= 1.8220340511756164e+236) tmp = Float64(x + Float64(t_1 / a)); else tmp = Float64(x + Float64(y * Float64(Float64(z - t) / a))); end return tmp end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -2.404461501901897e+254], N[(N[(z - t), $MachinePrecision] * N[(y * N[(1.0 / a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 1.8220340511756164e+236], N[(x + N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
x + \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
t_1 := y \cdot \left(z - t\right)\\
\mathbf{if}\;t_1 \leq -2.404461501901897 \cdot 10^{+254}:\\
\;\;\;\;\mathsf{fma}\left(z - t, y \cdot \frac{1}{a}, x\right)\\
\mathbf{elif}\;t_1 \leq 1.8220340511756164 \cdot 10^{+236}:\\
\;\;\;\;x + \frac{t_1}{a}\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 6.3 |
|---|---|
| Target | 0.7 |
| Herbie | 0.4 |
if (*.f64 y (-.f64 z t)) < -2.40446150190189726e254Initial program 40.8
Applied egg-rr0.3
if -2.40446150190189726e254 < (*.f64 y (-.f64 z t)) < 1.8220340511756164e236Initial program 0.3
if 1.8220340511756164e236 < (*.f64 y (-.f64 z t)) Initial program 37.0
Applied egg-rr0.7
Applied egg-rr0.6
Final simplification0.4
herbie shell --seed 2022148
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
:precision binary64
:herbie-target
(if (< y -1.0761266216389975e-10) (+ x (/ 1.0 (/ (/ a (- z t)) y))) (if (< y 2.894426862792089e-49) (+ x (/ (* y (- z t)) a)) (+ x (/ y (/ a (- z t))))))
(+ x (/ (* y (- z t)) a)))