(FPCore (x y z t a) :precision binary64 (+ x (/ (* y (- z t)) a)))
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (fma y (/ (- z t) a) x)))
(if (<= a -6e-20)
t_1
(if (<= a 6.2e-5) (+ x (/ (fma z y (* y (- t))) a)) t_1))))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 = fma(y, ((z - t) / a), x);
double tmp;
if (a <= -6e-20) {
tmp = t_1;
} else if (a <= 6.2e-5) {
tmp = x + (fma(z, y, (y * -t)) / a);
} else {
tmp = t_1;
}
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 = fma(y, Float64(Float64(z - t) / a), x) tmp = 0.0 if (a <= -6e-20) tmp = t_1; elseif (a <= 6.2e-5) tmp = Float64(x + Float64(fma(z, y, Float64(y * Float64(-t))) / a)); else tmp = t_1; 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[(N[(z - t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -6e-20], t$95$1, If[LessEqual[a, 6.2e-5], N[(x + N[(N[(z * y + N[(y * (-t)), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
x + \frac{y \cdot \left(z - t\right)}{a}
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{z - t}{a}, x\right)\\
\mathbf{if}\;a \leq -6 \cdot 10^{-20}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 6.2 \cdot 10^{-5}:\\
\;\;\;\;x + \frac{\mathsf{fma}\left(z, y, y \cdot \left(-t\right)\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 6.5 |
|---|---|
| Target | 0.6 |
| Herbie | 0.6 |
if a < -6.00000000000000057e-20 or 6.20000000000000027e-5 < a Initial program 9.6
Simplified0.4
if -6.00000000000000057e-20 < a < 6.20000000000000027e-5Initial program 0.8
Applied egg-rr0.8
Final simplification0.6
herbie shell --seed 2022170
(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)))