
(FPCore (x y z t a b) :precision binary64 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b): return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) end
function tmp = code(x, y, z, t, a, b) tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b): return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) end
function tmp = code(x, y, z, t, a, b) tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ t (+ x y))) (t_2 (+ (+ x t) y)))
(+
(* z (+ (/ x t_2) (/ y t_2)))
(+ (* a (+ (/ y t_1) (/ t t_1))) (/ -1.0 (* (/ t_2 b) (/ 1.0 y)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t + (x + y);
double t_2 = (x + t) + y;
return (z * ((x / t_2) + (y / t_2))) + ((a * ((y / t_1) + (t / t_1))) + (-1.0 / ((t_2 / b) * (1.0 / 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
real(8) :: t_1
real(8) :: t_2
t_1 = t + (x + y)
t_2 = (x + t) + y
code = (z * ((x / t_2) + (y / t_2))) + ((a * ((y / t_1) + (t / t_1))) + ((-1.0d0) / ((t_2 / b) * (1.0d0 / y))))
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 = (x + t) + y;
return (z * ((x / t_2) + (y / t_2))) + ((a * ((y / t_1) + (t / t_1))) + (-1.0 / ((t_2 / b) * (1.0 / y))));
}
def code(x, y, z, t, a, b): t_1 = t + (x + y) t_2 = (x + t) + y return (z * ((x / t_2) + (y / t_2))) + ((a * ((y / t_1) + (t / t_1))) + (-1.0 / ((t_2 / b) * (1.0 / y))))
function code(x, y, z, t, a, b) t_1 = Float64(t + Float64(x + y)) t_2 = Float64(Float64(x + t) + y) return Float64(Float64(z * Float64(Float64(x / t_2) + Float64(y / t_2))) + Float64(Float64(a * Float64(Float64(y / t_1) + Float64(t / t_1))) + Float64(-1.0 / Float64(Float64(t_2 / b) * Float64(1.0 / y))))) end
function tmp = code(x, y, z, t, a, b) t_1 = t + (x + y); t_2 = (x + t) + y; tmp = (z * ((x / t_2) + (y / t_2))) + ((a * ((y / t_1) + (t / t_1))) + (-1.0 / ((t_2 / b) * (1.0 / y)))); 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[(x + t), $MachinePrecision] + y), $MachinePrecision]}, N[(N[(z * N[(N[(x / t$95$2), $MachinePrecision] + N[(y / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * N[(N[(y / t$95$1), $MachinePrecision] + N[(t / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(-1.0 / N[(N[(t$95$2 / b), $MachinePrecision] * N[(1.0 / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \left(x + y\right)\\
t_2 := \left(x + t\right) + y\\
z \cdot \left(\frac{x}{t_2} + \frac{y}{t_2}\right) + \left(a \cdot \left(\frac{y}{t_1} + \frac{t}{t_1}\right) + \frac{-1}{\frac{t_2}{b} \cdot \frac{1}{y}}\right)
\end{array}
\end{array}
Initial program 58.0%
Taylor expanded in z around 0 71.4%
associate--l+71.4%
associate-+r+71.4%
associate-+r+71.4%
div-sub71.4%
*-commutative71.4%
associate-+r+71.4%
Simplified71.4%
Taylor expanded in a around 0 87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
+-commutative87.2%
mul-1-neg87.2%
unsub-neg87.2%
+-commutative87.2%
Simplified87.2%
clear-num87.2%
inv-pow87.2%
associate-+r+87.2%
+-commutative87.2%
associate-+r+87.2%
Applied egg-rr87.2%
unpow-187.2%
associate-+r+87.2%
Simplified87.2%
associate-/r*97.5%
div-inv97.5%
associate-+l+97.5%
Applied egg-rr97.5%
Final simplification97.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (* a (+ t y)))
(t_3 (/ (- (+ t_2 (* z (+ x y))) (* y b)) t_1)))
(if (or (<= t_3 -5e+304) (not (<= t_3 2e+261)))
(- (+ z a) b)
(+ (* z (+ (/ x t_1) (/ y t_1))) (/ (- t_2 (* y b)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = a * (t + y);
double t_3 = ((t_2 + (z * (x + y))) - (y * b)) / t_1;
double tmp;
if ((t_3 <= -5e+304) || !(t_3 <= 2e+261)) {
tmp = (z + a) - b;
} else {
tmp = (z * ((x / t_1) + (y / t_1))) + ((t_2 - (y * b)) / t_1);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = (x + t) + y
t_2 = a * (t + y)
t_3 = ((t_2 + (z * (x + y))) - (y * b)) / t_1
if ((t_3 <= (-5d+304)) .or. (.not. (t_3 <= 2d+261))) then
tmp = (z + a) - b
else
tmp = (z * ((x / t_1) + (y / t_1))) + ((t_2 - (y * b)) / 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 = (x + t) + y;
double t_2 = a * (t + y);
double t_3 = ((t_2 + (z * (x + y))) - (y * b)) / t_1;
double tmp;
if ((t_3 <= -5e+304) || !(t_3 <= 2e+261)) {
tmp = (z + a) - b;
} else {
tmp = (z * ((x / t_1) + (y / t_1))) + ((t_2 - (y * b)) / t_1);
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x + t) + y t_2 = a * (t + y) t_3 = ((t_2 + (z * (x + y))) - (y * b)) / t_1 tmp = 0 if (t_3 <= -5e+304) or not (t_3 <= 2e+261): tmp = (z + a) - b else: tmp = (z * ((x / t_1) + (y / t_1))) + ((t_2 - (y * b)) / t_1) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(a * Float64(t + y)) t_3 = Float64(Float64(Float64(t_2 + Float64(z * Float64(x + y))) - Float64(y * b)) / t_1) tmp = 0.0 if ((t_3 <= -5e+304) || !(t_3 <= 2e+261)) tmp = Float64(Float64(z + a) - b); else tmp = Float64(Float64(z * Float64(Float64(x / t_1) + Float64(y / t_1))) + Float64(Float64(t_2 - Float64(y * b)) / t_1)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x + t) + y; t_2 = a * (t + y); t_3 = ((t_2 + (z * (x + y))) - (y * b)) / t_1; tmp = 0.0; if ((t_3 <= -5e+304) || ~((t_3 <= 2e+261))) tmp = (z + a) - b; else tmp = (z * ((x / t_1) + (y / t_1))) + ((t_2 - (y * b)) / t_1); 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[(a * N[(t + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(t$95$2 + N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[Or[LessEqual[t$95$3, -5e+304], N[Not[LessEqual[t$95$3, 2e+261]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], N[(N[(z * N[(N[(x / t$95$1), $MachinePrecision] + N[(y / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(t$95$2 - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := a \cdot \left(t + y\right)\\
t_3 := \frac{\left(t_2 + z \cdot \left(x + y\right)\right) - y \cdot b}{t_1}\\
\mathbf{if}\;t_3 \leq -5 \cdot 10^{+304} \lor \neg \left(t_3 \leq 2 \cdot 10^{+261}\right):\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\frac{x}{t_1} + \frac{y}{t_1}\right) + \frac{t_2 - 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)) < -4.9999999999999997e304 or 1.9999999999999999e261 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 6.8%
Taylor expanded in y around inf 75.5%
if -4.9999999999999997e304 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.9999999999999999e261Initial program 99.8%
Taylor expanded in z around 0 99.8%
associate--l+99.8%
associate-+r+99.8%
associate-+r+99.8%
div-sub99.8%
*-commutative99.8%
associate-+r+99.8%
Simplified99.8%
Final simplification88.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (/ (- (+ (* a (+ t y)) (* z (+ x y))) (* y b)) (+ (+ x t) y)))) (if (or (<= t_1 -5e+304) (not (<= t_1 2e+261))) (- (+ z a) b) t_1)))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (((a * (t + y)) + (z * (x + y))) - (y * b)) / ((x + t) + y);
double tmp;
if ((t_1 <= -5e+304) || !(t_1 <= 2e+261)) {
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 = (((a * (t + y)) + (z * (x + y))) - (y * b)) / ((x + t) + y)
if ((t_1 <= (-5d+304)) .or. (.not. (t_1 <= 2d+261))) 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 = (((a * (t + y)) + (z * (x + y))) - (y * b)) / ((x + t) + y);
double tmp;
if ((t_1 <= -5e+304) || !(t_1 <= 2e+261)) {
tmp = (z + a) - b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (((a * (t + y)) + (z * (x + y))) - (y * b)) / ((x + t) + y) tmp = 0 if (t_1 <= -5e+304) or not (t_1 <= 2e+261): tmp = (z + a) - b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(a * Float64(t + y)) + Float64(z * Float64(x + y))) - Float64(y * b)) / Float64(Float64(x + t) + y)) tmp = 0.0 if ((t_1 <= -5e+304) || !(t_1 <= 2e+261)) 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 = (((a * (t + y)) + (z * (x + y))) - (y * b)) / ((x + t) + y); tmp = 0.0; if ((t_1 <= -5e+304) || ~((t_1 <= 2e+261))) 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[(a * N[(t + y), $MachinePrecision]), $MachinePrecision] + N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -5e+304], N[Not[LessEqual[t$95$1, 2e+261]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], t$95$1]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(a \cdot \left(t + y\right) + z \cdot \left(x + y\right)\right) - y \cdot b}{\left(x + t\right) + y}\\
\mathbf{if}\;t_1 \leq -5 \cdot 10^{+304} \lor \neg \left(t_1 \leq 2 \cdot 10^{+261}\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)) < -4.9999999999999997e304 or 1.9999999999999999e261 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 6.8%
Taylor expanded in y around inf 75.5%
if -4.9999999999999997e304 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.9999999999999999e261Initial program 99.8%
Final simplification88.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ t (+ x y))) (t_2 (+ (+ x t) y)))
(if (or (<= y -4.1e+210) (not (<= y 2.15e+107)))
(- (+ z a) b)
(+
(* z (+ (/ x t_2) (/ y t_2)))
(- (* a (+ (/ y t_1) (/ t 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 = (x + t) + y;
double tmp;
if ((y <= -4.1e+210) || !(y <= 2.15e+107)) {
tmp = (z + a) - b;
} else {
tmp = (z * ((x / t_2) + (y / t_2))) + ((a * ((y / t_1) + (t / t_1))) - ((y * b) / t_1));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = t + (x + y)
t_2 = (x + t) + y
if ((y <= (-4.1d+210)) .or. (.not. (y <= 2.15d+107))) then
tmp = (z + a) - b
else
tmp = (z * ((x / t_2) + (y / t_2))) + ((a * ((y / t_1) + (t / t_1))) - ((y * b) / 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 = t + (x + y);
double t_2 = (x + t) + y;
double tmp;
if ((y <= -4.1e+210) || !(y <= 2.15e+107)) {
tmp = (z + a) - b;
} else {
tmp = (z * ((x / t_2) + (y / t_2))) + ((a * ((y / t_1) + (t / t_1))) - ((y * b) / t_1));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = t + (x + y) t_2 = (x + t) + y tmp = 0 if (y <= -4.1e+210) or not (y <= 2.15e+107): tmp = (z + a) - b else: tmp = (z * ((x / t_2) + (y / t_2))) + ((a * ((y / t_1) + (t / 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(x + t) + y) tmp = 0.0 if ((y <= -4.1e+210) || !(y <= 2.15e+107)) tmp = Float64(Float64(z + a) - b); else tmp = Float64(Float64(z * Float64(Float64(x / t_2) + Float64(y / t_2))) + Float64(Float64(a * Float64(Float64(y / t_1) + Float64(t / 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 = (x + t) + y; tmp = 0.0; if ((y <= -4.1e+210) || ~((y <= 2.15e+107))) tmp = (z + a) - b; else tmp = (z * ((x / t_2) + (y / t_2))) + ((a * ((y / t_1) + (t / 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[(x + t), $MachinePrecision] + y), $MachinePrecision]}, If[Or[LessEqual[y, -4.1e+210], N[Not[LessEqual[y, 2.15e+107]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], N[(N[(z * N[(N[(x / t$95$2), $MachinePrecision] + N[(y / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * N[(N[(y / t$95$1), $MachinePrecision] + N[(t / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(y * b), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \left(x + y\right)\\
t_2 := \left(x + t\right) + y\\
\mathbf{if}\;y \leq -4.1 \cdot 10^{+210} \lor \neg \left(y \leq 2.15 \cdot 10^{+107}\right):\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(\frac{x}{t_2} + \frac{y}{t_2}\right) + \left(a \cdot \left(\frac{y}{t_1} + \frac{t}{t_1}\right) - \frac{y \cdot b}{t_1}\right)\\
\end{array}
\end{array}
if y < -4.10000000000000001e210 or 2.15e107 < y Initial program 23.7%
Taylor expanded in y around inf 86.9%
if -4.10000000000000001e210 < y < 2.15e107Initial program 69.2%
Taylor expanded in z around 0 81.3%
associate--l+81.3%
associate-+r+81.3%
associate-+r+81.3%
div-sub81.3%
*-commutative81.3%
associate-+r+81.3%
Simplified81.3%
Taylor expanded in a around 0 95.5%
+-commutative95.5%
+-commutative95.5%
+-commutative95.5%
+-commutative95.5%
mul-1-neg95.5%
unsub-neg95.5%
+-commutative95.5%
Simplified95.5%
Final simplification93.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- (+ z a) b)))
(if (<= y -5.6e-13)
t_1
(if (<= y 1.2e-149)
(/ (+ (* t a) (* z x)) (+ x t))
(if (<= y 1e+61) (/ (+ (* y (- a b)) (* z (+ x y))) (+ x y)) t_1)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z + a) - b;
double tmp;
if (y <= -5.6e-13) {
tmp = t_1;
} else if (y <= 1.2e-149) {
tmp = ((t * a) + (z * x)) / (x + t);
} else if (y <= 1e+61) {
tmp = ((y * (a - b)) + (z * (x + y))) / (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 + a) - b
if (y <= (-5.6d-13)) then
tmp = t_1
else if (y <= 1.2d-149) then
tmp = ((t * a) + (z * x)) / (x + t)
else if (y <= 1d+61) then
tmp = ((y * (a - b)) + (z * (x + y))) / (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 + a) - b;
double tmp;
if (y <= -5.6e-13) {
tmp = t_1;
} else if (y <= 1.2e-149) {
tmp = ((t * a) + (z * x)) / (x + t);
} else if (y <= 1e+61) {
tmp = ((y * (a - b)) + (z * (x + y))) / (x + y);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (z + a) - b tmp = 0 if y <= -5.6e-13: tmp = t_1 elif y <= 1.2e-149: tmp = ((t * a) + (z * x)) / (x + t) elif y <= 1e+61: tmp = ((y * (a - b)) + (z * (x + y))) / (x + y) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(z + a) - b) tmp = 0.0 if (y <= -5.6e-13) tmp = t_1; elseif (y <= 1.2e-149) tmp = Float64(Float64(Float64(t * a) + Float64(z * x)) / Float64(x + t)); elseif (y <= 1e+61) tmp = Float64(Float64(Float64(y * Float64(a - b)) + Float64(z * Float64(x + y))) / Float64(x + y)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (z + a) - b; tmp = 0.0; if (y <= -5.6e-13) tmp = t_1; elseif (y <= 1.2e-149) tmp = ((t * a) + (z * x)) / (x + t); elseif (y <= 1e+61) tmp = ((y * (a - b)) + (z * (x + y))) / (x + y); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[y, -5.6e-13], t$95$1, If[LessEqual[y, 1.2e-149], N[(N[(N[(t * a), $MachinePrecision] + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(x + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1e+61], N[(N[(N[(y * N[(a - b), $MachinePrecision]), $MachinePrecision] + N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(x + y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(z + a\right) - b\\
\mathbf{if}\;y \leq -5.6 \cdot 10^{-13}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq 1.2 \cdot 10^{-149}:\\
\;\;\;\;\frac{t \cdot a + z \cdot x}{x + t}\\
\mathbf{elif}\;y \leq 10^{+61}:\\
\;\;\;\;\frac{y \cdot \left(a - b\right) + z \cdot \left(x + y\right)}{x + y}\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -5.6000000000000004e-13 or 9.99999999999999949e60 < y Initial program 37.9%
Taylor expanded in y around inf 77.0%
if -5.6000000000000004e-13 < y < 1.2000000000000001e-149Initial program 78.1%
Taylor expanded in y around 0 65.5%
if 1.2000000000000001e-149 < y < 9.99999999999999949e60Initial program 75.9%
Taylor expanded in t around 0 60.9%
sub-neg60.9%
mul-1-neg60.9%
+-commutative60.9%
associate-+r+60.9%
+-commutative60.9%
associate-*r*60.9%
distribute-rgt-in60.9%
mul-1-neg60.9%
+-commutative60.9%
+-commutative60.9%
Simplified60.9%
Final simplification70.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y)) (t_2 (- (+ z a) b)))
(if (<= t -2.9e+218)
a
(if (<= t 5.2e+67)
t_2
(if (<= t 8.2e+138)
(/ z (/ t_1 (+ x y)))
(if (<= t 7.6e+161) t_2 (/ a (/ t_1 (+ t y)))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = (z + a) - b;
double tmp;
if (t <= -2.9e+218) {
tmp = a;
} else if (t <= 5.2e+67) {
tmp = t_2;
} else if (t <= 8.2e+138) {
tmp = z / (t_1 / (x + y));
} else if (t <= 7.6e+161) {
tmp = t_2;
} else {
tmp = a / (t_1 / (t + y));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (x + t) + y
t_2 = (z + a) - b
if (t <= (-2.9d+218)) then
tmp = a
else if (t <= 5.2d+67) then
tmp = t_2
else if (t <= 8.2d+138) then
tmp = z / (t_1 / (x + y))
else if (t <= 7.6d+161) then
tmp = t_2
else
tmp = a / (t_1 / (t + y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = (z + a) - b;
double tmp;
if (t <= -2.9e+218) {
tmp = a;
} else if (t <= 5.2e+67) {
tmp = t_2;
} else if (t <= 8.2e+138) {
tmp = z / (t_1 / (x + y));
} else if (t <= 7.6e+161) {
tmp = t_2;
} else {
tmp = a / (t_1 / (t + y));
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x + t) + y t_2 = (z + a) - b tmp = 0 if t <= -2.9e+218: tmp = a elif t <= 5.2e+67: tmp = t_2 elif t <= 8.2e+138: tmp = z / (t_1 / (x + y)) elif t <= 7.6e+161: tmp = t_2 else: tmp = a / (t_1 / (t + y)) return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(z + a) - b) tmp = 0.0 if (t <= -2.9e+218) tmp = a; elseif (t <= 5.2e+67) tmp = t_2; elseif (t <= 8.2e+138) tmp = Float64(z / Float64(t_1 / Float64(x + y))); elseif (t <= 7.6e+161) tmp = t_2; else tmp = Float64(a / Float64(t_1 / Float64(t + y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x + t) + y; t_2 = (z + a) - b; tmp = 0.0; if (t <= -2.9e+218) tmp = a; elseif (t <= 5.2e+67) tmp = t_2; elseif (t <= 8.2e+138) tmp = z / (t_1 / (x + y)); elseif (t <= 7.6e+161) tmp = t_2; else tmp = a / (t_1 / (t + y)); 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[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t, -2.9e+218], a, If[LessEqual[t, 5.2e+67], t$95$2, If[LessEqual[t, 8.2e+138], N[(z / N[(t$95$1 / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 7.6e+161], t$95$2, N[(a / N[(t$95$1 / N[(t + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \left(z + a\right) - b\\
\mathbf{if}\;t \leq -2.9 \cdot 10^{+218}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 5.2 \cdot 10^{+67}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 8.2 \cdot 10^{+138}:\\
\;\;\;\;\frac{z}{\frac{t_1}{x + y}}\\
\mathbf{elif}\;t \leq 7.6 \cdot 10^{+161}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{\frac{t_1}{t + y}}\\
\end{array}
\end{array}
if t < -2.8999999999999999e218Initial program 36.0%
Taylor expanded in t around inf 77.3%
if -2.8999999999999999e218 < t < 5.2000000000000001e67 or 8.19999999999999961e138 < t < 7.6000000000000005e161Initial program 59.5%
Taylor expanded in y around inf 69.6%
if 5.2000000000000001e67 < t < 8.19999999999999961e138Initial program 65.1%
Taylor expanded in z around inf 38.3%
associate-/l*59.1%
associate-+r+59.1%
+-commutative59.1%
Simplified59.1%
if 7.6000000000000005e161 < t Initial program 56.3%
Taylor expanded in a around inf 37.5%
associate-/l*64.4%
associate-+r+64.4%
Simplified64.4%
Final simplification68.8%
(FPCore (x y z t a b) :precision binary64 (if (or (<= y -8.5e-24) (not (<= y 6.5e-141))) (- (+ z a) b) (/ (+ (* t a) (* z x)) (+ x t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -8.5e-24) || !(y <= 6.5e-141)) {
tmp = (z + a) - b;
} else {
tmp = ((t * a) + (z * x)) / (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 <= (-8.5d-24)) .or. (.not. (y <= 6.5d-141))) then
tmp = (z + a) - b
else
tmp = ((t * a) + (z * x)) / (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 <= -8.5e-24) || !(y <= 6.5e-141)) {
tmp = (z + a) - b;
} else {
tmp = ((t * a) + (z * x)) / (x + t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (y <= -8.5e-24) or not (y <= 6.5e-141): tmp = (z + a) - b else: tmp = ((t * a) + (z * x)) / (x + t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -8.5e-24) || !(y <= 6.5e-141)) tmp = Float64(Float64(z + a) - b); else tmp = Float64(Float64(Float64(t * a) + Float64(z * x)) / Float64(x + t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((y <= -8.5e-24) || ~((y <= 6.5e-141))) tmp = (z + a) - b; else tmp = ((t * a) + (z * x)) / (x + t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -8.5e-24], N[Not[LessEqual[y, 6.5e-141]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], N[(N[(N[(t * a), $MachinePrecision] + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(x + t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -8.5 \cdot 10^{-24} \lor \neg \left(y \leq 6.5 \cdot 10^{-141}\right):\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;\frac{t \cdot a + z \cdot x}{x + t}\\
\end{array}
\end{array}
if y < -8.5000000000000002e-24 or 6.4999999999999995e-141 < y Initial program 45.7%
Taylor expanded in y around inf 71.1%
if -8.5000000000000002e-24 < y < 6.4999999999999995e-141Initial program 78.5%
Taylor expanded in y around 0 65.2%
Final simplification68.9%
(FPCore (x y z t a b) :precision binary64 (if (<= t -2.15e+219) a (if (<= t 6e+61) (- (+ z a) b) (/ a (/ (+ (+ x t) y) (+ t y))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -2.15e+219) {
tmp = a;
} else if (t <= 6e+61) {
tmp = (z + a) - b;
} else {
tmp = a / (((x + t) + y) / (t + y));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (t <= (-2.15d+219)) then
tmp = a
else if (t <= 6d+61) then
tmp = (z + a) - b
else
tmp = a / (((x + t) + y) / (t + y))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -2.15e+219) {
tmp = a;
} else if (t <= 6e+61) {
tmp = (z + a) - b;
} else {
tmp = a / (((x + t) + y) / (t + y));
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -2.15e+219: tmp = a elif t <= 6e+61: tmp = (z + a) - b else: tmp = a / (((x + t) + y) / (t + y)) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -2.15e+219) tmp = a; elseif (t <= 6e+61) tmp = Float64(Float64(z + a) - b); else tmp = Float64(a / Float64(Float64(Float64(x + t) + y) / Float64(t + y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -2.15e+219) tmp = a; elseif (t <= 6e+61) tmp = (z + a) - b; else tmp = a / (((x + t) + y) / (t + y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -2.15e+219], a, If[LessEqual[t, 6e+61], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], N[(a / N[(N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision] / N[(t + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.15 \cdot 10^{+219}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 6 \cdot 10^{+61}:\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;\frac{a}{\frac{\left(x + t\right) + y}{t + y}}\\
\end{array}
\end{array}
if t < -2.1499999999999999e219Initial program 36.0%
Taylor expanded in t around inf 77.3%
if -2.1499999999999999e219 < t < 6e61Initial program 60.4%
Taylor expanded in y around inf 68.8%
if 6e61 < t Initial program 56.2%
Taylor expanded in a around inf 34.7%
associate-/l*58.9%
associate-+r+58.9%
Simplified58.9%
Final simplification67.1%
(FPCore (x y z t a b) :precision binary64 (if (<= t -2.25e+218) a (if (<= t 5.5e+61) (- (+ z a) b) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -2.25e+218) {
tmp = a;
} else if (t <= 5.5e+61) {
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 <= (-2.25d+218)) then
tmp = a
else if (t <= 5.5d+61) 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 <= -2.25e+218) {
tmp = a;
} else if (t <= 5.5e+61) {
tmp = (z + a) - b;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -2.25e+218: tmp = a elif t <= 5.5e+61: tmp = (z + a) - b else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -2.25e+218) tmp = a; elseif (t <= 5.5e+61) 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 <= -2.25e+218) tmp = a; elseif (t <= 5.5e+61) tmp = (z + a) - b; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -2.25e+218], a, If[LessEqual[t, 5.5e+61], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -2.25 \cdot 10^{+218}:\\
\;\;\;\;a\\
\mathbf{elif}\;t \leq 5.5 \cdot 10^{+61}:\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if t < -2.25000000000000004e218 or 5.50000000000000036e61 < t Initial program 52.0%
Taylor expanded in t around inf 60.5%
if -2.25000000000000004e218 < t < 5.50000000000000036e61Initial program 60.4%
Taylor expanded in y around inf 68.8%
Final simplification66.5%
(FPCore (x y z t a b) :precision binary64 (if (<= a -7.8e+155) a (if (<= a 60.0) (- z b) a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -7.8e+155) {
tmp = a;
} else if (a <= 60.0) {
tmp = z - b;
} else {
tmp = a;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-7.8d+155)) then
tmp = a
else if (a <= 60.0d0) then
tmp = z - b
else
tmp = a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -7.8e+155) {
tmp = a;
} else if (a <= 60.0) {
tmp = z - b;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -7.8e+155: tmp = a elif a <= 60.0: tmp = z - b else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -7.8e+155) tmp = a; elseif (a <= 60.0) tmp = Float64(z - b); else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -7.8e+155) tmp = a; elseif (a <= 60.0) tmp = z - b; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -7.8e+155], a, If[LessEqual[a, 60.0], N[(z - b), $MachinePrecision], a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -7.8 \cdot 10^{+155}:\\
\;\;\;\;a\\
\mathbf{elif}\;a \leq 60:\\
\;\;\;\;z - b\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if a < -7.7999999999999996e155 or 60 < a Initial program 45.2%
Taylor expanded in t around inf 59.3%
if -7.7999999999999996e155 < a < 60Initial program 66.6%
Taylor expanded in a around 0 49.7%
+-commutative49.7%
*-commutative49.7%
Simplified49.7%
Taylor expanded in y around inf 50.8%
Final simplification54.2%
(FPCore (x y z t a b) :precision binary64 (if (<= a -3.1e+28) a (if (<= a 5.8e-25) z a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -3.1e+28) {
tmp = a;
} else if (a <= 5.8e-25) {
tmp = z;
} else {
tmp = a;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-3.1d+28)) then
tmp = a
else if (a <= 5.8d-25) then
tmp = z
else
tmp = a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -3.1e+28) {
tmp = a;
} else if (a <= 5.8e-25) {
tmp = z;
} else {
tmp = a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -3.1e+28: tmp = a elif a <= 5.8e-25: tmp = z else: tmp = a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -3.1e+28) tmp = a; elseif (a <= 5.8e-25) tmp = z; else tmp = a; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -3.1e+28) tmp = a; elseif (a <= 5.8e-25) tmp = z; else tmp = a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -3.1e+28], a, If[LessEqual[a, 5.8e-25], z, a]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.1 \cdot 10^{+28}:\\
\;\;\;\;a\\
\mathbf{elif}\;a \leq 5.8 \cdot 10^{-25}:\\
\;\;\;\;z\\
\mathbf{else}:\\
\;\;\;\;a\\
\end{array}
\end{array}
if a < -3.1000000000000001e28 or 5.8000000000000001e-25 < a Initial program 47.6%
Taylor expanded in t around inf 54.7%
if -3.1000000000000001e28 < a < 5.8000000000000001e-25Initial program 68.9%
Taylor expanded in x around inf 46.2%
Final simplification50.5%
(FPCore (x y z t a b) :precision binary64 a)
double code(double x, double y, double z, double t, double a, double b) {
return a;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = a
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a;
}
def code(x, y, z, t, a, b): return a
function code(x, y, z, t, a, b) return a end
function tmp = code(x, y, z, t, a, b) tmp = a; end
code[x_, y_, z_, t_, a_, b_] := a
\begin{array}{l}
\\
a
\end{array}
Initial program 58.0%
Taylor expanded in t around inf 36.1%
Final simplification36.1%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)))
(t_3 (/ t_2 t_1))
(t_4 (- (+ z a) b)))
(if (< t_3 -3.5813117084150564e+153)
t_4
(if (< t_3 1.2285964308315609e+82) (/ 1.0 (/ t_1 t_2)) t_4))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b);
double t_3 = t_2 / t_1;
double t_4 = (z + a) - b;
double tmp;
if (t_3 < -3.5813117084150564e+153) {
tmp = t_4;
} else if (t_3 < 1.2285964308315609e+82) {
tmp = 1.0 / (t_1 / t_2);
} else {
tmp = t_4;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: t_4
real(8) :: tmp
t_1 = (x + t) + y
t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b)
t_3 = t_2 / t_1
t_4 = (z + a) - b
if (t_3 < (-3.5813117084150564d+153)) then
tmp = t_4
else if (t_3 < 1.2285964308315609d+82) then
tmp = 1.0d0 / (t_1 / t_2)
else
tmp = t_4
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x + t) + y;
double t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b);
double t_3 = t_2 / t_1;
double t_4 = (z + a) - b;
double tmp;
if (t_3 < -3.5813117084150564e+153) {
tmp = t_4;
} else if (t_3 < 1.2285964308315609e+82) {
tmp = 1.0 / (t_1 / t_2);
} else {
tmp = t_4;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (x + t) + y t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b) t_3 = t_2 / t_1 t_4 = (z + a) - b tmp = 0 if t_3 < -3.5813117084150564e+153: tmp = t_4 elif t_3 < 1.2285964308315609e+82: tmp = 1.0 / (t_1 / t_2) else: tmp = t_4 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) t_3 = Float64(t_2 / t_1) t_4 = Float64(Float64(z + a) - b) tmp = 0.0 if (t_3 < -3.5813117084150564e+153) tmp = t_4; elseif (t_3 < 1.2285964308315609e+82) tmp = Float64(1.0 / Float64(t_1 / t_2)); else tmp = t_4; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (x + t) + y; t_2 = (((x + y) * z) + ((t + y) * a)) - (y * b); t_3 = t_2 / t_1; t_4 = (z + a) - b; tmp = 0.0; if (t_3 < -3.5813117084150564e+153) tmp = t_4; elseif (t_3 < 1.2285964308315609e+82) tmp = 1.0 / (t_1 / t_2); else tmp = t_4; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 / t$95$1), $MachinePrecision]}, Block[{t$95$4 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[Less[t$95$3, -3.5813117084150564e+153], t$95$4, If[Less[t$95$3, 1.2285964308315609e+82], N[(1.0 / N[(t$95$1 / t$95$2), $MachinePrecision]), $MachinePrecision], t$95$4]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b\\
t_3 := \frac{t_2}{t_1}\\
t_4 := \left(z + a\right) - b\\
\mathbf{if}\;t_3 < -3.5813117084150564 \cdot 10^{+153}:\\
\;\;\;\;t_4\\
\mathbf{elif}\;t_3 < 1.2285964308315609 \cdot 10^{+82}:\\
\;\;\;\;\frac{1}{\frac{t_1}{t_2}}\\
\mathbf{else}:\\
\;\;\;\;t_4\\
\end{array}
\end{array}
herbie shell --seed 2023331
(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)))