
(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 11 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 (if (<= y 1.8e-103) (+ x (/ (* y (- t z)) a)) (- x (/ y (/ a (- z t))))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 1.8e-103) {
tmp = x + ((y * (t - z)) / a);
} else {
tmp = x - (y / (a / (z - 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 (y <= 1.8d-103) then
tmp = x + ((y * (t - z)) / a)
else
tmp = x - (y / (a / (z - t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= 1.8e-103) {
tmp = x + ((y * (t - z)) / a);
} else {
tmp = x - (y / (a / (z - t)));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= 1.8e-103: tmp = x + ((y * (t - z)) / a) else: tmp = x - (y / (a / (z - t))) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= 1.8e-103) tmp = Float64(x + Float64(Float64(y * Float64(t - z)) / a)); else tmp = Float64(x - Float64(y / Float64(a / Float64(z - t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= 1.8e-103) tmp = x + ((y * (t - z)) / a); else tmp = x - (y / (a / (z - t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, 1.8e-103], N[(x + N[(N[(y * N[(t - z), $MachinePrecision]), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], N[(x - N[(y / N[(a / N[(z - t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq 1.8 \cdot 10^{-103}:\\
\;\;\;\;x + \frac{y \cdot \left(t - z\right)}{a}\\
\mathbf{else}:\\
\;\;\;\;x - \frac{y}{\frac{a}{z - t}}\\
\end{array}
\end{array}
if y < 1.7999999999999999e-103Initial program 98.7%
if 1.7999999999999999e-103 < y Initial program 86.2%
associate-/l*98.8%
Simplified98.8%
Final simplification98.7%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* z (/ (- y) a))))
(if (<= t -1.05e+117)
(* t (/ y a))
(if (<= t -1.9e-154)
x
(if (<= t -1.9e-300)
t_1
(if (<= t 2.8e-111)
x
(if (<= t 4.6e+77) t_1 (if (<= t 1.2e+96) x (/ t (/ a y))))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = z * (-y / a);
double tmp;
if (t <= -1.05e+117) {
tmp = t * (y / a);
} else if (t <= -1.9e-154) {
tmp = x;
} else if (t <= -1.9e-300) {
tmp = t_1;
} else if (t <= 2.8e-111) {
tmp = x;
} else if (t <= 4.6e+77) {
tmp = t_1;
} else if (t <= 1.2e+96) {
tmp = x;
} else {
tmp = t / (a / y);
}
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 (t <= (-1.05d+117)) then
tmp = t * (y / a)
else if (t <= (-1.9d-154)) then
tmp = x
else if (t <= (-1.9d-300)) then
tmp = t_1
else if (t <= 2.8d-111) then
tmp = x
else if (t <= 4.6d+77) then
tmp = t_1
else if (t <= 1.2d+96) then
tmp = x
else
tmp = t / (a / y)
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 (t <= -1.05e+117) {
tmp = t * (y / a);
} else if (t <= -1.9e-154) {
tmp = x;
} else if (t <= -1.9e-300) {
tmp = t_1;
} else if (t <= 2.8e-111) {
tmp = x;
} else if (t <= 4.6e+77) {
tmp = t_1;
} else if (t <= 1.2e+96) {
tmp = x;
} else {
tmp = t / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = z * (-y / a) tmp = 0 if t <= -1.05e+117: tmp = t * (y / a) elif t <= -1.9e-154: tmp = x elif t <= -1.9e-300: tmp = t_1 elif t <= 2.8e-111: tmp = x elif t <= 4.6e+77: tmp = t_1 elif t <= 1.2e+96: tmp = x else: tmp = t / (a / y) return tmp
function code(x, y, z, t, a) t_1 = Float64(z * Float64(Float64(-y) / a)) tmp = 0.0 if (t <= -1.05e+117) tmp = Float64(t * Float64(y / a)); elseif (t <= -1.9e-154) tmp = x; elseif (t <= -1.9e-300) tmp = t_1; elseif (t <= 2.8e-111) tmp = x; elseif (t <= 4.6e+77) tmp = t_1; elseif (t <= 1.2e+96) tmp = x; else tmp = Float64(t / Float64(a / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = z * (-y / a); tmp = 0.0; if (t <= -1.05e+117) tmp = t * (y / a); elseif (t <= -1.9e-154) tmp = x; elseif (t <= -1.9e-300) tmp = t_1; elseif (t <= 2.8e-111) tmp = x; elseif (t <= 4.6e+77) tmp = t_1; elseif (t <= 1.2e+96) tmp = x; else tmp = t / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(z * N[((-y) / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.05e+117], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.9e-154], x, If[LessEqual[t, -1.9e-300], t$95$1, If[LessEqual[t, 2.8e-111], x, If[LessEqual[t, 4.6e+77], t$95$1, If[LessEqual[t, 1.2e+96], x, N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{-y}{a}\\
\mathbf{if}\;t \leq -1.05 \cdot 10^{+117}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{elif}\;t \leq -1.9 \cdot 10^{-154}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq -1.9 \cdot 10^{-300}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{-111}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 4.6 \cdot 10^{+77}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{+96}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -1.0500000000000001e117Initial program 91.5%
associate-/l*77.6%
Simplified77.6%
Taylor expanded in t around inf 66.5%
associate-*l/56.4%
*-commutative56.4%
Simplified56.4%
clear-num56.4%
un-div-inv56.3%
Applied egg-rr56.3%
associate-/r/70.5%
Applied egg-rr70.5%
if -1.0500000000000001e117 < t < -1.90000000000000005e-154 or -1.90000000000000006e-300 < t < 2.79999999999999995e-111 or 4.5999999999999999e77 < t < 1.19999999999999996e96Initial program 95.1%
associate-/l*96.0%
Simplified96.0%
Taylor expanded in x around inf 55.3%
if -1.90000000000000005e-154 < t < -1.90000000000000006e-300 or 2.79999999999999995e-111 < t < 4.5999999999999999e77Initial program 98.0%
associate-/l*96.0%
Simplified96.0%
Taylor expanded in z around inf 51.5%
mul-1-neg51.5%
associate-*l/53.3%
*-commutative53.3%
Simplified53.3%
if 1.19999999999999996e96 < t Initial program 88.0%
associate-/l*93.8%
Simplified93.8%
Taylor expanded in t around inf 68.9%
associate-*l/71.0%
*-commutative71.0%
Simplified71.0%
clear-num70.8%
un-div-inv70.8%
Applied egg-rr70.8%
associate-/r/72.9%
Applied egg-rr72.9%
clear-num73.0%
associate-*l/73.0%
*-un-lft-identity73.0%
Applied egg-rr73.0%
Final simplification60.0%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ (- z) a))))
(if (<= t -1.15e+117)
(* t (/ y a))
(if (<= t -1.25e-155)
x
(if (<= t 1.2e-267)
t_1
(if (<= t 1.9e-113)
x
(if (<= t 1.2e-15) t_1 (if (<= t 4.8e+17) x (/ t (/ a y))))))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (-z / a);
double tmp;
if (t <= -1.15e+117) {
tmp = t * (y / a);
} else if (t <= -1.25e-155) {
tmp = x;
} else if (t <= 1.2e-267) {
tmp = t_1;
} else if (t <= 1.9e-113) {
tmp = x;
} else if (t <= 1.2e-15) {
tmp = t_1;
} else if (t <= 4.8e+17) {
tmp = x;
} else {
tmp = t / (a / y);
}
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 * (-z / a)
if (t <= (-1.15d+117)) then
tmp = t * (y / a)
else if (t <= (-1.25d-155)) then
tmp = x
else if (t <= 1.2d-267) then
tmp = t_1
else if (t <= 1.9d-113) then
tmp = x
else if (t <= 1.2d-15) then
tmp = t_1
else if (t <= 4.8d+17) then
tmp = x
else
tmp = t / (a / y)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = y * (-z / a);
double tmp;
if (t <= -1.15e+117) {
tmp = t * (y / a);
} else if (t <= -1.25e-155) {
tmp = x;
} else if (t <= 1.2e-267) {
tmp = t_1;
} else if (t <= 1.9e-113) {
tmp = x;
} else if (t <= 1.2e-15) {
tmp = t_1;
} else if (t <= 4.8e+17) {
tmp = x;
} else {
tmp = t / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (-z / a) tmp = 0 if t <= -1.15e+117: tmp = t * (y / a) elif t <= -1.25e-155: tmp = x elif t <= 1.2e-267: tmp = t_1 elif t <= 1.9e-113: tmp = x elif t <= 1.2e-15: tmp = t_1 elif t <= 4.8e+17: tmp = x else: tmp = t / (a / y) return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(Float64(-z) / a)) tmp = 0.0 if (t <= -1.15e+117) tmp = Float64(t * Float64(y / a)); elseif (t <= -1.25e-155) tmp = x; elseif (t <= 1.2e-267) tmp = t_1; elseif (t <= 1.9e-113) tmp = x; elseif (t <= 1.2e-15) tmp = t_1; elseif (t <= 4.8e+17) tmp = x; else tmp = Float64(t / Float64(a / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (-z / a); tmp = 0.0; if (t <= -1.15e+117) tmp = t * (y / a); elseif (t <= -1.25e-155) tmp = x; elseif (t <= 1.2e-267) tmp = t_1; elseif (t <= 1.9e-113) tmp = x; elseif (t <= 1.2e-15) tmp = t_1; elseif (t <= 4.8e+17) tmp = x; else tmp = t / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[((-z) / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.15e+117], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -1.25e-155], x, If[LessEqual[t, 1.2e-267], t$95$1, If[LessEqual[t, 1.9e-113], x, If[LessEqual[t, 1.2e-15], t$95$1, If[LessEqual[t, 4.8e+17], x, N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{-z}{a}\\
\mathbf{if}\;t \leq -1.15 \cdot 10^{+117}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{elif}\;t \leq -1.25 \cdot 10^{-155}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{-267}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 1.9 \cdot 10^{-113}:\\
\;\;\;\;x\\
\mathbf{elif}\;t \leq 1.2 \cdot 10^{-15}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 4.8 \cdot 10^{+17}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -1.14999999999999994e117Initial program 91.5%
associate-/l*77.6%
Simplified77.6%
Taylor expanded in t around inf 66.5%
associate-*l/56.4%
*-commutative56.4%
Simplified56.4%
clear-num56.4%
un-div-inv56.3%
Applied egg-rr56.3%
associate-/r/70.5%
Applied egg-rr70.5%
if -1.14999999999999994e117 < t < -1.25e-155 or 1.1999999999999999e-267 < t < 1.89999999999999992e-113 or 1.19999999999999997e-15 < t < 4.8e17Initial program 94.7%
associate-/l*94.7%
Simplified94.7%
Taylor expanded in x around inf 57.6%
if -1.25e-155 < t < 1.1999999999999999e-267 or 1.89999999999999992e-113 < t < 1.19999999999999997e-15Initial program 97.8%
associate-/l*99.9%
Simplified99.9%
associate-/r/97.0%
Applied egg-rr97.0%
Taylor expanded in z around inf 55.2%
associate-*r/57.3%
mul-1-neg57.3%
distribute-rgt-neg-in57.3%
distribute-neg-frac57.3%
Simplified57.3%
if 4.8e17 < t Initial program 90.8%
associate-/l*92.2%
Simplified92.2%
Taylor expanded in t around inf 59.1%
associate-*l/60.7%
*-commutative60.7%
Simplified60.7%
clear-num60.6%
un-div-inv60.6%
Applied egg-rr60.6%
associate-/r/62.2%
Applied egg-rr62.2%
clear-num62.3%
associate-*l/62.3%
*-un-lft-identity62.3%
Applied egg-rr62.3%
Final simplification60.4%
(FPCore (x y z t a)
:precision binary64
(if (<= x -0.0045)
x
(if (or (<= x 2.9e-14) (and (not (<= x 13500.0)) (<= x 2.6e+177)))
(* (/ y a) (- t z))
x)))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (x <= -0.0045) {
tmp = x;
} else if ((x <= 2.9e-14) || (!(x <= 13500.0) && (x <= 2.6e+177))) {
tmp = (y / a) * (t - z);
} 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 (x <= (-0.0045d0)) then
tmp = x
else if ((x <= 2.9d-14) .or. (.not. (x <= 13500.0d0)) .and. (x <= 2.6d+177)) then
tmp = (y / a) * (t - z)
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 (x <= -0.0045) {
tmp = x;
} else if ((x <= 2.9e-14) || (!(x <= 13500.0) && (x <= 2.6e+177))) {
tmp = (y / a) * (t - z);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if x <= -0.0045: tmp = x elif (x <= 2.9e-14) or (not (x <= 13500.0) and (x <= 2.6e+177)): tmp = (y / a) * (t - z) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if (x <= -0.0045) tmp = x; elseif ((x <= 2.9e-14) || (!(x <= 13500.0) && (x <= 2.6e+177))) tmp = Float64(Float64(y / a) * Float64(t - z)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (x <= -0.0045) tmp = x; elseif ((x <= 2.9e-14) || (~((x <= 13500.0)) && (x <= 2.6e+177))) tmp = (y / a) * (t - z); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[x, -0.0045], x, If[Or[LessEqual[x, 2.9e-14], And[N[Not[LessEqual[x, 13500.0]], $MachinePrecision], LessEqual[x, 2.6e+177]]], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], x]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -0.0045:\\
\;\;\;\;x\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{-14} \lor \neg \left(x \leq 13500\right) \land x \leq 2.6 \cdot 10^{+177}:\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if x < -0.00449999999999999966 or 2.9000000000000003e-14 < x < 13500 or 2.59999999999999979e177 < x Initial program 92.3%
associate-/l*96.6%
Simplified96.6%
Taylor expanded in x around inf 66.8%
if -0.00449999999999999966 < x < 2.9000000000000003e-14 or 13500 < x < 2.59999999999999979e177Initial program 95.1%
associate-/l*91.4%
Simplified91.4%
associate-/r/95.4%
Applied egg-rr95.4%
Taylor expanded in y around inf 71.8%
distribute-lft-out--66.5%
associate-*r/67.7%
associate-*l/63.9%
associate-*r/65.4%
associate-*l/66.4%
distribute-lft-out--77.0%
Simplified77.0%
Final simplification73.6%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* (/ y a) (- t z))))
(if (<= t -1.35e+118)
t_1
(if (<= t -1.8e-44)
(+ x (* y (/ t a)))
(if (<= t 1.95e+17) (- x (* y (/ z a))) t_1)))))
double code(double x, double y, double z, double t, double a) {
double t_1 = (y / a) * (t - z);
double tmp;
if (t <= -1.35e+118) {
tmp = t_1;
} else if (t <= -1.8e-44) {
tmp = x + (y * (t / a));
} else if (t <= 1.95e+17) {
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 / a) * (t - z)
if (t <= (-1.35d+118)) then
tmp = t_1
else if (t <= (-1.8d-44)) then
tmp = x + (y * (t / a))
else if (t <= 1.95d+17) 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 / a) * (t - z);
double tmp;
if (t <= -1.35e+118) {
tmp = t_1;
} else if (t <= -1.8e-44) {
tmp = x + (y * (t / a));
} else if (t <= 1.95e+17) {
tmp = x - (y * (z / a));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = (y / a) * (t - z) tmp = 0 if t <= -1.35e+118: tmp = t_1 elif t <= -1.8e-44: tmp = x + (y * (t / a)) elif t <= 1.95e+17: tmp = x - (y * (z / a)) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(y / a) * Float64(t - z)) tmp = 0.0 if (t <= -1.35e+118) tmp = t_1; elseif (t <= -1.8e-44) tmp = Float64(x + Float64(y * Float64(t / a))); elseif (t <= 1.95e+17) tmp = Float64(x - Float64(y * Float64(z / a))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = (y / a) * (t - z); tmp = 0.0; if (t <= -1.35e+118) tmp = t_1; elseif (t <= -1.8e-44) tmp = x + (y * (t / a)); elseif (t <= 1.95e+17) 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[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.35e+118], t$95$1, If[LessEqual[t, -1.8e-44], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.95e+17], N[(x - N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{if}\;t \leq -1.35 \cdot 10^{+118}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq -1.8 \cdot 10^{-44}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\mathbf{elif}\;t \leq 1.95 \cdot 10^{+17}:\\
\;\;\;\;x - y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -1.35e118 or 1.95e17 < t Initial program 91.1%
associate-/l*87.1%
Simplified87.1%
associate-/r/95.7%
Applied egg-rr95.7%
Taylor expanded in y around inf 70.9%
distribute-lft-out--63.6%
associate-*r/64.6%
associate-*l/58.2%
associate-*r/59.5%
associate-*l/65.9%
distribute-lft-out--81.5%
Simplified81.5%
if -1.35e118 < t < -1.7999999999999999e-44Initial program 96.6%
sub-neg96.6%
+-commutative96.6%
associate-*l/99.9%
distribute-rgt-neg-in99.9%
sub-neg99.9%
distribute-neg-in99.9%
remove-double-neg99.9%
+-commutative99.9%
sub-neg99.9%
*-commutative99.9%
fma-def99.9%
Simplified99.9%
Taylor expanded in z around 0 85.0%
associate-*l/88.3%
*-commutative88.3%
Simplified88.3%
if -1.7999999999999999e-44 < t < 1.95e17Initial program 95.8%
associate-/l*97.5%
Simplified97.5%
Taylor expanded in z around inf 89.2%
*-commutative89.2%
associate-*l/90.7%
*-commutative90.7%
Simplified90.7%
Final simplification87.0%
(FPCore (x y z t a) :precision binary64 (if (or (<= z -2.85e+107) (not (<= z 5.1e+84))) (* (/ y a) (- t z)) (+ x (* y (/ t a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((z <= -2.85e+107) || !(z <= 5.1e+84)) {
tmp = (y / a) * (t - z);
} else {
tmp = x + (y * (t / 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 <= (-2.85d+107)) .or. (.not. (z <= 5.1d+84))) then
tmp = (y / a) * (t - z)
else
tmp = x + (y * (t / 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 <= -2.85e+107) || !(z <= 5.1e+84)) {
tmp = (y / a) * (t - z);
} else {
tmp = x + (y * (t / a));
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (z <= -2.85e+107) or not (z <= 5.1e+84): tmp = (y / a) * (t - z) else: tmp = x + (y * (t / a)) return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((z <= -2.85e+107) || !(z <= 5.1e+84)) tmp = Float64(Float64(y / a) * Float64(t - z)); else tmp = Float64(x + Float64(y * Float64(t / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((z <= -2.85e+107) || ~((z <= 5.1e+84))) tmp = (y / a) * (t - z); else tmp = x + (y * (t / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[z, -2.85e+107], N[Not[LessEqual[z, 5.1e+84]], $MachinePrecision]], N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision], N[(x + N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.85 \cdot 10^{+107} \lor \neg \left(z \leq 5.1 \cdot 10^{+84}\right):\\
\;\;\;\;\frac{y}{a} \cdot \left(t - z\right)\\
\mathbf{else}:\\
\;\;\;\;x + y \cdot \frac{t}{a}\\
\end{array}
\end{array}
if z < -2.84999999999999986e107 or 5.1000000000000001e84 < z Initial program 91.4%
associate-/l*90.1%
Simplified90.1%
associate-/r/95.6%
Applied egg-rr95.6%
Taylor expanded in y around inf 68.4%
distribute-lft-out--58.3%
associate-*r/61.1%
associate-*l/61.2%
associate-*r/61.2%
associate-*l/62.1%
distribute-lft-out--76.8%
Simplified76.8%
if -2.84999999999999986e107 < z < 5.1000000000000001e84Initial program 95.6%
sub-neg95.6%
+-commutative95.6%
associate-*l/97.1%
distribute-rgt-neg-in97.1%
sub-neg97.1%
distribute-neg-in97.1%
remove-double-neg97.1%
+-commutative97.1%
sub-neg97.1%
*-commutative97.1%
fma-def97.1%
Simplified97.1%
Taylor expanded in z around 0 83.1%
associate-*l/82.5%
*-commutative82.5%
Simplified82.5%
Final simplification80.5%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -4.2e+117) (not (<= t 1.4e+16))) (* y (/ t a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -4.2e+117) || !(t <= 1.4e+16)) {
tmp = y * (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 ((t <= (-4.2d+117)) .or. (.not. (t <= 1.4d+16))) then
tmp = y * (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 ((t <= -4.2e+117) || !(t <= 1.4e+16)) {
tmp = y * (t / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -4.2e+117) or not (t <= 1.4e+16): tmp = y * (t / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -4.2e+117) || !(t <= 1.4e+16)) tmp = Float64(y * Float64(t / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((t <= -4.2e+117) || ~((t <= 1.4e+16))) tmp = y * (t / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -4.2e+117], N[Not[LessEqual[t, 1.4e+16]], $MachinePrecision]], N[(y * N[(t / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.2 \cdot 10^{+117} \lor \neg \left(t \leq 1.4 \cdot 10^{+16}\right):\\
\;\;\;\;y \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -4.2000000000000002e117 or 1.4e16 < t Initial program 91.1%
associate-/l*87.1%
Simplified87.1%
Taylor expanded in t around inf 61.7%
associate-*l/59.2%
*-commutative59.2%
Simplified59.2%
if -4.2000000000000002e117 < t < 1.4e16Initial program 96.0%
associate-/l*96.8%
Simplified96.8%
Taylor expanded in x around inf 48.9%
Final simplification52.7%
(FPCore (x y z t a) :precision binary64 (if (or (<= t -2.4e+117) (not (<= t 4.8e+17))) (* t (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((t <= -2.4e+117) || !(t <= 4.8e+17)) {
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 ((t <= (-2.4d+117)) .or. (.not. (t <= 4.8d+17))) 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 ((t <= -2.4e+117) || !(t <= 4.8e+17)) {
tmp = t * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (t <= -2.4e+117) or not (t <= 4.8e+17): tmp = t * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((t <= -2.4e+117) || !(t <= 4.8e+17)) 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 ((t <= -2.4e+117) || ~((t <= 4.8e+17))) tmp = t * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[t, -2.4e+117], N[Not[LessEqual[t, 4.8e+17]], $MachinePrecision]], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.4 \cdot 10^{+117} \lor \neg \left(t \leq 4.8 \cdot 10^{+17}\right):\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if t < -2.3999999999999999e117 or 4.8e17 < t Initial program 91.1%
associate-/l*87.1%
Simplified87.1%
Taylor expanded in t around inf 61.7%
associate-*l/59.2%
*-commutative59.2%
Simplified59.2%
clear-num59.1%
un-div-inv59.1%
Applied egg-rr59.1%
associate-/r/65.1%
Applied egg-rr65.1%
if -2.3999999999999999e117 < t < 4.8e17Initial program 96.0%
associate-/l*96.8%
Simplified96.8%
Taylor expanded in x around inf 48.9%
Final simplification55.0%
(FPCore (x y z t a) :precision binary64 (if (<= t -1.12e+117) (* t (/ y a)) (if (<= t 1.6e+17) x (/ t (/ a y)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -1.12e+117) {
tmp = t * (y / a);
} else if (t <= 1.6e+17) {
tmp = x;
} else {
tmp = t / (a / y);
}
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.12d+117)) then
tmp = t * (y / a)
else if (t <= 1.6d+17) then
tmp = x
else
tmp = t / (a / y)
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.12e+117) {
tmp = t * (y / a);
} else if (t <= 1.6e+17) {
tmp = x;
} else {
tmp = t / (a / y);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -1.12e+117: tmp = t * (y / a) elif t <= 1.6e+17: tmp = x else: tmp = t / (a / y) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -1.12e+117) tmp = Float64(t * Float64(y / a)); elseif (t <= 1.6e+17) tmp = x; else tmp = Float64(t / Float64(a / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -1.12e+117) tmp = t * (y / a); elseif (t <= 1.6e+17) tmp = x; else tmp = t / (a / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -1.12e+117], N[(t * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.6e+17], x, N[(t / N[(a / y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.12 \cdot 10^{+117}:\\
\;\;\;\;t \cdot \frac{y}{a}\\
\mathbf{elif}\;t \leq 1.6 \cdot 10^{+17}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;\frac{t}{\frac{a}{y}}\\
\end{array}
\end{array}
if t < -1.12000000000000002e117Initial program 91.5%
associate-/l*77.6%
Simplified77.6%
Taylor expanded in t around inf 66.5%
associate-*l/56.4%
*-commutative56.4%
Simplified56.4%
clear-num56.4%
un-div-inv56.3%
Applied egg-rr56.3%
associate-/r/70.5%
Applied egg-rr70.5%
if -1.12000000000000002e117 < t < 1.6e17Initial program 96.0%
associate-/l*96.8%
Simplified96.8%
Taylor expanded in x around inf 48.9%
if 1.6e17 < t Initial program 90.8%
associate-/l*92.2%
Simplified92.2%
Taylor expanded in t around inf 59.1%
associate-*l/60.7%
*-commutative60.7%
Simplified60.7%
clear-num60.6%
un-div-inv60.6%
Applied egg-rr60.6%
associate-/r/62.2%
Applied egg-rr62.2%
clear-num62.3%
associate-*l/62.3%
*-un-lft-identity62.3%
Applied egg-rr62.3%
Final simplification55.0%
(FPCore (x y z t a) :precision binary64 (+ x (* (/ y a) (- t z))))
double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (t - z));
}
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) * (t - z))
end function
public static double code(double x, double y, double z, double t, double a) {
return x + ((y / a) * (t - z));
}
def code(x, y, z, t, a): return x + ((y / a) * (t - z))
function code(x, y, z, t, a) return Float64(x + Float64(Float64(y / a) * Float64(t - z))) end
function tmp = code(x, y, z, t, a) tmp = x + ((y / a) * (t - z)); end
code[x_, y_, z_, t_, a_] := N[(x + N[(N[(y / a), $MachinePrecision] * N[(t - z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + \frac{y}{a} \cdot \left(t - z\right)
\end{array}
Initial program 94.1%
associate-/l*93.1%
Simplified93.1%
associate-/r/96.5%
Applied egg-rr96.5%
Final simplification96.5%
(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 94.1%
associate-/l*93.1%
Simplified93.1%
Taylor expanded in x around inf 36.4%
Final simplification36.4%
(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 2023301
(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)))