
(FPCore (x y z t a b) :precision binary64 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b): return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) end
function tmp = code(x, y, z, t, a, b) tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b): return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) end
function tmp = code(x, y, z, t, a, b) tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\end{array}
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- (+ (* (+ y t) a) (* z (+ x y))) (* y b)) (+ y (+ x t))))) (if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+241))) (- (+ z a) b) t_1)))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((y + t) * a) + (z * (x + y))) - (y * b)) / (y + (x + t));
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+241)) {
tmp = (z + a) - b;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((y + t) * a) + (z * (x + y))) - (y * b)) / (y + (x + t));
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e+241)) {
tmp = (z + a) - b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((((y + t) * a) + (z * (x + y))) - (y * b)) / (y + (x + t)) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 2e+241): tmp = (z + a) - b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(Float64(y + t) * a) + Float64(z * Float64(x + y))) - Float64(y * b)) / Float64(y + Float64(x + t))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+241)) tmp = Float64(Float64(z + a) - b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((((y + t) * a) + (z * (x + y))) - (y * b)) / (y + (x + t)); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 2e+241))) tmp = (z + a) - b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(N[(y + t), $MachinePrecision] * a), $MachinePrecision] + N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+241]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(\left(y + t\right) \cdot a + z \cdot \left(x + y\right)\right) - y \cdot b}{y + \left(x + t\right)}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{+241}\right):\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 2.0000000000000001e241 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 6.4%
Taylor expanded in y around inf 70.3%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e241Initial program 99.7%
Final simplification87.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (+ x t)))
(t_2 (/ (- (* (+ y t) a) (* y b)) t_1))
(t_3 (- (+ z a) b)))
(if (<= y -3.2e+26)
t_3
(if (<= y -4.3e-51)
t_2
(if (<= y -5.6e-138)
(* z (/ (+ x y) t_1))
(if (<= y -3.1e-207)
a
(if (<= y 8.4e-274)
(* z (/ 1.0 (/ (+ t (+ x y)) (+ x y))))
(if (<= y 2.5e-25) t_2 t_3))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (x + t);
double t_2 = (((y + t) * a) - (y * b)) / t_1;
double t_3 = (z + a) - b;
double tmp;
if (y <= -3.2e+26) {
tmp = t_3;
} else if (y <= -4.3e-51) {
tmp = t_2;
} else if (y <= -5.6e-138) {
tmp = z * ((x + y) / t_1);
} else if (y <= -3.1e-207) {
tmp = a;
} else if (y <= 8.4e-274) {
tmp = z * (1.0 / ((t + (x + y)) / (x + y)));
} else if (y <= 2.5e-25) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = y + (x + t)
t_2 = (((y + t) * a) - (y * b)) / t_1
t_3 = (z + a) - b
if (y <= (-3.2d+26)) then
tmp = t_3
else if (y <= (-4.3d-51)) then
tmp = t_2
else if (y <= (-5.6d-138)) then
tmp = z * ((x + y) / t_1)
else if (y <= (-3.1d-207)) then
tmp = a
else if (y <= 8.4d-274) then
tmp = z * (1.0d0 / ((t + (x + y)) / (x + y)))
else if (y <= 2.5d-25) then
tmp = t_2
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (x + t);
double t_2 = (((y + t) * a) - (y * b)) / t_1;
double t_3 = (z + a) - b;
double tmp;
if (y <= -3.2e+26) {
tmp = t_3;
} else if (y <= -4.3e-51) {
tmp = t_2;
} else if (y <= -5.6e-138) {
tmp = z * ((x + y) / t_1);
} else if (y <= -3.1e-207) {
tmp = a;
} else if (y <= 8.4e-274) {
tmp = z * (1.0 / ((t + (x + y)) / (x + y)));
} else if (y <= 2.5e-25) {
tmp = t_2;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = y + (x + t) t_2 = (((y + t) * a) - (y * b)) / t_1 t_3 = (z + a) - b tmp = 0 if y <= -3.2e+26: tmp = t_3 elif y <= -4.3e-51: tmp = t_2 elif y <= -5.6e-138: tmp = z * ((x + y) / t_1) elif y <= -3.1e-207: tmp = a elif y <= 8.4e-274: tmp = z * (1.0 / ((t + (x + y)) / (x + y))) elif y <= 2.5e-25: tmp = t_2 else: tmp = t_3 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(x + t)) t_2 = Float64(Float64(Float64(Float64(y + t) * a) - Float64(y * b)) / t_1) t_3 = Float64(Float64(z + a) - b) tmp = 0.0 if (y <= -3.2e+26) tmp = t_3; elseif (y <= -4.3e-51) tmp = t_2; elseif (y <= -5.6e-138) tmp = Float64(z * Float64(Float64(x + y) / t_1)); elseif (y <= -3.1e-207) tmp = a; elseif (y <= 8.4e-274) tmp = Float64(z * Float64(1.0 / Float64(Float64(t + Float64(x + y)) / Float64(x + y)))); elseif (y <= 2.5e-25) tmp = t_2; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = y + (x + t); t_2 = (((y + t) * a) - (y * b)) / t_1; t_3 = (z + a) - b; tmp = 0.0; if (y <= -3.2e+26) tmp = t_3; elseif (y <= -4.3e-51) tmp = t_2; elseif (y <= -5.6e-138) tmp = z * ((x + y) / t_1); elseif (y <= -3.1e-207) tmp = a; elseif (y <= 8.4e-274) tmp = z * (1.0 / ((t + (x + y)) / (x + y))); elseif (y <= 2.5e-25) tmp = t_2; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(y + t), $MachinePrecision] * a), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[y, -3.2e+26], t$95$3, If[LessEqual[y, -4.3e-51], t$95$2, If[LessEqual[y, -5.6e-138], N[(z * N[(N[(x + y), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -3.1e-207], a, If[LessEqual[y, 8.4e-274], N[(z * N[(1.0 / N[(N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.5e-25], t$95$2, t$95$3]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + \left(x + t\right)\\
t_2 := \frac{\left(y + t\right) \cdot a - y \cdot b}{t\_1}\\
t_3 := \left(z + a\right) - b\\
\mathbf{if}\;y \leq -3.2 \cdot 10^{+26}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;y \leq -4.3 \cdot 10^{-51}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -5.6 \cdot 10^{-138}:\\
\;\;\;\;z \cdot \frac{x + y}{t\_1}\\
\mathbf{elif}\;y \leq -3.1 \cdot 10^{-207}:\\
\;\;\;\;a\\
\mathbf{elif}\;y \leq 8.4 \cdot 10^{-274}:\\
\;\;\;\;z \cdot \frac{1}{\frac{t + \left(x + y\right)}{x + y}}\\
\mathbf{elif}\;y \leq 2.5 \cdot 10^{-25}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if y < -3.20000000000000029e26 or 2.49999999999999981e-25 < y Initial program 47.7%
Taylor expanded in y around inf 76.3%
if -3.20000000000000029e26 < y < -4.2999999999999997e-51 or 8.39999999999999977e-274 < y < 2.49999999999999981e-25Initial program 83.6%
Taylor expanded in z around 0 61.8%
*-commutative61.8%
Simplified61.8%
if -4.2999999999999997e-51 < y < -5.60000000000000002e-138Initial program 91.4%
Taylor expanded in z around inf 75.6%
associate-/l*75.8%
+-commutative75.8%
associate-+r+75.8%
Simplified75.8%
if -5.60000000000000002e-138 < y < -3.1000000000000001e-207Initial program 67.2%
Taylor expanded in t around inf 61.7%
if -3.1000000000000001e-207 < y < 8.39999999999999977e-274Initial program 66.8%
Taylor expanded in z around inf 40.3%
associate-/l*55.6%
+-commutative55.6%
associate-+r+55.6%
Simplified55.6%
clear-num55.7%
inv-pow55.7%
associate-+l+55.7%
+-commutative55.7%
Applied egg-rr55.7%
unpow-155.7%
Simplified55.7%
Final simplification69.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ z a) b))
(t_2 (* z (+ x y)))
(t_3 (+ y (+ x t)))
(t_4 (* a (/ (+ y t) t_3))))
(if (<= a -1.2e+156)
t_4
(if (<= a -3500000.0)
(* z (+ 1.0 (/ (* y (- a b)) t_2)))
(if (<= a -1.2e-174)
t_1
(if (<= a 0.19)
(/ (- t_2 (* y b)) t_3)
(if (<= a 1.5e+96) t_1 t_4)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z + a) - b;
double t_2 = z * (x + y);
double t_3 = y + (x + t);
double t_4 = a * ((y + t) / t_3);
double tmp;
if (a <= -1.2e+156) {
tmp = t_4;
} else if (a <= -3500000.0) {
tmp = z * (1.0 + ((y * (a - b)) / t_2));
} else if (a <= -1.2e-174) {
tmp = t_1;
} else if (a <= 0.19) {
tmp = (t_2 - (y * b)) / t_3;
} else if (a <= 1.5e+96) {
tmp = t_1;
} else {
tmp = t_4;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = (z + a) - b
t_2 = z * (x + y)
t_3 = y + (x + t)
t_4 = a * ((y + t) / t_3)
if (a <= (-1.2d+156)) then
tmp = t_4
else if (a <= (-3500000.0d0)) then
tmp = z * (1.0d0 + ((y * (a - b)) / t_2))
else if (a <= (-1.2d-174)) then
tmp = t_1
else if (a <= 0.19d0) then
tmp = (t_2 - (y * b)) / t_3
else if (a <= 1.5d+96) then
tmp = t_1
else
tmp = t_4
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z + a) - b;
double t_2 = z * (x + y);
double t_3 = y + (x + t);
double t_4 = a * ((y + t) / t_3);
double tmp;
if (a <= -1.2e+156) {
tmp = t_4;
} else if (a <= -3500000.0) {
tmp = z * (1.0 + ((y * (a - b)) / t_2));
} else if (a <= -1.2e-174) {
tmp = t_1;
} else if (a <= 0.19) {
tmp = (t_2 - (y * b)) / t_3;
} else if (a <= 1.5e+96) {
tmp = t_1;
} else {
tmp = t_4;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (z + a) - b t_2 = z * (x + y) t_3 = y + (x + t) t_4 = a * ((y + t) / t_3) tmp = 0 if a <= -1.2e+156: tmp = t_4 elif a <= -3500000.0: tmp = z * (1.0 + ((y * (a - b)) / t_2)) elif a <= -1.2e-174: tmp = t_1 elif a <= 0.19: tmp = (t_2 - (y * b)) / t_3 elif a <= 1.5e+96: tmp = t_1 else: tmp = t_4 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(z + a) - b) t_2 = Float64(z * Float64(x + y)) t_3 = Float64(y + Float64(x + t)) t_4 = Float64(a * Float64(Float64(y + t) / t_3)) tmp = 0.0 if (a <= -1.2e+156) tmp = t_4; elseif (a <= -3500000.0) tmp = Float64(z * Float64(1.0 + Float64(Float64(y * Float64(a - b)) / t_2))); elseif (a <= -1.2e-174) tmp = t_1; elseif (a <= 0.19) tmp = Float64(Float64(t_2 - Float64(y * b)) / t_3); elseif (a <= 1.5e+96) tmp = t_1; else tmp = t_4; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (z + a) - b; t_2 = z * (x + y); t_3 = y + (x + t); t_4 = a * ((y + t) / t_3); tmp = 0.0; if (a <= -1.2e+156) tmp = t_4; elseif (a <= -3500000.0) tmp = z * (1.0 + ((y * (a - b)) / t_2)); elseif (a <= -1.2e-174) tmp = t_1; elseif (a <= 0.19) tmp = (t_2 - (y * b)) / t_3; elseif (a <= 1.5e+96) tmp = t_1; else tmp = t_4; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(a * N[(N[(y + t), $MachinePrecision] / t$95$3), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.2e+156], t$95$4, If[LessEqual[a, -3500000.0], N[(z * N[(1.0 + N[(N[(y * N[(a - b), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -1.2e-174], t$95$1, If[LessEqual[a, 0.19], N[(N[(t$95$2 - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision], If[LessEqual[a, 1.5e+96], t$95$1, t$95$4]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z + a\right) - b\\
t_2 := z \cdot \left(x + y\right)\\
t_3 := y + \left(x + t\right)\\
t_4 := a \cdot \frac{y + t}{t\_3}\\
\mathbf{if}\;a \leq -1.2 \cdot 10^{+156}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;a \leq -3500000:\\
\;\;\;\;z \cdot \left(1 + \frac{y \cdot \left(a - b\right)}{t\_2}\right)\\
\mathbf{elif}\;a \leq -1.2 \cdot 10^{-174}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 0.19:\\
\;\;\;\;\frac{t\_2 - y \cdot b}{t\_3}\\
\mathbf{elif}\;a \leq 1.5 \cdot 10^{+96}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\end{array}
\end{array}
if a < -1.2000000000000001e156 or 1.5e96 < a Initial program 37.5%
Taylor expanded in a around inf 27.7%
associate-/l*76.4%
associate-+r+76.4%
Simplified76.4%
if -1.2000000000000001e156 < a < -3.5e6Initial program 87.5%
Taylor expanded in z around -inf 95.7%
mul-1-neg95.7%
distribute-rgt-neg-in95.7%
mul-1-neg95.7%
unsub-neg95.7%
Simplified95.7%
Taylor expanded in t around 0 78.7%
associate--l+78.7%
div-sub78.7%
distribute-rgt-out--78.7%
*-commutative78.7%
+-commutative78.7%
Simplified78.7%
if -3.5e6 < a < -1.2e-174 or 0.19 < a < 1.5e96Initial program 59.1%
Taylor expanded in y around inf 61.4%
if -1.2e-174 < a < 0.19Initial program 78.7%
Taylor expanded in a around 0 68.5%
+-commutative68.5%
*-commutative68.5%
Simplified68.5%
Final simplification70.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (+ x t))) (t_2 (- (+ z a) b)))
(if (<= y -6.5e+26)
t_2
(if (<= y -8.6e-44)
(/ (- (* (+ y t) a) (* y b)) t_1)
(if (<= y 1.65e-187)
(* z (+ (/ x (+ x t)) (* (/ a z) (/ t (+ x t)))))
(if (<= y 5.6e-20) (/ (- (* z (+ x y)) (* y b)) t_1) t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (x + t);
double t_2 = (z + a) - b;
double tmp;
if (y <= -6.5e+26) {
tmp = t_2;
} else if (y <= -8.6e-44) {
tmp = (((y + t) * a) - (y * b)) / t_1;
} else if (y <= 1.65e-187) {
tmp = z * ((x / (x + t)) + ((a / z) * (t / (x + t))));
} else if (y <= 5.6e-20) {
tmp = ((z * (x + y)) - (y * b)) / t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = y + (x + t)
t_2 = (z + a) - b
if (y <= (-6.5d+26)) then
tmp = t_2
else if (y <= (-8.6d-44)) then
tmp = (((y + t) * a) - (y * b)) / t_1
else if (y <= 1.65d-187) then
tmp = z * ((x / (x + t)) + ((a / z) * (t / (x + t))))
else if (y <= 5.6d-20) then
tmp = ((z * (x + y)) - (y * b)) / 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 b) {
double t_1 = y + (x + t);
double t_2 = (z + a) - b;
double tmp;
if (y <= -6.5e+26) {
tmp = t_2;
} else if (y <= -8.6e-44) {
tmp = (((y + t) * a) - (y * b)) / t_1;
} else if (y <= 1.65e-187) {
tmp = z * ((x / (x + t)) + ((a / z) * (t / (x + t))));
} else if (y <= 5.6e-20) {
tmp = ((z * (x + y)) - (y * b)) / t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = y + (x + t) t_2 = (z + a) - b tmp = 0 if y <= -6.5e+26: tmp = t_2 elif y <= -8.6e-44: tmp = (((y + t) * a) - (y * b)) / t_1 elif y <= 1.65e-187: tmp = z * ((x / (x + t)) + ((a / z) * (t / (x + t)))) elif y <= 5.6e-20: tmp = ((z * (x + y)) - (y * b)) / t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(x + t)) t_2 = Float64(Float64(z + a) - b) tmp = 0.0 if (y <= -6.5e+26) tmp = t_2; elseif (y <= -8.6e-44) tmp = Float64(Float64(Float64(Float64(y + t) * a) - Float64(y * b)) / t_1); elseif (y <= 1.65e-187) tmp = Float64(z * Float64(Float64(x / Float64(x + t)) + Float64(Float64(a / z) * Float64(t / Float64(x + t))))); elseif (y <= 5.6e-20) tmp = Float64(Float64(Float64(z * Float64(x + y)) - Float64(y * b)) / t_1); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = y + (x + t); t_2 = (z + a) - b; tmp = 0.0; if (y <= -6.5e+26) tmp = t_2; elseif (y <= -8.6e-44) tmp = (((y + t) * a) - (y * b)) / t_1; elseif (y <= 1.65e-187) tmp = z * ((x / (x + t)) + ((a / z) * (t / (x + t)))); elseif (y <= 5.6e-20) tmp = ((z * (x + y)) - (y * b)) / t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[y, -6.5e+26], t$95$2, If[LessEqual[y, -8.6e-44], N[(N[(N[(N[(y + t), $MachinePrecision] * a), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[y, 1.65e-187], N[(z * N[(N[(x / N[(x + t), $MachinePrecision]), $MachinePrecision] + N[(N[(a / z), $MachinePrecision] * N[(t / N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 5.6e-20], N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + \left(x + t\right)\\
t_2 := \left(z + a\right) - b\\
\mathbf{if}\;y \leq -6.5 \cdot 10^{+26}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;y \leq -8.6 \cdot 10^{-44}:\\
\;\;\;\;\frac{\left(y + t\right) \cdot a - y \cdot b}{t\_1}\\
\mathbf{elif}\;y \leq 1.65 \cdot 10^{-187}:\\
\;\;\;\;z \cdot \left(\frac{x}{x + t} + \frac{a}{z} \cdot \frac{t}{x + t}\right)\\
\mathbf{elif}\;y \leq 5.6 \cdot 10^{-20}:\\
\;\;\;\;\frac{z \cdot \left(x + y\right) - y \cdot b}{t\_1}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if y < -6.50000000000000022e26 or 5.6000000000000005e-20 < y Initial program 47.7%
Taylor expanded in y around inf 76.3%
if -6.50000000000000022e26 < y < -8.60000000000000027e-44Initial program 76.1%
Taylor expanded in z around 0 76.0%
*-commutative76.0%
Simplified76.0%
if -8.60000000000000027e-44 < y < 1.65e-187Initial program 75.2%
Taylor expanded in z around -inf 80.2%
mul-1-neg80.2%
distribute-rgt-neg-in80.2%
mul-1-neg80.2%
unsub-neg80.2%
Simplified80.2%
Taylor expanded in b around inf 63.9%
fma-define63.9%
+-commutative63.9%
associate-/l*61.3%
Simplified70.2%
Taylor expanded in y around 0 71.7%
+-commutative71.7%
times-frac79.4%
+-commutative79.4%
Simplified79.4%
if 1.65e-187 < y < 5.6000000000000005e-20Initial program 85.5%
Taylor expanded in a around 0 67.8%
+-commutative67.8%
*-commutative67.8%
Simplified67.8%
Final simplification76.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= t -4e+135)
(* a (/ t (+ x t)))
(if (<= t -2.1e-116)
(- (+ z a) b)
(if (<= t 6.8e+120)
(* z (+ 1.0 (/ (* y (- a b)) (* z (+ x y)))))
(* a (/ (+ y t) (+ y (+ x t))))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -4e+135) {
tmp = a * (t / (x + t));
} else if (t <= -2.1e-116) {
tmp = (z + a) - b;
} else if (t <= 6.8e+120) {
tmp = z * (1.0 + ((y * (a - b)) / (z * (x + y))));
} else {
tmp = a * ((y + t) / (y + (x + t)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if (t <= (-4d+135)) then
tmp = a * (t / (x + t))
else if (t <= (-2.1d-116)) then
tmp = (z + a) - b
else if (t <= 6.8d+120) then
tmp = z * (1.0d0 + ((y * (a - b)) / (z * (x + y))))
else
tmp = a * ((y + t) / (y + (x + t)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -4e+135) {
tmp = a * (t / (x + t));
} else if (t <= -2.1e-116) {
tmp = (z + a) - b;
} else if (t <= 6.8e+120) {
tmp = z * (1.0 + ((y * (a - b)) / (z * (x + y))));
} else {
tmp = a * ((y + t) / (y + (x + t)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -4e+135: tmp = a * (t / (x + t)) elif t <= -2.1e-116: tmp = (z + a) - b elif t <= 6.8e+120: tmp = z * (1.0 + ((y * (a - b)) / (z * (x + y)))) else: tmp = a * ((y + t) / (y + (x + t))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -4e+135) tmp = Float64(a * Float64(t / Float64(x + t))); elseif (t <= -2.1e-116) tmp = Float64(Float64(z + a) - b); elseif (t <= 6.8e+120) tmp = Float64(z * Float64(1.0 + Float64(Float64(y * Float64(a - b)) / Float64(z * Float64(x + y))))); else tmp = Float64(a * Float64(Float64(y + t) / Float64(y + Float64(x + t)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -4e+135) tmp = a * (t / (x + t)); elseif (t <= -2.1e-116) tmp = (z + a) - b; elseif (t <= 6.8e+120) tmp = z * (1.0 + ((y * (a - b)) / (z * (x + y)))); else tmp = a * ((y + t) / (y + (x + t))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -4e+135], N[(a * N[(t / N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, -2.1e-116], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], If[LessEqual[t, 6.8e+120], N[(z * N[(1.0 + N[(N[(y * N[(a - b), $MachinePrecision]), $MachinePrecision] / N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(y + t), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+135}:\\
\;\;\;\;a \cdot \frac{t}{x + t}\\
\mathbf{elif}\;t \leq -2.1 \cdot 10^{-116}:\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{elif}\;t \leq 6.8 \cdot 10^{+120}:\\
\;\;\;\;z \cdot \left(1 + \frac{y \cdot \left(a - b\right)}{z \cdot \left(x + y\right)}\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{y + t}{y + \left(x + t\right)}\\
\end{array}
\end{array}
if t < -3.99999999999999985e135Initial program 52.5%
Taylor expanded in z around 0 35.5%
*-commutative35.5%
Simplified35.5%
Taylor expanded in y around 0 26.9%
associate-/l*60.1%
+-commutative60.1%
Simplified60.1%
if -3.99999999999999985e135 < t < -2.0999999999999999e-116Initial program 60.9%
Taylor expanded in y around inf 56.8%
if -2.0999999999999999e-116 < t < 6.79999999999999998e120Initial program 73.5%
Taylor expanded in z around -inf 80.3%
mul-1-neg80.3%
distribute-rgt-neg-in80.3%
mul-1-neg80.3%
unsub-neg80.3%
Simplified80.3%
Taylor expanded in t around 0 71.2%
associate--l+71.2%
div-sub71.3%
distribute-rgt-out--71.3%
*-commutative71.3%
+-commutative71.3%
Simplified71.3%
if 6.79999999999999998e120 < t Initial program 35.3%
Taylor expanded in a around inf 21.3%
associate-/l*49.4%
associate-+r+49.4%
Simplified49.4%
Final simplification63.2%
(FPCore (x y z t a b)
:precision binary64
(if (<= x -2.2e+97)
z
(if (<= x -6.5e+31)
a
(if (<= x -4.2e-57) z (if (<= x 2.9e+119) (- a b) z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -2.2e+97) {
tmp = z;
} else if (x <= -6.5e+31) {
tmp = a;
} else if (x <= -4.2e-57) {
tmp = z;
} else if (x <= 2.9e+119) {
tmp = a - b;
} else {
tmp = z;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if (x <= (-2.2d+97)) then
tmp = z
else if (x <= (-6.5d+31)) then
tmp = a
else if (x <= (-4.2d-57)) then
tmp = z
else if (x <= 2.9d+119) then
tmp = a - b
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -2.2e+97) {
tmp = z;
} else if (x <= -6.5e+31) {
tmp = a;
} else if (x <= -4.2e-57) {
tmp = z;
} else if (x <= 2.9e+119) {
tmp = a - b;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -2.2e+97: tmp = z elif x <= -6.5e+31: tmp = a elif x <= -4.2e-57: tmp = z elif x <= 2.9e+119: tmp = a - b else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -2.2e+97) tmp = z; elseif (x <= -6.5e+31) tmp = a; elseif (x <= -4.2e-57) tmp = z; elseif (x <= 2.9e+119) tmp = Float64(a - b); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -2.2e+97) tmp = z; elseif (x <= -6.5e+31) tmp = a; elseif (x <= -4.2e-57) tmp = z; elseif (x <= 2.9e+119) tmp = a - b; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -2.2e+97], z, If[LessEqual[x, -6.5e+31], a, If[LessEqual[x, -4.2e-57], z, If[LessEqual[x, 2.9e+119], N[(a - b), $MachinePrecision], z]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.2 \cdot 10^{+97}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq -6.5 \cdot 10^{+31}:\\
\;\;\;\;a\\
\mathbf{elif}\;x \leq -4.2 \cdot 10^{-57}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{+119}:\\
\;\;\;\;a - b\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -2.2000000000000001e97 or -6.5000000000000004e31 < x < -4.1999999999999999e-57 or 2.90000000000000007e119 < x Initial program 54.0%
Taylor expanded in x around inf 52.1%
if -2.2000000000000001e97 < x < -6.5000000000000004e31Initial program 47.5%
Taylor expanded in t around inf 67.6%
if -4.1999999999999999e-57 < x < 2.90000000000000007e119Initial program 68.4%
Taylor expanded in z around 0 52.4%
*-commutative52.4%
Simplified52.4%
Taylor expanded in y around inf 52.0%
(FPCore (x y z t a b) :precision binary64 (if (or (<= x -4.9e+45) (not (<= x 2.4e+123))) (* z (/ (+ x y) (+ y (+ x t)))) (- (+ z a) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -4.9e+45) || !(x <= 2.4e+123)) {
tmp = z * ((x + y) / (y + (x + t)));
} else {
tmp = (z + a) - b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if ((x <= (-4.9d+45)) .or. (.not. (x <= 2.4d+123))) then
tmp = z * ((x + y) / (y + (x + t)))
else
tmp = (z + a) - b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -4.9e+45) || !(x <= 2.4e+123)) {
tmp = z * ((x + y) / (y + (x + t)));
} else {
tmp = (z + a) - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x <= -4.9e+45) or not (x <= 2.4e+123): tmp = z * ((x + y) / (y + (x + t))) else: tmp = (z + a) - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((x <= -4.9e+45) || !(x <= 2.4e+123)) tmp = Float64(z * Float64(Float64(x + y) / Float64(y + Float64(x + t)))); else tmp = Float64(Float64(z + a) - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x <= -4.9e+45) || ~((x <= 2.4e+123))) tmp = z * ((x + y) / (y + (x + t))); else tmp = (z + a) - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[x, -4.9e+45], N[Not[LessEqual[x, 2.4e+123]], $MachinePrecision]], N[(z * N[(N[(x + y), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.9 \cdot 10^{+45} \lor \neg \left(x \leq 2.4 \cdot 10^{+123}\right):\\
\;\;\;\;z \cdot \frac{x + y}{y + \left(x + t\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(z + a\right) - b\\
\end{array}
\end{array}
if x < -4.9000000000000002e45 or 2.39999999999999989e123 < x Initial program 51.4%
Taylor expanded in z around inf 33.0%
associate-/l*60.0%
+-commutative60.0%
associate-+r+60.0%
Simplified60.0%
if -4.9000000000000002e45 < x < 2.39999999999999989e123Initial program 67.5%
Taylor expanded in y around inf 64.2%
Final simplification62.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= x -1.4e+107) (not (<= x 3.7e+154))) (- z (/ (* y b) x)) (- (+ z a) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -1.4e+107) || !(x <= 3.7e+154)) {
tmp = z - ((y * b) / x);
} else {
tmp = (z + a) - b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if ((x <= (-1.4d+107)) .or. (.not. (x <= 3.7d+154))) then
tmp = z - ((y * b) / x)
else
tmp = (z + a) - b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -1.4e+107) || !(x <= 3.7e+154)) {
tmp = z - ((y * b) / x);
} else {
tmp = (z + a) - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x <= -1.4e+107) or not (x <= 3.7e+154): tmp = z - ((y * b) / x) else: tmp = (z + a) - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((x <= -1.4e+107) || !(x <= 3.7e+154)) tmp = Float64(z - Float64(Float64(y * b) / x)); else tmp = Float64(Float64(z + a) - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x <= -1.4e+107) || ~((x <= 3.7e+154))) tmp = z - ((y * b) / x); else tmp = (z + a) - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[x, -1.4e+107], N[Not[LessEqual[x, 3.7e+154]], $MachinePrecision]], N[(z - N[(N[(y * b), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+107} \lor \neg \left(x \leq 3.7 \cdot 10^{+154}\right):\\
\;\;\;\;z - \frac{y \cdot b}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(z + a\right) - b\\
\end{array}
\end{array}
if x < -1.39999999999999992e107 or 3.69999999999999994e154 < x Initial program 53.0%
Taylor expanded in a around 0 42.2%
+-commutative42.2%
*-commutative42.2%
Simplified42.2%
Taylor expanded in t around 0 42.2%
Taylor expanded in x around inf 60.8%
mul-1-neg60.8%
distribute-frac-neg260.8%
Simplified60.8%
if -1.39999999999999992e107 < x < 3.69999999999999994e154Initial program 65.7%
Taylor expanded in y around inf 63.6%
Final simplification62.8%
(FPCore (x y z t a b) :precision binary64 (if (<= x -1.75e+135) z (if (<= x 4.8e+156) (- (+ z a) b) z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.75e+135) {
tmp = z;
} else if (x <= 4.8e+156) {
tmp = (z + a) - b;
} else {
tmp = z;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if (x <= (-1.75d+135)) then
tmp = z
else if (x <= 4.8d+156) then
tmp = (z + a) - b
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.75e+135) {
tmp = z;
} else if (x <= 4.8e+156) {
tmp = (z + a) - b;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -1.75e+135: tmp = z elif x <= 4.8e+156: tmp = (z + a) - b else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -1.75e+135) tmp = z; elseif (x <= 4.8e+156) tmp = Float64(Float64(z + a) - b); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -1.75e+135) tmp = z; elseif (x <= 4.8e+156) tmp = (z + a) - b; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.75e+135], z, If[LessEqual[x, 4.8e+156], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.75 \cdot 10^{+135}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+156}:\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -1.7500000000000001e135 or 4.8000000000000002e156 < x Initial program 57.4%
Taylor expanded in x around inf 56.0%
if -1.7500000000000001e135 < x < 4.8000000000000002e156Initial program 63.8%
Taylor expanded in y around inf 62.2%
Final simplification60.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= z -4.1e+75) (not (<= z 7.6e+142))) (- z b) (- a b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -4.1e+75) || !(z <= 7.6e+142)) {
tmp = z - b;
} else {
tmp = a - b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if ((z <= (-4.1d+75)) .or. (.not. (z <= 7.6d+142))) then
tmp = z - b
else
tmp = a - b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -4.1e+75) || !(z <= 7.6e+142)) {
tmp = z - b;
} else {
tmp = a - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (z <= -4.1e+75) or not (z <= 7.6e+142): tmp = z - b else: tmp = a - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -4.1e+75) || !(z <= 7.6e+142)) tmp = Float64(z - b); else tmp = Float64(a - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((z <= -4.1e+75) || ~((z <= 7.6e+142))) tmp = z - b; else tmp = a - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -4.1e+75], N[Not[LessEqual[z, 7.6e+142]], $MachinePrecision]], N[(z - b), $MachinePrecision], N[(a - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.1 \cdot 10^{+75} \lor \neg \left(z \leq 7.6 \cdot 10^{+142}\right):\\
\;\;\;\;z - b\\
\mathbf{else}:\\
\;\;\;\;a - b\\
\end{array}
\end{array}
if z < -4.0999999999999998e75 or 7.59999999999999979e142 < z Initial program 39.2%
Taylor expanded in a around 0 34.5%
+-commutative34.5%
*-commutative34.5%
Simplified34.5%
Taylor expanded in y around inf 58.0%
if -4.0999999999999998e75 < z < 7.59999999999999979e142Initial program 73.4%
Taylor expanded in z around 0 53.3%
*-commutative53.3%
Simplified53.3%
Taylor expanded in y around inf 46.5%
Final simplification50.3%
(FPCore (x y z t a b) :precision binary64 (if (<= z -9.4e+76) z (if (<= z 7.5e+142) a z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -9.4e+76) {
tmp = z;
} else if (z <= 7.5e+142) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: tmp
if (z <= (-9.4d+76)) then
tmp = z
else if (z <= 7.5d+142) then
tmp = a
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -9.4e+76) {
tmp = z;
} else if (z <= 7.5e+142) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -9.4e+76: tmp = z elif z <= 7.5e+142: tmp = a else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -9.4e+76) tmp = z; elseif (z <= 7.5e+142) tmp = a; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -9.4e+76) tmp = z; elseif (z <= 7.5e+142) tmp = a; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -9.4e+76], z, If[LessEqual[z, 7.5e+142], a, z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.4 \cdot 10^{+76}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 7.5 \cdot 10^{+142}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -9.4000000000000006e76 or 7.5000000000000002e142 < z Initial program 39.2%
Taylor expanded in x around inf 55.6%
if -9.4000000000000006e76 < z < 7.5000000000000002e142Initial program 73.4%
Taylor expanded in t around inf 42.4%
(FPCore (x y z t a b) :precision binary64 a)
double code(double x, double y, double z, double t, double a, double b) {
return a;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
code = a
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a;
}
def code(x, y, z, t, a, b): return a
function code(x, y, z, t, a, b) return a end
function tmp = code(x, y, z, t, a, b) tmp = a; end
code[x_, y_, z_, t_, a_, b_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 62.2%
Taylor expanded in t around inf 34.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)))
(t_3 (/ t_2 t_1))
(t_4 (- (+ z a) b)))
(if (< t_3 -3.5813117084150564e+153)
t_4
(if (< t_3 1.2285964308315609e+82) (/ 1.0 (/ t_1 t_2)) t_4))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b);
double t_3 = t_2 / t_1;
double t_4 = (z + a) - b;
double tmp;
if (t_3 < -3.5813117084150564e+153) {
tmp = t_4;
} else if (t_3 < 1.2285964308315609e+82) {
tmp = 1.0 / (t_1 / t_2);
} else {
tmp = t_4;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = (x + t) + y
t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b)
t_3 = t_2 / t_1
t_4 = (z + a) - b
if (t_3 < (-3.5813117084150564d+153)) then
tmp = t_4
else if (t_3 < 1.2285964308315609d+82) then
tmp = 1.0d0 / (t_1 / t_2)
else
tmp = t_4
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b);
double t_3 = t_2 / t_1;
double t_4 = (z + a) - b;
double tmp;
if (t_3 < -3.5813117084150564e+153) {
tmp = t_4;
} else if (t_3 < 1.2285964308315609e+82) {
tmp = 1.0 / (t_1 / t_2);
} else {
tmp = t_4;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x + t) + y t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b) t_3 = t_2 / t_1 t_4 = (z + a) - b tmp = 0 if t_3 < -3.5813117084150564e+153: tmp = t_4 elif t_3 < 1.2285964308315609e+82: tmp = 1.0 / (t_1 / t_2) else: tmp = t_4 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) t_3 = Float64(t_2 / t_1) t_4 = Float64(Float64(z + a) - b) tmp = 0.0 if (t_3 < -3.5813117084150564e+153) tmp = t_4; elseif (t_3 < 1.2285964308315609e+82) tmp = Float64(1.0 / Float64(t_1 / t_2)); else tmp = t_4; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x + t) + y; t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b); t_3 = t_2 / t_1; t_4 = (z + a) - b; tmp = 0.0; if (t_3 < -3.5813117084150564e+153) tmp = t_4; elseif (t_3 < 1.2285964308315609e+82) tmp = 1.0 / (t_1 / t_2); else tmp = t_4; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[Less[t$95$3, -3.5813117084150564e+153], t$95$4, If[Less[t$95$3, 1.2285964308315609e+82], N[(1.0 / N[(t$95$1 / t$95$2), $MachinePrecision]), $MachinePrecision], t$95$4]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b\\
t_3 := \frac{t\_2}{t\_1}\\
t_4 := \left(z + a\right) - b\\
\mathbf{if}\;t\_3 < -3.5813117084150564 \cdot 10^{+153}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 < 1.2285964308315609 \cdot 10^{+82}:\\
\;\;\;\;\frac{1}{\frac{t\_1}{t\_2}}\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\end{array}
\end{array}
herbie shell --seed 2024101
(FPCore (x y z t a b)
:name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
:precision binary64
:alt
(if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) -3.5813117084150564e+153) (- (+ z a) b) (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) 1.2285964308315609e+82) (/ 1.0 (/ (+ (+ x t) y) (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)))) (- (+ z a) b)))
(/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))