
(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 (* z (/ 1.0 (/ (+ y (+ x t)) (+ y x))))) (t_2 (+ t (+ y x))))
(if (or (<= y -1.02e+185) (not (<= y 1e+149)))
(- (+ a t_1) b)
(- (+ t_1 (* a (+ (/ t t_2) (/ y t_2)))) (/ (* y b) t_2)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * (1.0 / ((y + (x + t)) / (y + x)));
double t_2 = t + (y + x);
double tmp;
if ((y <= -1.02e+185) || !(y <= 1e+149)) {
tmp = (a + t_1) - b;
} else {
tmp = (t_1 + (a * ((t / t_2) + (y / t_2)))) - ((y * b) / 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 = z * (1.0d0 / ((y + (x + t)) / (y + x)))
t_2 = t + (y + x)
if ((y <= (-1.02d+185)) .or. (.not. (y <= 1d+149))) then
tmp = (a + t_1) - b
else
tmp = (t_1 + (a * ((t / t_2) + (y / t_2)))) - ((y * b) / 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 = z * (1.0 / ((y + (x + t)) / (y + x)));
double t_2 = t + (y + x);
double tmp;
if ((y <= -1.02e+185) || !(y <= 1e+149)) {
tmp = (a + t_1) - b;
} else {
tmp = (t_1 + (a * ((t / t_2) + (y / t_2)))) - ((y * b) / t_2);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = z * (1.0 / ((y + (x + t)) / (y + x))) t_2 = t + (y + x) tmp = 0 if (y <= -1.02e+185) or not (y <= 1e+149): tmp = (a + t_1) - b else: tmp = (t_1 + (a * ((t / t_2) + (y / t_2)))) - ((y * b) / t_2) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(z * Float64(1.0 / Float64(Float64(y + Float64(x + t)) / Float64(y + x)))) t_2 = Float64(t + Float64(y + x)) tmp = 0.0 if ((y <= -1.02e+185) || !(y <= 1e+149)) tmp = Float64(Float64(a + t_1) - b); else tmp = Float64(Float64(t_1 + Float64(a * Float64(Float64(t / t_2) + Float64(y / t_2)))) - Float64(Float64(y * b) / t_2)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = z * (1.0 / ((y + (x + t)) / (y + x))); t_2 = t + (y + x); tmp = 0.0; if ((y <= -1.02e+185) || ~((y <= 1e+149))) tmp = (a + t_1) - b; else tmp = (t_1 + (a * ((t / t_2) + (y / t_2)))) - ((y * b) / t_2); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(1.0 / N[(N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision] / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t + N[(y + x), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[y, -1.02e+185], N[Not[LessEqual[y, 1e+149]], $MachinePrecision]], N[(N[(a + t$95$1), $MachinePrecision] - b), $MachinePrecision], N[(N[(t$95$1 + N[(a * N[(N[(t / t$95$2), $MachinePrecision] + N[(y / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(y * b), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{1}{\frac{y + \left(x + t\right)}{y + x}}\\
t_2 := t + \left(y + x\right)\\
\mathbf{if}\;y \leq -1.02 \cdot 10^{+185} \lor \neg \left(y \leq 10^{+149}\right):\\
\;\;\;\;\left(a + t_1\right) - b\\
\mathbf{else}:\\
\;\;\;\;\left(t_1 + a \cdot \left(\frac{t}{t_2} + \frac{y}{t_2}\right)\right) - \frac{y \cdot b}{t_2}\\
\end{array}
\end{array}
if y < -1.0200000000000001e185 or 1.00000000000000005e149 < y Initial program 23.9%
Taylor expanded in a around 0 40.6%
associate-/l*60.7%
associate-+r+60.7%
+-commutative60.7%
div-inv60.7%
+-commutative60.7%
+-commutative60.7%
+-commutative60.7%
Applied egg-rr60.7%
Taylor expanded in t around inf 59.2%
Taylor expanded in y around inf 86.3%
if -1.0200000000000001e185 < y < 1.00000000000000005e149Initial program 68.5%
Taylor expanded in a around 0 83.6%
associate-/l*96.4%
associate-+r+96.4%
+-commutative96.4%
div-inv96.3%
+-commutative96.3%
+-commutative96.3%
+-commutative96.3%
Applied egg-rr96.3%
Final simplification93.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (+ y t)))
(t_2 (+ y (+ x t)))
(t_3 (/ (- (+ (* z (+ y x)) t_1) (* y b)) t_2)))
(if (or (<= t_3 (- INFINITY)) (not (<= t_3 2e+264)))
(- (+ a (* z (/ 1.0 (/ t_2 (+ y x))))) b)
(+ (* z (+ (/ x t_2) (/ y t_2))) (/ (- t_1 (* y b)) t_2)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (y + t);
double t_2 = y + (x + t);
double t_3 = (((z * (y + x)) + t_1) - (y * b)) / t_2;
double tmp;
if ((t_3 <= -((double) INFINITY)) || !(t_3 <= 2e+264)) {
tmp = (a + (z * (1.0 / (t_2 / (y + x))))) - b;
} else {
tmp = (z * ((x / t_2) + (y / t_2))) + ((t_1 - (y * b)) / t_2);
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (y + t);
double t_2 = y + (x + t);
double t_3 = (((z * (y + x)) + t_1) - (y * b)) / t_2;
double tmp;
if ((t_3 <= -Double.POSITIVE_INFINITY) || !(t_3 <= 2e+264)) {
tmp = (a + (z * (1.0 / (t_2 / (y + x))))) - b;
} else {
tmp = (z * ((x / t_2) + (y / t_2))) + ((t_1 - (y * b)) / t_2);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a * (y + t) t_2 = y + (x + t) t_3 = (((z * (y + x)) + t_1) - (y * b)) / t_2 tmp = 0 if (t_3 <= -math.inf) or not (t_3 <= 2e+264): tmp = (a + (z * (1.0 / (t_2 / (y + x))))) - b else: tmp = (z * ((x / t_2) + (y / t_2))) + ((t_1 - (y * b)) / t_2) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(y + t)) t_2 = Float64(y + Float64(x + t)) t_3 = Float64(Float64(Float64(Float64(z * Float64(y + x)) + t_1) - Float64(y * b)) / t_2) tmp = 0.0 if ((t_3 <= Float64(-Inf)) || !(t_3 <= 2e+264)) tmp = Float64(Float64(a + Float64(z * Float64(1.0 / Float64(t_2 / Float64(y + x))))) - b); else tmp = Float64(Float64(z * Float64(Float64(x / t_2) + Float64(y / t_2))) + Float64(Float64(t_1 - Float64(y * b)) / t_2)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a * (y + t); t_2 = y + (x + t); t_3 = (((z * (y + x)) + t_1) - (y * b)) / t_2; tmp = 0.0; if ((t_3 <= -Inf) || ~((t_3 <= 2e+264))) tmp = (a + (z * (1.0 / (t_2 / (y + x))))) - b; else tmp = (z * ((x / t_2) + (y / t_2))) + ((t_1 - (y * b)) / t_2); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(y + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]}, If[Or[LessEqual[t$95$3, (-Infinity)], N[Not[LessEqual[t$95$3, 2e+264]], $MachinePrecision]], N[(N[(a + N[(z * N[(1.0 / N[(t$95$2 / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision], N[(N[(z * N[(N[(x / t$95$2), $MachinePrecision] + N[(y / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$1 - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot \left(y + t\right)\\
t_2 := y + \left(x + t\right)\\
t_3 := \frac{\left(z \cdot \left(y + x\right) + t_1\right) - y \cdot b}{t_2}\\
\mathbf{if}\;t_3 \leq -\infty \lor \neg \left(t_3 \leq 2 \cdot 10^{+264}\right):\\
\;\;\;\;\left(a + z \cdot \frac{1}{\frac{t_2}{y + x}}\right) - b\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\frac{x}{t_2} + \frac{y}{t_2}\right) + \frac{t_1 - y \cdot b}{t_2}\\
\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.00000000000000009e264 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 6.6%
Taylor expanded in a around 0 40.5%
associate-/l*72.5%
associate-+r+72.5%
+-commutative72.5%
div-inv72.4%
+-commutative72.4%
+-commutative72.4%
+-commutative72.4%
Applied egg-rr72.4%
Taylor expanded in t around inf 68.2%
Taylor expanded in y around inf 80.9%
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.00000000000000009e264Initial program 99.8%
Taylor expanded in z around 0 99.8%
associate--l+99.8%
associate-+r+99.8%
associate-+r+99.8%
div-sub99.8%
*-commutative99.8%
associate-+r+99.8%
Simplified99.8%
Final simplification91.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (+ x t)))
(t_2 (/ (- (+ (* z (+ y x)) (* a (+ y t))) (* y b)) t_1)))
(if (or (<= t_2 (- INFINITY)) (not (<= t_2 2e+264)))
(- (+ a (* z (/ 1.0 (/ t_1 (+ y x))))) b)
(+ (/ a (/ t_1 (+ y t))) (/ (+ (* y (- z b)) (* z x)) 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 + x)) + (a * (y + t))) - (y * b)) / t_1;
double tmp;
if ((t_2 <= -((double) INFINITY)) || !(t_2 <= 2e+264)) {
tmp = (a + (z * (1.0 / (t_1 / (y + x))))) - b;
} else {
tmp = (a / (t_1 / (y + t))) + (((y * (z - b)) + (z * x)) / t_1);
}
return tmp;
}
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 + x)) + (a * (y + t))) - (y * b)) / t_1;
double tmp;
if ((t_2 <= -Double.POSITIVE_INFINITY) || !(t_2 <= 2e+264)) {
tmp = (a + (z * (1.0 / (t_1 / (y + x))))) - b;
} else {
tmp = (a / (t_1 / (y + t))) + (((y * (z - b)) + (z * x)) / t_1);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = y + (x + t) t_2 = (((z * (y + x)) + (a * (y + t))) - (y * b)) / t_1 tmp = 0 if (t_2 <= -math.inf) or not (t_2 <= 2e+264): tmp = (a + (z * (1.0 / (t_1 / (y + x))))) - b else: tmp = (a / (t_1 / (y + t))) + (((y * (z - b)) + (z * x)) / t_1) 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(y + x)) + Float64(a * Float64(y + t))) - Float64(y * b)) / t_1) tmp = 0.0 if ((t_2 <= Float64(-Inf)) || !(t_2 <= 2e+264)) tmp = Float64(Float64(a + Float64(z * Float64(1.0 / Float64(t_1 / Float64(y + x))))) - b); else tmp = Float64(Float64(a / Float64(t_1 / Float64(y + t))) + Float64(Float64(Float64(y * Float64(z - b)) + Float64(z * x)) / 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 + x)) + (a * (y + t))) - (y * b)) / t_1; tmp = 0.0; if ((t_2 <= -Inf) || ~((t_2 <= 2e+264))) tmp = (a + (z * (1.0 / (t_1 / (y + x))))) - b; else tmp = (a / (t_1 / (y + t))) + (((y * (z - b)) + (z * x)) / 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[(N[(N[(N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision] + N[(a * N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[Or[LessEqual[t$95$2, (-Infinity)], N[Not[LessEqual[t$95$2, 2e+264]], $MachinePrecision]], N[(N[(a + N[(z * N[(1.0 / N[(t$95$1 / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision], N[(N[(a / N[(t$95$1 / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(N[(y * N[(z - b), $MachinePrecision]), $MachinePrecision] + N[(z * x), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + \left(x + t\right)\\
t_2 := \frac{\left(z \cdot \left(y + x\right) + a \cdot \left(y + t\right)\right) - y \cdot b}{t_1}\\
\mathbf{if}\;t_2 \leq -\infty \lor \neg \left(t_2 \leq 2 \cdot 10^{+264}\right):\\
\;\;\;\;\left(a + z \cdot \frac{1}{\frac{t_1}{y + x}}\right) - b\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{\frac{t_1}{y + t}} + \frac{y \cdot \left(z - b\right) + z \cdot x}{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.00000000000000009e264 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 6.6%
Taylor expanded in a around 0 40.5%
associate-/l*72.5%
associate-+r+72.5%
+-commutative72.5%
div-inv72.4%
+-commutative72.4%
+-commutative72.4%
+-commutative72.4%
Applied egg-rr72.4%
Taylor expanded in t around inf 68.2%
Taylor expanded in y around inf 80.9%
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.00000000000000009e264Initial program 99.8%
Taylor expanded in z around inf 99.8%
associate--l+99.8%
associate-/l*99.8%
associate-+r+99.8%
div-sub99.8%
Simplified99.8%
Final simplification91.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (+ x t)))
(t_2 (/ (- (+ (* z (+ y x)) (* a (+ y t))) (* y b)) t_1)))
(if (or (<= t_2 (- INFINITY)) (not (<= t_2 2e+264)))
(- (+ a (* z (/ 1.0 (/ t_1 (+ y x))))) b)
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 * (y + x)) + (a * (y + t))) - (y * b)) / t_1;
double tmp;
if ((t_2 <= -((double) INFINITY)) || !(t_2 <= 2e+264)) {
tmp = (a + (z * (1.0 / (t_1 / (y + x))))) - b;
} else {
tmp = t_2;
}
return tmp;
}
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 + x)) + (a * (y + t))) - (y * b)) / t_1;
double tmp;
if ((t_2 <= -Double.POSITIVE_INFINITY) || !(t_2 <= 2e+264)) {
tmp = (a + (z * (1.0 / (t_1 / (y + x))))) - b;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = y + (x + t) t_2 = (((z * (y + x)) + (a * (y + t))) - (y * b)) / t_1 tmp = 0 if (t_2 <= -math.inf) or not (t_2 <= 2e+264): tmp = (a + (z * (1.0 / (t_1 / (y + x))))) - b 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(Float64(Float64(z * Float64(y + x)) + Float64(a * Float64(y + t))) - Float64(y * b)) / t_1) tmp = 0.0 if ((t_2 <= Float64(-Inf)) || !(t_2 <= 2e+264)) tmp = Float64(Float64(a + Float64(z * Float64(1.0 / Float64(t_1 / Float64(y + x))))) - b); 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 * (y + x)) + (a * (y + t))) - (y * b)) / t_1; tmp = 0.0; if ((t_2 <= -Inf) || ~((t_2 <= 2e+264))) tmp = (a + (z * (1.0 / (t_1 / (y + x))))) - b; 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[(N[(N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision] + N[(a * N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[Or[LessEqual[t$95$2, (-Infinity)], N[Not[LessEqual[t$95$2, 2e+264]], $MachinePrecision]], N[(N[(a + N[(z * N[(1.0 / N[(t$95$1 / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision], t$95$2]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + \left(x + t\right)\\
t_2 := \frac{\left(z \cdot \left(y + x\right) + a \cdot \left(y + t\right)\right) - y \cdot b}{t_1}\\
\mathbf{if}\;t_2 \leq -\infty \lor \neg \left(t_2 \leq 2 \cdot 10^{+264}\right):\\
\;\;\;\;\left(a + z \cdot \frac{1}{\frac{t_1}{y + x}}\right) - b\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\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.00000000000000009e264 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 6.6%
Taylor expanded in a around 0 40.5%
associate-/l*72.5%
associate-+r+72.5%
+-commutative72.5%
div-inv72.4%
+-commutative72.4%
+-commutative72.4%
+-commutative72.4%
Applied egg-rr72.4%
Taylor expanded in t around inf 68.2%
Taylor expanded in y around inf 80.9%
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.00000000000000009e264Initial program 99.8%
Final simplification91.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (+ x t))))
(if (<= b -2.15e+163)
(* y (/ (- b) t_1))
(if (<= b 5.3e+244)
(- (+ a (* z (/ 1.0 (/ t_1 (+ y x))))) b)
(/ (- b) (/ t_1 y))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (x + t);
double tmp;
if (b <= -2.15e+163) {
tmp = y * (-b / t_1);
} else if (b <= 5.3e+244) {
tmp = (a + (z * (1.0 / (t_1 / (y + x))))) - b;
} else {
tmp = -b / (t_1 / 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) :: tmp
t_1 = y + (x + t)
if (b <= (-2.15d+163)) then
tmp = y * (-b / t_1)
else if (b <= 5.3d+244) then
tmp = (a + (z * (1.0d0 / (t_1 / (y + x))))) - b
else
tmp = -b / (t_1 / 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 tmp;
if (b <= -2.15e+163) {
tmp = y * (-b / t_1);
} else if (b <= 5.3e+244) {
tmp = (a + (z * (1.0 / (t_1 / (y + x))))) - b;
} else {
tmp = -b / (t_1 / y);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = y + (x + t) tmp = 0 if b <= -2.15e+163: tmp = y * (-b / t_1) elif b <= 5.3e+244: tmp = (a + (z * (1.0 / (t_1 / (y + x))))) - b else: tmp = -b / (t_1 / y) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(x + t)) tmp = 0.0 if (b <= -2.15e+163) tmp = Float64(y * Float64(Float64(-b) / t_1)); elseif (b <= 5.3e+244) tmp = Float64(Float64(a + Float64(z * Float64(1.0 / Float64(t_1 / Float64(y + x))))) - b); else tmp = Float64(Float64(-b) / Float64(t_1 / y)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = y + (x + t); tmp = 0.0; if (b <= -2.15e+163) tmp = y * (-b / t_1); elseif (b <= 5.3e+244) tmp = (a + (z * (1.0 / (t_1 / (y + x))))) - b; else tmp = -b / (t_1 / y); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -2.15e+163], N[(y * N[((-b) / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.3e+244], N[(N[(a + N[(z * N[(1.0 / N[(t$95$1 / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - b), $MachinePrecision], N[((-b) / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + \left(x + t\right)\\
\mathbf{if}\;b \leq -2.15 \cdot 10^{+163}:\\
\;\;\;\;y \cdot \frac{-b}{t_1}\\
\mathbf{elif}\;b \leq 5.3 \cdot 10^{+244}:\\
\;\;\;\;\left(a + z \cdot \frac{1}{\frac{t_1}{y + x}}\right) - b\\
\mathbf{else}:\\
\;\;\;\;\frac{-b}{\frac{t_1}{y}}\\
\end{array}
\end{array}
if b < -2.1500000000000001e163Initial program 51.4%
Taylor expanded in x around inf 45.4%
*-commutative45.4%
Simplified45.4%
Taylor expanded in z around 0 29.5%
mul-1-neg29.5%
associate-/l*46.9%
+-commutative46.9%
+-commutative46.9%
associate-+r+46.9%
associate-/r/50.2%
distribute-rgt-neg-in50.2%
+-commutative50.2%
Simplified50.2%
if -2.1500000000000001e163 < b < 5.2999999999999997e244Initial program 59.2%
Taylor expanded in a around 0 75.9%
associate-/l*92.9%
associate-+r+92.9%
+-commutative92.9%
div-inv92.9%
+-commutative92.9%
+-commutative92.9%
+-commutative92.9%
Applied egg-rr92.9%
Taylor expanded in t around inf 83.0%
Taylor expanded in y around inf 74.6%
if 5.2999999999999997e244 < b Initial program 44.2%
Taylor expanded in b around inf 38.9%
mul-1-neg38.9%
associate-/l*71.3%
distribute-neg-frac71.3%
associate-+r+71.3%
Simplified71.3%
Final simplification71.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (+ x t))))
(if (<= z -2.4e+53)
(* (+ y x) (/ z t_1))
(if (or (<= z 1.45e-295) (not (<= z 2.6e-153)))
(- (+ a z) b)
(/ a (/ t_1 (+ y t)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (x + t);
double tmp;
if (z <= -2.4e+53) {
tmp = (y + x) * (z / t_1);
} else if ((z <= 1.45e-295) || !(z <= 2.6e-153)) {
tmp = (a + z) - b;
} else {
tmp = a / (t_1 / (y + 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) :: t_1
real(8) :: tmp
t_1 = y + (x + t)
if (z <= (-2.4d+53)) then
tmp = (y + x) * (z / t_1)
else if ((z <= 1.45d-295) .or. (.not. (z <= 2.6d-153))) then
tmp = (a + z) - b
else
tmp = a / (t_1 / (y + t))
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 tmp;
if (z <= -2.4e+53) {
tmp = (y + x) * (z / t_1);
} else if ((z <= 1.45e-295) || !(z <= 2.6e-153)) {
tmp = (a + z) - b;
} else {
tmp = a / (t_1 / (y + t));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = y + (x + t) tmp = 0 if z <= -2.4e+53: tmp = (y + x) * (z / t_1) elif (z <= 1.45e-295) or not (z <= 2.6e-153): tmp = (a + z) - b else: tmp = a / (t_1 / (y + t)) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(x + t)) tmp = 0.0 if (z <= -2.4e+53) tmp = Float64(Float64(y + x) * Float64(z / t_1)); elseif ((z <= 1.45e-295) || !(z <= 2.6e-153)) tmp = Float64(Float64(a + z) - b); else tmp = Float64(a / Float64(t_1 / Float64(y + t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = y + (x + t); tmp = 0.0; if (z <= -2.4e+53) tmp = (y + x) * (z / t_1); elseif ((z <= 1.45e-295) || ~((z <= 2.6e-153))) tmp = (a + z) - b; else tmp = a / (t_1 / (y + t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.4e+53], N[(N[(y + x), $MachinePrecision] * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 1.45e-295], N[Not[LessEqual[z, 2.6e-153]], $MachinePrecision]], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], N[(a / N[(t$95$1 / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + \left(x + t\right)\\
\mathbf{if}\;z \leq -2.4 \cdot 10^{+53}:\\
\;\;\;\;\left(y + x\right) \cdot \frac{z}{t_1}\\
\mathbf{elif}\;z \leq 1.45 \cdot 10^{-295} \lor \neg \left(z \leq 2.6 \cdot 10^{-153}\right):\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{\frac{t_1}{y + t}}\\
\end{array}
\end{array}
if z < -2.4e53Initial program 48.7%
Taylor expanded in z around inf 36.8%
associate-/l*75.6%
associate-+r+75.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in z around 0 36.8%
+-commutative36.8%
+-commutative36.8%
associate-+r+36.8%
associate-*l/75.6%
*-commutative75.6%
+-commutative75.6%
+-commutative75.6%
Simplified75.6%
if -2.4e53 < z < 1.45000000000000008e-295 or 2.6000000000000001e-153 < z Initial program 57.4%
Taylor expanded in y around inf 65.0%
if 1.45000000000000008e-295 < z < 2.6000000000000001e-153Initial program 68.5%
Taylor expanded in a around inf 45.7%
associate-/l*70.6%
associate-+r+70.6%
Simplified70.6%
Final simplification67.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (+ x t))))
(if (<= z -4e+50)
(/ z (/ t_1 (+ y x)))
(if (or (<= z 7.6e-297) (not (<= z 4.5e-154)))
(- (+ a z) b)
(/ a (/ t_1 (+ y t)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (x + t);
double tmp;
if (z <= -4e+50) {
tmp = z / (t_1 / (y + x));
} else if ((z <= 7.6e-297) || !(z <= 4.5e-154)) {
tmp = (a + z) - b;
} else {
tmp = a / (t_1 / (y + 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) :: t_1
real(8) :: tmp
t_1 = y + (x + t)
if (z <= (-4d+50)) then
tmp = z / (t_1 / (y + x))
else if ((z <= 7.6d-297) .or. (.not. (z <= 4.5d-154))) then
tmp = (a + z) - b
else
tmp = a / (t_1 / (y + t))
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 tmp;
if (z <= -4e+50) {
tmp = z / (t_1 / (y + x));
} else if ((z <= 7.6e-297) || !(z <= 4.5e-154)) {
tmp = (a + z) - b;
} else {
tmp = a / (t_1 / (y + t));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = y + (x + t) tmp = 0 if z <= -4e+50: tmp = z / (t_1 / (y + x)) elif (z <= 7.6e-297) or not (z <= 4.5e-154): tmp = (a + z) - b else: tmp = a / (t_1 / (y + t)) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(x + t)) tmp = 0.0 if (z <= -4e+50) tmp = Float64(z / Float64(t_1 / Float64(y + x))); elseif ((z <= 7.6e-297) || !(z <= 4.5e-154)) tmp = Float64(Float64(a + z) - b); else tmp = Float64(a / Float64(t_1 / Float64(y + t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = y + (x + t); tmp = 0.0; if (z <= -4e+50) tmp = z / (t_1 / (y + x)); elseif ((z <= 7.6e-297) || ~((z <= 4.5e-154))) tmp = (a + z) - b; else tmp = a / (t_1 / (y + t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -4e+50], N[(z / N[(t$95$1 / N[(y + x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, 7.6e-297], N[Not[LessEqual[z, 4.5e-154]], $MachinePrecision]], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], N[(a / N[(t$95$1 / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + \left(x + t\right)\\
\mathbf{if}\;z \leq -4 \cdot 10^{+50}:\\
\;\;\;\;\frac{z}{\frac{t_1}{y + x}}\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{-297} \lor \neg \left(z \leq 4.5 \cdot 10^{-154}\right):\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{\frac{t_1}{y + t}}\\
\end{array}
\end{array}
if z < -4.0000000000000003e50Initial program 48.7%
Taylor expanded in z around inf 36.8%
associate-/l*75.6%
associate-+r+75.6%
+-commutative75.6%
Simplified75.6%
if -4.0000000000000003e50 < z < 7.6000000000000001e-297 or 4.4999999999999997e-154 < z Initial program 57.4%
Taylor expanded in y around inf 65.0%
if 7.6000000000000001e-297 < z < 4.4999999999999997e-154Initial program 68.5%
Taylor expanded in a around inf 45.7%
associate-/l*70.6%
associate-+r+70.6%
Simplified70.6%
Final simplification67.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -1.06e+172) (not (<= t 5e+97))) (+ a (- (/ y (/ t z)) (* y (/ b t)))) (- (+ a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -1.06e+172) || !(t <= 5e+97)) {
tmp = a + ((y / (t / z)) - (y * (b / t)));
} else {
tmp = (a + z) - 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.06d+172)) .or. (.not. (t <= 5d+97))) then
tmp = a + ((y / (t / z)) - (y * (b / t)))
else
tmp = (a + z) - 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.06e+172) || !(t <= 5e+97)) {
tmp = a + ((y / (t / z)) - (y * (b / t)));
} else {
tmp = (a + z) - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -1.06e+172) or not (t <= 5e+97): tmp = a + ((y / (t / z)) - (y * (b / t))) else: tmp = (a + z) - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -1.06e+172) || !(t <= 5e+97)) tmp = Float64(a + Float64(Float64(y / Float64(t / z)) - Float64(y * Float64(b / t)))); else tmp = Float64(Float64(a + z) - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -1.06e+172) || ~((t <= 5e+97))) tmp = a + ((y / (t / z)) - (y * (b / t))); else tmp = (a + z) - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -1.06e+172], N[Not[LessEqual[t, 5e+97]], $MachinePrecision]], N[(a + N[(N[(y / N[(t / z), $MachinePrecision]), $MachinePrecision] - N[(y * N[(b / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.06 \cdot 10^{+172} \lor \neg \left(t \leq 5 \cdot 10^{+97}\right):\\
\;\;\;\;a + \left(\frac{y}{\frac{t}{z}} - y \cdot \frac{b}{t}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\
\end{array}
\end{array}
if t < -1.05999999999999996e172 or 4.99999999999999999e97 < t Initial program 50.6%
associate--l+50.6%
fma-def50.7%
fma-neg50.7%
+-commutative50.7%
distribute-rgt-neg-out50.7%
associate-+l+50.7%
+-commutative50.7%
Simplified50.7%
Taylor expanded in t around inf 55.5%
associate-+r+55.5%
mul-1-neg55.5%
unsub-neg55.5%
associate-/l*57.4%
associate-/l*57.5%
associate-/l*66.3%
+-commutative66.3%
associate-/l*76.0%
+-commutative76.0%
Simplified76.0%
Taylor expanded in x around 0 59.1%
associate--l+59.1%
associate-/l*62.2%
associate-*l/67.2%
*-commutative67.2%
Simplified67.2%
if -1.05999999999999996e172 < t < 4.99999999999999999e97Initial program 60.9%
Taylor expanded in y around inf 70.5%
Final simplification69.3%
(FPCore (x y z t a b) :precision binary64 (if (<= z -1.75e+53) (* (+ y x) (/ z (+ y (+ x t)))) (- (+ a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.75e+53) {
tmp = (y + x) * (z / (y + (x + t)));
} else {
tmp = (a + z) - 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 <= (-1.75d+53)) then
tmp = (y + x) * (z / (y + (x + t)))
else
tmp = (a + z) - 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 <= -1.75e+53) {
tmp = (y + x) * (z / (y + (x + t)));
} else {
tmp = (a + z) - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -1.75e+53: tmp = (y + x) * (z / (y + (x + t))) else: tmp = (a + z) - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.75e+53) tmp = Float64(Float64(y + x) * Float64(z / Float64(y + Float64(x + t)))); else tmp = Float64(Float64(a + z) - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -1.75e+53) tmp = (y + x) * (z / (y + (x + t))); else tmp = (a + z) - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.75e+53], N[(N[(y + x), $MachinePrecision] * N[(z / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.75 \cdot 10^{+53}:\\
\;\;\;\;\left(y + x\right) \cdot \frac{z}{y + \left(x + t\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\
\end{array}
\end{array}
if z < -1.75000000000000009e53Initial program 48.7%
Taylor expanded in z around inf 36.8%
associate-/l*75.6%
associate-+r+75.6%
+-commutative75.6%
Simplified75.6%
Taylor expanded in z around 0 36.8%
+-commutative36.8%
+-commutative36.8%
associate-+r+36.8%
associate-*l/75.6%
*-commutative75.6%
+-commutative75.6%
+-commutative75.6%
Simplified75.6%
if -1.75000000000000009e53 < z Initial program 59.1%
Taylor expanded in y around inf 60.9%
Final simplification63.7%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.25e+172) a (if (<= t 2.25e+136) (- (+ a z) b) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.25e+172) {
tmp = a;
} else if (t <= 2.25e+136) {
tmp = (a + z) - b;
} else {
tmp = 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 <= (-1.25d+172)) then
tmp = a
else if (t <= 2.25d+136) then
tmp = (a + z) - b
else
tmp = 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 <= -1.25e+172) {
tmp = a;
} else if (t <= 2.25e+136) {
tmp = (a + z) - b;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.25e+172: tmp = a elif t <= 2.25e+136: tmp = (a + z) - b else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.25e+172) tmp = a; elseif (t <= 2.25e+136) tmp = Float64(Float64(a + z) - b); else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -1.25e+172) tmp = a; elseif (t <= 2.25e+136) tmp = (a + z) - b; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.25e+172], a, If[LessEqual[t, 2.25e+136], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.25 \cdot 10^{+172}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 2.25 \cdot 10^{+136}:\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < -1.25e172 or 2.25e136 < t Initial program 50.4%
Taylor expanded in t around inf 48.8%
if -1.25e172 < t < 2.25e136Initial program 60.6%
Taylor expanded in y around inf 69.8%
Final simplification62.7%
(FPCore (x y z t a b) :precision binary64 (if (<= t -7.2e+33) a (if (<= t 5.6e-61) z a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -7.2e+33) {
tmp = a;
} else if (t <= 5.6e-61) {
tmp = z;
} else {
tmp = 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 <= (-7.2d+33)) then
tmp = a
else if (t <= 5.6d-61) then
tmp = z
else
tmp = 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 <= -7.2e+33) {
tmp = a;
} else if (t <= 5.6e-61) {
tmp = z;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -7.2e+33: tmp = a elif t <= 5.6e-61: tmp = z else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -7.2e+33) tmp = a; elseif (t <= 5.6e-61) tmp = z; else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -7.2e+33) tmp = a; elseif (t <= 5.6e-61) tmp = z; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -7.2e+33], a, If[LessEqual[t, 5.6e-61], z, a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.2 \cdot 10^{+33}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 5.6 \cdot 10^{-61}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < -7.2000000000000005e33 or 5.6000000000000002e-61 < t Initial program 52.8%
Taylor expanded in t around inf 47.9%
if -7.2000000000000005e33 < t < 5.6000000000000002e-61Initial program 61.8%
Taylor expanded in x around inf 48.1%
Final simplification48.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 57.2%
Taylor expanded in t around inf 34.1%
Final simplification34.1%
(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 2024021
(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)))