
(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 (/ (- (+ (* (+ x y) z) (* a (+ y t))) (* y b)) (+ y (+ x t))))) (if (or (<= t_1 (- INFINITY)) (not (<= t_1 2e+265))) (- (+ z a) b) t_1)))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((x + y) * z) + (a * (y + t))) - (y * b)) / (y + (x + t));
double tmp;
if ((t_1 <= -((double) INFINITY)) || !(t_1 <= 2e+265)) {
tmp = (z + a) - b;
} else {
tmp = t_1;
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((x + y) * z) + (a * (y + t))) - (y * b)) / (y + (x + t));
double tmp;
if ((t_1 <= -Double.POSITIVE_INFINITY) || !(t_1 <= 2e+265)) {
tmp = (z + a) - b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((((x + y) * z) + (a * (y + t))) - (y * b)) / (y + (x + t)) tmp = 0 if (t_1 <= -math.inf) or not (t_1 <= 2e+265): tmp = (z + a) - b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(a * Float64(y + t))) - Float64(y * b)) / Float64(y + Float64(x + t))) tmp = 0.0 if ((t_1 <= Float64(-Inf)) || !(t_1 <= 2e+265)) tmp = Float64(Float64(z + a) - b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((((x + y) * z) + (a * (y + t))) - (y * b)) / (y + (x + t)); tmp = 0.0; if ((t_1 <= -Inf) || ~((t_1 <= 2e+265))) tmp = (z + a) - b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(a * N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, (-Infinity)], N[Not[LessEqual[t$95$1, 2e+265]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + a \cdot \left(y + t\right)\right) - y \cdot b}{y + \left(x + t\right)}\\
\mathbf{if}\;t\_1 \leq -\infty \lor \neg \left(t\_1 \leq 2 \cdot 10^{+265}\right):\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 2.00000000000000013e265 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 7.9%
Taylor expanded in y around inf 74.1%
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.00000000000000013e265Initial program 99.7%
Final simplification88.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.5e+49) (not (<= y 1.5e-14))) (- (+ z a) b) (* z (+ (/ x (+ x t)) (* (/ a z) (/ t (+ x t)))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.5e+49) || !(y <= 1.5e-14)) {
tmp = (z + a) - b;
} else {
tmp = z * ((x / (x + t)) + ((a / z) * (t / (x + t))));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-2.5d+49)) .or. (.not. (y <= 1.5d-14))) then
tmp = (z + a) - b
else
tmp = z * ((x / (x + t)) + ((a / z) * (t / (x + t))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.5e+49) || !(y <= 1.5e-14)) {
tmp = (z + a) - b;
} else {
tmp = z * ((x / (x + t)) + ((a / z) * (t / (x + t))));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -2.5e+49) or not (y <= 1.5e-14): tmp = (z + a) - b else: tmp = z * ((x / (x + t)) + ((a / z) * (t / (x + t)))) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.5e+49) || !(y <= 1.5e-14)) tmp = Float64(Float64(z + a) - b); else tmp = Float64(z * Float64(Float64(x / Float64(x + t)) + Float64(Float64(a / z) * Float64(t / Float64(x + t))))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -2.5e+49) || ~((y <= 1.5e-14))) tmp = (z + a) - b; else tmp = z * ((x / (x + t)) + ((a / z) * (t / (x + t)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.5e+49], N[Not[LessEqual[y, 1.5e-14]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], N[(z * N[(N[(x / N[(x + t), $MachinePrecision]), $MachinePrecision] + N[(N[(a / z), $MachinePrecision] * N[(t / N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.5 \cdot 10^{+49} \lor \neg \left(y \leq 1.5 \cdot 10^{-14}\right):\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\frac{x}{x + t} + \frac{a}{z} \cdot \frac{t}{x + t}\right)\\
\end{array}
\end{array}
if y < -2.5000000000000002e49 or 1.4999999999999999e-14 < y Initial program 42.1%
Taylor expanded in y around inf 72.9%
if -2.5000000000000002e49 < y < 1.4999999999999999e-14Initial program 79.0%
Taylor expanded in z around inf 79.2%
associate--l+79.2%
+-commutative79.2%
associate-+r+79.2%
+-commutative79.2%
associate-+r+79.2%
associate-/l*85.1%
+-commutative85.1%
+-commutative85.1%
associate-+r+85.1%
associate-/r*83.7%
Simplified83.7%
Taylor expanded in y around 0 62.2%
times-frac68.6%
Simplified68.6%
Final simplification70.7%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -2.35e-98) (not (<= y 1.05e-13))) (- (+ z a) b) (/ (+ (* t a) (* x z)) (+ x t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.35e-98) || !(y <= 1.05e-13)) {
tmp = (z + a) - b;
} else {
tmp = ((t * a) + (x * z)) / (x + t);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-2.35d-98)) .or. (.not. (y <= 1.05d-13))) then
tmp = (z + a) - b
else
tmp = ((t * a) + (x * z)) / (x + t)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.35e-98) || !(y <= 1.05e-13)) {
tmp = (z + a) - b;
} else {
tmp = ((t * a) + (x * z)) / (x + t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -2.35e-98) or not (y <= 1.05e-13): tmp = (z + a) - b else: tmp = ((t * a) + (x * z)) / (x + t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.35e-98) || !(y <= 1.05e-13)) tmp = Float64(Float64(z + a) - b); else tmp = Float64(Float64(Float64(t * a) + Float64(x * z)) / Float64(x + t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -2.35e-98) || ~((y <= 1.05e-13))) tmp = (z + a) - b; else tmp = ((t * a) + (x * z)) / (x + t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.35e-98], N[Not[LessEqual[y, 1.05e-13]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], N[(N[(N[(t * a), $MachinePrecision] + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(x + t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.35 \cdot 10^{-98} \lor \neg \left(y \leq 1.05 \cdot 10^{-13}\right):\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot a + x \cdot z}{x + t}\\
\end{array}
\end{array}
if y < -2.35000000000000003e-98 or 1.04999999999999994e-13 < y Initial program 48.7%
Taylor expanded in y around inf 68.0%
if -2.35000000000000003e-98 < y < 1.04999999999999994e-13Initial program 79.5%
Taylor expanded in y around 0 61.3%
Final simplification65.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -8e+104) (not (<= a 4.1e+59))) (* a (/ (+ y t) (+ x (+ y t)))) (- (+ z a) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -8e+104) || !(a <= 4.1e+59)) {
tmp = a * ((y + t) / (x + (y + 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 ((a <= (-8d+104)) .or. (.not. (a <= 4.1d+59))) then
tmp = a * ((y + t) / (x + (y + 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 ((a <= -8e+104) || !(a <= 4.1e+59)) {
tmp = a * ((y + t) / (x + (y + t)));
} else {
tmp = (z + a) - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -8e+104) or not (a <= 4.1e+59): tmp = a * ((y + t) / (x + (y + t))) else: tmp = (z + a) - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -8e+104) || !(a <= 4.1e+59)) tmp = Float64(a * Float64(Float64(y + t) / Float64(x + Float64(y + 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 ((a <= -8e+104) || ~((a <= 4.1e+59))) tmp = a * ((y + t) / (x + (y + t))); else tmp = (z + a) - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -8e+104], N[Not[LessEqual[a, 4.1e+59]], $MachinePrecision]], N[(a * N[(N[(y + t), $MachinePrecision] / N[(x + N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8 \cdot 10^{+104} \lor \neg \left(a \leq 4.1 \cdot 10^{+59}\right):\\
\;\;\;\;a \cdot \frac{y + t}{x + \left(y + t\right)}\\
\mathbf{else}:\\
\;\;\;\;\left(z + a\right) - b\\
\end{array}
\end{array}
if a < -8e104 or 4.1e59 < a Initial program 46.5%
Taylor expanded in a around inf 38.6%
associate-/l*79.7%
+-commutative79.7%
+-commutative79.7%
associate-+r+79.7%
Simplified79.7%
if -8e104 < a < 4.1e59Initial program 67.3%
Taylor expanded in y around inf 56.5%
Final simplification63.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= t -2.3e+214) (not (<= t 1.3e+99))) (+ a (/ (* (+ x y) z) t)) (- (+ z a) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -2.3e+214) || !(t <= 1.3e+99)) {
tmp = a + (((x + y) * z) / 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 <= (-2.3d+214)) .or. (.not. (t <= 1.3d+99))) then
tmp = a + (((x + y) * z) / 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 <= -2.3e+214) || !(t <= 1.3e+99)) {
tmp = a + (((x + y) * z) / t);
} else {
tmp = (z + a) - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (t <= -2.3e+214) or not (t <= 1.3e+99): tmp = a + (((x + y) * z) / t) else: tmp = (z + a) - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -2.3e+214) || !(t <= 1.3e+99)) tmp = Float64(a + Float64(Float64(Float64(x + y) * z) / 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 <= -2.3e+214) || ~((t <= 1.3e+99))) tmp = a + (((x + y) * z) / t); else tmp = (z + a) - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -2.3e+214], N[Not[LessEqual[t, 1.3e+99]], $MachinePrecision]], N[(a + N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.3 \cdot 10^{+214} \lor \neg \left(t \leq 1.3 \cdot 10^{+99}\right):\\
\;\;\;\;a + \frac{\left(x + y\right) \cdot z}{t}\\
\mathbf{else}:\\
\;\;\;\;\left(z + a\right) - b\\
\end{array}
\end{array}
if t < -2.2999999999999999e214 or 1.3e99 < t Initial program 51.7%
Taylor expanded in a around inf 78.6%
Simplified78.6%
Taylor expanded in t around inf 56.6%
Taylor expanded in z around -inf 67.1%
if -2.2999999999999999e214 < t < 1.3e99Initial program 64.0%
Taylor expanded in y around inf 60.1%
Final simplification61.8%
(FPCore (x y z t a b) :precision binary64 (if (<= x -4.2e+211) z (if (or (<= x -2.3e-64) (not (<= x 1.08e-100))) (+ z a) (- a b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -4.2e+211) {
tmp = z;
} else if ((x <= -2.3e-64) || !(x <= 1.08e-100)) {
tmp = z + a;
} else {
tmp = a - b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (x <= (-4.2d+211)) then
tmp = z
else if ((x <= (-2.3d-64)) .or. (.not. (x <= 1.08d-100))) then
tmp = z + a
else
tmp = a - b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -4.2e+211) {
tmp = z;
} else if ((x <= -2.3e-64) || !(x <= 1.08e-100)) {
tmp = z + a;
} else {
tmp = a - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -4.2e+211: tmp = z elif (x <= -2.3e-64) or not (x <= 1.08e-100): tmp = z + a else: tmp = a - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -4.2e+211) tmp = z; elseif ((x <= -2.3e-64) || !(x <= 1.08e-100)) tmp = Float64(z + a); else tmp = Float64(a - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -4.2e+211) tmp = z; elseif ((x <= -2.3e-64) || ~((x <= 1.08e-100))) tmp = z + a; else tmp = a - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -4.2e+211], z, If[Or[LessEqual[x, -2.3e-64], N[Not[LessEqual[x, 1.08e-100]], $MachinePrecision]], N[(z + a), $MachinePrecision], N[(a - b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.2 \cdot 10^{+211}:\\
\;\;\;\;z\\
\mathbf{elif}\;x \leq -2.3 \cdot 10^{-64} \lor \neg \left(x \leq 1.08 \cdot 10^{-100}\right):\\
\;\;\;\;z + a\\
\mathbf{else}:\\
\;\;\;\;a - b\\
\end{array}
\end{array}
if x < -4.2e211Initial program 55.9%
Taylor expanded in x around inf 54.6%
if -4.2e211 < x < -2.3000000000000001e-64 or 1.0800000000000001e-100 < x Initial program 56.5%
Taylor expanded in y around inf 59.3%
Taylor expanded in b around 0 55.5%
+-commutative55.5%
Simplified55.5%
if -2.3000000000000001e-64 < x < 1.0800000000000001e-100Initial program 70.0%
Taylor expanded in y around inf 57.6%
Taylor expanded in z around 0 57.6%
Final simplification56.1%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -2.4e-60) (not (<= a 9.8e-135))) (+ z a) (- z b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -2.4e-60) || !(a <= 9.8e-135)) {
tmp = z + a;
} else {
tmp = 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 ((a <= (-2.4d-60)) .or. (.not. (a <= 9.8d-135))) then
tmp = z + a
else
tmp = 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 ((a <= -2.4e-60) || !(a <= 9.8e-135)) {
tmp = z + a;
} else {
tmp = z - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -2.4e-60) or not (a <= 9.8e-135): tmp = z + a else: tmp = z - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -2.4e-60) || !(a <= 9.8e-135)) tmp = Float64(z + a); else tmp = Float64(z - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -2.4e-60) || ~((a <= 9.8e-135))) tmp = z + a; else tmp = z - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -2.4e-60], N[Not[LessEqual[a, 9.8e-135]], $MachinePrecision]], N[(z + a), $MachinePrecision], N[(z - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{-60} \lor \neg \left(a \leq 9.8 \cdot 10^{-135}\right):\\
\;\;\;\;z + a\\
\mathbf{else}:\\
\;\;\;\;z - b\\
\end{array}
\end{array}
if a < -2.40000000000000009e-60 or 9.8000000000000005e-135 < a Initial program 56.6%
Taylor expanded in y around inf 58.8%
Taylor expanded in b around 0 57.3%
+-commutative57.3%
Simplified57.3%
if -2.40000000000000009e-60 < a < 9.8000000000000005e-135Initial program 68.6%
Taylor expanded in y around inf 50.7%
Taylor expanded in a around 0 51.6%
Final simplification55.2%
(FPCore (x y z t a b) :precision binary64 (if (<= t -1.7e+214) a (if (<= t 2.35e+253) (+ z a) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -1.7e+214) {
tmp = a;
} else if (t <= 2.35e+253) {
tmp = z + a;
} 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.7d+214)) then
tmp = a
else if (t <= 2.35d+253) then
tmp = z + a
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.7e+214) {
tmp = a;
} else if (t <= 2.35e+253) {
tmp = z + a;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -1.7e+214: tmp = a elif t <= 2.35e+253: tmp = z + a else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -1.7e+214) tmp = a; elseif (t <= 2.35e+253) tmp = Float64(z + a); else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -1.7e+214) tmp = a; elseif (t <= 2.35e+253) tmp = z + a; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -1.7e+214], a, If[LessEqual[t, 2.35e+253], N[(z + a), $MachinePrecision], a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -1.7 \cdot 10^{+214}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 2.35 \cdot 10^{+253}:\\
\;\;\;\;z + a\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < -1.6999999999999999e214 or 2.35000000000000011e253 < t Initial program 42.1%
Taylor expanded in t around inf 69.9%
if -1.6999999999999999e214 < t < 2.35000000000000011e253Initial program 63.8%
Taylor expanded in y around inf 58.8%
Taylor expanded in b around 0 51.8%
+-commutative51.8%
Simplified51.8%
(FPCore (x y z t a b) :precision binary64 (if (<= t 6.5e+137) (- (+ z a) b) (* a (/ t (+ x t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 6.5e+137) {
tmp = (z + a) - b;
} else {
tmp = a * (t / (x + t));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (t <= 6.5d+137) then
tmp = (z + a) - b
else
tmp = a * (t / (x + t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 6.5e+137) {
tmp = (z + a) - b;
} else {
tmp = a * (t / (x + t));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= 6.5e+137: tmp = (z + a) - b else: tmp = a * (t / (x + t)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= 6.5e+137) tmp = Float64(Float64(z + a) - b); else tmp = Float64(a * Float64(t / Float64(x + t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= 6.5e+137) tmp = (z + a) - b; else tmp = a * (t / (x + t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 6.5e+137], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], N[(a * N[(t / N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 6.5 \cdot 10^{+137}:\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;a \cdot \frac{t}{x + t}\\
\end{array}
\end{array}
if t < 6.5000000000000002e137Initial program 62.6%
Taylor expanded in y around inf 58.3%
if 6.5000000000000002e137 < t Initial program 51.3%
Taylor expanded in z around inf 58.0%
associate--l+58.0%
+-commutative58.0%
associate-+r+58.0%
+-commutative58.0%
associate-+r+58.0%
associate-/l*66.0%
+-commutative66.0%
+-commutative66.0%
associate-+r+66.0%
associate-/r*58.2%
Simplified58.2%
Taylor expanded in y around 0 47.6%
times-frac71.7%
Simplified71.7%
Taylor expanded in z around 0 35.4%
associate-*r/68.7%
+-commutative68.7%
Simplified68.7%
Final simplification59.8%
(FPCore (x y z t a b) :precision binary64 (if (<= t 1.15e+227) (- (+ z a) b) (* a (- 1.0 (/ x t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 1.15e+227) {
tmp = (z + a) - b;
} else {
tmp = a * (1.0 - (x / t));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (t <= 1.15d+227) then
tmp = (z + a) - b
else
tmp = a * (1.0d0 - (x / t))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 1.15e+227) {
tmp = (z + a) - b;
} else {
tmp = a * (1.0 - (x / t));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= 1.15e+227: tmp = (z + a) - b else: tmp = a * (1.0 - (x / t)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= 1.15e+227) tmp = Float64(Float64(z + a) - b); else tmp = Float64(a * Float64(1.0 - Float64(x / t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= 1.15e+227) tmp = (z + a) - b; else tmp = a * (1.0 - (x / t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 1.15e+227], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], N[(a * N[(1.0 - N[(x / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.15 \cdot 10^{+227}:\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(1 - \frac{x}{t}\right)\\
\end{array}
\end{array}
if t < 1.1499999999999999e227Initial program 62.0%
Taylor expanded in y around inf 57.6%
if 1.1499999999999999e227 < t Initial program 49.9%
Taylor expanded in a around inf 90.9%
Simplified86.4%
Taylor expanded in t around inf 71.9%
Taylor expanded in a around inf 76.6%
Final simplification59.2%
(FPCore (x y z t a b) :precision binary64 (if (<= z -6.5e+21) z (if (<= z 2.8e+154) a z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -6.5e+21) {
tmp = z;
} else if (z <= 2.8e+154) {
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 <= (-6.5d+21)) then
tmp = z
else if (z <= 2.8d+154) 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 <= -6.5e+21) {
tmp = z;
} else if (z <= 2.8e+154) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -6.5e+21: tmp = z elif z <= 2.8e+154: tmp = a else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -6.5e+21) tmp = z; elseif (z <= 2.8e+154) tmp = a; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -6.5e+21) tmp = z; elseif (z <= 2.8e+154) tmp = a; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -6.5e+21], z, If[LessEqual[z, 2.8e+154], a, z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{+21}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{+154}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -6.5e21 or 2.7999999999999999e154 < z Initial program 41.4%
Taylor expanded in x around inf 56.9%
if -6.5e21 < z < 2.7999999999999999e154Initial program 70.0%
Taylor expanded in t around inf 41.2%
(FPCore (x y z t a b) :precision binary64 (if (<= t 1.3e+227) (- (+ z a) b) a))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 1.3e+227) {
tmp = (z + a) - 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.3d+227) then
tmp = (z + a) - 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.3e+227) {
tmp = (z + a) - b;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= 1.3e+227: tmp = (z + a) - b else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= 1.3e+227) tmp = Float64(Float64(z + a) - b); else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= 1.3e+227) tmp = (z + a) - b; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 1.3e+227], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], a]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.3 \cdot 10^{+227}:\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < 1.29999999999999991e227Initial program 62.0%
Taylor expanded in y around inf 57.6%
if 1.29999999999999991e227 < t Initial program 49.9%
Taylor expanded in t around inf 74.8%
Final simplification59.1%
(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 61.0%
Taylor expanded in t around inf 33.6%
(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 2024181
(FPCore (x y z t a b)
:name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
:precision binary64
:alt
(! :herbie-platform default (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) -3581311708415056400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (+ z a) b) (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) 12285964308315609000000000000000000000000000000000000000000000000000000000000000000) (/ 1 (/ (+ (+ 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)))