
(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 10 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 (/ (- z t) (/ a y))))
double code(double x, double y, double z, double t, double a) {
return x + ((z - t) / (a / y));
}
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 + ((z - t) / (a / y))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((z - t) / (a / y));
}
def code(x, y, z, t, a): return x + ((z - t) / (a / y))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(z - t) / Float64(a / y))) end
function tmp = code(x, y, z, t, a) tmp = x + ((z - t) / (a / y)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(z - t), $MachinePrecision] / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{z - t}{\frac{a}{y}}
\end{array}
Initial program 92.9%
*-commutative92.9%
associate-/l*98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (- z t) a))) (t_2 (/ (* (- z t) y) a)))
(if (<= t_2 (- INFINITY))
t_1
(if (<= t_2 -2e+75)
t_2
(if (<= t_2 1e+83) (- x (/ (* t y) a)) (if (<= t_2 2e+303) t_2 t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((z - t) / a);
double t_2 = ((z - t) * y) / a;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_1;
} else if (t_2 <= -2e+75) {
tmp = t_2;
} else if (t_2 <= 1e+83) {
tmp = x - ((t * y) / a);
} else if (t_2 <= 2e+303) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * ((z - t) / a);
double t_2 = ((z - t) * y) / a;
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = t_1;
} else if (t_2 <= -2e+75) {
tmp = t_2;
} else if (t_2 <= 1e+83) {
tmp = x - ((t * y) / a);
} else if (t_2 <= 2e+303) {
tmp = t_2;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * ((z - t) / a) t_2 = ((z - t) * y) / a tmp = 0 if t_2 <= -math.inf: tmp = t_1 elif t_2 <= -2e+75: tmp = t_2 elif t_2 <= 1e+83: tmp = x - ((t * y) / a) elif t_2 <= 2e+303: tmp = t_2 else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(z - t) / a)) t_2 = Float64(Float64(Float64(z - t) * y) / a) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_1; elseif (t_2 <= -2e+75) tmp = t_2; elseif (t_2 <= 1e+83) tmp = Float64(x - Float64(Float64(t * y) / a)); elseif (t_2 <= 2e+303) tmp = t_2; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * ((z - t) / a); t_2 = ((z - t) * y) / a; tmp = 0.0; if (t_2 <= -Inf) tmp = t_1; elseif (t_2 <= -2e+75) tmp = t_2; elseif (t_2 <= 1e+83) tmp = x - ((t * y) / a); elseif (t_2 <= 2e+303) tmp = t_2; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / a), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$1, If[LessEqual[t$95$2, -2e+75], t$95$2, If[LessEqual[t$95$2, 1e+83], N[(x - N[(N[(t * y), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+303], t$95$2, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z - t}{a}\\
t_2 := \frac{\left(z - t\right) \cdot y}{a}\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t_2 \leq -2 \cdot 10^{+75}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t_2 \leq 10^{+83}:\\
\;\;\;\;x - \frac{t \cdot y}{a}\\
\mathbf{elif}\;t_2 \leq 2 \cdot 10^{+303}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -inf.0 or 2e303 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 79.8%
Taylor expanded in x around 0 79.8%
*-commutative79.8%
associate-*l/95.5%
Applied egg-rr95.5%
if -inf.0 < (/.f64 (*.f64 y (-.f64 z t)) a) < -1.99999999999999985e75 or 1.00000000000000003e83 < (/.f64 (*.f64 y (-.f64 z t)) a) < 2e303Initial program 99.7%
Taylor expanded in x around 0 90.3%
if -1.99999999999999985e75 < (/.f64 (*.f64 y (-.f64 z t)) a) < 1.00000000000000003e83Initial program 99.9%
Taylor expanded in z around 0 91.5%
mul-1-neg91.5%
associate-*l/90.6%
unsub-neg90.6%
associate-*l/91.5%
*-commutative91.5%
associate-/l*90.6%
Simplified90.6%
Taylor expanded in y around 0 91.5%
Final simplification92.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (- z t) y)))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+286)))
(* y (/ (- z t) a))
(+ x (/ t_1 a)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) * y;
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+286)) {
tmp = y * ((z - t) / a);
} else {
tmp = x + (t_1 / a);
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a) {
double t_1 = (z - t) * y;
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e+286)) {
tmp = y * ((z - t) / a);
} else {
tmp = x + (t_1 / a);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (z - t) * y tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 2e+286): tmp = y * ((z - t) / a) else: tmp = x + (t_1 / a) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(z - t) * y) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+286)) tmp = Float64(y * Float64(Float64(z - t) / a)); else tmp = Float64(x + Float64(t_1 / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (z - t) * y; tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 2e+286))) tmp = y * ((z - t) / a); else tmp = x + (t_1 / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+286]], $MachinePrecision]], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(t$95$1 / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z - t\right) \cdot y\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 2 \cdot 10^{+286}\right):\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t_1}{a}\\
\end{array}
\end{array}
if (*.f64 y (-.f64 z t)) < -inf.0 or 2.00000000000000007e286 < (*.f64 y (-.f64 z t)) Initial program 71.1%
Taylor expanded in x around 0 71.1%
*-commutative71.1%
associate-*l/93.6%
Applied egg-rr93.6%
if -inf.0 < (*.f64 y (-.f64 z t)) < 2.00000000000000007e286Initial program 99.9%
Final simplification98.3%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* z (/ y a))))
(if (<= z -5.2e+17)
t_1
(if (<= z -1.15e-151)
x
(if (<= z 1.28e-207) (* (/ y a) (- t)) (if (<= z 3.3e+42) x t_1))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = z * (y / a);
double tmp;
if (z <= -5.2e+17) {
tmp = t_1;
} else if (z <= -1.15e-151) {
tmp = x;
} else if (z <= 1.28e-207) {
tmp = (y / a) * -t;
} else if (z <= 3.3e+42) {
tmp = x;
} 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 = z * (y / a)
if (z <= (-5.2d+17)) then
tmp = t_1
else if (z <= (-1.15d-151)) then
tmp = x
else if (z <= 1.28d-207) then
tmp = (y / a) * -t
else if (z <= 3.3d+42) then
tmp = x
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 = z * (y / a);
double tmp;
if (z <= -5.2e+17) {
tmp = t_1;
} else if (z <= -1.15e-151) {
tmp = x;
} else if (z <= 1.28e-207) {
tmp = (y / a) * -t;
} else if (z <= 3.3e+42) {
tmp = x;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = z * (y / a) tmp = 0 if z <= -5.2e+17: tmp = t_1 elif z <= -1.15e-151: tmp = x elif z <= 1.28e-207: tmp = (y / a) * -t elif z <= 3.3e+42: tmp = x else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(z * Float64(y / a)) tmp = 0.0 if (z <= -5.2e+17) tmp = t_1; elseif (z <= -1.15e-151) tmp = x; elseif (z <= 1.28e-207) tmp = Float64(Float64(y / a) * Float64(-t)); elseif (z <= 3.3e+42) tmp = x; else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = z * (y / a); tmp = 0.0; if (z <= -5.2e+17) tmp = t_1; elseif (z <= -1.15e-151) tmp = x; elseif (z <= 1.28e-207) tmp = (y / a) * -t; elseif (z <= 3.3e+42) tmp = x; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5.2e+17], t$95$1, If[LessEqual[z, -1.15e-151], x, If[LessEqual[z, 1.28e-207], N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision], If[LessEqual[z, 3.3e+42], x, t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{y}{a}\\
\mathbf{if}\;z \leq -5.2 \cdot 10^{+17}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.15 \cdot 10^{-151}:\\
\;\;\;\;x\\
\mathbf{elif}\;z \leq 1.28 \cdot 10^{-207}:\\
\;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{+42}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -5.2e17 or 3.2999999999999999e42 < z Initial program 88.3%
Taylor expanded in x around 0 72.5%
Taylor expanded in z around inf 62.6%
associate-*l/69.2%
*-commutative69.2%
Simplified69.2%
if -5.2e17 < z < -1.14999999999999998e-151 or 1.2800000000000001e-207 < z < 3.2999999999999999e42Initial program 96.8%
Taylor expanded in x around inf 61.8%
if -1.14999999999999998e-151 < z < 1.2800000000000001e-207Initial program 96.3%
Taylor expanded in x around 0 58.5%
Taylor expanded in z around 0 54.8%
mul-1-neg54.8%
associate-*r/58.4%
distribute-rgt-neg-in58.4%
Simplified58.4%
Final simplification64.4%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -2.9e-68) (not (<= y 1.3e-167))) (* y (/ (- z t) a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -2.9e-68) || !(y <= 1.3e-167)) {
tmp = y * ((z - t) / 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 ((y <= (-2.9d-68)) .or. (.not. (y <= 1.3d-167))) then
tmp = y * ((z - t) / 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 ((y <= -2.9e-68) || !(y <= 1.3e-167)) {
tmp = y * ((z - t) / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -2.9e-68) or not (y <= 1.3e-167): tmp = y * ((z - t) / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -2.9e-68) || !(y <= 1.3e-167)) tmp = Float64(y * Float64(Float64(z - t) / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -2.9e-68) || ~((y <= 1.3e-167))) tmp = y * ((z - t) / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -2.9e-68], N[Not[LessEqual[y, 1.3e-167]], $MachinePrecision]], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.9 \cdot 10^{-68} \lor \neg \left(y \leq 1.3 \cdot 10^{-167}\right):\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.9e-68 or 1.2999999999999999e-167 < y Initial program 89.8%
Taylor expanded in x around 0 67.0%
*-commutative67.0%
associate-*l/73.5%
Applied egg-rr73.5%
if -2.9e-68 < y < 1.2999999999999999e-167Initial program 99.8%
Taylor expanded in x around inf 65.9%
Final simplification71.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.15e+92) (* y (/ (- z t) a)) (if (<= t 1.02e+256) (+ x (* z (/ y a))) (* (/ y a) (- t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.15e+92) {
tmp = y * ((z - t) / a);
} else if (t <= 1.02e+256) {
tmp = x + (z * (y / a));
} else {
tmp = (y / a) * -t;
}
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 (t <= (-2.15d+92)) then
tmp = y * ((z - t) / a)
else if (t <= 1.02d+256) then
tmp = x + (z * (y / a))
else
tmp = (y / a) * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.15e+92) {
tmp = y * ((z - t) / a);
} else if (t <= 1.02e+256) {
tmp = x + (z * (y / a));
} else {
tmp = (y / a) * -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.15e+92: tmp = y * ((z - t) / a) elif t <= 1.02e+256: tmp = x + (z * (y / a)) else: tmp = (y / a) * -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.15e+92) tmp = Float64(y * Float64(Float64(z - t) / a)); elseif (t <= 1.02e+256) tmp = Float64(x + Float64(z * Float64(y / a))); else tmp = Float64(Float64(y / a) * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.15e+92) tmp = y * ((z - t) / a); elseif (t <= 1.02e+256) tmp = x + (z * (y / a)); else tmp = (y / a) * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.15e+92], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.02e+256], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.15 \cdot 10^{+92}:\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{elif}\;t \leq 1.02 \cdot 10^{+256}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\
\end{array}
\end{array}
if t < -2.1499999999999999e92Initial program 86.6%
Taylor expanded in x around 0 69.1%
*-commutative69.1%
associate-*l/68.8%
Applied egg-rr68.8%
if -2.1499999999999999e92 < t < 1.02e256Initial program 94.2%
Taylor expanded in z around inf 81.1%
associate-*l/45.0%
*-commutative45.0%
Simplified85.3%
if 1.02e256 < t Initial program 92.5%
Taylor expanded in x around 0 70.7%
Taylor expanded in z around 0 70.7%
mul-1-neg70.7%
associate-*r/74.8%
distribute-rgt-neg-in74.8%
Simplified74.8%
Final simplification82.1%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.3e+91) (* y (/ (- z t) a)) (if (<= t 1.02e+256) (+ x (/ z (/ a y))) (* (/ y a) (- t)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.3e+91) {
tmp = y * ((z - t) / a);
} else if (t <= 1.02e+256) {
tmp = x + (z / (a / y));
} else {
tmp = (y / a) * -t;
}
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 (t <= (-1.3d+91)) then
tmp = y * ((z - t) / a)
else if (t <= 1.02d+256) then
tmp = x + (z / (a / y))
else
tmp = (y / a) * -t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.3e+91) {
tmp = y * ((z - t) / a);
} else if (t <= 1.02e+256) {
tmp = x + (z / (a / y));
} else {
tmp = (y / a) * -t;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.3e+91: tmp = y * ((z - t) / a) elif t <= 1.02e+256: tmp = x + (z / (a / y)) else: tmp = (y / a) * -t return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.3e+91) tmp = Float64(y * Float64(Float64(z - t) / a)); elseif (t <= 1.02e+256) tmp = Float64(x + Float64(z / Float64(a / y))); else tmp = Float64(Float64(y / a) * Float64(-t)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.3e+91) tmp = y * ((z - t) / a); elseif (t <= 1.02e+256) tmp = x + (z / (a / y)); else tmp = (y / a) * -t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.3e+91], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.02e+256], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y / a), $MachinePrecision] * (-t)), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.3 \cdot 10^{+91}:\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{elif}\;t \leq 1.02 \cdot 10^{+256}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\mathbf{else}:\\
\;\;\;\;\frac{y}{a} \cdot \left(-t\right)\\
\end{array}
\end{array}
if t < -1.3e91Initial program 86.6%
Taylor expanded in x around 0 69.1%
*-commutative69.1%
associate-*l/68.8%
Applied egg-rr68.8%
if -1.3e91 < t < 1.02e256Initial program 94.2%
Taylor expanded in z around inf 81.1%
associate-*l/45.0%
*-commutative45.0%
Simplified85.3%
clear-num85.3%
un-div-inv85.8%
Applied egg-rr85.8%
if 1.02e256 < t Initial program 92.5%
Taylor expanded in x around 0 70.7%
Taylor expanded in z around 0 70.7%
mul-1-neg70.7%
associate-*r/74.8%
distribute-rgt-neg-in74.8%
Simplified74.8%
Final simplification82.5%
(FPCore (x y z t a) :precision binary64 (if (<= z -1.16e-63) (+ x (/ z (/ a y))) (if (<= z 3.3e-51) (- x (/ y (/ a t))) (+ x (* z (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.16e-63) {
tmp = x + (z / (a / y));
} else if (z <= 3.3e-51) {
tmp = x - (y / (a / t));
} else {
tmp = x + (z * (y / a));
}
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 (z <= (-1.16d-63)) then
tmp = x + (z / (a / y))
else if (z <= 3.3d-51) then
tmp = x - (y / (a / t))
else
tmp = x + (z * (y / a))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (z <= -1.16e-63) {
tmp = x + (z / (a / y));
} else if (z <= 3.3e-51) {
tmp = x - (y / (a / t));
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if z <= -1.16e-63: tmp = x + (z / (a / y)) elif z <= 3.3e-51: tmp = x - (y / (a / t)) else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (z <= -1.16e-63) tmp = Float64(x + Float64(z / Float64(a / y))); elseif (z <= 3.3e-51) tmp = Float64(x - Float64(y / Float64(a / t))); else tmp = Float64(x + Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (z <= -1.16e-63) tmp = x + (z / (a / y)); elseif (z <= 3.3e-51) tmp = x - (y / (a / t)); else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[z, -1.16e-63], N[(x + N[(z / N[(a / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.3e-51], N[(x - N[(y / N[(a / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.16 \cdot 10^{-63}:\\
\;\;\;\;x + \frac{z}{\frac{a}{y}}\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-51}:\\
\;\;\;\;x - \frac{y}{\frac{a}{t}}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if z < -1.16e-63Initial program 89.1%
Taylor expanded in z around inf 78.1%
associate-*l/61.0%
*-commutative61.0%
Simplified86.7%
clear-num86.7%
un-div-inv86.7%
Applied egg-rr86.7%
if -1.16e-63 < z < 3.29999999999999973e-51Initial program 96.2%
Taylor expanded in z around 0 90.3%
mul-1-neg90.3%
associate-*l/91.2%
unsub-neg91.2%
associate-*l/90.3%
*-commutative90.3%
associate-/l*92.0%
Simplified92.0%
if 3.29999999999999973e-51 < z Initial program 92.9%
Taylor expanded in z around inf 83.3%
associate-*l/58.4%
*-commutative58.4%
Simplified87.6%
Final simplification89.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -1.05e+15) (not (<= z 4.2e+39))) (* z (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -1.05e+15) || !(z <= 4.2e+39)) {
tmp = z * (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 ((z <= (-1.05d+15)) .or. (.not. (z <= 4.2d+39))) then
tmp = z * (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 ((z <= -1.05e+15) || !(z <= 4.2e+39)) {
tmp = z * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -1.05e+15) or not (z <= 4.2e+39): tmp = z * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -1.05e+15) || !(z <= 4.2e+39)) tmp = Float64(z * Float64(y / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -1.05e+15) || ~((z <= 4.2e+39))) tmp = z * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -1.05e+15], N[Not[LessEqual[z, 4.2e+39]], $MachinePrecision]], N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{+15} \lor \neg \left(z \leq 4.2 \cdot 10^{+39}\right):\\
\;\;\;\;z \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if z < -1.05e15 or 4.1999999999999997e39 < z Initial program 88.3%
Taylor expanded in x around 0 72.5%
Taylor expanded in z around inf 62.6%
associate-*l/69.2%
*-commutative69.2%
Simplified69.2%
if -1.05e15 < z < 4.1999999999999997e39Initial program 96.6%
Taylor expanded in x around inf 53.6%
Final simplification60.6%
(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 92.9%
Taylor expanded in x around inf 38.5%
Final simplification38.5%
(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 2023314
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
: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)))