(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 (/ (- t z) a) x))) (if (<= a -2e+69) t_1 (if (<= a 1e-30) (- x (/ (* y (- z 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, ((t - z) / a), x);
double tmp;
if (a <= -2e+69) {
tmp = t_1;
} else if (a <= 1e-30) {
tmp = x - ((y * (z - 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(t - z) / a), x) tmp = 0.0 if (a <= -2e+69) tmp = t_1; elseif (a <= 1e-30) tmp = Float64(x - Float64(Float64(y * Float64(z - 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[(t - z), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[a, -2e+69], t$95$1, If[LessEqual[a, 1e-30], N[(x - N[(N[(y * N[(z - 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{t - z}{a}, x\right)\\
\mathbf{if}\;a \leq -2 \cdot 10^{+69}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 10^{-30}:\\
\;\;\;\;x - \frac{y \cdot \left(z - t\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.3 |
|---|---|
| Target | 0.7 |
| Herbie | 0.9 |
if a < -2.0000000000000001e69 or 1e-30 < a Initial program 9.9
Simplified0.6
if -2.0000000000000001e69 < a < 1e-30Initial program 1.3
Final simplification0.9
herbie shell --seed 2022162
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
: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)))