
(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 13 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))
(t_2 (+ x (+ y t)))
(t_3 (+ y (+ x t)))
(t_4 (/ (- (+ (* z (+ y x)) t_1) (* b y)) t_3)))
(if (or (<= t_4 (- INFINITY)) (not (<= t_4 1e+243)))
(+
(/ (- z b) (/ t_3 y))
(+ (* a (+ (/ y t_2) (/ t t_2))) (* x (/ z t_2))))
(/ (- (fma (+ y x) z t_1) (* b y)) t_3))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y + t) * a;
double t_2 = x + (y + t);
double t_3 = y + (x + t);
double t_4 = (((z * (y + x)) + t_1) - (b * y)) / t_3;
double tmp;
if ((t_4 <= -((double) INFINITY)) || !(t_4 <= 1e+243)) {
tmp = ((z - b) / (t_3 / y)) + ((a * ((y / t_2) + (t / t_2))) + (x * (z / t_2)));
} else {
tmp = (fma((y + x), z, t_1) - (b * y)) / t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(y + t) * a) t_2 = Float64(x + Float64(y + t)) t_3 = Float64(y + Float64(x + t)) t_4 = Float64(Float64(Float64(Float64(z * Float64(y + x)) + t_1) - Float64(b * y)) / t_3) tmp = 0.0 if ((t_4 <= Float64(-Inf)) || !(t_4 <= 1e+243)) tmp = Float64(Float64(Float64(z - b) / Float64(t_3 / y)) + Float64(Float64(a * Float64(Float64(y / t_2) + Float64(t / t_2))) + Float64(x * Float64(z / t_2)))); else tmp = Float64(Float64(fma(Float64(y + x), z, t_1) - Float64(b * y)) / t_3); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y + t), $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[(N[(z * N[(y + x), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision] - N[(b * y), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]}, If[Or[LessEqual[t$95$4, (-Infinity)], N[Not[LessEqual[t$95$4, 1e+243]], $MachinePrecision]], N[(N[(N[(z - b), $MachinePrecision] / N[(t$95$3 / y), $MachinePrecision]), $MachinePrecision] + N[(N[(a * N[(N[(y / t$95$2), $MachinePrecision] + N[(t / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * N[(z / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(y + x), $MachinePrecision] * z + t$95$1), $MachinePrecision] - N[(b * y), $MachinePrecision]), $MachinePrecision] / t$95$3), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(y + t\right) \cdot a\\
t_2 := x + \left(y + t\right)\\
t_3 := y + \left(x + t\right)\\
t_4 := \frac{\left(z \cdot \left(y + x\right) + t_1\right) - b \cdot y}{t_3}\\
\mathbf{if}\;t_4 \leq -\infty \lor \neg \left(t_4 \leq 10^{+243}\right):\\
\;\;\;\;\frac{z - b}{\frac{t_3}{y}} + \left(a \cdot \left(\frac{y}{t_2} + \frac{t}{t_2}\right) + x \cdot \frac{z}{t_2}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y + x, z, t_1\right) - b \cdot y}{t_3}\\
\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 1.0000000000000001e243 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 7.3%
Simplified7.4%
Taylor expanded in a around 0 35.7%
associate-/l*71.2%
+-commutative71.2%
+-commutative71.2%
+-commutative71.2%
fma-def71.2%
+-commutative71.2%
+-commutative71.2%
+-commutative71.2%
+-commutative71.2%
associate-/l*99.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
fma-udef99.9%
associate-+l+99.9%
associate-+l+99.9%
associate-/r/99.8%
associate-+l+99.8%
Applied egg-rr99.8%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.0000000000000001e243Initial program 99.7%
fma-def99.7%
+-commutative99.7%
+-commutative99.7%
Simplified99.7%
Final simplification99.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (+ x t))))
(+
(* (- z b) (/ y (+ x (+ y t))))
(fma a (+ (/ y t_1) (/ t t_1)) (/ z (/ t_1 x))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (x + t);
return ((z - b) * (y / (x + (y + t)))) + fma(a, ((y / t_1) + (t / t_1)), (z / (t_1 / x)));
}
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(x + t)) return Float64(Float64(Float64(z - b) * Float64(y / Float64(x + Float64(y + t)))) + fma(a, Float64(Float64(y / t_1) + Float64(t / t_1)), Float64(z / Float64(t_1 / x)))) end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]}, N[(N[(N[(z - b), $MachinePrecision] * N[(y / N[(x + N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(N[(y / t$95$1), $MachinePrecision] + N[(t / t$95$1), $MachinePrecision]), $MachinePrecision] + N[(z / N[(t$95$1 / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + \left(x + t\right)\\
\left(z - b\right) \cdot \frac{y}{x + \left(y + t\right)} + \mathsf{fma}\left(a, \frac{y}{t_1} + \frac{t}{t_1}, \frac{z}{\frac{t_1}{x}}\right)
\end{array}
\end{array}
Initial program 57.1%
Simplified57.2%
Taylor expanded in a around 0 69.7%
associate-/l*85.7%
+-commutative85.7%
+-commutative85.7%
+-commutative85.7%
fma-def85.7%
+-commutative85.7%
+-commutative85.7%
+-commutative85.7%
+-commutative85.7%
associate-/l*98.9%
+-commutative98.9%
+-commutative98.9%
Simplified98.9%
div-inv98.9%
clear-num99.0%
associate-+l+99.0%
Applied egg-rr99.0%
Final simplification99.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ x (+ y t)))
(t_2 (+ y (+ x t)))
(t_3 (/ (- (+ (* z (+ y x)) (* (+ y t) a)) (* b y)) t_2)))
(if (or (<= t_3 (- INFINITY)) (not (<= t_3 1e+243)))
(+
(/ (- z b) (/ t_2 y))
(+ (* a (+ (/ y t_1) (/ t t_1))) (* x (/ z t_1))))
t_3)))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y + t);
double t_2 = y + (x + t);
double t_3 = (((z * (y + x)) + ((y + t) * a)) - (b * y)) / t_2;
double tmp;
if ((t_3 <= -((double) INFINITY)) || !(t_3 <= 1e+243)) {
tmp = ((z - b) / (t_2 / y)) + ((a * ((y / t_1) + (t / t_1))) + (x * (z / t_1)));
} else {
tmp = t_3;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = x + (y + t);
double t_2 = y + (x + t);
double t_3 = (((z * (y + x)) + ((y + t) * a)) - (b * y)) / t_2;
double tmp;
if ((t_3 <= -Double.POSITIVE_INFINITY) || !(t_3 <= 1e+243)) {
tmp = ((z - b) / (t_2 / y)) + ((a * ((y / t_1) + (t / t_1))) + (x * (z / t_1)));
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = x + (y + t) t_2 = y + (x + t) t_3 = (((z * (y + x)) + ((y + t) * a)) - (b * y)) / t_2 tmp = 0 if (t_3 <= -math.inf) or not (t_3 <= 1e+243): tmp = ((z - b) / (t_2 / y)) + ((a * ((y / t_1) + (t / t_1))) + (x * (z / t_1))) else: tmp = t_3 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(x + Float64(y + t)) t_2 = Float64(y + Float64(x + t)) t_3 = Float64(Float64(Float64(Float64(z * Float64(y + x)) + Float64(Float64(y + t) * a)) - Float64(b * y)) / t_2) tmp = 0.0 if ((t_3 <= Float64(-Inf)) || !(t_3 <= 1e+243)) tmp = Float64(Float64(Float64(z - b) / Float64(t_2 / y)) + Float64(Float64(a * Float64(Float64(y / t_1) + Float64(t / t_1))) + Float64(x * Float64(z / t_1)))); else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = x + (y + t); t_2 = y + (x + t); t_3 = (((z * (y + x)) + ((y + t) * a)) - (b * y)) / t_2; tmp = 0.0; if ((t_3 <= -Inf) || ~((t_3 <= 1e+243))) tmp = ((z - b) / (t_2 / y)) + ((a * ((y / t_1) + (t / t_1))) + (x * (z / t_1))); else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(x + 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] + N[(N[(y + t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(b * y), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]}, If[Or[LessEqual[t$95$3, (-Infinity)], N[Not[LessEqual[t$95$3, 1e+243]], $MachinePrecision]], N[(N[(N[(z - b), $MachinePrecision] / N[(t$95$2 / y), $MachinePrecision]), $MachinePrecision] + N[(N[(a * N[(N[(y / t$95$1), $MachinePrecision] + N[(t / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * N[(z / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$3]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x + \left(y + t\right)\\
t_2 := y + \left(x + t\right)\\
t_3 := \frac{\left(z \cdot \left(y + x\right) + \left(y + t\right) \cdot a\right) - b \cdot y}{t_2}\\
\mathbf{if}\;t_3 \leq -\infty \lor \neg \left(t_3 \leq 10^{+243}\right):\\
\;\;\;\;\frac{z - b}{\frac{t_2}{y}} + \left(a \cdot \left(\frac{y}{t_1} + \frac{t}{t_1}\right) + x \cdot \frac{z}{t_1}\right)\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\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 1.0000000000000001e243 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 7.3%
Simplified7.4%
Taylor expanded in a around 0 35.7%
associate-/l*71.2%
+-commutative71.2%
+-commutative71.2%
+-commutative71.2%
fma-def71.2%
+-commutative71.2%
+-commutative71.2%
+-commutative71.2%
+-commutative71.2%
associate-/l*99.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
fma-udef99.9%
associate-+l+99.9%
associate-+l+99.9%
associate-/r/99.8%
associate-+l+99.8%
Applied egg-rr99.8%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.0000000000000001e243Initial program 99.7%
Final simplification99.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (+ x t)))
(t_2 (/ (- (+ (* z (+ y x)) (* (+ y t) a)) (* b y)) t_1)))
(if (or (<= t_2 (- INFINITY)) (not (<= t_2 5e+283)))
(+ (/ (- z b) (/ t_1 y)) (+ a (* x (/ z (+ x (+ y t))))))
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)) + ((y + t) * a)) - (b * y)) / t_1;
double tmp;
if ((t_2 <= -((double) INFINITY)) || !(t_2 <= 5e+283)) {
tmp = ((z - b) / (t_1 / y)) + (a + (x * (z / (x + (y + t)))));
} 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)) + ((y + t) * a)) - (b * y)) / t_1;
double tmp;
if ((t_2 <= -Double.POSITIVE_INFINITY) || !(t_2 <= 5e+283)) {
tmp = ((z - b) / (t_1 / y)) + (a + (x * (z / (x + (y + t)))));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = y + (x + t) t_2 = (((z * (y + x)) + ((y + t) * a)) - (b * y)) / t_1 tmp = 0 if (t_2 <= -math.inf) or not (t_2 <= 5e+283): tmp = ((z - b) / (t_1 / y)) + (a + (x * (z / (x + (y + t))))) 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(Float64(y + t) * a)) - Float64(b * y)) / t_1) tmp = 0.0 if ((t_2 <= Float64(-Inf)) || !(t_2 <= 5e+283)) tmp = Float64(Float64(Float64(z - b) / Float64(t_1 / y)) + Float64(a + Float64(x * Float64(z / Float64(x + Float64(y + t)))))); 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)) + ((y + t) * a)) - (b * y)) / t_1; tmp = 0.0; if ((t_2 <= -Inf) || ~((t_2 <= 5e+283))) tmp = ((z - b) / (t_1 / y)) + (a + (x * (z / (x + (y + t))))); 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[(N[(y + t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(b * y), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[Or[LessEqual[t$95$2, (-Infinity)], N[Not[LessEqual[t$95$2, 5e+283]], $MachinePrecision]], N[(N[(N[(z - b), $MachinePrecision] / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision] + N[(a + N[(x * N[(z / N[(x + N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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) + \left(y + t\right) \cdot a\right) - b \cdot y}{t_1}\\
\mathbf{if}\;t_2 \leq -\infty \lor \neg \left(t_2 \leq 5 \cdot 10^{+283}\right):\\
\;\;\;\;\frac{z - b}{\frac{t_1}{y}} + \left(a + x \cdot \frac{z}{x + \left(y + t\right)}\right)\\
\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 5.0000000000000004e283 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 5.7%
Simplified5.8%
Taylor expanded in a around 0 34.6%
associate-/l*70.7%
+-commutative70.7%
+-commutative70.7%
+-commutative70.7%
fma-def70.7%
+-commutative70.7%
+-commutative70.7%
+-commutative70.7%
+-commutative70.7%
associate-/l*99.9%
+-commutative99.9%
+-commutative99.9%
Simplified99.9%
fma-udef99.9%
associate-+l+99.9%
associate-+l+99.9%
associate-/r/99.8%
associate-+l+99.8%
Applied egg-rr99.8%
Taylor expanded in y around inf 91.5%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.0000000000000004e283Initial program 99.7%
Final simplification96.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* z (+ y x)) (* (+ y t) a)) (* b y)) (+ y (+ x t)))))
(if (or (<= t_1 (- INFINITY)) (not (<= t_1 5e+283)))
(+ z (/ y (/ (+ y x) (- a b))))
t_1)))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (((z * (y + x)) + ((y + t) * a)) - (b * y)) / (y + (x + t));
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 5e+283)) {
tmp = z + (y / ((y + x) / (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 = (((z * (y + x)) + ((y + t) * a)) - (b * y)) / (y + (x + t));
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 5e+283)) {
tmp = z + (y / ((y + x) / (a - b)));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (((z * (y + x)) + ((y + t) * a)) - (b * y)) / (y + (x + t)) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 5e+283): tmp = z + (y / ((y + x) / (a - b))) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(z * Float64(y + x)) + Float64(Float64(y + t) * a)) - Float64(b * y)) / Float64(y + Float64(x + t))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 5e+283)) tmp = Float64(z + Float64(y / Float64(Float64(y + x) / Float64(a - b)))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (((z * (y + x)) + ((y + t) * a)) - (b * y)) / (y + (x + t)); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 5e+283))) tmp = z + (y / ((y + x) / (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[(z * N[(y + x), $MachinePrecision]), $MachinePrecision] + N[(N[(y + t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(b * y), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 5e+283]], $MachinePrecision]], N[(z + N[(y / N[(N[(y + x), $MachinePrecision] / N[(a - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(z \cdot \left(y + x\right) + \left(y + t\right) \cdot a\right) - b \cdot y}{y + \left(x + t\right)}\\
\mathbf{if}\;t_1 \leq -\infty \lor \neg \left(t_1 \leq 5 \cdot 10^{+283}\right):\\
\;\;\;\;z + \frac{y}{\frac{y + x}{a - 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 5.0000000000000004e283 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 5.7%
Simplified5.8%
Taylor expanded in t around 0 7.8%
Taylor expanded in z around 0 37.8%
+-commutative37.8%
associate-/l*74.3%
Simplified74.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)) < 5.0000000000000004e283Initial program 99.7%
Final simplification88.2%
(FPCore (x y z t a b) :precision binary64 (if (or (<= x -6e+64) (not (<= x 7.5e+102))) (+ z (/ y (/ (+ y x) (- a b)))) (+ a (/ (- z b) (/ (+ y (+ x t)) y)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -6e+64) || !(x <= 7.5e+102)) {
tmp = z + (y / ((y + x) / (a - b)));
} else {
tmp = a + ((z - b) / ((y + (x + 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 <= (-6d+64)) .or. (.not. (x <= 7.5d+102))) then
tmp = z + (y / ((y + x) / (a - b)))
else
tmp = a + ((z - b) / ((y + (x + 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 <= -6e+64) || !(x <= 7.5e+102)) {
tmp = z + (y / ((y + x) / (a - b)));
} else {
tmp = a + ((z - b) / ((y + (x + t)) / y));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x <= -6e+64) or not (x <= 7.5e+102): tmp = z + (y / ((y + x) / (a - b))) else: tmp = a + ((z - b) / ((y + (x + t)) / y)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((x <= -6e+64) || !(x <= 7.5e+102)) tmp = Float64(z + Float64(y / Float64(Float64(y + x) / Float64(a - b)))); else tmp = Float64(a + Float64(Float64(z - b) / Float64(Float64(y + Float64(x + t)) / y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x <= -6e+64) || ~((x <= 7.5e+102))) tmp = z + (y / ((y + x) / (a - b))); else tmp = a + ((z - b) / ((y + (x + t)) / y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[x, -6e+64], N[Not[LessEqual[x, 7.5e+102]], $MachinePrecision]], N[(z + N[(y / N[(N[(y + x), $MachinePrecision] / N[(a - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(N[(z - b), $MachinePrecision] / N[(N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+64} \lor \neg \left(x \leq 7.5 \cdot 10^{+102}\right):\\
\;\;\;\;z + \frac{y}{\frac{y + x}{a - b}}\\
\mathbf{else}:\\
\;\;\;\;a + \frac{z - b}{\frac{y + \left(x + t\right)}{y}}\\
\end{array}
\end{array}
if x < -6.0000000000000004e64 or 7.5e102 < x Initial program 48.8%
Simplified48.5%
Taylor expanded in t around 0 40.2%
Taylor expanded in z around 0 65.4%
+-commutative65.4%
associate-/l*78.4%
Simplified78.4%
if -6.0000000000000004e64 < x < 7.5e102Initial program 63.7%
Simplified64.1%
Taylor expanded in a around 0 76.6%
associate-/l*97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
fma-def97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
+-commutative97.9%
associate-/l*99.2%
+-commutative99.2%
+-commutative99.2%
Simplified99.2%
Taylor expanded in y around inf 80.3%
Final simplification79.5%
(FPCore (x y z t a b) :precision binary64 (if (or (<= x -1.4e+203) (not (<= x 3.5e+137))) (+ z (* a (+ (/ y x) (/ t x)))) (- (+ z a) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -1.4e+203) || !(x <= 3.5e+137)) {
tmp = z + (a * ((y / x) + (t / 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+203)) .or. (.not. (x <= 3.5d+137))) then
tmp = z + (a * ((y / x) + (t / 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+203) || !(x <= 3.5e+137)) {
tmp = z + (a * ((y / x) + (t / x)));
} else {
tmp = (z + a) - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x <= -1.4e+203) or not (x <= 3.5e+137): tmp = z + (a * ((y / x) + (t / x))) else: tmp = (z + a) - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((x <= -1.4e+203) || !(x <= 3.5e+137)) tmp = Float64(z + Float64(a * Float64(Float64(y / x) + Float64(t / 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+203) || ~((x <= 3.5e+137))) tmp = z + (a * ((y / x) + (t / x))); else tmp = (z + a) - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[x, -1.4e+203], N[Not[LessEqual[x, 3.5e+137]], $MachinePrecision]], N[(z + N[(a * N[(N[(y / x), $MachinePrecision] + N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+203} \lor \neg \left(x \leq 3.5 \cdot 10^{+137}\right):\\
\;\;\;\;z + a \cdot \left(\frac{y}{x} + \frac{t}{x}\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z + a\right) - b\\
\end{array}
\end{array}
if x < -1.39999999999999995e203 or 3.5000000000000001e137 < x Initial program 44.8%
Simplified44.4%
Taylor expanded in x around inf 59.7%
associate--l+61.0%
+-commutative61.0%
associate-/l*61.2%
associate-/l*67.9%
sub-neg67.9%
+-commutative67.9%
associate-+r+67.9%
sub-neg67.9%
associate-/l*82.3%
+-commutative82.3%
Simplified82.3%
Taylor expanded in a around inf 76.8%
if -1.39999999999999995e203 < x < 3.5000000000000001e137Initial program 61.9%
*-commutative61.9%
distribute-rgt-in61.8%
associate-+r+61.8%
associate--l+61.8%
+-commutative61.8%
+-commutative61.8%
distribute-lft-out--61.9%
fma-def62.2%
+-commutative62.2%
fma-def62.2%
associate-+l+62.2%
+-commutative62.2%
Simplified62.2%
Taylor expanded in y around inf 56.7%
Final simplification62.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -7.5e+164) (not (<= t 5.7e+159))) (/ a (/ (+ x t) t)) (+ z (/ y (/ (+ y x) (- a b))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -7.5e+164) || !(t <= 5.7e+159)) {
tmp = a / ((x + t) / t);
} else {
tmp = z + (y / ((y + x) / (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 <= (-7.5d+164)) .or. (.not. (t <= 5.7d+159))) then
tmp = a / ((x + t) / t)
else
tmp = z + (y / ((y + x) / (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 <= -7.5e+164) || !(t <= 5.7e+159)) {
tmp = a / ((x + t) / t);
} else {
tmp = z + (y / ((y + x) / (a - b)));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -7.5e+164) or not (t <= 5.7e+159): tmp = a / ((x + t) / t) else: tmp = z + (y / ((y + x) / (a - b))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -7.5e+164) || !(t <= 5.7e+159)) tmp = Float64(a / Float64(Float64(x + t) / t)); else tmp = Float64(z + Float64(y / Float64(Float64(y + x) / Float64(a - b)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((t <= -7.5e+164) || ~((t <= 5.7e+159))) tmp = a / ((x + t) / t); else tmp = z + (y / ((y + x) / (a - b))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -7.5e+164], N[Not[LessEqual[t, 5.7e+159]], $MachinePrecision]], N[(a / N[(N[(x + t), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(z + N[(y / N[(N[(y + x), $MachinePrecision] / N[(a - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{+164} \lor \neg \left(t \leq 5.7 \cdot 10^{+159}\right):\\
\;\;\;\;\frac{a}{\frac{x + t}{t}}\\
\mathbf{else}:\\
\;\;\;\;z + \frac{y}{\frac{y + x}{a - b}}\\
\end{array}
\end{array}
if t < -7.49999999999999976e164 or 5.6999999999999999e159 < t Initial program 47.3%
*-commutative47.3%
distribute-rgt-in47.2%
associate-+r+47.2%
associate--l+47.2%
+-commutative47.2%
+-commutative47.2%
distribute-lft-out--47.2%
fma-def47.3%
+-commutative47.3%
fma-def47.5%
associate-+l+47.5%
+-commutative47.5%
Simplified47.5%
Taylor expanded in a around inf 29.0%
Taylor expanded in y around 0 29.0%
associate-/l*59.1%
Simplified59.1%
if -7.49999999999999976e164 < t < 5.6999999999999999e159Initial program 60.6%
Simplified60.7%
Taylor expanded in t around 0 43.7%
Taylor expanded in z around 0 60.1%
+-commutative60.1%
associate-/l*75.7%
Simplified75.7%
Final simplification71.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= x -6e+202) (not (<= x 1.5e+138))) (+ z (* a (/ t x))) (- (+ z a) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -6e+202) || !(x <= 1.5e+138)) {
tmp = z + (a * (t / 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 <= (-6d+202)) .or. (.not. (x <= 1.5d+138))) then
tmp = z + (a * (t / 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 <= -6e+202) || !(x <= 1.5e+138)) {
tmp = z + (a * (t / x));
} else {
tmp = (z + a) - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x <= -6e+202) or not (x <= 1.5e+138): tmp = z + (a * (t / x)) else: tmp = (z + a) - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((x <= -6e+202) || !(x <= 1.5e+138)) tmp = Float64(z + Float64(a * Float64(t / 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 <= -6e+202) || ~((x <= 1.5e+138))) tmp = z + (a * (t / x)); else tmp = (z + a) - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[x, -6e+202], N[Not[LessEqual[x, 1.5e+138]], $MachinePrecision]], N[(z + N[(a * N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -6 \cdot 10^{+202} \lor \neg \left(x \leq 1.5 \cdot 10^{+138}\right):\\
\;\;\;\;z + a \cdot \frac{t}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(z + a\right) - b\\
\end{array}
\end{array}
if x < -6.0000000000000003e202 or 1.50000000000000005e138 < x Initial program 44.8%
Simplified44.4%
Taylor expanded in x around inf 59.7%
associate--l+61.0%
+-commutative61.0%
associate-/l*61.2%
associate-/l*67.9%
sub-neg67.9%
+-commutative67.9%
associate-+r+67.9%
sub-neg67.9%
associate-/l*82.3%
+-commutative82.3%
Simplified82.3%
Taylor expanded in a around inf 76.8%
Taylor expanded in y around 0 66.9%
if -6.0000000000000003e202 < x < 1.50000000000000005e138Initial program 61.9%
*-commutative61.9%
distribute-rgt-in61.8%
associate-+r+61.8%
associate--l+61.8%
+-commutative61.8%
+-commutative61.8%
distribute-lft-out--61.9%
fma-def62.2%
+-commutative62.2%
fma-def62.2%
associate-+l+62.2%
+-commutative62.2%
Simplified62.2%
Taylor expanded in y around inf 56.7%
Final simplification59.5%
(FPCore (x y z t a b) :precision binary64 (if (<= x -7e+203) (+ z (/ (* y a) x)) (if (<= x 4.8e+135) (- (+ z a) b) (+ z (* a (/ t x))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -7e+203) {
tmp = z + ((y * a) / x);
} else if (x <= 4.8e+135) {
tmp = (z + a) - b;
} else {
tmp = z + (a * (t / x));
}
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 <= (-7d+203)) then
tmp = z + ((y * a) / x)
else if (x <= 4.8d+135) then
tmp = (z + a) - b
else
tmp = z + (a * (t / x))
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 <= -7e+203) {
tmp = z + ((y * a) / x);
} else if (x <= 4.8e+135) {
tmp = (z + a) - b;
} else {
tmp = z + (a * (t / x));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -7e+203: tmp = z + ((y * a) / x) elif x <= 4.8e+135: tmp = (z + a) - b else: tmp = z + (a * (t / x)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -7e+203) tmp = Float64(z + Float64(Float64(y * a) / x)); elseif (x <= 4.8e+135) tmp = Float64(Float64(z + a) - b); else tmp = Float64(z + Float64(a * Float64(t / x))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -7e+203) tmp = z + ((y * a) / x); elseif (x <= 4.8e+135) tmp = (z + a) - b; else tmp = z + (a * (t / x)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -7e+203], N[(z + N[(N[(y * a), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.8e+135], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], N[(z + N[(a * N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -7 \cdot 10^{+203}:\\
\;\;\;\;z + \frac{y \cdot a}{x}\\
\mathbf{elif}\;x \leq 4.8 \cdot 10^{+135}:\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;z + a \cdot \frac{t}{x}\\
\end{array}
\end{array}
if x < -7.00000000000000062e203Initial program 49.3%
Simplified48.8%
Taylor expanded in x around inf 75.4%
associate--l+75.4%
+-commutative75.4%
associate-/l*75.8%
associate-/l*75.7%
sub-neg75.7%
+-commutative75.7%
associate-+r+75.7%
sub-neg75.7%
associate-/l*79.4%
+-commutative79.4%
Simplified79.4%
Taylor expanded in a around inf 77.9%
Taylor expanded in y around inf 72.3%
if -7.00000000000000062e203 < x < 4.79999999999999995e135Initial program 61.9%
*-commutative61.9%
distribute-rgt-in61.8%
associate-+r+61.8%
associate--l+61.8%
+-commutative61.8%
+-commutative61.8%
distribute-lft-out--61.9%
fma-def62.2%
+-commutative62.2%
fma-def62.2%
associate-+l+62.2%
+-commutative62.2%
Simplified62.2%
Taylor expanded in y around inf 56.7%
if 4.79999999999999995e135 < x Initial program 41.9%
Simplified41.5%
Taylor expanded in x around inf 49.7%
associate--l+51.9%
+-commutative51.9%
associate-/l*51.9%
associate-/l*62.9%
sub-neg62.9%
+-commutative62.9%
associate-+r+62.9%
sub-neg62.9%
associate-/l*84.2%
+-commutative84.2%
Simplified84.2%
Taylor expanded in a around inf 76.2%
Taylor expanded in y around 0 70.8%
Final simplification60.8%
(FPCore (x y z t a b) :precision binary64 (if (<= z -4.2e+47) z (if (<= z 9e-77) a (if (<= z 8.2e-24) z (if (<= z 3.4e+152) a z)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -4.2e+47) {
tmp = z;
} else if (z <= 9e-77) {
tmp = a;
} else if (z <= 8.2e-24) {
tmp = z;
} else if (z <= 3.4e+152) {
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 <= (-4.2d+47)) then
tmp = z
else if (z <= 9d-77) then
tmp = a
else if (z <= 8.2d-24) then
tmp = z
else if (z <= 3.4d+152) 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 <= -4.2e+47) {
tmp = z;
} else if (z <= 9e-77) {
tmp = a;
} else if (z <= 8.2e-24) {
tmp = z;
} else if (z <= 3.4e+152) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -4.2e+47: tmp = z elif z <= 9e-77: tmp = a elif z <= 8.2e-24: tmp = z elif z <= 3.4e+152: tmp = a else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -4.2e+47) tmp = z; elseif (z <= 9e-77) tmp = a; elseif (z <= 8.2e-24) tmp = z; elseif (z <= 3.4e+152) tmp = a; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -4.2e+47) tmp = z; elseif (z <= 9e-77) tmp = a; elseif (z <= 8.2e-24) tmp = z; elseif (z <= 3.4e+152) tmp = a; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -4.2e+47], z, If[LessEqual[z, 9e-77], a, If[LessEqual[z, 8.2e-24], z, If[LessEqual[z, 3.4e+152], a, z]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+47}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 9 \cdot 10^{-77}:\\
\;\;\;\;a\\
\mathbf{elif}\;z \leq 8.2 \cdot 10^{-24}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 3.4 \cdot 10^{+152}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -4.2e47 or 9.0000000000000001e-77 < z < 8.20000000000000029e-24 or 3.4000000000000002e152 < z Initial program 49.3%
*-commutative49.3%
distribute-rgt-in49.2%
associate-+r+49.2%
associate--l+49.2%
+-commutative49.2%
+-commutative49.2%
distribute-lft-out--49.2%
fma-def49.6%
+-commutative49.6%
fma-def49.7%
associate-+l+49.7%
+-commutative49.7%
Simplified49.7%
Taylor expanded in x around inf 67.3%
if -4.2e47 < z < 9.0000000000000001e-77 or 8.20000000000000029e-24 < z < 3.4000000000000002e152Initial program 62.0%
*-commutative62.0%
distribute-rgt-in61.9%
associate-+r+61.9%
associate--l+61.9%
+-commutative61.9%
+-commutative61.9%
distribute-lft-out--62.0%
fma-def62.1%
+-commutative62.1%
fma-def62.1%
associate-+l+62.1%
+-commutative62.1%
Simplified62.1%
Taylor expanded in t around inf 40.0%
Final simplification50.6%
(FPCore (x y z t a b) :precision binary64 (if (<= x -1.25e+204) z (if (<= x 5.2e+140) (- (+ z a) b) z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.25e+204) {
tmp = z;
} else if (x <= 5.2e+140) {
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.25d+204)) then
tmp = z
else if (x <= 5.2d+140) 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.25e+204) {
tmp = z;
} else if (x <= 5.2e+140) {
tmp = (z + a) - b;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -1.25e+204: tmp = z elif x <= 5.2e+140: tmp = (z + a) - b else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -1.25e+204) tmp = z; elseif (x <= 5.2e+140) 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.25e+204) tmp = z; elseif (x <= 5.2e+140) tmp = (z + a) - b; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.25e+204], z, If[LessEqual[x, 5.2e+140], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.25 \cdot 10^{+204}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+140}:\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if x < -1.25000000000000002e204 or 5.2000000000000002e140 < x Initial program 44.8%
*-commutative44.8%
distribute-rgt-in44.7%
associate-+r+44.7%
associate--l+44.7%
+-commutative44.7%
+-commutative44.7%
distribute-lft-out--44.7%
fma-def44.8%
+-commutative44.8%
fma-def44.9%
associate-+l+44.9%
+-commutative44.9%
Simplified44.9%
Taylor expanded in x around inf 57.2%
if -1.25000000000000002e204 < x < 5.2000000000000002e140Initial program 61.9%
*-commutative61.9%
distribute-rgt-in61.8%
associate-+r+61.8%
associate--l+61.8%
+-commutative61.8%
+-commutative61.8%
distribute-lft-out--61.9%
fma-def62.2%
+-commutative62.2%
fma-def62.2%
associate-+l+62.2%
+-commutative62.2%
Simplified62.2%
Taylor expanded in y around inf 56.7%
Final simplification56.8%
(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.1%
*-commutative57.1%
distribute-rgt-in57.0%
associate-+r+57.0%
associate--l+57.0%
+-commutative57.0%
+-commutative57.0%
distribute-lft-out--57.1%
fma-def57.3%
+-commutative57.3%
fma-def57.3%
associate-+l+57.3%
+-commutative57.3%
Simplified57.3%
Taylor expanded in t around inf 28.8%
Final simplification28.8%
(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 2023199
(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)))