(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 -8.432815853165983e+146)
(+ x (* (/ y a) (- t z)))
(if (<= t_1 5.196317462097143e+225)
(+ x (/ (* y (- t z)) a))
(+ x (/ (/ (- t z) a) (pow y -1.0)))))))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 <= -8.432815853165983e+146) {
tmp = x + ((y / a) * (t - z));
} else if (t_1 <= 5.196317462097143e+225) {
tmp = x + ((y * (t - z)) / a);
} else {
tmp = x + (((t - z) / a) / pow(y, -1.0));
}
return tmp;
}
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
code = x - ((y * (z - t)) / a)
end function
real(8) function code(x, y, z, t, a)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8) :: t_1
real(8) :: tmp
t_1 = y * (z - t)
if (t_1 <= (-8.432815853165983d+146)) then
tmp = x + ((y / a) * (t - z))
else if (t_1 <= 5.196317462097143d+225) then
tmp = x + ((y * (t - z)) / a)
else
tmp = x + (((t - z) / a) / (y ** (-1.0d0)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z - t);
double tmp;
if (t_1 <= -8.432815853165983e+146) {
tmp = x + ((y / a) * (t - z));
} else if (t_1 <= 5.196317462097143e+225) {
tmp = x + ((y * (t - z)) / a);
} else {
tmp = x + (((t - z) / a) / Math.pow(y, -1.0));
}
return tmp;
}
def code(x, y, z, t, a): return x - ((y * (z - t)) / a)
def code(x, y, z, t, a): t_1 = y * (z - t) tmp = 0 if t_1 <= -8.432815853165983e+146: tmp = x + ((y / a) * (t - z)) elif t_1 <= 5.196317462097143e+225: tmp = x + ((y * (t - z)) / a) else: tmp = x + (((t - z) / a) / math.pow(y, -1.0)) 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 <= -8.432815853165983e+146) tmp = Float64(x + Float64(Float64(y / a) * Float64(t - z))); elseif (t_1 <= 5.196317462097143e+225) tmp = Float64(x + Float64(Float64(y * Float64(t - z)) / a)); else tmp = Float64(x + Float64(Float64(Float64(t - z) / a) / (y ^ -1.0))); end return tmp end
function tmp = code(x, y, z, t, a) tmp = x - ((y * (z - t)) / a); end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z - t); tmp = 0.0; if (t_1 <= -8.432815853165983e+146) tmp = x + ((y / a) * (t - z)); elseif (t_1 <= 5.196317462097143e+225) tmp = x + ((y * (t - z)) / a); else tmp = x + (((t - z) / a) / (y ^ -1.0)); end tmp_2 = 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, -8.432815853165983e+146], N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5.196317462097143e+225], N[(x + N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(N[(N[(t - z), $MachinePrecision] / a), $MachinePrecision] / N[Power[y, -1.0], $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 -8.432815853165983 \cdot 10^{+146}:\\
\;\;\;\;x + \frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{elif}\;t_1 \leq 5.196317462097143 \cdot 10^{+225}:\\
\;\;\;\;x + \frac{y \cdot \left(t - z\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{\frac{t - z}{a}}{{y}^{-1}}\\
\end{array}




Bits error versus x




Bits error versus y




Bits error versus z




Bits error versus t




Bits error versus a
Results
| Original | 5.7 |
|---|---|
| Target | 0.7 |
| Herbie | 0.5 |
if (*.f64 y (-.f64 z t)) < -8.4328158531659829e146Initial program 20.7
Taylor expanded in y around 0 20.7
Simplified0.9
if -8.4328158531659829e146 < (*.f64 y (-.f64 z t)) < 5.1963174620971431e225Initial program 0.4
if 5.1963174620971431e225 < (*.f64 y (-.f64 z t)) Initial program 32.3
Applied egg-rr1.0
Applied egg-rr1.0
Final simplification0.5
herbie shell --seed 2022153
(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)))