
(FPCore (x y z t a) :precision binary64 (- x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
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
public static double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x - ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x - ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y \cdot \left(z - t\right)}{a}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 8 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a) :precision binary64 (- x (/ (* y (- z t)) a)))
double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
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
public static double code(double x, double y, double z, double t, double a) {
return x - ((y * (z - t)) / a);
}
def code(x, y, z, t, a): return x - ((y * (z - t)) / a)
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y * Float64(z - t)) / a)) end
function tmp = code(x, y, z, t, a) tmp = x - ((y * (z - t)) / a); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y \cdot \left(z - t\right)}{a}
\end{array}
(FPCore (x y z t a) :precision binary64 (- x (/ -1.0 (/ (- (/ a y)) (- z t)))))
double code(double x, double y, double z, double t, double a) {
return x - (-1.0 / (-(a / y) / (z - t)));
}
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 - ((-1.0d0) / (-(a / y) / (z - t)))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - (-1.0 / (-(a / y) / (z - t)));
}
def code(x, y, z, t, a): return x - (-1.0 / (-(a / y) / (z - t)))
function code(x, y, z, t, a) return Float64(x - Float64(-1.0 / Float64(Float64(-Float64(a / y)) / Float64(z - t)))) end
function tmp = code(x, y, z, t, a) tmp = x - (-1.0 / (-(a / y) / (z - t))); end
code[x_, y_, z_, t_, a_] := N[(x - N[(-1.0 / N[((-N[(a / y), $MachinePrecision]) / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{-1}{\frac{-\frac{a}{y}}{z - t}}
\end{array}
Initial program 96.2%
Applied egg-rr0
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (+ (/ (* y t) a) x))) (if (<= t -1.36e+42) t_1 (if (<= t 5.5e+51) (- x (/ (* y z) a)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y * t) / a) + x;
double tmp;
if (t <= -1.36e+42) {
tmp = t_1;
} else if (t <= 5.5e+51) {
tmp = x - ((y * z) / a);
} else {
tmp = t_1;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = ((y * t) / a) + x
if (t <= (-1.36d+42)) then
tmp = t_1
else if (t <= 5.5d+51) then
tmp = x - ((y * z) / a)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((y * t) / a) + x;
double tmp;
if (t <= -1.36e+42) {
tmp = t_1;
} else if (t <= 5.5e+51) {
tmp = x - ((y * z) / a);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((y * t) / a) + x tmp = 0 if t <= -1.36e+42: tmp = t_1 elif t <= 5.5e+51: tmp = x - ((y * z) / a) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y * t) / a) + x) tmp = 0.0 if (t <= -1.36e+42) tmp = t_1; elseif (t <= 5.5e+51) tmp = Float64(x - Float64(Float64(y * z) / a)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((y * t) / a) + x; tmp = 0.0; if (t <= -1.36e+42) tmp = t_1; elseif (t <= 5.5e+51) tmp = x - ((y * z) / a); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -1.36e+42], t$95$1, If[LessEqual[t, 5.5e+51], N[(x - N[(N[(y * z), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot t}{a} + x\\
\mathbf{if}\;t \leq -1.36 \cdot 10^{+42}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{+51}:\\
\;\;\;\;x - \frac{y \cdot z}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.35999999999999999e42 or 5.5e51 < t Initial program 96.2%
Taylor expanded in z around 0 0
Simplified0
if -1.35999999999999999e42 < t < 5.5e51Initial program 96.2%
Taylor expanded in z around inf 0
Simplified0
(FPCore (x y z t a) :precision binary64 (let* ((t_1 (+ (/ (* y t) a) x))) (if (<= t -1.78e+44) t_1 (if (<= t 4.7e+47) (- x (* (/ z a) y)) t_1))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((y * t) / a) + x;
double tmp;
if (t <= -1.78e+44) {
tmp = t_1;
} else if (t <= 4.7e+47) {
tmp = x - ((z / a) * y);
} else {
tmp = t_1;
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = ((y * t) / a) + x
if (t <= (-1.78d+44)) then
tmp = t_1
else if (t <= 4.7d+47) then
tmp = x - ((z / a) * y)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = ((y * t) / a) + x;
double tmp;
if (t <= -1.78e+44) {
tmp = t_1;
} else if (t <= 4.7e+47) {
tmp = x - ((z / a) * y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((y * t) / a) + x tmp = 0 if t <= -1.78e+44: tmp = t_1 elif t <= 4.7e+47: tmp = x - ((z / a) * y) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(y * t) / a) + x) tmp = 0.0 if (t <= -1.78e+44) tmp = t_1; elseif (t <= 4.7e+47) tmp = Float64(x - Float64(Float64(z / a) * y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((y * t) / a) + x; tmp = 0.0; if (t <= -1.78e+44) tmp = t_1; elseif (t <= 4.7e+47) tmp = x - ((z / a) * y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]}, If[LessEqual[t, -1.78e+44], t$95$1, If[LessEqual[t, 4.7e+47], N[(x - N[(N[(z / a), $MachinePrecision] * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y \cdot t}{a} + x\\
\mathbf{if}\;t \leq -1.78 \cdot 10^{+44}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 4.7 \cdot 10^{+47}:\\
\;\;\;\;x - \frac{z}{a} \cdot y\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.7799999999999999e44 or 4.69999999999999964e47 < t Initial program 96.2%
Taylor expanded in z around 0 0
Simplified0
if -1.7799999999999999e44 < t < 4.69999999999999964e47Initial program 96.2%
Applied egg-rr0
Taylor expanded in z around inf 0
Simplified0
(FPCore (x y z t a) :precision binary64 (if (<= a -140000.0) x (if (<= a 1.25e-18) (* t (/ y a)) x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -140000.0) {
tmp = x;
} else if (a <= 1.25e-18) {
tmp = t * (y / a);
} else {
tmp = x;
}
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
real(8) :: tmp
if (a <= (-140000.0d0)) then
tmp = x
else if (a <= 1.25d-18) then
tmp = t * (y / a)
else
tmp = x
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (a <= -140000.0) {
tmp = x;
} else if (a <= 1.25e-18) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if a <= -140000.0: tmp = x elif a <= 1.25e-18: tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (a <= -140000.0) tmp = x; elseif (a <= 1.25e-18) tmp = Float64(t * Float64(y / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (a <= -140000.0) tmp = x; elseif (a <= 1.25e-18) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[a, -140000.0], x, If[LessEqual[a, 1.25e-18], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -140000:\\
\;\;\;\;x\\
\mathbf{elif}\;a \leq 1.25 \cdot 10^{-18}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if a < -1.4e5 or 1.25000000000000009e-18 < a Initial program 93.4%
Taylor expanded in x around inf 0
Simplified0
if -1.4e5 < a < 1.25000000000000009e-18Initial program 99.1%
Applied egg-rr0
Taylor expanded in t around inf 0
Simplified0
(FPCore (x y z t a) :precision binary64 (- x (* (/ y a) (- z t))))
double code(double x, double y, double z, double t, double a) {
return x - ((y / a) * (z - t));
}
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 / a) * (z - t))
end function
public static double code(double x, double y, double z, double t, double a) {
return x - ((y / a) * (z - t));
}
def code(x, y, z, t, a): return x - ((y / a) * (z - t))
function code(x, y, z, t, a) return Float64(x - Float64(Float64(y / a) * Float64(z - t))) end
function tmp = code(x, y, z, t, a) tmp = x - ((y / a) * (z - t)); end
code[x_, y_, z_, t_, a_] := N[(x - N[(N[(y / a), $MachinePrecision] * N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x - \frac{y}{a} \cdot \left(z - t\right)
\end{array}
Initial program 96.2%
Applied egg-rr0
(FPCore (x y z t a) :precision binary64 (+ (/ (* y t) a) x))
double code(double x, double y, double z, double t, double a) {
return ((y * t) / a) + x;
}
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 = ((y * t) / a) + x
end function
public static double code(double x, double y, double z, double t, double a) {
return ((y * t) / a) + x;
}
def code(x, y, z, t, a): return ((y * t) / a) + x
function code(x, y, z, t, a) return Float64(Float64(Float64(y * t) / a) + x) end
function tmp = code(x, y, z, t, a) tmp = ((y * t) / a) + x; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(y * t), $MachinePrecision] / a), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\frac{y \cdot t}{a} + x
\end{array}
Initial program 96.2%
Taylor expanded in z around 0 0
Simplified0
(FPCore (x y z t a) :precision binary64 (+ (/ y (/ a t)) x))
double code(double x, double y, double z, double t, double a) {
return (y / (a / t)) + x;
}
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 = (y / (a / t)) + x
end function
public static double code(double x, double y, double z, double t, double a) {
return (y / (a / t)) + x;
}
def code(x, y, z, t, a): return (y / (a / t)) + x
function code(x, y, z, t, a) return Float64(Float64(y / Float64(a / t)) + x) end
function tmp = code(x, y, z, t, a) tmp = (y / (a / t)) + x; end
code[x_, y_, z_, t_, a_] := N[(N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\frac{y}{\frac{a}{t}} + x
\end{array}
Initial program 96.2%
Taylor expanded in z around 0 0
Simplified0
Applied egg-rr0
(FPCore (x y z t a) :precision binary64 x)
double code(double x, double y, double z, double t, double a) {
return x;
}
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
end function
public static double code(double x, double y, double z, double t, double a) {
return x;
}
def code(x, y, z, t, a): return x
function code(x, y, z, t, a) return x end
function tmp = code(x, y, z, t, a) tmp = x; end
code[x_, y_, z_, t_, a_] := x
\begin{array}{l}
\\
x
\end{array}
Initial program 96.2%
Taylor expanded in x around inf 0
Simplified0
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ a (- z t))))
(if (< y -1.0761266216389975e-10)
(- x (/ 1.0 (/ t_1 y)))
(if (< y 2.894426862792089e-49)
(- x (/ (* y (- z t)) a))
(- x (/ y t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x - (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x - ((y * (z - t)) / a);
} else {
tmp = x - (y / t_1);
}
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
real(8) :: t_1
real(8) :: tmp
t_1 = a / (z - t)
if (y < (-1.0761266216389975d-10)) then
tmp = x - (1.0d0 / (t_1 / y))
else if (y < 2.894426862792089d-49) then
tmp = x - ((y * (z - t)) / a)
else
tmp = x - (y / t_1)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = a / (z - t);
double tmp;
if (y < -1.0761266216389975e-10) {
tmp = x - (1.0 / (t_1 / y));
} else if (y < 2.894426862792089e-49) {
tmp = x - ((y * (z - t)) / a);
} else {
tmp = x - (y / t_1);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = a / (z - t) tmp = 0 if y < -1.0761266216389975e-10: tmp = x - (1.0 / (t_1 / y)) elif y < 2.894426862792089e-49: tmp = x - ((y * (z - t)) / a) else: tmp = x - (y / t_1) return tmp
function code(x, y, z, t, a) t_1 = Float64(a / Float64(z - t)) tmp = 0.0 if (y < -1.0761266216389975e-10) tmp = Float64(x - Float64(1.0 / Float64(t_1 / y))); elseif (y < 2.894426862792089e-49) tmp = Float64(x - Float64(Float64(y * Float64(z - t)) / a)); else tmp = Float64(x - Float64(y / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = a / (z - t); tmp = 0.0; if (y < -1.0761266216389975e-10) tmp = x - (1.0 / (t_1 / y)); elseif (y < 2.894426862792089e-49) tmp = x - ((y * (z - t)) / a); else tmp = x - (y / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]}, If[Less[y, -1.0761266216389975e-10], N[(x - N[(1.0 / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Less[y, 2.894426862792089e-49], N[(x - N[(N[(y * N[(z - t), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{a}{z - t}\\
\mathbf{if}\;y < -1.0761266216389975 \cdot 10^{-10}:\\
\;\;\;\;x - \frac{1}{\frac{t\_1}{y}}\\
\mathbf{elif}\;y < 2.894426862792089 \cdot 10^{-49}:\\
\;\;\;\;x - \frac{y \cdot \left(z - t\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{t\_1}\\
\end{array}
\end{array}
herbie shell --seed 2024110
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, F"
:precision binary64
:alt
(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)))