(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 -5.499918093307507e+269)
(fma y (* (- z t) (/ 1.0 (- a))) x)
(if (<= t_1 5.9398726778860405e+71)
(- (+ x (/ (* y t) a)) (/ (* y z) a))
(fma (- t z) (/ y a) 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 = y * (z - t);
double tmp;
if (t_1 <= -5.499918093307507e+269) {
tmp = fma(y, ((z - t) * (1.0 / -a)), x);
} else if (t_1 <= 5.9398726778860405e+71) {
tmp = (x + ((y * t) / a)) - ((y * z) / a);
} else {
tmp = fma((t - z), (y / a), 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(y * Float64(z - t)) tmp = 0.0 if (t_1 <= -5.499918093307507e+269) tmp = fma(y, Float64(Float64(z - t) * Float64(1.0 / Float64(-a))), x); elseif (t_1 <= 5.9398726778860405e+71) tmp = Float64(Float64(x + Float64(Float64(y * t) / a)) - Float64(Float64(y * z) / a)); else tmp = fma(Float64(t - z), Float64(y / a), 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[(y * N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -5.499918093307507e+269], N[(y * N[(N[(z - t), $MachinePrecision] * N[(1.0 / (-a)), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision], If[LessEqual[t$95$1, 5.9398726778860405e+71], N[(N[(x + N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision] - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(N[(t - z), $MachinePrecision] * N[(y / a), $MachinePrecision] + x), $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 -5.499918093307507 \cdot 10^{+269}:\\
\;\;\;\;\mathsf{fma}\left(y, \left(z - t\right) \cdot \frac{1}{-a}, x\right)\\
\mathbf{elif}\;t_1 \leq 5.9398726778860405 \cdot 10^{+71}:\\
\;\;\;\;\left(x + \frac{y \cdot t}{a}\right) - \frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t - z, \frac{y}{a}, 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.1 |
|---|---|
| Target | 0.6 |
| Herbie | 0.7 |
if (*.f64 y (-.f64 z t)) < -5.49991809330750669e269Initial program 46.9
Simplified0.2
Applied egg-rr0.3
Applied egg-rr0.3
if -5.49991809330750669e269 < (*.f64 y (-.f64 z t)) < 5.9398726778860405e71Initial program 0.4
Simplified6.9
Taylor expanded in y around 0 0.4
if 5.9398726778860405e71 < (*.f64 y (-.f64 z t)) Initial program 13.3
Simplified4.1
Taylor expanded in y around 0 13.3
Simplified2.0
Final simplification0.7
herbie shell --seed 2022133
(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)))