
(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 (+ x t)))
(t_2 (/ a (/ t_1 (+ y t))))
(t_3 (/ (- z b) (/ t_1 y))))
(if (or (<= x -4.5e+89) (not (<= x 2e+22)))
(+ t_3 (+ z t_2))
(+ t_3 (+ t_2 (/ (* x z) t_1))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (x + t);
double t_2 = a / (t_1 / (y + t));
double t_3 = (z - b) / (t_1 / y);
double tmp;
if ((x <= -4.5e+89) || !(x <= 2e+22)) {
tmp = t_3 + (z + t_2);
} else {
tmp = t_3 + (t_2 + ((x * z) / t_1));
}
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 = a / (t_1 / (y + t))
t_3 = (z - b) / (t_1 / y)
if ((x <= (-4.5d+89)) .or. (.not. (x <= 2d+22))) then
tmp = t_3 + (z + t_2)
else
tmp = t_3 + (t_2 + ((x * z) / t_1))
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 = a / (t_1 / (y + t));
double t_3 = (z - b) / (t_1 / y);
double tmp;
if ((x <= -4.5e+89) || !(x <= 2e+22)) {
tmp = t_3 + (z + t_2);
} else {
tmp = t_3 + (t_2 + ((x * z) / t_1));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = y + (x + t) t_2 = a / (t_1 / (y + t)) t_3 = (z - b) / (t_1 / y) tmp = 0 if (x <= -4.5e+89) or not (x <= 2e+22): tmp = t_3 + (z + t_2) else: tmp = t_3 + (t_2 + ((x * z) / t_1)) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(x + t)) t_2 = Float64(a / Float64(t_1 / Float64(y + t))) t_3 = Float64(Float64(z - b) / Float64(t_1 / y)) tmp = 0.0 if ((x <= -4.5e+89) || !(x <= 2e+22)) tmp = Float64(t_3 + Float64(z + t_2)); else tmp = Float64(t_3 + Float64(t_2 + Float64(Float64(x * z) / t_1))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = y + (x + t); t_2 = a / (t_1 / (y + t)); t_3 = (z - b) / (t_1 / y); tmp = 0.0; if ((x <= -4.5e+89) || ~((x <= 2e+22))) tmp = t_3 + (z + t_2); else tmp = t_3 + (t_2 + ((x * z) / t_1)); 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[(a / N[(t$95$1 / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(z - b), $MachinePrecision] / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[x, -4.5e+89], N[Not[LessEqual[x, 2e+22]], $MachinePrecision]], N[(t$95$3 + N[(z + t$95$2), $MachinePrecision]), $MachinePrecision], N[(t$95$3 + N[(t$95$2 + N[(N[(x * z), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + \left(x + t\right)\\
t_2 := \frac{a}{\frac{t_1}{y + t}}\\
t_3 := \frac{z - b}{\frac{t_1}{y}}\\
\mathbf{if}\;x \leq -4.5 \cdot 10^{+89} \lor \neg \left(x \leq 2 \cdot 10^{+22}\right):\\
\;\;\;\;t_3 + \left(z + t_2\right)\\
\mathbf{else}:\\
\;\;\;\;t_3 + \left(t_2 + \frac{x \cdot z}{t_1}\right)\\
\end{array}
\end{array}
if x < -4.5e89 or 2e22 < x Initial program 46.1%
Simplified46.3%
Taylor expanded in a around inf 45.9%
associate-/l*50.9%
+-commutative50.9%
associate-/l*63.8%
Simplified63.8%
Taylor expanded in x around inf 87.5%
if -4.5e89 < x < 2e22Initial program 66.3%
Simplified66.6%
Taylor expanded in a around inf 66.3%
associate-/l*76.8%
+-commutative76.8%
associate-/l*97.5%
Simplified97.5%
Final simplification93.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* z (+ x y)) (* a (+ y t))) (* b y)) (+ y (+ x t)))))
(if (or (<= t_1 -1.5e+290) (not (<= t_1 2e+274)))
(+ a (/ (- z b) (/ (+ y t) y)))
t_1)))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (((z * (x + y)) + (a * (y + t))) - (b * y)) / (y + (x + t));
double tmp;
if ((t_1 <= -1.5e+290) || !(t_1 <= 2e+274)) {
tmp = a + ((z - b) / ((y + t) / y));
} else {
tmp = t_1;
}
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) :: tmp
t_1 = (((z * (x + y)) + (a * (y + t))) - (b * y)) / (y + (x + t))
if ((t_1 <= (-1.5d+290)) .or. (.not. (t_1 <= 2d+274))) then
tmp = a + ((z - b) / ((y + t) / y))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (((z * (x + y)) + (a * (y + t))) - (b * y)) / (y + (x + t));
double tmp;
if ((t_1 <= -1.5e+290) || !(t_1 <= 2e+274)) {
tmp = a + ((z - b) / ((y + t) / y));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (((z * (x + y)) + (a * (y + t))) - (b * y)) / (y + (x + t)) tmp = 0 if (t_1 <= -1.5e+290) or not (t_1 <= 2e+274): tmp = a + ((z - b) / ((y + t) / y)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(z * Float64(x + y)) + Float64(a * Float64(y + t))) - Float64(b * y)) / Float64(y + Float64(x + t))) tmp = 0.0 if ((t_1 <= -1.5e+290) || !(t_1 <= 2e+274)) tmp = Float64(a + Float64(Float64(z - b) / Float64(Float64(y + t) / y))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (((z * (x + y)) + (a * (y + t))) - (b * y)) / (y + (x + t)); tmp = 0.0; if ((t_1 <= -1.5e+290) || ~((t_1 <= 2e+274))) tmp = a + ((z - b) / ((y + t) / y)); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(a * N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * y), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1.5e+290], N[Not[LessEqual[t$95$1, 2e+274]], $MachinePrecision]], N[(a + N[(N[(z - b), $MachinePrecision] / N[(N[(y + t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(z \cdot \left(x + y\right) + a \cdot \left(y + t\right)\right) - b \cdot y}{y + \left(x + t\right)}\\
\mathbf{if}\;t_1 \leq -1.5 \cdot 10^{+290} \lor \neg \left(t_1 \leq 2 \cdot 10^{+274}\right):\\
\;\;\;\;a + \frac{z - b}{\frac{y + t}{y}}\\
\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)) < -1.5e290 or 1.99999999999999984e274 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 7.5%
Simplified8.1%
Taylor expanded in x around 0 11.9%
Taylor expanded in a around 0 37.7%
+-commutative37.7%
associate-/l*79.2%
Simplified79.2%
if -1.5e290 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.99999999999999984e274Initial program 99.6%
Final simplification90.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (+ x t)))
(t_2 (/ (- (+ (* z (+ x y)) (* a (+ y t))) (* b y)) t_1)))
(if (<= t_2 -1.5e+290)
(+ (/ (- z b) (/ t_1 y)) (+ z (/ a (/ t_1 (+ y t)))))
(if (<= t_2 2e+274) t_2 (+ a (/ (- z b) (/ (+ y t) y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (x + t);
double t_2 = (((z * (x + y)) + (a * (y + t))) - (b * y)) / t_1;
double tmp;
if (t_2 <= -1.5e+290) {
tmp = ((z - b) / (t_1 / y)) + (z + (a / (t_1 / (y + t))));
} else if (t_2 <= 2e+274) {
tmp = t_2;
} else {
tmp = a + ((z - b) / ((y + t) / y));
}
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 * (x + y)) + (a * (y + t))) - (b * y)) / t_1
if (t_2 <= (-1.5d+290)) then
tmp = ((z - b) / (t_1 / y)) + (z + (a / (t_1 / (y + t))))
else if (t_2 <= 2d+274) then
tmp = t_2
else
tmp = a + ((z - b) / ((y + t) / y))
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 * (x + y)) + (a * (y + t))) - (b * y)) / t_1;
double tmp;
if (t_2 <= -1.5e+290) {
tmp = ((z - b) / (t_1 / y)) + (z + (a / (t_1 / (y + t))));
} else if (t_2 <= 2e+274) {
tmp = t_2;
} else {
tmp = a + ((z - b) / ((y + t) / y));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = y + (x + t) t_2 = (((z * (x + y)) + (a * (y + t))) - (b * y)) / t_1 tmp = 0 if t_2 <= -1.5e+290: tmp = ((z - b) / (t_1 / y)) + (z + (a / (t_1 / (y + t)))) elif t_2 <= 2e+274: tmp = t_2 else: tmp = a + ((z - b) / ((y + t) / y)) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(x + t)) t_2 = Float64(Float64(Float64(Float64(z * Float64(x + y)) + Float64(a * Float64(y + t))) - Float64(b * y)) / t_1) tmp = 0.0 if (t_2 <= -1.5e+290) tmp = Float64(Float64(Float64(z - b) / Float64(t_1 / y)) + Float64(z + Float64(a / Float64(t_1 / Float64(y + t))))); elseif (t_2 <= 2e+274) tmp = t_2; else tmp = Float64(a + Float64(Float64(z - b) / Float64(Float64(y + t) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = y + (x + t); t_2 = (((z * (x + y)) + (a * (y + t))) - (b * y)) / t_1; tmp = 0.0; if (t_2 <= -1.5e+290) tmp = ((z - b) / (t_1 / y)) + (z + (a / (t_1 / (y + t)))); elseif (t_2 <= 2e+274) tmp = t_2; else tmp = a + ((z - b) / ((y + t) / y)); 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[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(a * N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(b * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -1.5e+290], N[(N[(N[(z - b), $MachinePrecision] / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision] + N[(z + N[(a / N[(t$95$1 / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+274], t$95$2, N[(a + N[(N[(z - b), $MachinePrecision] / N[(N[(y + t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + \left(x + t\right)\\
t_2 := \frac{\left(z \cdot \left(x + y\right) + a \cdot \left(y + t\right)\right) - b \cdot y}{t_1}\\
\mathbf{if}\;t_2 \leq -1.5 \cdot 10^{+290}:\\
\;\;\;\;\frac{z - b}{\frac{t_1}{y}} + \left(z + \frac{a}{\frac{t_1}{y + t}}\right)\\
\mathbf{elif}\;t_2 \leq 2 \cdot 10^{+274}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;a + \frac{z - b}{\frac{y + t}{y}}\\
\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)) < -1.5e290Initial program 8.7%
Simplified8.4%
Taylor expanded in a around inf 8.2%
associate-/l*22.9%
+-commutative22.9%
associate-/l*62.4%
Simplified62.4%
Taylor expanded in x around inf 87.9%
if -1.5e290 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.99999999999999984e274Initial program 99.6%
if 1.99999999999999984e274 < (/.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%
Simplified7.8%
Taylor expanded in x around 0 10.8%
Taylor expanded in a around 0 31.6%
+-commutative31.6%
associate-/l*82.5%
Simplified82.5%
Final simplification93.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (+ x t))) (t_2 (+ z (* y (/ (- z b) t_1)))))
(if (<= x -1.5e+106)
t_2
(if (<= x 2.9e+71)
(+ a (/ (- z b) (/ (+ y t) y)))
(if (or (<= x 3.4e+221) (not (<= x 2.5e+273)))
t_2
(* (+ y t) (/ a t_1)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (x + t);
double t_2 = z + (y * ((z - b) / t_1));
double tmp;
if (x <= -1.5e+106) {
tmp = t_2;
} else if (x <= 2.9e+71) {
tmp = a + ((z - b) / ((y + t) / y));
} else if ((x <= 3.4e+221) || !(x <= 2.5e+273)) {
tmp = t_2;
} else {
tmp = (y + t) * (a / t_1);
}
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 + (y * ((z - b) / t_1))
if (x <= (-1.5d+106)) then
tmp = t_2
else if (x <= 2.9d+71) then
tmp = a + ((z - b) / ((y + t) / y))
else if ((x <= 3.4d+221) .or. (.not. (x <= 2.5d+273))) then
tmp = t_2
else
tmp = (y + t) * (a / t_1)
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 + (y * ((z - b) / t_1));
double tmp;
if (x <= -1.5e+106) {
tmp = t_2;
} else if (x <= 2.9e+71) {
tmp = a + ((z - b) / ((y + t) / y));
} else if ((x <= 3.4e+221) || !(x <= 2.5e+273)) {
tmp = t_2;
} else {
tmp = (y + t) * (a / t_1);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = y + (x + t) t_2 = z + (y * ((z - b) / t_1)) tmp = 0 if x <= -1.5e+106: tmp = t_2 elif x <= 2.9e+71: tmp = a + ((z - b) / ((y + t) / y)) elif (x <= 3.4e+221) or not (x <= 2.5e+273): tmp = t_2 else: tmp = (y + t) * (a / t_1) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(x + t)) t_2 = Float64(z + Float64(y * Float64(Float64(z - b) / t_1))) tmp = 0.0 if (x <= -1.5e+106) tmp = t_2; elseif (x <= 2.9e+71) tmp = Float64(a + Float64(Float64(z - b) / Float64(Float64(y + t) / y))); elseif ((x <= 3.4e+221) || !(x <= 2.5e+273)) tmp = t_2; else tmp = Float64(Float64(y + t) * Float64(a / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = y + (x + t); t_2 = z + (y * ((z - b) / t_1)); tmp = 0.0; if (x <= -1.5e+106) tmp = t_2; elseif (x <= 2.9e+71) tmp = a + ((z - b) / ((y + t) / y)); elseif ((x <= 3.4e+221) || ~((x <= 2.5e+273))) tmp = t_2; else tmp = (y + t) * (a / t_1); 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[(z + N[(y * N[(N[(z - b), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.5e+106], t$95$2, If[LessEqual[x, 2.9e+71], N[(a + N[(N[(z - b), $MachinePrecision] / N[(N[(y + t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[x, 3.4e+221], N[Not[LessEqual[x, 2.5e+273]], $MachinePrecision]], t$95$2, N[(N[(y + t), $MachinePrecision] * N[(a / t$95$1), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + \left(x + t\right)\\
t_2 := z + y \cdot \frac{z - b}{t_1}\\
\mathbf{if}\;x \leq -1.5 \cdot 10^{+106}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 2.9 \cdot 10^{+71}:\\
\;\;\;\;a + \frac{z - b}{\frac{y + t}{y}}\\
\mathbf{elif}\;x \leq 3.4 \cdot 10^{+221} \lor \neg \left(x \leq 2.5 \cdot 10^{+273}\right):\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\left(y + t\right) \cdot \frac{a}{t_1}\\
\end{array}
\end{array}
if x < -1.5e106 or 2.90000000000000007e71 < x < 3.3999999999999998e221 or 2.4999999999999998e273 < x Initial program 51.4%
Simplified51.4%
Taylor expanded in a around inf 51.2%
associate-/l*52.7%
+-commutative52.7%
associate-/l*62.7%
Simplified62.7%
Taylor expanded in x around inf 89.2%
Taylor expanded in a around 0 57.0%
associate-*l/67.5%
+-commutative67.5%
*-commutative67.5%
Simplified67.5%
if -1.5e106 < x < 2.90000000000000007e71Initial program 63.0%
Simplified63.4%
Taylor expanded in x around 0 52.3%
Taylor expanded in a around 0 66.4%
+-commutative66.4%
associate-/l*85.6%
Simplified85.6%
if 3.3999999999999998e221 < x < 2.4999999999999998e273Initial program 38.6%
Taylor expanded in a around inf 31.4%
associate-/l*51.6%
Simplified51.6%
associate-/r/65.2%
+-commutative65.2%
Applied egg-rr65.2%
Final simplification79.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= x -5e+59) (not (<= x 5e+61))) (+ (/ a (/ x (+ y t))) (+ z (/ (- z b) (/ x y)))) (+ a (/ (- z b) (/ (+ y t) y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -5e+59) || !(x <= 5e+61)) {
tmp = (a / (x / (y + t))) + (z + ((z - b) / (x / y)));
} else {
tmp = a + ((z - b) / ((y + t) / y));
}
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 <= (-5d+59)) .or. (.not. (x <= 5d+61))) then
tmp = (a / (x / (y + t))) + (z + ((z - b) / (x / y)))
else
tmp = a + ((z - b) / ((y + t) / y))
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 <= -5e+59) || !(x <= 5e+61)) {
tmp = (a / (x / (y + t))) + (z + ((z - b) / (x / y)));
} else {
tmp = a + ((z - b) / ((y + t) / y));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x <= -5e+59) or not (x <= 5e+61): tmp = (a / (x / (y + t))) + (z + ((z - b) / (x / y))) else: tmp = a + ((z - b) / ((y + t) / y)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((x <= -5e+59) || !(x <= 5e+61)) tmp = Float64(Float64(a / Float64(x / Float64(y + t))) + Float64(z + Float64(Float64(z - b) / Float64(x / y)))); else tmp = Float64(a + Float64(Float64(z - b) / Float64(Float64(y + t) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x <= -5e+59) || ~((x <= 5e+61))) tmp = (a / (x / (y + t))) + (z + ((z - b) / (x / y))); else tmp = a + ((z - b) / ((y + t) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[x, -5e+59], N[Not[LessEqual[x, 5e+61]], $MachinePrecision]], N[(N[(a / N[(x / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z + N[(N[(z - b), $MachinePrecision] / N[(x / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(N[(z - b), $MachinePrecision] / N[(N[(y + t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -5 \cdot 10^{+59} \lor \neg \left(x \leq 5 \cdot 10^{+61}\right):\\
\;\;\;\;\frac{a}{\frac{x}{y + t}} + \left(z + \frac{z - b}{\frac{x}{y}}\right)\\
\mathbf{else}:\\
\;\;\;\;a + \frac{z - b}{\frac{y + t}{y}}\\
\end{array}
\end{array}
if x < -4.9999999999999997e59 or 5.00000000000000018e61 < x Initial program 49.5%
Simplified49.7%
Taylor expanded in a around inf 49.2%
associate-/l*50.6%
+-commutative50.6%
associate-/l*62.5%
Simplified62.5%
Taylor expanded in x around inf 87.6%
Taylor expanded in x around inf 60.7%
associate-/l*62.8%
associate-/l*70.4%
Simplified70.4%
if -4.9999999999999997e59 < x < 5.00000000000000018e61Initial program 63.4%
Simplified63.8%
Taylor expanded in x around 0 53.5%
Taylor expanded in a around 0 68.1%
+-commutative68.1%
associate-/l*87.5%
Simplified87.5%
Final simplification81.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ z (/ (+ x t) x))))
(if (<= x -1.25e+106)
t_1
(if (<= x 2.3e+84)
(+ a (/ (- z b) (/ (+ y t) y)))
(if (<= x 2.6e+141)
t_1
(if (<= x 3.3e+270) (* (+ y t) (/ a (+ y (+ x t)))) z))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z / ((x + t) / x);
double tmp;
if (x <= -1.25e+106) {
tmp = t_1;
} else if (x <= 2.3e+84) {
tmp = a + ((z - b) / ((y + t) / y));
} else if (x <= 2.6e+141) {
tmp = t_1;
} else if (x <= 3.3e+270) {
tmp = (y + t) * (a / (y + (x + t)));
} 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) :: t_1
real(8) :: tmp
t_1 = z / ((x + t) / x)
if (x <= (-1.25d+106)) then
tmp = t_1
else if (x <= 2.3d+84) then
tmp = a + ((z - b) / ((y + t) / y))
else if (x <= 2.6d+141) then
tmp = t_1
else if (x <= 3.3d+270) then
tmp = (y + t) * (a / (y + (x + t)))
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 t_1 = z / ((x + t) / x);
double tmp;
if (x <= -1.25e+106) {
tmp = t_1;
} else if (x <= 2.3e+84) {
tmp = a + ((z - b) / ((y + t) / y));
} else if (x <= 2.6e+141) {
tmp = t_1;
} else if (x <= 3.3e+270) {
tmp = (y + t) * (a / (y + (x + t)));
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = z / ((x + t) / x) tmp = 0 if x <= -1.25e+106: tmp = t_1 elif x <= 2.3e+84: tmp = a + ((z - b) / ((y + t) / y)) elif x <= 2.6e+141: tmp = t_1 elif x <= 3.3e+270: tmp = (y + t) * (a / (y + (x + t))) else: tmp = z return tmp
function code(x, y, z, t, a, b) t_1 = Float64(z / Float64(Float64(x + t) / x)) tmp = 0.0 if (x <= -1.25e+106) tmp = t_1; elseif (x <= 2.3e+84) tmp = Float64(a + Float64(Float64(z - b) / Float64(Float64(y + t) / y))); elseif (x <= 2.6e+141) tmp = t_1; elseif (x <= 3.3e+270) tmp = Float64(Float64(y + t) * Float64(a / Float64(y + Float64(x + t)))); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = z / ((x + t) / x); tmp = 0.0; if (x <= -1.25e+106) tmp = t_1; elseif (x <= 2.3e+84) tmp = a + ((z - b) / ((y + t) / y)); elseif (x <= 2.6e+141) tmp = t_1; elseif (x <= 3.3e+270) tmp = (y + t) * (a / (y + (x + t))); else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z / N[(N[(x + t), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.25e+106], t$95$1, If[LessEqual[x, 2.3e+84], N[(a + N[(N[(z - b), $MachinePrecision] / N[(N[(y + t), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.6e+141], t$95$1, If[LessEqual[x, 3.3e+270], N[(N[(y + t), $MachinePrecision] * N[(a / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], z]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{\frac{x + t}{x}}\\
\mathbf{if}\;x \leq -1.25 \cdot 10^{+106}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+84}:\\
\;\;\;\;a + \frac{z - b}{\frac{y + t}{y}}\\
\mathbf{elif}\;x \leq 2.6 \cdot 10^{+141}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 3.3 \cdot 10^{+270}:\\
\;\;\;\;\left(y + t\right) \cdot \frac{a}{y + \left(x + t\right)}\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -1.25e106 or 2.2999999999999999e84 < x < 2.5999999999999999e141Initial program 49.5%
Simplified49.5%
Taylor expanded in a around 0 40.4%
Taylor expanded in y around 0 27.1%
associate-/l*61.9%
Simplified61.9%
if -1.25e106 < x < 2.2999999999999999e84Initial program 63.5%
Simplified63.8%
Taylor expanded in x around 0 52.3%
Taylor expanded in a around 0 66.2%
+-commutative66.2%
associate-/l*85.2%
Simplified85.2%
if 2.5999999999999999e141 < x < 3.29999999999999992e270Initial program 33.4%
Taylor expanded in a around inf 24.5%
associate-/l*49.3%
Simplified49.3%
associate-/r/53.5%
+-commutative53.5%
Applied egg-rr53.5%
if 3.29999999999999992e270 < x Initial program 78.2%
Taylor expanded in x around inf 57.3%
Final simplification76.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.35e+110) (not (<= t 1e+28))) (/ a (/ (+ x t) t)) (- (+ z a) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.35e+110) || !(t <= 1e+28)) {
tmp = a / ((x + t) / 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 ((t <= (-1.35d+110)) .or. (.not. (t <= 1d+28))) then
tmp = a / ((x + t) / 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 ((t <= -1.35e+110) || !(t <= 1e+28)) {
tmp = a / ((x + t) / t);
} else {
tmp = (z + a) - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.35e+110) or not (t <= 1e+28): tmp = a / ((x + t) / t) else: tmp = (z + a) - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.35e+110) || !(t <= 1e+28)) tmp = Float64(a / Float64(Float64(x + t) / 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 ((t <= -1.35e+110) || ~((t <= 1e+28))) tmp = a / ((x + t) / t); else tmp = (z + a) - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.35e+110], N[Not[LessEqual[t, 1e+28]], $MachinePrecision]], N[(a / N[(N[(x + t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.35 \cdot 10^{+110} \lor \neg \left(t \leq 10^{+28}\right):\\
\;\;\;\;\frac{a}{\frac{x + t}{t}}\\
\mathbf{else}:\\
\;\;\;\;\left(z + a\right) - b\\
\end{array}
\end{array}
if t < -1.35000000000000005e110 or 9.99999999999999958e27 < t Initial program 45.3%
Taylor expanded in a around inf 29.6%
associate-/l*62.7%
Simplified62.7%
Taylor expanded in y around 0 31.4%
associate-/l*62.2%
+-commutative62.2%
Simplified62.2%
if -1.35000000000000005e110 < t < 9.99999999999999958e27Initial program 66.4%
Taylor expanded in y around inf 58.0%
+-commutative58.0%
Simplified58.0%
Final simplification59.6%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1e+183) a (if (<= t 3.1e-81) (- (+ z a) b) (+ z a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1e+183) {
tmp = a;
} else if (t <= 3.1e-81) {
tmp = (z + a) - b;
} else {
tmp = z + a;
}
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 <= (-1d+183)) then
tmp = a
else if (t <= 3.1d-81) then
tmp = (z + a) - b
else
tmp = z + a
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 <= -1e+183) {
tmp = a;
} else if (t <= 3.1e-81) {
tmp = (z + a) - b;
} else {
tmp = z + a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1e+183: tmp = a elif t <= 3.1e-81: tmp = (z + a) - b else: tmp = z + a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1e+183) tmp = a; elseif (t <= 3.1e-81) tmp = Float64(Float64(z + a) - b); else tmp = Float64(z + a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -1e+183) tmp = a; elseif (t <= 3.1e-81) tmp = (z + a) - b; else tmp = z + a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1e+183], a, If[LessEqual[t, 3.1e-81], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], N[(z + a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1 \cdot 10^{+183}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{-81}:\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;z + a\\
\end{array}
\end{array}
if t < -9.99999999999999947e182Initial program 33.0%
Taylor expanded in t around inf 71.2%
if -9.99999999999999947e182 < t < 3.09999999999999988e-81Initial program 61.9%
Taylor expanded in y around inf 59.3%
+-commutative59.3%
Simplified59.3%
if 3.09999999999999988e-81 < t Initial program 60.0%
Simplified60.2%
Taylor expanded in a around inf 59.9%
associate-/l*63.4%
+-commutative63.4%
associate-/l*86.8%
Simplified86.8%
Taylor expanded in x around inf 71.0%
Taylor expanded in t around inf 53.9%
Final simplification58.7%
(FPCore (x y z t a b) :precision binary64 (if (<= t -9.5e+181) (* a (- 1.0 (/ x t))) (if (<= t 1.8e-80) (- (+ z a) b) (+ z a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -9.5e+181) {
tmp = a * (1.0 - (x / t));
} else if (t <= 1.8e-80) {
tmp = (z + a) - b;
} else {
tmp = z + a;
}
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 <= (-9.5d+181)) then
tmp = a * (1.0d0 - (x / t))
else if (t <= 1.8d-80) then
tmp = (z + a) - b
else
tmp = z + a
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 <= -9.5e+181) {
tmp = a * (1.0 - (x / t));
} else if (t <= 1.8e-80) {
tmp = (z + a) - b;
} else {
tmp = z + a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -9.5e+181: tmp = a * (1.0 - (x / t)) elif t <= 1.8e-80: tmp = (z + a) - b else: tmp = z + a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -9.5e+181) tmp = Float64(a * Float64(1.0 - Float64(x / t))); elseif (t <= 1.8e-80) tmp = Float64(Float64(z + a) - b); else tmp = Float64(z + a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -9.5e+181) tmp = a * (1.0 - (x / t)); elseif (t <= 1.8e-80) tmp = (z + a) - b; else tmp = z + a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -9.5e+181], N[(a * N[(1.0 - N[(x / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.8e-80], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], N[(z + a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.5 \cdot 10^{+181}:\\
\;\;\;\;a \cdot \left(1 - \frac{x}{t}\right)\\
\mathbf{elif}\;t \leq 1.8 \cdot 10^{-80}:\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;z + a\\
\end{array}
\end{array}
if t < -9.50000000000000032e181Initial program 33.0%
Simplified33.4%
Taylor expanded in t around inf 53.4%
Taylor expanded in a around inf 71.2%
if -9.50000000000000032e181 < t < 1.8e-80Initial program 61.9%
Taylor expanded in y around inf 59.3%
+-commutative59.3%
Simplified59.3%
if 1.8e-80 < t Initial program 60.0%
Simplified60.2%
Taylor expanded in a around inf 59.9%
associate-/l*63.4%
+-commutative63.4%
associate-/l*86.8%
Simplified86.8%
Taylor expanded in x around inf 71.0%
Taylor expanded in t around inf 53.9%
Final simplification58.7%
(FPCore (x y z t a b) :precision binary64 (if (<= x -9.2e+103) z (if (<= x 1.32e+67) a z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -9.2e+103) {
tmp = z;
} else if (x <= 1.32e+67) {
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 (x <= (-9.2d+103)) then
tmp = z
else if (x <= 1.32d+67) 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 (x <= -9.2e+103) {
tmp = z;
} else if (x <= 1.32e+67) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -9.2e+103: tmp = z elif x <= 1.32e+67: tmp = a else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -9.2e+103) tmp = z; elseif (x <= 1.32e+67) tmp = a; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -9.2e+103) tmp = z; elseif (x <= 1.32e+67) tmp = a; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -9.2e+103], z, If[LessEqual[x, 1.32e+67], a, z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -9.2 \cdot 10^{+103}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 1.32 \cdot 10^{+67}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -9.20000000000000034e103 or 1.3200000000000001e67 < x Initial program 49.4%
Taylor expanded in x around inf 51.6%
if -9.20000000000000034e103 < x < 1.3200000000000001e67Initial program 63.0%
Taylor expanded in t around inf 48.5%
Final simplification49.6%
(FPCore (x y z t a b) :precision binary64 (if (<= t -4e+220) a (+ z a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -4e+220) {
tmp = a;
} else {
tmp = z + a;
}
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+220)) then
tmp = a
else
tmp = z + a
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+220) {
tmp = a;
} else {
tmp = z + a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -4e+220: tmp = a else: tmp = z + a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -4e+220) tmp = a; else tmp = Float64(z + a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -4e+220) tmp = a; else tmp = z + a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -4e+220], a, N[(z + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4 \cdot 10^{+220}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;z + a\\
\end{array}
\end{array}
if t < -4e220Initial program 34.8%
Taylor expanded in t around inf 79.6%
if -4e220 < t Initial program 60.1%
Simplified60.3%
Taylor expanded in a around inf 60.0%
associate-/l*67.4%
+-commutative67.4%
associate-/l*83.2%
Simplified83.2%
Taylor expanded in x around inf 78.2%
Taylor expanded in t around inf 52.0%
Final simplification54.0%
(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 58.2%
Taylor expanded in t around inf 36.3%
Final simplification36.3%
(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 2023196
(FPCore (x y z t a b)
:name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
:precision binary64
:herbie-target
(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)))