
(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 15 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 (+ t (+ x y)))
(t_2 (* (+ y t) a))
(t_3 (/ (- (+ t_2 (* z (+ x y))) (* y b)) (+ y (+ x t)))))
(if (or (<= t_3 (- INFINITY)) (not (<= t_3 1e+247)))
(- (+ z a) b)
(- (+ (* z (+ (/ x t_1) (/ y t_1))) (/ t_2 t_1)) (/ (* y b) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t + (x + y);
double t_2 = (y + t) * a;
double t_3 = ((t_2 + (z * (x + y))) - (y * b)) / (y + (x + t));
double tmp;
if ((t_3 <= -((double) INFINITY)) || !(t_3 <= 1e+247)) {
tmp = (z + a) - b;
} else {
tmp = ((z * ((x / t_1) + (y / t_1))) + (t_2 / t_1)) - ((y * b) / t_1);
}
return tmp;
}
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t + (x + y);
double t_2 = (y + t) * a;
double t_3 = ((t_2 + (z * (x + y))) - (y * b)) / (y + (x + t));
double tmp;
if ((t_3 <= -Double.POSITIVE_INFINITY) || !(t_3 <= 1e+247)) {
tmp = (z + a) - b;
} else {
tmp = ((z * ((x / t_1) + (y / t_1))) + (t_2 / t_1)) - ((y * b) / t_1);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = t + (x + y) t_2 = (y + t) * a t_3 = ((t_2 + (z * (x + y))) - (y * b)) / (y + (x + t)) tmp = 0 if (t_3 <= -math.inf) or not (t_3 <= 1e+247): tmp = (z + a) - b else: tmp = ((z * ((x / t_1) + (y / t_1))) + (t_2 / t_1)) - ((y * b) / t_1) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(t + Float64(x + y)) t_2 = Float64(Float64(y + t) * a) t_3 = Float64(Float64(Float64(t_2 + Float64(z * Float64(x + y))) - Float64(y * b)) / Float64(y + Float64(x + t))) tmp = 0.0 if ((t_3 <= Float64(-Inf)) || !(t_3 <= 1e+247)) tmp = Float64(Float64(z + a) - b); else tmp = Float64(Float64(Float64(z * Float64(Float64(x / t_1) + Float64(y / t_1))) + Float64(t_2 / t_1)) - Float64(Float64(y * b) / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = t + (x + y); t_2 = (y + t) * a; t_3 = ((t_2 + (z * (x + y))) - (y * b)) / (y + (x + t)); tmp = 0.0; if ((t_3 <= -Inf) || ~((t_3 <= 1e+247))) tmp = (z + a) - b; else tmp = ((z * ((x / t_1) + (y / t_1))) + (t_2 / t_1)) - ((y * b) / t_1); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + t), $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(t$95$2 + N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$3, (-Infinity)], N[Not[LessEqual[t$95$3, 1e+247]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], N[(N[(N[(z * N[(N[(x / t$95$1), $MachinePrecision] + N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(t$95$2 / t$95$1), $MachinePrecision]), $MachinePrecision] - N[(N[(y * b), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \left(x + y\right)\\
t_2 := \left(y + t\right) \cdot a\\
t_3 := \frac{\left(t_2 + z \cdot \left(x + y\right)\right) - y \cdot b}{y + \left(x + t\right)}\\
\mathbf{if}\;t_3 \leq -\infty \lor \neg \left(t_3 \leq 10^{+247}\right):\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot \left(\frac{x}{t_1} + \frac{y}{t_1}\right) + \frac{t_2}{t_1}\right) - \frac{y \cdot b}{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 9.99999999999999952e246 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 7.5%
Taylor expanded in y around inf 77.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)) < 9.99999999999999952e246Initial program 99.7%
Taylor expanded in z around 0 99.8%
Final simplification89.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- (+ (* (+ y t) a) (* z (+ x y))) (* y b)) (+ y (+ x t))))) (if (or (<= t_1 -1e+264) (not (<= t_1 1e+247))) (- (+ z a) b) t_1)))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((y + t) * a) + (z * (x + y))) - (y * b)) / (y + (x + t));
double tmp;
if ((t_1 <= -1e+264) || !(t_1 <= 1e+247)) {
tmp = (z + a) - b;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = ((((y + t) * a) + (z * (x + y))) - (y * b)) / (y + (x + t))
if ((t_1 <= (-1d+264)) .or. (.not. (t_1 <= 1d+247))) then
tmp = (z + a) - b
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((y + t) * a) + (z * (x + y))) - (y * b)) / (y + (x + t));
double tmp;
if ((t_1 <= -1e+264) || !(t_1 <= 1e+247)) {
tmp = (z + a) - b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = ((((y + t) * a) + (z * (x + y))) - (y * b)) / (y + (x + t)) tmp = 0 if (t_1 <= -1e+264) or not (t_1 <= 1e+247): tmp = (z + a) - b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(Float64(y + t) * a) + Float64(z * Float64(x + y))) - Float64(y * b)) / Float64(y + Float64(x + t))) tmp = 0.0 if ((t_1 <= -1e+264) || !(t_1 <= 1e+247)) tmp = Float64(Float64(z + a) - b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = ((((y + t) * a) + (z * (x + y))) - (y * b)) / (y + (x + t)); tmp = 0.0; if ((t_1 <= -1e+264) || ~((t_1 <= 1e+247))) tmp = (z + a) - b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(N[(y + t), $MachinePrecision] * a), $MachinePrecision] + N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e+264], N[Not[LessEqual[t$95$1, 1e+247]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(\left(y + t\right) \cdot a + z \cdot \left(x + y\right)\right) - y \cdot b}{y + \left(x + t\right)}\\
\mathbf{if}\;t_1 \leq -1 \cdot 10^{+264} \lor \neg \left(t_1 \leq 10^{+247}\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)) < -1.00000000000000004e264 or 9.99999999999999952e246 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 10.6%
Taylor expanded in y around inf 77.9%
if -1.00000000000000004e264 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.99999999999999952e246Initial program 99.7%
Final simplification89.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ z (/ (+ x (+ y t)) (+ x y)))))
(if (<= z -2.2e+19)
t_1
(if (<= z -3.7e-296)
(- (+ z a) (/ (* y b) (+ t (+ x y))))
(if (<= z 1.05e-260)
(* y (/ (- a b) (+ x y)))
(if (<= z 1.1e-182)
(/ (- (* (+ y t) a) (* y b)) (+ y (+ x t)))
(if (<= z 7.4e-63)
(- (+ z a) b)
(if (<= z 1.05e+24)
(/ (- (+ (* y a) (* z (+ x y))) (* y b)) (+ x y))
t_1))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z / ((x + (y + t)) / (x + y));
double tmp;
if (z <= -2.2e+19) {
tmp = t_1;
} else if (z <= -3.7e-296) {
tmp = (z + a) - ((y * b) / (t + (x + y)));
} else if (z <= 1.05e-260) {
tmp = y * ((a - b) / (x + y));
} else if (z <= 1.1e-182) {
tmp = (((y + t) * a) - (y * b)) / (y + (x + t));
} else if (z <= 7.4e-63) {
tmp = (z + a) - b;
} else if (z <= 1.05e+24) {
tmp = (((y * a) + (z * (x + y))) - (y * b)) / (x + y);
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = z / ((x + (y + t)) / (x + y))
if (z <= (-2.2d+19)) then
tmp = t_1
else if (z <= (-3.7d-296)) then
tmp = (z + a) - ((y * b) / (t + (x + y)))
else if (z <= 1.05d-260) then
tmp = y * ((a - b) / (x + y))
else if (z <= 1.1d-182) then
tmp = (((y + t) * a) - (y * b)) / (y + (x + t))
else if (z <= 7.4d-63) then
tmp = (z + a) - b
else if (z <= 1.05d+24) then
tmp = (((y * a) + (z * (x + y))) - (y * b)) / (x + y)
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z / ((x + (y + t)) / (x + y));
double tmp;
if (z <= -2.2e+19) {
tmp = t_1;
} else if (z <= -3.7e-296) {
tmp = (z + a) - ((y * b) / (t + (x + y)));
} else if (z <= 1.05e-260) {
tmp = y * ((a - b) / (x + y));
} else if (z <= 1.1e-182) {
tmp = (((y + t) * a) - (y * b)) / (y + (x + t));
} else if (z <= 7.4e-63) {
tmp = (z + a) - b;
} else if (z <= 1.05e+24) {
tmp = (((y * a) + (z * (x + y))) - (y * b)) / (x + y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = z / ((x + (y + t)) / (x + y)) tmp = 0 if z <= -2.2e+19: tmp = t_1 elif z <= -3.7e-296: tmp = (z + a) - ((y * b) / (t + (x + y))) elif z <= 1.05e-260: tmp = y * ((a - b) / (x + y)) elif z <= 1.1e-182: tmp = (((y + t) * a) - (y * b)) / (y + (x + t)) elif z <= 7.4e-63: tmp = (z + a) - b elif z <= 1.05e+24: tmp = (((y * a) + (z * (x + y))) - (y * b)) / (x + y) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(z / Float64(Float64(x + Float64(y + t)) / Float64(x + y))) tmp = 0.0 if (z <= -2.2e+19) tmp = t_1; elseif (z <= -3.7e-296) tmp = Float64(Float64(z + a) - Float64(Float64(y * b) / Float64(t + Float64(x + y)))); elseif (z <= 1.05e-260) tmp = Float64(y * Float64(Float64(a - b) / Float64(x + y))); elseif (z <= 1.1e-182) tmp = Float64(Float64(Float64(Float64(y + t) * a) - Float64(y * b)) / Float64(y + Float64(x + t))); elseif (z <= 7.4e-63) tmp = Float64(Float64(z + a) - b); elseif (z <= 1.05e+24) tmp = Float64(Float64(Float64(Float64(y * a) + Float64(z * Float64(x + y))) - Float64(y * b)) / Float64(x + y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = z / ((x + (y + t)) / (x + y)); tmp = 0.0; if (z <= -2.2e+19) tmp = t_1; elseif (z <= -3.7e-296) tmp = (z + a) - ((y * b) / (t + (x + y))); elseif (z <= 1.05e-260) tmp = y * ((a - b) / (x + y)); elseif (z <= 1.1e-182) tmp = (((y + t) * a) - (y * b)) / (y + (x + t)); elseif (z <= 7.4e-63) tmp = (z + a) - b; elseif (z <= 1.05e+24) tmp = (((y * a) + (z * (x + y))) - (y * b)) / (x + y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z / N[(N[(x + N[(y + t), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.2e+19], t$95$1, If[LessEqual[z, -3.7e-296], N[(N[(z + a), $MachinePrecision] - N[(N[(y * b), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.05e-260], N[(y * N[(N[(a - b), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.1e-182], N[(N[(N[(N[(y + t), $MachinePrecision] * a), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.4e-63], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], If[LessEqual[z, 1.05e+24], N[(N[(N[(N[(y * a), $MachinePrecision] + N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{\frac{x + \left(y + t\right)}{x + y}}\\
\mathbf{if}\;z \leq -2.2 \cdot 10^{+19}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{-296}:\\
\;\;\;\;\left(z + a\right) - \frac{y \cdot b}{t + \left(x + y\right)}\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-260}:\\
\;\;\;\;y \cdot \frac{a - b}{x + y}\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-182}:\\
\;\;\;\;\frac{\left(y + t\right) \cdot a - y \cdot b}{y + \left(x + t\right)}\\
\mathbf{elif}\;z \leq 7.4 \cdot 10^{-63}:\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{+24}:\\
\;\;\;\;\frac{\left(y \cdot a + z \cdot \left(x + y\right)\right) - y \cdot b}{x + y}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -2.2e19 or 1.0500000000000001e24 < z Initial program 53.1%
Taylor expanded in z around inf 43.3%
associate-/l*75.6%
+-commutative75.6%
associate-+r+75.6%
+-commutative75.6%
Simplified75.6%
if -2.2e19 < z < -3.70000000000000027e-296Initial program 64.4%
Taylor expanded in z around 0 64.5%
Taylor expanded in t around inf 70.7%
Taylor expanded in x around inf 66.4%
if -3.70000000000000027e-296 < z < 1.05000000000000002e-260Initial program 39.4%
Taylor expanded in z around 0 39.4%
Taylor expanded in t around 0 39.0%
distribute-rgt-out--41.8%
+-commutative41.8%
Simplified41.8%
expm1-log1p-u24.1%
expm1-udef2.3%
+-commutative2.3%
Applied egg-rr2.3%
expm1-def24.1%
expm1-log1p41.8%
associate-*r/77.6%
+-commutative77.6%
Simplified77.6%
if 1.05000000000000002e-260 < z < 1.1e-182Initial program 70.5%
Taylor expanded in z around 0 64.6%
if 1.1e-182 < z < 7.40000000000000025e-63Initial program 53.9%
Taylor expanded in y around inf 68.5%
if 7.40000000000000025e-63 < z < 1.0500000000000001e24Initial program 99.6%
Taylor expanded in t around 0 80.5%
Final simplification72.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (* (+ y t) a) (* y b)) (+ y (+ x t))))
(t_2 (/ z (/ (+ x (+ y t)) (+ x y)))))
(if (<= z -3.6e+20)
t_2
(if (<= z -2.45e-296)
(- (+ z a) (/ (* y b) (+ t (+ x y))))
(if (<= z 5.8e-262)
(* y (/ (- a b) (+ x y)))
(if (<= z 2.8e-180)
t_1
(if (<= z 7.8e-63) (- (+ z a) b) (if (<= z 8.5e+22) t_1 t_2))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (((y + t) * a) - (y * b)) / (y + (x + t));
double t_2 = z / ((x + (y + t)) / (x + y));
double tmp;
if (z <= -3.6e+20) {
tmp = t_2;
} else if (z <= -2.45e-296) {
tmp = (z + a) - ((y * b) / (t + (x + y)));
} else if (z <= 5.8e-262) {
tmp = y * ((a - b) / (x + y));
} else if (z <= 2.8e-180) {
tmp = t_1;
} else if (z <= 7.8e-63) {
tmp = (z + a) - b;
} else if (z <= 8.5e+22) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (((y + t) * a) - (y * b)) / (y + (x + t))
t_2 = z / ((x + (y + t)) / (x + y))
if (z <= (-3.6d+20)) then
tmp = t_2
else if (z <= (-2.45d-296)) then
tmp = (z + a) - ((y * b) / (t + (x + y)))
else if (z <= 5.8d-262) then
tmp = y * ((a - b) / (x + y))
else if (z <= 2.8d-180) then
tmp = t_1
else if (z <= 7.8d-63) then
tmp = (z + a) - b
else if (z <= 8.5d+22) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (((y + t) * a) - (y * b)) / (y + (x + t));
double t_2 = z / ((x + (y + t)) / (x + y));
double tmp;
if (z <= -3.6e+20) {
tmp = t_2;
} else if (z <= -2.45e-296) {
tmp = (z + a) - ((y * b) / (t + (x + y)));
} else if (z <= 5.8e-262) {
tmp = y * ((a - b) / (x + y));
} else if (z <= 2.8e-180) {
tmp = t_1;
} else if (z <= 7.8e-63) {
tmp = (z + a) - b;
} else if (z <= 8.5e+22) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (((y + t) * a) - (y * b)) / (y + (x + t)) t_2 = z / ((x + (y + t)) / (x + y)) tmp = 0 if z <= -3.6e+20: tmp = t_2 elif z <= -2.45e-296: tmp = (z + a) - ((y * b) / (t + (x + y))) elif z <= 5.8e-262: tmp = y * ((a - b) / (x + y)) elif z <= 2.8e-180: tmp = t_1 elif z <= 7.8e-63: tmp = (z + a) - b elif z <= 8.5e+22: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(y + t) * a) - Float64(y * b)) / Float64(y + Float64(x + t))) t_2 = Float64(z / Float64(Float64(x + Float64(y + t)) / Float64(x + y))) tmp = 0.0 if (z <= -3.6e+20) tmp = t_2; elseif (z <= -2.45e-296) tmp = Float64(Float64(z + a) - Float64(Float64(y * b) / Float64(t + Float64(x + y)))); elseif (z <= 5.8e-262) tmp = Float64(y * Float64(Float64(a - b) / Float64(x + y))); elseif (z <= 2.8e-180) tmp = t_1; elseif (z <= 7.8e-63) tmp = Float64(Float64(z + a) - b); elseif (z <= 8.5e+22) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (((y + t) * a) - (y * b)) / (y + (x + t)); t_2 = z / ((x + (y + t)) / (x + y)); tmp = 0.0; if (z <= -3.6e+20) tmp = t_2; elseif (z <= -2.45e-296) tmp = (z + a) - ((y * b) / (t + (x + y))); elseif (z <= 5.8e-262) tmp = y * ((a - b) / (x + y)); elseif (z <= 2.8e-180) tmp = t_1; elseif (z <= 7.8e-63) tmp = (z + a) - b; elseif (z <= 8.5e+22) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(y + t), $MachinePrecision] * a), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z / N[(N[(x + N[(y + t), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.6e+20], t$95$2, If[LessEqual[z, -2.45e-296], N[(N[(z + a), $MachinePrecision] - N[(N[(y * b), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.8e-262], N[(y * N[(N[(a - b), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.8e-180], t$95$1, If[LessEqual[z, 7.8e-63], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], If[LessEqual[z, 8.5e+22], t$95$1, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(y + t\right) \cdot a - y \cdot b}{y + \left(x + t\right)}\\
t_2 := \frac{z}{\frac{x + \left(y + t\right)}{x + y}}\\
\mathbf{if}\;z \leq -3.6 \cdot 10^{+20}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -2.45 \cdot 10^{-296}:\\
\;\;\;\;\left(z + a\right) - \frac{y \cdot b}{t + \left(x + y\right)}\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{-262}:\\
\;\;\;\;y \cdot \frac{a - b}{x + y}\\
\mathbf{elif}\;z \leq 2.8 \cdot 10^{-180}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{-63}:\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+22}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -3.6e20 or 8.49999999999999979e22 < z Initial program 53.1%
Taylor expanded in z around inf 43.3%
associate-/l*75.6%
+-commutative75.6%
associate-+r+75.6%
+-commutative75.6%
Simplified75.6%
if -3.6e20 < z < -2.4499999999999999e-296Initial program 64.4%
Taylor expanded in z around 0 64.5%
Taylor expanded in t around inf 70.7%
Taylor expanded in x around inf 66.4%
if -2.4499999999999999e-296 < z < 5.79999999999999993e-262Initial program 39.4%
Taylor expanded in z around 0 39.4%
Taylor expanded in t around 0 39.0%
distribute-rgt-out--41.8%
+-commutative41.8%
Simplified41.8%
expm1-log1p-u24.1%
expm1-udef2.3%
+-commutative2.3%
Applied egg-rr2.3%
expm1-def24.1%
expm1-log1p41.8%
associate-*r/77.6%
+-commutative77.6%
Simplified77.6%
if 5.79999999999999993e-262 < z < 2.79999999999999997e-180 or 7.80000000000000044e-63 < z < 8.49999999999999979e22Initial program 84.1%
Taylor expanded in z around 0 67.7%
if 2.79999999999999997e-180 < z < 7.80000000000000044e-63Initial program 56.0%
Taylor expanded in y around inf 69.9%
Final simplification71.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ t (+ x y))) (t_2 (/ z (/ (+ x (+ y t)) (+ x y)))))
(if (<= z -2.2e+19)
t_2
(if (<= z 3.6e-63)
(- (* (+ y t) (/ a t_1)) (/ b (/ t_1 y)))
(if (<= z 9.2e+24)
(/ (- (+ (* y a) (* z (+ x y))) (* y b)) (+ x y))
t_2)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t + (x + y);
double t_2 = z / ((x + (y + t)) / (x + y));
double tmp;
if (z <= -2.2e+19) {
tmp = t_2;
} else if (z <= 3.6e-63) {
tmp = ((y + t) * (a / t_1)) - (b / (t_1 / y));
} else if (z <= 9.2e+24) {
tmp = (((y * a) + (z * (x + y))) - (y * b)) / (x + y);
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t + (x + y)
t_2 = z / ((x + (y + t)) / (x + y))
if (z <= (-2.2d+19)) then
tmp = t_2
else if (z <= 3.6d-63) then
tmp = ((y + t) * (a / t_1)) - (b / (t_1 / y))
else if (z <= 9.2d+24) then
tmp = (((y * a) + (z * (x + y))) - (y * b)) / (x + y)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t + (x + y);
double t_2 = z / ((x + (y + t)) / (x + y));
double tmp;
if (z <= -2.2e+19) {
tmp = t_2;
} else if (z <= 3.6e-63) {
tmp = ((y + t) * (a / t_1)) - (b / (t_1 / y));
} else if (z <= 9.2e+24) {
tmp = (((y * a) + (z * (x + y))) - (y * b)) / (x + y);
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = t + (x + y) t_2 = z / ((x + (y + t)) / (x + y)) tmp = 0 if z <= -2.2e+19: tmp = t_2 elif z <= 3.6e-63: tmp = ((y + t) * (a / t_1)) - (b / (t_1 / y)) elif z <= 9.2e+24: tmp = (((y * a) + (z * (x + y))) - (y * b)) / (x + y) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(t + Float64(x + y)) t_2 = Float64(z / Float64(Float64(x + Float64(y + t)) / Float64(x + y))) tmp = 0.0 if (z <= -2.2e+19) tmp = t_2; elseif (z <= 3.6e-63) tmp = Float64(Float64(Float64(y + t) * Float64(a / t_1)) - Float64(b / Float64(t_1 / y))); elseif (z <= 9.2e+24) tmp = Float64(Float64(Float64(Float64(y * a) + Float64(z * Float64(x + y))) - Float64(y * b)) / Float64(x + y)); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = t + (x + y); t_2 = z / ((x + (y + t)) / (x + y)); tmp = 0.0; if (z <= -2.2e+19) tmp = t_2; elseif (z <= 3.6e-63) tmp = ((y + t) * (a / t_1)) - (b / (t_1 / y)); elseif (z <= 9.2e+24) tmp = (((y * a) + (z * (x + y))) - (y * b)) / (x + y); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(z / N[(N[(x + N[(y + t), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.2e+19], t$95$2, If[LessEqual[z, 3.6e-63], N[(N[(N[(y + t), $MachinePrecision] * N[(a / t$95$1), $MachinePrecision]), $MachinePrecision] - N[(b / N[(t$95$1 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 9.2e+24], N[(N[(N[(N[(y * a), $MachinePrecision] + N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \left(x + y\right)\\
t_2 := \frac{z}{\frac{x + \left(y + t\right)}{x + y}}\\
\mathbf{if}\;z \leq -2.2 \cdot 10^{+19}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq 3.6 \cdot 10^{-63}:\\
\;\;\;\;\left(y + t\right) \cdot \frac{a}{t_1} - \frac{b}{\frac{t_1}{y}}\\
\mathbf{elif}\;z \leq 9.2 \cdot 10^{+24}:\\
\;\;\;\;\frac{\left(y \cdot a + z \cdot \left(x + y\right)\right) - y \cdot b}{x + y}\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -2.2e19 or 9.1999999999999996e24 < z Initial program 53.1%
Taylor expanded in z around inf 43.3%
associate-/l*75.6%
+-commutative75.6%
associate-+r+75.6%
+-commutative75.6%
Simplified75.6%
if -2.2e19 < z < 3.60000000000000008e-63Initial program 60.7%
Taylor expanded in z around 0 50.6%
div-sub50.6%
+-commutative50.6%
associate-+r+50.6%
associate-/l*68.3%
+-commutative68.3%
associate-+l+68.3%
associate-/r/63.8%
associate-+l+63.8%
+-commutative63.8%
associate-+r+63.8%
associate-/l*83.4%
+-commutative83.4%
Applied egg-rr83.4%
if 3.60000000000000008e-63 < z < 9.1999999999999996e24Initial program 99.6%
Taylor expanded in t around 0 80.5%
Final simplification79.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ z a) b))
(t_2 (* z (/ (+ x y) (+ y (+ x t)))))
(t_3 (/ a (/ (+ x (+ y t)) (+ y t)))))
(if (<= z -2e+20)
t_2
(if (<= z -2.7e-161)
t_1
(if (<= z -3.8e-301)
t_3
(if (<= z 1.9e-260)
(* y (/ (- a b) (+ x y)))
(if (<= z 2.9e-184) t_3 (if (<= z 3.1e+45) t_1 t_2))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z + a) - b;
double t_2 = z * ((x + y) / (y + (x + t)));
double t_3 = a / ((x + (y + t)) / (y + t));
double tmp;
if (z <= -2e+20) {
tmp = t_2;
} else if (z <= -2.7e-161) {
tmp = t_1;
} else if (z <= -3.8e-301) {
tmp = t_3;
} else if (z <= 1.9e-260) {
tmp = y * ((a - b) / (x + y));
} else if (z <= 2.9e-184) {
tmp = t_3;
} else if (z <= 3.1e+45) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = (z + a) - b
t_2 = z * ((x + y) / (y + (x + t)))
t_3 = a / ((x + (y + t)) / (y + t))
if (z <= (-2d+20)) then
tmp = t_2
else if (z <= (-2.7d-161)) then
tmp = t_1
else if (z <= (-3.8d-301)) then
tmp = t_3
else if (z <= 1.9d-260) then
tmp = y * ((a - b) / (x + y))
else if (z <= 2.9d-184) then
tmp = t_3
else if (z <= 3.1d+45) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z + a) - b;
double t_2 = z * ((x + y) / (y + (x + t)));
double t_3 = a / ((x + (y + t)) / (y + t));
double tmp;
if (z <= -2e+20) {
tmp = t_2;
} else if (z <= -2.7e-161) {
tmp = t_1;
} else if (z <= -3.8e-301) {
tmp = t_3;
} else if (z <= 1.9e-260) {
tmp = y * ((a - b) / (x + y));
} else if (z <= 2.9e-184) {
tmp = t_3;
} else if (z <= 3.1e+45) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (z + a) - b t_2 = z * ((x + y) / (y + (x + t))) t_3 = a / ((x + (y + t)) / (y + t)) tmp = 0 if z <= -2e+20: tmp = t_2 elif z <= -2.7e-161: tmp = t_1 elif z <= -3.8e-301: tmp = t_3 elif z <= 1.9e-260: tmp = y * ((a - b) / (x + y)) elif z <= 2.9e-184: tmp = t_3 elif z <= 3.1e+45: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(z + a) - b) t_2 = Float64(z * Float64(Float64(x + y) / Float64(y + Float64(x + t)))) t_3 = Float64(a / Float64(Float64(x + Float64(y + t)) / Float64(y + t))) tmp = 0.0 if (z <= -2e+20) tmp = t_2; elseif (z <= -2.7e-161) tmp = t_1; elseif (z <= -3.8e-301) tmp = t_3; elseif (z <= 1.9e-260) tmp = Float64(y * Float64(Float64(a - b) / Float64(x + y))); elseif (z <= 2.9e-184) tmp = t_3; elseif (z <= 3.1e+45) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (z + a) - b; t_2 = z * ((x + y) / (y + (x + t))); t_3 = a / ((x + (y + t)) / (y + t)); tmp = 0.0; if (z <= -2e+20) tmp = t_2; elseif (z <= -2.7e-161) tmp = t_1; elseif (z <= -3.8e-301) tmp = t_3; elseif (z <= 1.9e-260) tmp = y * ((a - b) / (x + y)); elseif (z <= 2.9e-184) tmp = t_3; elseif (z <= 3.1e+45) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, Block[{t$95$2 = N[(z * N[(N[(x + y), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(a / N[(N[(x + N[(y + t), $MachinePrecision]), $MachinePrecision] / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2e+20], t$95$2, If[LessEqual[z, -2.7e-161], t$95$1, If[LessEqual[z, -3.8e-301], t$95$3, If[LessEqual[z, 1.9e-260], N[(y * N[(N[(a - b), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.9e-184], t$95$3, If[LessEqual[z, 3.1e+45], t$95$1, t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z + a\right) - b\\
t_2 := z \cdot \frac{x + y}{y + \left(x + t\right)}\\
t_3 := \frac{a}{\frac{x + \left(y + t\right)}{y + t}}\\
\mathbf{if}\;z \leq -2 \cdot 10^{+20}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -2.7 \cdot 10^{-161}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -3.8 \cdot 10^{-301}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq 1.9 \cdot 10^{-260}:\\
\;\;\;\;y \cdot \frac{a - b}{x + y}\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{-184}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq 3.1 \cdot 10^{+45}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -2e20 or 3.09999999999999988e45 < z Initial program 53.6%
Taylor expanded in z around inf 43.4%
associate-/l*76.2%
+-commutative76.2%
associate-+r+76.2%
+-commutative76.2%
Simplified76.2%
Taylor expanded in z around 0 43.4%
associate-+r+43.4%
+-commutative43.4%
associate-+r+43.4%
*-lft-identity43.4%
times-frac76.2%
/-rgt-identity76.2%
+-commutative76.2%
+-commutative76.2%
+-commutative76.2%
associate-+l+76.2%
Simplified76.2%
if -2e20 < z < -2.6999999999999999e-161 or 2.90000000000000014e-184 < z < 3.09999999999999988e45Initial program 68.0%
Taylor expanded in y around inf 63.7%
if -2.6999999999999999e-161 < z < -3.79999999999999996e-301 or 1.9000000000000002e-260 < z < 2.90000000000000014e-184Initial program 64.3%
Taylor expanded in a around inf 39.4%
associate-/l*65.5%
+-commutative65.5%
associate-+r+65.5%
Simplified65.5%
if -3.79999999999999996e-301 < z < 1.9000000000000002e-260Initial program 42.4%
Taylor expanded in z around 0 42.4%
Taylor expanded in t around 0 42.0%
distribute-rgt-out--45.1%
+-commutative45.1%
Simplified45.1%
expm1-log1p-u25.8%
expm1-udef2.2%
+-commutative2.2%
Applied egg-rr2.2%
expm1-def25.8%
expm1-log1p45.1%
associate-*r/83.8%
+-commutative83.8%
Simplified83.8%
Final simplification70.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ z a) b))
(t_2 (+ x (+ y t)))
(t_3 (/ z (/ t_2 (+ x y))))
(t_4 (/ a (/ t_2 (+ y t)))))
(if (<= z -1.35e+20)
t_3
(if (<= z -2e-161)
t_1
(if (<= z -1.1e-300)
t_4
(if (<= z 9.5e-261)
(* y (/ (- a b) (+ x y)))
(if (<= z 2.2e-183) t_4 (if (<= z 4.2e+52) t_1 t_3))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z + a) - b;
double t_2 = x + (y + t);
double t_3 = z / (t_2 / (x + y));
double t_4 = a / (t_2 / (y + t));
double tmp;
if (z <= -1.35e+20) {
tmp = t_3;
} else if (z <= -2e-161) {
tmp = t_1;
} else if (z <= -1.1e-300) {
tmp = t_4;
} else if (z <= 9.5e-261) {
tmp = y * ((a - b) / (x + y));
} else if (z <= 2.2e-183) {
tmp = t_4;
} else if (z <= 4.2e+52) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = (z + a) - b
t_2 = x + (y + t)
t_3 = z / (t_2 / (x + y))
t_4 = a / (t_2 / (y + t))
if (z <= (-1.35d+20)) then
tmp = t_3
else if (z <= (-2d-161)) then
tmp = t_1
else if (z <= (-1.1d-300)) then
tmp = t_4
else if (z <= 9.5d-261) then
tmp = y * ((a - b) / (x + y))
else if (z <= 2.2d-183) then
tmp = t_4
else if (z <= 4.2d+52) then
tmp = t_1
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z + a) - b;
double t_2 = x + (y + t);
double t_3 = z / (t_2 / (x + y));
double t_4 = a / (t_2 / (y + t));
double tmp;
if (z <= -1.35e+20) {
tmp = t_3;
} else if (z <= -2e-161) {
tmp = t_1;
} else if (z <= -1.1e-300) {
tmp = t_4;
} else if (z <= 9.5e-261) {
tmp = y * ((a - b) / (x + y));
} else if (z <= 2.2e-183) {
tmp = t_4;
} else if (z <= 4.2e+52) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (z + a) - b t_2 = x + (y + t) t_3 = z / (t_2 / (x + y)) t_4 = a / (t_2 / (y + t)) tmp = 0 if z <= -1.35e+20: tmp = t_3 elif z <= -2e-161: tmp = t_1 elif z <= -1.1e-300: tmp = t_4 elif z <= 9.5e-261: tmp = y * ((a - b) / (x + y)) elif z <= 2.2e-183: tmp = t_4 elif z <= 4.2e+52: tmp = t_1 else: tmp = t_3 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(z + a) - b) t_2 = Float64(x + Float64(y + t)) t_3 = Float64(z / Float64(t_2 / Float64(x + y))) t_4 = Float64(a / Float64(t_2 / Float64(y + t))) tmp = 0.0 if (z <= -1.35e+20) tmp = t_3; elseif (z <= -2e-161) tmp = t_1; elseif (z <= -1.1e-300) tmp = t_4; elseif (z <= 9.5e-261) tmp = Float64(y * Float64(Float64(a - b) / Float64(x + y))); elseif (z <= 2.2e-183) tmp = t_4; elseif (z <= 4.2e+52) tmp = t_1; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (z + a) - b; t_2 = x + (y + t); t_3 = z / (t_2 / (x + y)); t_4 = a / (t_2 / (y + t)); tmp = 0.0; if (z <= -1.35e+20) tmp = t_3; elseif (z <= -2e-161) tmp = t_1; elseif (z <= -1.1e-300) tmp = t_4; elseif (z <= 9.5e-261) tmp = y * ((a - b) / (x + y)); elseif (z <= 2.2e-183) tmp = t_4; elseif (z <= 4.2e+52) tmp = t_1; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(z / N[(t$95$2 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(a / N[(t$95$2 / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.35e+20], t$95$3, If[LessEqual[z, -2e-161], t$95$1, If[LessEqual[z, -1.1e-300], t$95$4, If[LessEqual[z, 9.5e-261], N[(y * N[(N[(a - b), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e-183], t$95$4, If[LessEqual[z, 4.2e+52], t$95$1, t$95$3]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z + a\right) - b\\
t_2 := x + \left(y + t\right)\\
t_3 := \frac{z}{\frac{t_2}{x + y}}\\
t_4 := \frac{a}{\frac{t_2}{y + t}}\\
\mathbf{if}\;z \leq -1.35 \cdot 10^{+20}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq -2 \cdot 10^{-161}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -1.1 \cdot 10^{-300}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;z \leq 9.5 \cdot 10^{-261}:\\
\;\;\;\;y \cdot \frac{a - b}{x + y}\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-183}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+52}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if z < -1.35e20 or 4.2e52 < z Initial program 53.6%
Taylor expanded in z around inf 43.4%
associate-/l*76.2%
+-commutative76.2%
associate-+r+76.2%
+-commutative76.2%
Simplified76.2%
if -1.35e20 < z < -2.00000000000000006e-161 or 2.2e-183 < z < 4.2e52Initial program 68.0%
Taylor expanded in y around inf 63.7%
if -2.00000000000000006e-161 < z < -1.10000000000000001e-300 or 9.5000000000000008e-261 < z < 2.2e-183Initial program 64.3%
Taylor expanded in a around inf 39.4%
associate-/l*65.5%
+-commutative65.5%
associate-+r+65.5%
Simplified65.5%
if -1.10000000000000001e-300 < z < 9.5000000000000008e-261Initial program 42.4%
Taylor expanded in z around 0 42.4%
Taylor expanded in t around 0 42.0%
distribute-rgt-out--45.1%
+-commutative45.1%
Simplified45.1%
expm1-log1p-u25.8%
expm1-udef2.2%
+-commutative2.2%
Applied egg-rr2.2%
expm1-def25.8%
expm1-log1p45.1%
associate-*r/83.8%
+-commutative83.8%
Simplified83.8%
Final simplification70.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ z a) (/ (* y b) (+ t (+ x y)))))
(t_2 (+ x (+ y t)))
(t_3 (/ z (/ t_2 (+ x y)))))
(if (<= z -2e+20)
t_3
(if (<= z -2.55e-297)
t_1
(if (<= z 2e-270)
(* y (/ (- a b) (+ x y)))
(if (<= z 1.1e-181)
t_1
(if (<= z 7.8e-63)
(- (+ z a) b)
(if (<= z 1.7e+18) (/ a (/ t_2 (+ y t))) t_3))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z + a) - ((y * b) / (t + (x + y)));
double t_2 = x + (y + t);
double t_3 = z / (t_2 / (x + y));
double tmp;
if (z <= -2e+20) {
tmp = t_3;
} else if (z <= -2.55e-297) {
tmp = t_1;
} else if (z <= 2e-270) {
tmp = y * ((a - b) / (x + y));
} else if (z <= 1.1e-181) {
tmp = t_1;
} else if (z <= 7.8e-63) {
tmp = (z + a) - b;
} else if (z <= 1.7e+18) {
tmp = a / (t_2 / (y + t));
} else {
tmp = t_3;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = (z + a) - ((y * b) / (t + (x + y)))
t_2 = x + (y + t)
t_3 = z / (t_2 / (x + y))
if (z <= (-2d+20)) then
tmp = t_3
else if (z <= (-2.55d-297)) then
tmp = t_1
else if (z <= 2d-270) then
tmp = y * ((a - b) / (x + y))
else if (z <= 1.1d-181) then
tmp = t_1
else if (z <= 7.8d-63) then
tmp = (z + a) - b
else if (z <= 1.7d+18) then
tmp = a / (t_2 / (y + t))
else
tmp = t_3
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z + a) - ((y * b) / (t + (x + y)));
double t_2 = x + (y + t);
double t_3 = z / (t_2 / (x + y));
double tmp;
if (z <= -2e+20) {
tmp = t_3;
} else if (z <= -2.55e-297) {
tmp = t_1;
} else if (z <= 2e-270) {
tmp = y * ((a - b) / (x + y));
} else if (z <= 1.1e-181) {
tmp = t_1;
} else if (z <= 7.8e-63) {
tmp = (z + a) - b;
} else if (z <= 1.7e+18) {
tmp = a / (t_2 / (y + t));
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (z + a) - ((y * b) / (t + (x + y))) t_2 = x + (y + t) t_3 = z / (t_2 / (x + y)) tmp = 0 if z <= -2e+20: tmp = t_3 elif z <= -2.55e-297: tmp = t_1 elif z <= 2e-270: tmp = y * ((a - b) / (x + y)) elif z <= 1.1e-181: tmp = t_1 elif z <= 7.8e-63: tmp = (z + a) - b elif z <= 1.7e+18: tmp = a / (t_2 / (y + t)) else: tmp = t_3 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(z + a) - Float64(Float64(y * b) / Float64(t + Float64(x + y)))) t_2 = Float64(x + Float64(y + t)) t_3 = Float64(z / Float64(t_2 / Float64(x + y))) tmp = 0.0 if (z <= -2e+20) tmp = t_3; elseif (z <= -2.55e-297) tmp = t_1; elseif (z <= 2e-270) tmp = Float64(y * Float64(Float64(a - b) / Float64(x + y))); elseif (z <= 1.1e-181) tmp = t_1; elseif (z <= 7.8e-63) tmp = Float64(Float64(z + a) - b); elseif (z <= 1.7e+18) tmp = Float64(a / Float64(t_2 / Float64(y + t))); else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (z + a) - ((y * b) / (t + (x + y))); t_2 = x + (y + t); t_3 = z / (t_2 / (x + y)); tmp = 0.0; if (z <= -2e+20) tmp = t_3; elseif (z <= -2.55e-297) tmp = t_1; elseif (z <= 2e-270) tmp = y * ((a - b) / (x + y)); elseif (z <= 1.1e-181) tmp = t_1; elseif (z <= 7.8e-63) tmp = (z + a) - b; elseif (z <= 1.7e+18) tmp = a / (t_2 / (y + t)); else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z + a), $MachinePrecision] - N[(N[(y * b), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(x + N[(y + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(z / N[(t$95$2 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2e+20], t$95$3, If[LessEqual[z, -2.55e-297], t$95$1, If[LessEqual[z, 2e-270], N[(y * N[(N[(a - b), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.1e-181], t$95$1, If[LessEqual[z, 7.8e-63], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], If[LessEqual[z, 1.7e+18], N[(a / N[(t$95$2 / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z + a\right) - \frac{y \cdot b}{t + \left(x + y\right)}\\
t_2 := x + \left(y + t\right)\\
t_3 := \frac{z}{\frac{t_2}{x + y}}\\
\mathbf{if}\;z \leq -2 \cdot 10^{+20}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;z \leq -2.55 \cdot 10^{-297}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2 \cdot 10^{-270}:\\
\;\;\;\;y \cdot \frac{a - b}{x + y}\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-181}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 7.8 \cdot 10^{-63}:\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{elif}\;z \leq 1.7 \cdot 10^{+18}:\\
\;\;\;\;\frac{a}{\frac{t_2}{y + t}}\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if z < -2e20 or 1.7e18 < z Initial program 53.9%
Taylor expanded in z around inf 43.4%
associate-/l*75.2%
+-commutative75.2%
associate-+r+75.2%
+-commutative75.2%
Simplified75.2%
if -2e20 < z < -2.55000000000000004e-297 or 2.0000000000000001e-270 < z < 1.09999999999999999e-181Initial program 66.0%
Taylor expanded in z around 0 66.0%
Taylor expanded in t around inf 70.8%
Taylor expanded in x around inf 66.2%
if -2.55000000000000004e-297 < z < 2.0000000000000001e-270Initial program 23.6%
Taylor expanded in z around 0 23.6%
Taylor expanded in t around 0 23.0%
distribute-rgt-out--26.3%
+-commutative26.3%
Simplified26.3%
expm1-log1p-u12.6%
expm1-udef2.4%
+-commutative2.4%
Applied egg-rr2.4%
expm1-def12.6%
expm1-log1p26.3%
associate-*r/78.1%
+-commutative78.1%
Simplified78.1%
if 1.09999999999999999e-181 < z < 7.80000000000000044e-63Initial program 56.0%
Taylor expanded in y around inf 69.9%
if 7.80000000000000044e-63 < z < 1.7e18Initial program 99.5%
Taylor expanded in a around inf 66.2%
associate-/l*66.4%
+-commutative66.4%
associate-+r+66.4%
Simplified66.4%
Final simplification71.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* z (/ (+ x y) (+ y (+ x t))))) (t_2 (- (+ z a) b)))
(if (<= y -2.7e+18)
t_2
(if (<= y -6.7e-116)
t_1
(if (<= y 1.1e-117)
(/ a (+ 1.0 (/ x t)))
(if (<= y 3.1e+28) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * ((x + y) / (y + (x + t)));
double t_2 = (z + a) - b;
double tmp;
if (y <= -2.7e+18) {
tmp = t_2;
} else if (y <= -6.7e-116) {
tmp = t_1;
} else if (y <= 1.1e-117) {
tmp = a / (1.0 + (x / t));
} else if (y <= 3.1e+28) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = z * ((x + y) / (y + (x + t)))
t_2 = (z + a) - b
if (y <= (-2.7d+18)) then
tmp = t_2
else if (y <= (-6.7d-116)) then
tmp = t_1
else if (y <= 1.1d-117) then
tmp = a / (1.0d0 + (x / t))
else if (y <= 3.1d+28) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z * ((x + y) / (y + (x + t)));
double t_2 = (z + a) - b;
double tmp;
if (y <= -2.7e+18) {
tmp = t_2;
} else if (y <= -6.7e-116) {
tmp = t_1;
} else if (y <= 1.1e-117) {
tmp = a / (1.0 + (x / t));
} else if (y <= 3.1e+28) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = z * ((x + y) / (y + (x + t))) t_2 = (z + a) - b tmp = 0 if y <= -2.7e+18: tmp = t_2 elif y <= -6.7e-116: tmp = t_1 elif y <= 1.1e-117: tmp = a / (1.0 + (x / t)) elif y <= 3.1e+28: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(z * Float64(Float64(x + y) / Float64(y + Float64(x + t)))) t_2 = Float64(Float64(z + a) - b) tmp = 0.0 if (y <= -2.7e+18) tmp = t_2; elseif (y <= -6.7e-116) tmp = t_1; elseif (y <= 1.1e-117) tmp = Float64(a / Float64(1.0 + Float64(x / t))); elseif (y <= 3.1e+28) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = z * ((x + y) / (y + (x + t))); t_2 = (z + a) - b; tmp = 0.0; if (y <= -2.7e+18) tmp = t_2; elseif (y <= -6.7e-116) tmp = t_1; elseif (y <= 1.1e-117) tmp = a / (1.0 + (x / t)); elseif (y <= 3.1e+28) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(N[(x + y), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[y, -2.7e+18], t$95$2, If[LessEqual[y, -6.7e-116], t$95$1, If[LessEqual[y, 1.1e-117], N[(a / N[(1.0 + N[(x / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.1e+28], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \frac{x + y}{y + \left(x + t\right)}\\
t_2 := \left(z + a\right) - b\\
\mathbf{if}\;y \leq -2.7 \cdot 10^{+18}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -6.7 \cdot 10^{-116}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.1 \cdot 10^{-117}:\\
\;\;\;\;\frac{a}{1 + \frac{x}{t}}\\
\mathbf{elif}\;y \leq 3.1 \cdot 10^{+28}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if y < -2.7e18 or 3.1000000000000001e28 < y Initial program 33.7%
Taylor expanded in y around inf 76.1%
if -2.7e18 < y < -6.69999999999999993e-116 or 1.1000000000000001e-117 < y < 3.1000000000000001e28Initial program 81.6%
Taylor expanded in z around inf 55.4%
associate-/l*70.3%
+-commutative70.3%
associate-+r+70.3%
+-commutative70.3%
Simplified70.3%
Taylor expanded in z around 0 55.4%
associate-+r+55.4%
+-commutative55.4%
associate-+r+55.4%
*-lft-identity55.4%
times-frac70.3%
/-rgt-identity70.3%
+-commutative70.3%
+-commutative70.3%
+-commutative70.3%
associate-+l+70.3%
Simplified70.3%
if -6.69999999999999993e-116 < y < 1.1000000000000001e-117Initial program 84.7%
Taylor expanded in a around inf 44.7%
associate-/l*56.0%
+-commutative56.0%
associate-+r+56.0%
Simplified56.0%
Taylor expanded in t around inf 53.9%
Final simplification68.3%
(FPCore (x y z t a b) :precision binary64 (if (or (<= x -2.15e+160) (not (<= x 6.2e+157))) (- z (/ y (/ x b))) (- (+ z a) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -2.15e+160) || !(x <= 6.2e+157)) {
tmp = z - (y / (x / b));
} 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 <= (-2.15d+160)) .or. (.not. (x <= 6.2d+157))) then
tmp = z - (y / (x / b))
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 <= -2.15e+160) || !(x <= 6.2e+157)) {
tmp = z - (y / (x / b));
} else {
tmp = (z + a) - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x <= -2.15e+160) or not (x <= 6.2e+157): tmp = z - (y / (x / b)) else: tmp = (z + a) - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((x <= -2.15e+160) || !(x <= 6.2e+157)) tmp = Float64(z - Float64(y / Float64(x / b))); 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 <= -2.15e+160) || ~((x <= 6.2e+157))) tmp = z - (y / (x / b)); else tmp = (z + a) - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[x, -2.15e+160], N[Not[LessEqual[x, 6.2e+157]], $MachinePrecision]], N[(z - N[(y / N[(x / b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.15 \cdot 10^{+160} \lor \neg \left(x \leq 6.2 \cdot 10^{+157}\right):\\
\;\;\;\;z - \frac{y}{\frac{x}{b}}\\
\mathbf{else}:\\
\;\;\;\;\left(z + a\right) - b\\
\end{array}
\end{array}
if x < -2.14999999999999994e160 or 6.1999999999999994e157 < x Initial program 47.1%
Taylor expanded in x around inf 54.7%
associate--l+54.7%
associate-/l*59.3%
associate-/l*61.9%
associate-/l*62.4%
Simplified62.4%
Taylor expanded in b around inf 57.4%
mul-1-neg57.4%
*-commutative57.4%
Simplified57.4%
unsub-neg57.4%
associate-/l*66.0%
Applied egg-rr66.0%
if -2.14999999999999994e160 < x < 6.1999999999999994e157Initial program 63.3%
Taylor expanded in y around inf 61.4%
Final simplification62.6%
(FPCore (x y z t a b) :precision binary64 (if (<= x -2.5e+163) (+ z (* z (/ t x))) (- (+ z a) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -2.5e+163) {
tmp = z + (z * (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 <= (-2.5d+163)) then
tmp = z + (z * (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 <= -2.5e+163) {
tmp = z + (z * (t / x));
} else {
tmp = (z + a) - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -2.5e+163: tmp = z + (z * (t / x)) else: tmp = (z + a) - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -2.5e+163) tmp = Float64(z + Float64(z * 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 <= -2.5e+163) tmp = z + (z * (t / x)); else tmp = (z + a) - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -2.5e+163], N[(z + N[(z * N[(t / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.5 \cdot 10^{+163}:\\
\;\;\;\;z + z \cdot \frac{t}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(z + a\right) - b\\
\end{array}
\end{array}
if x < -2.5e163Initial program 48.1%
Taylor expanded in x around inf 60.6%
associate--l+60.6%
associate-/l*66.5%
associate-/l*65.2%
associate-/l*65.9%
Simplified65.9%
Taylor expanded in z around inf 53.2%
expm1-log1p-u38.7%
expm1-udef27.1%
Applied egg-rr29.5%
expm1-def41.2%
expm1-log1p56.3%
associate-/l*53.3%
associate-*r/56.3%
*-commutative56.3%
*-commutative56.3%
Simplified56.3%
if -2.5e163 < x Initial program 61.0%
Taylor expanded in y around inf 59.3%
Final simplification58.9%
(FPCore (x y z t a b) :precision binary64 (if (<= z -1.35e+20) z (if (<= z 760000000000.0) (- a b) z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.35e+20) {
tmp = z;
} else if (z <= 760000000000.0) {
tmp = a - b;
} else {
tmp = z;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-1.35d+20)) then
tmp = z
else if (z <= 760000000000.0d0) then
tmp = a - b
else
tmp = z
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.35e+20) {
tmp = z;
} else if (z <= 760000000000.0) {
tmp = a - b;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -1.35e+20: tmp = z elif z <= 760000000000.0: tmp = a - b else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.35e+20) tmp = z; elseif (z <= 760000000000.0) tmp = Float64(a - b); else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -1.35e+20) tmp = z; elseif (z <= 760000000000.0) tmp = a - b; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.35e+20], z, If[LessEqual[z, 760000000000.0], N[(a - b), $MachinePrecision], z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+20}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 760000000000:\\
\;\;\;\;a - b\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -1.35e20 or 7.6e11 < z Initial program 53.9%
Taylor expanded in x around inf 56.1%
if -1.35e20 < z < 7.6e11Initial program 64.5%
Taylor expanded in z around 0 52.4%
Taylor expanded in y around inf 50.7%
Final simplification53.3%
(FPCore (x y z t a b) :precision binary64 (if (<= x -1.55e+164) z (- (+ z a) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.55e+164) {
tmp = z;
} 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.55d+164)) then
tmp = z
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.55e+164) {
tmp = z;
} else {
tmp = (z + a) - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -1.55e+164: tmp = z else: tmp = (z + a) - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -1.55e+164) tmp = z; 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.55e+164) tmp = z; else tmp = (z + a) - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.55e+164], z, N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.55 \cdot 10^{+164}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;\left(z + a\right) - b\\
\end{array}
\end{array}
if x < -1.5500000000000001e164Initial program 48.1%
Taylor expanded in x around inf 56.1%
if -1.5500000000000001e164 < x Initial program 61.0%
Taylor expanded in y around inf 59.3%
Final simplification58.9%
(FPCore (x y z t a b) :precision binary64 (if (<= z -1.35e+20) z (if (<= z 2.9e+18) a z)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.35e+20) {
tmp = z;
} else if (z <= 2.9e+18) {
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 <= (-1.35d+20)) then
tmp = z
else if (z <= 2.9d+18) 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 <= -1.35e+20) {
tmp = z;
} else if (z <= 2.9e+18) {
tmp = a;
} else {
tmp = z;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -1.35e+20: tmp = z elif z <= 2.9e+18: tmp = a else: tmp = z return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.35e+20) tmp = z; elseif (z <= 2.9e+18) tmp = a; else tmp = z; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -1.35e+20) tmp = z; elseif (z <= 2.9e+18) tmp = a; else tmp = z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.35e+20], z, If[LessEqual[z, 2.9e+18], a, z]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.35 \cdot 10^{+20}:\\
\;\;\;\;z\\
\mathbf{elif}\;z \leq 2.9 \cdot 10^{+18}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;z\\
\end{array}
\end{array}
if z < -1.35e20 or 2.9e18 < z Initial program 53.9%
Taylor expanded in x around inf 56.1%
if -1.35e20 < z < 2.9e18Initial program 64.5%
Taylor expanded in t around inf 44.0%
Final simplification49.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 59.3%
Taylor expanded in t around inf 32.2%
Final simplification32.2%
(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 2023290
(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)))