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




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
| Original | 6.2 |
|---|---|
| Target | 0.7 |
| Herbie | 0.5 |
if (*.f64 y (-.f64 z t)) < -9.9999999999999993e158Initial program 22.2
Simplified1.5
Applied egg-rr1.5
if -9.9999999999999993e158 < (*.f64 y (-.f64 z t)) < 5.00000000000000031e289Initial program 0.4
if 5.00000000000000031e289 < (*.f64 y (-.f64 z t)) Initial program 56.2
Simplified0.2
Applied egg-rr0.2
Final simplification0.5
herbie shell --seed 2022166
(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)))