
(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 12 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
(let* ((t_1 (* (- z t) y)))
(if (or (<= t_1 -5e+220) (not (<= t_1 2e+107)))
(+ x (* 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 <= -5e+220) || !(t_1 <= 2e+107)) {
tmp = x + (y * ((z - t) / a));
} else {
tmp = x + (t_1 / 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) :: t_1
real(8) :: tmp
t_1 = (z - t) * y
if ((t_1 <= (-5d+220)) .or. (.not. (t_1 <= 2d+107))) then
tmp = x + (y * ((z - t) / a))
else
tmp = x + (t_1 / a)
end if
code = tmp
end function
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 <= -5e+220) || !(t_1 <= 2e+107)) {
tmp = x + (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 <= -5e+220) or not (t_1 <= 2e+107): tmp = x + (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 <= -5e+220) || !(t_1 <= 2e+107)) tmp = Float64(x + 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 <= -5e+220) || ~((t_1 <= 2e+107))) tmp = x + (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, -5e+220], N[Not[LessEqual[t$95$1, 2e+107]], $MachinePrecision]], N[(x + N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $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 -5 \cdot 10^{+220} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+107}\right):\\
\;\;\;\;x + y \cdot \frac{z - t}{a}\\
\mathbf{else}:\\
\;\;\;\;x + \frac{t\_1}{a}\\
\end{array}
\end{array}
if (*.f64 y (-.f64 z t)) < -5.0000000000000002e220 or 1.9999999999999999e107 < (*.f64 y (-.f64 z t)) Initial program 84.4%
associate-/l*100.0%
*-commutative100.0%
Applied egg-rr100.0%
if -5.0000000000000002e220 < (*.f64 y (-.f64 z t)) < 1.9999999999999999e107Initial program 99.9%
Final simplification99.9%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* y (/ z a))))
(if (<= y -1.8e+165)
(/ (* z y) a)
(if (<= y -3.5e+53)
(* t (/ (- y) a))
(if (<= y -2.7e-36)
t_1
(if (<= y 2.8e-44)
x
(if (or (<= y 8.5e+65) (not (<= y 1.88e+130)))
(* (- y) (/ t a))
t_1)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = y * (z / a);
double tmp;
if (y <= -1.8e+165) {
tmp = (z * y) / a;
} else if (y <= -3.5e+53) {
tmp = t * (-y / a);
} else if (y <= -2.7e-36) {
tmp = t_1;
} else if (y <= 2.8e-44) {
tmp = x;
} else if ((y <= 8.5e+65) || !(y <= 1.88e+130)) {
tmp = -y * (t / 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 * (z / a)
if (y <= (-1.8d+165)) then
tmp = (z * y) / a
else if (y <= (-3.5d+53)) then
tmp = t * (-y / a)
else if (y <= (-2.7d-36)) then
tmp = t_1
else if (y <= 2.8d-44) then
tmp = x
else if ((y <= 8.5d+65) .or. (.not. (y <= 1.88d+130))) then
tmp = -y * (t / 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 * (z / a);
double tmp;
if (y <= -1.8e+165) {
tmp = (z * y) / a;
} else if (y <= -3.5e+53) {
tmp = t * (-y / a);
} else if (y <= -2.7e-36) {
tmp = t_1;
} else if (y <= 2.8e-44) {
tmp = x;
} else if ((y <= 8.5e+65) || !(y <= 1.88e+130)) {
tmp = -y * (t / a);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = y * (z / a) tmp = 0 if y <= -1.8e+165: tmp = (z * y) / a elif y <= -3.5e+53: tmp = t * (-y / a) elif y <= -2.7e-36: tmp = t_1 elif y <= 2.8e-44: tmp = x elif (y <= 8.5e+65) or not (y <= 1.88e+130): tmp = -y * (t / a) else: tmp = t_1 return tmp
function code(x, y, z, t, a) t_1 = Float64(y * Float64(z / a)) tmp = 0.0 if (y <= -1.8e+165) tmp = Float64(Float64(z * y) / a); elseif (y <= -3.5e+53) tmp = Float64(t * Float64(Float64(-y) / a)); elseif (y <= -2.7e-36) tmp = t_1; elseif (y <= 2.8e-44) tmp = x; elseif ((y <= 8.5e+65) || !(y <= 1.88e+130)) tmp = Float64(Float64(-y) * Float64(t / a)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = y * (z / a); tmp = 0.0; if (y <= -1.8e+165) tmp = (z * y) / a; elseif (y <= -3.5e+53) tmp = t * (-y / a); elseif (y <= -2.7e-36) tmp = t_1; elseif (y <= 2.8e-44) tmp = x; elseif ((y <= 8.5e+65) || ~((y <= 1.88e+130))) tmp = -y * (t / a); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.8e+165], N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, -3.5e+53], N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -2.7e-36], t$95$1, If[LessEqual[y, 2.8e-44], x, If[Or[LessEqual[y, 8.5e+65], N[Not[LessEqual[y, 1.88e+130]], $MachinePrecision]], N[((-y) * N[(t / a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y \cdot \frac{z}{a}\\
\mathbf{if}\;y \leq -1.8 \cdot 10^{+165}:\\
\;\;\;\;\frac{z \cdot y}{a}\\
\mathbf{elif}\;y \leq -3.5 \cdot 10^{+53}:\\
\;\;\;\;t \cdot \frac{-y}{a}\\
\mathbf{elif}\;y \leq -2.7 \cdot 10^{-36}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{-44}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 8.5 \cdot 10^{+65} \lor \neg \left(y \leq 1.88 \cdot 10^{+130}\right):\\
\;\;\;\;\left(-y\right) \cdot \frac{t}{a}\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.7999999999999999e165Initial program 88.3%
Taylor expanded in x around 0 82.1%
Taylor expanded in z around inf 72.6%
if -1.7999999999999999e165 < y < -3.50000000000000019e53Initial program 85.4%
Taylor expanded in x around 0 73.3%
Taylor expanded in z around 0 62.9%
mul-1-neg62.9%
associate-/l*77.2%
distribute-rgt-neg-in77.2%
mul-1-neg77.2%
associate-*r/77.2%
mul-1-neg77.2%
Simplified77.2%
if -3.50000000000000019e53 < y < -2.70000000000000007e-36 or 8.50000000000000075e65 < y < 1.88000000000000003e130Initial program 89.4%
Taylor expanded in x around 0 75.9%
Taylor expanded in z around inf 65.0%
associate-/l*85.6%
Simplified70.1%
if -2.70000000000000007e-36 < y < 2.8e-44Initial program 99.9%
Taylor expanded in x around inf 67.3%
if 2.8e-44 < y < 8.50000000000000075e65 or 1.88000000000000003e130 < y Initial program 89.5%
Taylor expanded in x around 0 73.0%
Taylor expanded in z around 0 49.2%
mul-1-neg49.2%
associate-/l*53.0%
distribute-rgt-neg-in53.0%
mul-1-neg53.0%
associate-*r/53.0%
mul-1-neg53.0%
Simplified53.0%
Taylor expanded in t around 0 49.2%
mul-1-neg49.2%
*-commutative49.2%
distribute-frac-neg249.2%
associate-/l*54.2%
Simplified54.2%
Final simplification65.2%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (* t (/ (- y) a))) (t_2 (* y (/ z a))))
(if (<= y -6.5e+167)
(/ (* z y) a)
(if (<= y -4.5e+53)
t_1
(if (<= y -2.7e-36)
t_2
(if (<= y 1.75e-44) x (if (<= y 5.6e+65) t_1 t_2)))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = t * (-y / a);
double t_2 = y * (z / a);
double tmp;
if (y <= -6.5e+167) {
tmp = (z * y) / a;
} else if (y <= -4.5e+53) {
tmp = t_1;
} else if (y <= -2.7e-36) {
tmp = t_2;
} else if (y <= 1.75e-44) {
tmp = x;
} else if (y <= 5.6e+65) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_1 = t * (-y / a)
t_2 = y * (z / a)
if (y <= (-6.5d+167)) then
tmp = (z * y) / a
else if (y <= (-4.5d+53)) then
tmp = t_1
else if (y <= (-2.7d-36)) then
tmp = t_2
else if (y <= 1.75d-44) then
tmp = x
else if (y <= 5.6d+65) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a) {
double t_1 = t * (-y / a);
double t_2 = y * (z / a);
double tmp;
if (y <= -6.5e+167) {
tmp = (z * y) / a;
} else if (y <= -4.5e+53) {
tmp = t_1;
} else if (y <= -2.7e-36) {
tmp = t_2;
} else if (y <= 1.75e-44) {
tmp = x;
} else if (y <= 5.6e+65) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a): t_1 = t * (-y / a) t_2 = y * (z / a) tmp = 0 if y <= -6.5e+167: tmp = (z * y) / a elif y <= -4.5e+53: tmp = t_1 elif y <= -2.7e-36: tmp = t_2 elif y <= 1.75e-44: tmp = x elif y <= 5.6e+65: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a) t_1 = Float64(t * Float64(Float64(-y) / a)) t_2 = Float64(y * Float64(z / a)) tmp = 0.0 if (y <= -6.5e+167) tmp = Float64(Float64(z * y) / a); elseif (y <= -4.5e+53) tmp = t_1; elseif (y <= -2.7e-36) tmp = t_2; elseif (y <= 1.75e-44) tmp = x; elseif (y <= 5.6e+65) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = t * (-y / a); t_2 = y * (z / a); tmp = 0.0; if (y <= -6.5e+167) tmp = (z * y) / a; elseif (y <= -4.5e+53) tmp = t_1; elseif (y <= -2.7e-36) tmp = t_2; elseif (y <= 1.75e-44) tmp = x; elseif (y <= 5.6e+65) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(t * N[((-y) / a), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -6.5e+167], N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, -4.5e+53], t$95$1, If[LessEqual[y, -2.7e-36], t$95$2, If[LessEqual[y, 1.75e-44], x, If[LessEqual[y, 5.6e+65], t$95$1, t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t \cdot \frac{-y}{a}\\
t_2 := y \cdot \frac{z}{a}\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{+167}:\\
\;\;\;\;\frac{z \cdot y}{a}\\
\mathbf{elif}\;y \leq -4.5 \cdot 10^{+53}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq -2.7 \cdot 10^{-36}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq 1.75 \cdot 10^{-44}:\\
\;\;\;\;x\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{+65}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -6.5e167Initial program 88.3%
Taylor expanded in x around 0 82.1%
Taylor expanded in z around inf 72.6%
if -6.5e167 < y < -4.5000000000000002e53 or 1.7499999999999999e-44 < y < 5.5999999999999998e65Initial program 95.0%
Taylor expanded in x around 0 74.9%
Taylor expanded in z around 0 57.0%
mul-1-neg57.0%
associate-/l*61.7%
distribute-rgt-neg-in61.7%
mul-1-neg61.7%
associate-*r/61.7%
mul-1-neg61.7%
Simplified61.7%
if -4.5000000000000002e53 < y < -2.70000000000000007e-36 or 5.5999999999999998e65 < y Initial program 86.2%
Taylor expanded in x around 0 73.4%
Taylor expanded in z around inf 49.3%
associate-/l*68.8%
Simplified56.2%
if -2.70000000000000007e-36 < y < 1.7499999999999999e-44Initial program 99.9%
Taylor expanded in x around inf 67.3%
Final simplification63.5%
(FPCore (x y z t a)
:precision binary64
(let* ((t_1 (/ (* (- z t) y) a)))
(if (or (<= t_1 -4e+30) (not (<= t_1 1e+114)))
(* (- z t) (/ y a))
(+ x (* z (/ y a))))))
double code(double x, double y, double z, double t, double a) {
double t_1 = ((z - t) * y) / a;
double tmp;
if ((t_1 <= -4e+30) || !(t_1 <= 1e+114)) {
tmp = (z - t) * (y / a);
} 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) :: t_1
real(8) :: tmp
t_1 = ((z - t) * y) / a
if ((t_1 <= (-4d+30)) .or. (.not. (t_1 <= 1d+114))) then
tmp = (z - t) * (y / a)
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 t_1 = ((z - t) * y) / a;
double tmp;
if ((t_1 <= -4e+30) || !(t_1 <= 1e+114)) {
tmp = (z - t) * (y / a);
} else {
tmp = x + (z * (y / a));
}
return tmp;
}
def code(x, y, z, t, a): t_1 = ((z - t) * y) / a tmp = 0 if (t_1 <= -4e+30) or not (t_1 <= 1e+114): tmp = (z - t) * (y / a) else: tmp = x + (z * (y / a)) return tmp
function code(x, y, z, t, a) t_1 = Float64(Float64(Float64(z - t) * y) / a) tmp = 0.0 if ((t_1 <= -4e+30) || !(t_1 <= 1e+114)) tmp = Float64(Float64(z - t) * Float64(y / a)); else tmp = Float64(x + Float64(z * Float64(y / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a) t_1 = ((z - t) * y) / a; tmp = 0.0; if ((t_1 <= -4e+30) || ~((t_1 <= 1e+114))) tmp = (z - t) * (y / a); else tmp = x + (z * (y / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := Block[{t$95$1 = N[(N[(N[(z - t), $MachinePrecision] * y), $MachinePrecision] / a), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -4e+30], N[Not[LessEqual[t$95$1, 1e+114]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision], N[(x + N[(z * N[(y / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(z - t\right) \cdot y}{a}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+30} \lor \neg \left(t\_1 \leq 10^{+114}\right):\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x + z \cdot \frac{y}{a}\\
\end{array}
\end{array}
if (/.f64 (*.f64 y (-.f64 z t)) a) < -4.0000000000000001e30 or 1e114 < (/.f64 (*.f64 y (-.f64 z t)) a) Initial program 88.3%
Taylor expanded in x around 0 83.0%
*-commutative83.0%
associate-/l*91.3%
Applied egg-rr91.3%
if -4.0000000000000001e30 < (/.f64 (*.f64 y (-.f64 z t)) a) < 1e114Initial program 99.9%
+-commutative99.9%
*-commutative99.9%
associate-/l*98.2%
Applied egg-rr98.2%
Taylor expanded in z around inf 89.6%
associate-*l/88.7%
*-commutative88.7%
Simplified88.7%
Final simplification90.2%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -1.7e-43) (not (<= y 1.8e-167))) (* (- z t) (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -1.7e-43) || !(y <= 1.8e-167)) {
tmp = (z - 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 ((y <= (-1.7d-43)) .or. (.not. (y <= 1.8d-167))) then
tmp = (z - 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 ((y <= -1.7e-43) || !(y <= 1.8e-167)) {
tmp = (z - t) * (y / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -1.7e-43) or not (y <= 1.8e-167): tmp = (z - t) * (y / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -1.7e-43) || !(y <= 1.8e-167)) tmp = Float64(Float64(z - t) * Float64(y / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -1.7e-43) || ~((y <= 1.8e-167))) tmp = (z - t) * (y / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -1.7e-43], N[Not[LessEqual[y, 1.8e-167]], $MachinePrecision]], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.7 \cdot 10^{-43} \lor \neg \left(y \leq 1.8 \cdot 10^{-167}\right):\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -1.7e-43 or 1.8e-167 < y Initial program 90.5%
Taylor expanded in x around 0 72.9%
*-commutative72.9%
associate-/l*79.5%
Applied egg-rr79.5%
if -1.7e-43 < y < 1.8e-167Initial program 99.9%
Taylor expanded in x around inf 76.7%
Final simplification78.7%
(FPCore (x y z t a) :precision binary64 (if (<= t -2.6e+183) (* y (/ (- z t) a)) (if (<= t 2.3e+114) (+ x (* y (/ z a))) (* (- z t) (/ y a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (t <= -2.6e+183) {
tmp = y * ((z - t) / a);
} else if (t <= 2.3e+114) {
tmp = x + (y * (z / a));
} else {
tmp = (z - t) * (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 (t <= (-2.6d+183)) then
tmp = y * ((z - t) / a)
else if (t <= 2.3d+114) then
tmp = x + (y * (z / a))
else
tmp = (z - t) * (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 (t <= -2.6e+183) {
tmp = y * ((z - t) / a);
} else if (t <= 2.3e+114) {
tmp = x + (y * (z / a));
} else {
tmp = (z - t) * (y / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if t <= -2.6e+183: tmp = y * ((z - t) / a) elif t <= 2.3e+114: tmp = x + (y * (z / a)) else: tmp = (z - t) * (y / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (t <= -2.6e+183) tmp = Float64(y * Float64(Float64(z - t) / a)); elseif (t <= 2.3e+114) tmp = Float64(x + Float64(y * Float64(z / a))); else tmp = Float64(Float64(z - t) * Float64(y / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (t <= -2.6e+183) tmp = y * ((z - t) / a); elseif (t <= 2.3e+114) tmp = x + (y * (z / a)); else tmp = (z - t) * (y / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[t, -2.6e+183], N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 2.3e+114], N[(x + N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.6 \cdot 10^{+183}:\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\mathbf{elif}\;t \leq 2.3 \cdot 10^{+114}:\\
\;\;\;\;x + y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a}\\
\end{array}
\end{array}
if t < -2.5999999999999999e183Initial program 93.2%
Taylor expanded in x around 0 82.8%
associate-/l*93.2%
*-commutative93.2%
Applied egg-rr86.1%
if -2.5999999999999999e183 < t < 2.3e114Initial program 95.3%
Taylor expanded in z around inf 83.7%
associate-/l*83.2%
Simplified83.2%
if 2.3e114 < t Initial program 85.3%
Taylor expanded in x around 0 76.5%
*-commutative76.5%
associate-/l*89.1%
Applied egg-rr89.1%
Final simplification84.6%
(FPCore (x y z t a) :precision binary64 (if (<= y -3.8e-43) (* (- z t) (/ y a)) (if (<= y 1.7e-139) x (* y (/ (- z t) a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -3.8e-43) {
tmp = (z - t) * (y / a);
} else if (y <= 1.7e-139) {
tmp = x;
} else {
tmp = y * ((z - 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 (y <= (-3.8d-43)) then
tmp = (z - t) * (y / a)
else if (y <= 1.7d-139) then
tmp = x
else
tmp = y * ((z - 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 (y <= -3.8e-43) {
tmp = (z - t) * (y / a);
} else if (y <= 1.7e-139) {
tmp = x;
} else {
tmp = y * ((z - t) / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -3.8e-43: tmp = (z - t) * (y / a) elif y <= 1.7e-139: tmp = x else: tmp = y * ((z - t) / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -3.8e-43) tmp = Float64(Float64(z - t) * Float64(y / a)); elseif (y <= 1.7e-139) tmp = x; else tmp = Float64(y * Float64(Float64(z - t) / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -3.8e-43) tmp = (z - t) * (y / a); elseif (y <= 1.7e-139) tmp = x; else tmp = y * ((z - t) / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -3.8e-43], N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.7e-139], x, N[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -3.8 \cdot 10^{-43}:\\
\;\;\;\;\left(z - t\right) \cdot \frac{y}{a}\\
\mathbf{elif}\;y \leq 1.7 \cdot 10^{-139}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z - t}{a}\\
\end{array}
\end{array}
if y < -3.7999999999999997e-43Initial program 89.8%
Taylor expanded in x around 0 80.6%
*-commutative80.6%
associate-/l*87.8%
Applied egg-rr87.8%
if -3.7999999999999997e-43 < y < 1.69999999999999999e-139Initial program 99.9%
Taylor expanded in x around inf 73.9%
if 1.69999999999999999e-139 < y Initial program 90.2%
Taylor expanded in x around 0 69.9%
associate-/l*99.0%
*-commutative99.0%
Applied egg-rr78.0%
Final simplification79.1%
(FPCore (x y z t a) :precision binary64 (if (or (<= y -2.75e-36) (not (<= y 1.05e+33))) (* y (/ z a)) x))
double code(double x, double y, double z, double t, double a) {
double tmp;
if ((y <= -2.75e-36) || !(y <= 1.05e+33)) {
tmp = y * (z / 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.75d-36)) .or. (.not. (y <= 1.05d+33))) then
tmp = y * (z / 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.75e-36) || !(y <= 1.05e+33)) {
tmp = y * (z / a);
} else {
tmp = x;
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if (y <= -2.75e-36) or not (y <= 1.05e+33): tmp = y * (z / a) else: tmp = x return tmp
function code(x, y, z, t, a) tmp = 0.0 if ((y <= -2.75e-36) || !(y <= 1.05e+33)) tmp = Float64(y * Float64(z / a)); else tmp = x; end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if ((y <= -2.75e-36) || ~((y <= 1.05e+33))) tmp = y * (z / a); else tmp = x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[Or[LessEqual[y, -2.75e-36], N[Not[LessEqual[y, 1.05e+33]], $MachinePrecision]], N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision], x]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.75 \cdot 10^{-36} \lor \neg \left(y \leq 1.05 \cdot 10^{+33}\right):\\
\;\;\;\;y \cdot \frac{z}{a}\\
\mathbf{else}:\\
\;\;\;\;x\\
\end{array}
\end{array}
if y < -2.74999999999999992e-36 or 1.05e33 < y Initial program 87.4%
Taylor expanded in x around 0 76.1%
Taylor expanded in z around inf 50.5%
associate-/l*65.2%
Simplified52.7%
if -2.74999999999999992e-36 < y < 1.05e33Initial program 99.9%
Taylor expanded in x around inf 61.5%
Final simplification56.9%
(FPCore (x y z t a) :precision binary64 (if (<= y -2.75e-36) (/ (* z y) a) (if (<= y 1.1e+34) x (* y (/ z a)))))
double code(double x, double y, double z, double t, double a) {
double tmp;
if (y <= -2.75e-36) {
tmp = (z * y) / a;
} else if (y <= 1.1e+34) {
tmp = x;
} else {
tmp = y * (z / 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 (y <= (-2.75d-36)) then
tmp = (z * y) / a
else if (y <= 1.1d+34) then
tmp = x
else
tmp = y * (z / a)
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.75e-36) {
tmp = (z * y) / a;
} else if (y <= 1.1e+34) {
tmp = x;
} else {
tmp = y * (z / a);
}
return tmp;
}
def code(x, y, z, t, a): tmp = 0 if y <= -2.75e-36: tmp = (z * y) / a elif y <= 1.1e+34: tmp = x else: tmp = y * (z / a) return tmp
function code(x, y, z, t, a) tmp = 0.0 if (y <= -2.75e-36) tmp = Float64(Float64(z * y) / a); elseif (y <= 1.1e+34) tmp = x; else tmp = Float64(y * Float64(z / a)); end return tmp end
function tmp_2 = code(x, y, z, t, a) tmp = 0.0; if (y <= -2.75e-36) tmp = (z * y) / a; elseif (y <= 1.1e+34) tmp = x; else tmp = y * (z / a); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_] := If[LessEqual[y, -2.75e-36], N[(N[(z * y), $MachinePrecision] / a), $MachinePrecision], If[LessEqual[y, 1.1e+34], x, N[(y * N[(z / a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.75 \cdot 10^{-36}:\\
\;\;\;\;\frac{z \cdot y}{a}\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{+34}:\\
\;\;\;\;x\\
\mathbf{else}:\\
\;\;\;\;y \cdot \frac{z}{a}\\
\end{array}
\end{array}
if y < -2.74999999999999992e-36Initial program 89.7%
Taylor expanded in x around 0 81.0%
Taylor expanded in z around inf 61.4%
if -2.74999999999999992e-36 < y < 1.1000000000000001e34Initial program 99.9%
Taylor expanded in x around inf 61.5%
if 1.1000000000000001e34 < y Initial program 85.3%
Taylor expanded in x around 0 71.6%
Taylor expanded in z around inf 40.6%
associate-/l*62.6%
Simplified48.6%
Final simplification57.9%
(FPCore (x y z t a) :precision binary64 (+ (* (- z t) (/ y a)) x))
double code(double x, double y, double z, double t, double a) {
return ((z - t) * (y / 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 = ((z - t) * (y / a)) + x
end function
public static double code(double x, double y, double z, double t, double a) {
return ((z - t) * (y / a)) + x;
}
def code(x, y, z, t, a): return ((z - t) * (y / a)) + x
function code(x, y, z, t, a) return Float64(Float64(Float64(z - t) * Float64(y / a)) + x) end
function tmp = code(x, y, z, t, a) tmp = ((z - t) * (y / a)) + x; end
code[x_, y_, z_, t_, a_] := N[(N[(N[(z - t), $MachinePrecision] * N[(y / a), $MachinePrecision]), $MachinePrecision] + x), $MachinePrecision]
\begin{array}{l}
\\
\left(z - t\right) \cdot \frac{y}{a} + x
\end{array}
Initial program 93.3%
+-commutative93.3%
*-commutative93.3%
associate-/l*98.0%
Applied egg-rr98.0%
(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(y * Float64(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[(y * N[(N[(z - t), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
x + y \cdot \frac{z - t}{a}
\end{array}
Initial program 93.3%
associate-/l*94.3%
*-commutative94.3%
Applied egg-rr94.3%
Final simplification94.3%
(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 93.3%
Taylor expanded in x around inf 36.8%
(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 2024096
(FPCore (x y z t a)
:name "Optimisation.CirclePacking:place from circle-packing-0.1.0.4, E"
: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)))