
(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 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))
double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
}
def code(x, y, z, t, a, b): return ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) end
function tmp = code(x, y, z, t, a, b) tmp = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}
\end{array}
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* z (+ x y)) (* (+ y t) a)) (* y b)) (+ y (+ x t))))
(t_2 (+ t (+ x y)))
(t_3 (/ a t_2)))
(if (<= t_1 (- INFINITY))
(fma (+ y t) t_3 (* z (/ (+ x y) t_2)))
(if (<= t_1 2e+281) t_1 (fma (+ y t) t_3 (- z b))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (((z * (x + y)) + ((y + t) * a)) - (y * b)) / (y + (x + t));
double t_2 = t + (x + y);
double t_3 = a / t_2;
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma((y + t), t_3, (z * ((x + y) / t_2)));
} else if (t_1 <= 2e+281) {
tmp = t_1;
} else {
tmp = fma((y + t), t_3, (z - b));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(z * Float64(x + y)) + Float64(Float64(y + t) * a)) - Float64(y * b)) / Float64(y + Float64(x + t))) t_2 = Float64(t + Float64(x + y)) t_3 = Float64(a / t_2) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = fma(Float64(y + t), t_3, Float64(z * Float64(Float64(x + y) / t_2))); elseif (t_1 <= 2e+281) tmp = t_1; else tmp = fma(Float64(y + t), t_3, Float64(z - b)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(N[(y + t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(a / t$95$2), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(y + t), $MachinePrecision] * t$95$3 + N[(z * N[(N[(x + y), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+281], t$95$1, N[(N[(y + t), $MachinePrecision] * t$95$3 + N[(z - b), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(z \cdot \left(x + y\right) + \left(y + t\right) \cdot a\right) - y \cdot b}{y + \left(x + t\right)}\\
t_2 := t + \left(x + y\right)\\
t_3 := \frac{a}{t\_2}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(y + t, t\_3, z \cdot \frac{x + y}{t\_2}\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+281}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y + t, t\_3, z - b\right)\\
\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.0Initial program 6.7%
Taylor expanded in b around 0
mul-1-negN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-/l*N/A
sub-negN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites43.2%
Taylor expanded in z around -inf
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
neg-mul-1N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f64N/A
lower-/.f64N/A
mul-1-negN/A
+-commutativeN/A
unsub-negN/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6486.2
Applied rewrites86.2%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e281Initial program 99.5%
if 2.0000000000000001e281 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 6.7%
Taylor expanded in b around 0
mul-1-negN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-/l*N/A
sub-negN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites40.5%
Taylor expanded in y around inf
lower--.f6492.2
Applied rewrites92.2%
Final simplification95.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* z (+ x y)) (* (+ y t) a)) (* y b)) (+ y (+ x t))))
(t_2 (- (+ z a) b)))
(if (<= t_1 -500000000000.0)
t_2
(if (<= t_1 -2e-159)
(fma a (/ y (+ x y)) z)
(if (<= t_1 5e-29) (* a (/ t (+ x t))) t_2)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (((z * (x + y)) + ((y + t) * a)) - (y * b)) / (y + (x + t));
double t_2 = (z + a) - b;
double tmp;
if (t_1 <= -500000000000.0) {
tmp = t_2;
} else if (t_1 <= -2e-159) {
tmp = fma(a, (y / (x + y)), z);
} else if (t_1 <= 5e-29) {
tmp = a * (t / (x + t));
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(z * Float64(x + y)) + Float64(Float64(y + t) * a)) - Float64(y * b)) / Float64(y + Float64(x + t))) t_2 = Float64(Float64(z + a) - b) tmp = 0.0 if (t_1 <= -500000000000.0) tmp = t_2; elseif (t_1 <= -2e-159) tmp = fma(a, Float64(y / Float64(x + y)), z); elseif (t_1 <= 5e-29) tmp = Float64(a * Float64(t / Float64(x + t))); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(N[(y + t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$1, -500000000000.0], t$95$2, If[LessEqual[t$95$1, -2e-159], N[(a * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision], If[LessEqual[t$95$1, 5e-29], N[(a * N[(t / N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(z \cdot \left(x + y\right) + \left(y + t\right) \cdot a\right) - y \cdot b}{y + \left(x + t\right)}\\
t_2 := \left(z + a\right) - b\\
\mathbf{if}\;t\_1 \leq -500000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -2 \cdot 10^{-159}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{x + y}, z\right)\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-29}:\\
\;\;\;\;a \cdot \frac{t}{x + t}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -5e11 or 4.99999999999999986e-29 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 49.4%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6467.7
Applied rewrites67.7%
if -5e11 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -1.99999999999999998e-159Initial program 99.6%
Taylor expanded in b around 0
mul-1-negN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-/l*N/A
sub-negN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites92.5%
Taylor expanded in z around -inf
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
neg-mul-1N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f64N/A
lower-/.f64N/A
mul-1-negN/A
+-commutativeN/A
unsub-negN/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6482.0
Applied rewrites82.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6464.8
Applied rewrites64.8%
if -1.99999999999999998e-159 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.99999999999999986e-29Initial program 98.8%
Taylor expanded in a around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
Applied rewrites93.9%
Taylor expanded in a around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6471.4
Applied rewrites71.4%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6471.4
Applied rewrites71.4%
Final simplification67.9%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* z (+ x y)) (* (+ y t) a)) (* y b)) (+ y (+ x t))))
(t_2 (- (+ z a) b)))
(if (<= t_1 -50000000000.0)
t_2
(if (<= t_1 -5e-139)
(* a (/ z a))
(if (<= t_1 5e-29) (* a (/ t (+ x t))) t_2)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (((z * (x + y)) + ((y + t) * a)) - (y * b)) / (y + (x + t));
double t_2 = (z + a) - b;
double tmp;
if (t_1 <= -50000000000.0) {
tmp = t_2;
} else if (t_1 <= -5e-139) {
tmp = a * (z / a);
} else if (t_1 <= 5e-29) {
tmp = a * (t / (x + t));
} 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 + t) * a)) - (y * b)) / (y + (x + t))
t_2 = (z + a) - b
if (t_1 <= (-50000000000.0d0)) then
tmp = t_2
else if (t_1 <= (-5d-139)) then
tmp = a * (z / a)
else if (t_1 <= 5d-29) then
tmp = a * (t / (x + t))
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 + t) * a)) - (y * b)) / (y + (x + t));
double t_2 = (z + a) - b;
double tmp;
if (t_1 <= -50000000000.0) {
tmp = t_2;
} else if (t_1 <= -5e-139) {
tmp = a * (z / a);
} else if (t_1 <= 5e-29) {
tmp = a * (t / (x + t));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (((z * (x + y)) + ((y + t) * a)) - (y * b)) / (y + (x + t)) t_2 = (z + a) - b tmp = 0 if t_1 <= -50000000000.0: tmp = t_2 elif t_1 <= -5e-139: tmp = a * (z / a) elif t_1 <= 5e-29: tmp = a * (t / (x + t)) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(z * Float64(x + y)) + Float64(Float64(y + t) * a)) - Float64(y * b)) / Float64(y + Float64(x + t))) t_2 = Float64(Float64(z + a) - b) tmp = 0.0 if (t_1 <= -50000000000.0) tmp = t_2; elseif (t_1 <= -5e-139) tmp = Float64(a * Float64(z / a)); elseif (t_1 <= 5e-29) tmp = Float64(a * Float64(t / Float64(x + t))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (((z * (x + y)) + ((y + t) * a)) - (y * b)) / (y + (x + t)); t_2 = (z + a) - b; tmp = 0.0; if (t_1 <= -50000000000.0) tmp = t_2; elseif (t_1 <= -5e-139) tmp = a * (z / a); elseif (t_1 <= 5e-29) tmp = a * (t / (x + t)); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(N[(y + t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$1, -50000000000.0], t$95$2, If[LessEqual[t$95$1, -5e-139], N[(a * N[(z / a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 5e-29], N[(a * N[(t / N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(z \cdot \left(x + y\right) + \left(y + t\right) \cdot a\right) - y \cdot b}{y + \left(x + t\right)}\\
t_2 := \left(z + a\right) - b\\
\mathbf{if}\;t\_1 \leq -50000000000:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq -5 \cdot 10^{-139}:\\
\;\;\;\;a \cdot \frac{z}{a}\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-29}:\\
\;\;\;\;a \cdot \frac{t}{x + t}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -5e10 or 4.99999999999999986e-29 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 49.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6467.4
Applied rewrites67.4%
if -5e10 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -5.00000000000000034e-139Initial program 99.6%
Taylor expanded in a around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
Applied rewrites91.1%
Taylor expanded in x around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f6453.1
Applied rewrites53.1%
if -5.00000000000000034e-139 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.99999999999999986e-29Initial program 98.9%
Taylor expanded in a around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
Applied rewrites91.8%
Taylor expanded in a around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6468.5
Applied rewrites68.5%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6468.4
Applied rewrites68.4%
Final simplification66.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* z (+ x y)) (* (+ y t) a)) (* y b)) (+ y (+ x t))))
(t_2 (fma (+ y t) (/ a (+ t (+ x y))) (- z b))))
(if (<= t_1 (- INFINITY)) t_2 (if (<= t_1 2e+281) 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 + t) * a)) - (y * b)) / (y + (x + t));
double t_2 = fma((y + t), (a / (t + (x + y))), (z - b));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_2;
} else if (t_1 <= 2e+281) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(z * Float64(x + y)) + Float64(Float64(y + t) * a)) - Float64(y * b)) / Float64(y + Float64(x + t))) t_2 = fma(Float64(y + t), Float64(a / Float64(t + Float64(x + y))), Float64(z - b)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_2; elseif (t_1 <= 2e+281) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(N[(y + t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + t), $MachinePrecision] * N[(a / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$2, If[LessEqual[t$95$1, 2e+281], t$95$1, t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(z \cdot \left(x + y\right) + \left(y + t\right) \cdot a\right) - y \cdot b}{y + \left(x + t\right)}\\
t_2 := \mathsf{fma}\left(y + t, \frac{a}{t + \left(x + y\right)}, z - b\right)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+281}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 2.0000000000000001e281 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 6.7%
Taylor expanded in b around 0
mul-1-negN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-/l*N/A
sub-negN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites41.6%
Taylor expanded in y around inf
lower--.f6488.0
Applied rewrites88.0%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2.0000000000000001e281Initial program 99.5%
Final simplification94.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* z (+ x y)) (* (+ y t) a)) (* y b)) (+ y (+ x t))))
(t_2 (- (+ z a) b)))
(if (<= t_1 -1e-145) t_2 (if (<= t_1 5e-29) (* a (/ t (+ x t))) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (((z * (x + y)) + ((y + t) * a)) - (y * b)) / (y + (x + t));
double t_2 = (z + a) - b;
double tmp;
if (t_1 <= -1e-145) {
tmp = t_2;
} else if (t_1 <= 5e-29) {
tmp = a * (t / (x + t));
} 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 + t) * a)) - (y * b)) / (y + (x + t))
t_2 = (z + a) - b
if (t_1 <= (-1d-145)) then
tmp = t_2
else if (t_1 <= 5d-29) then
tmp = a * (t / (x + t))
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 + t) * a)) - (y * b)) / (y + (x + t));
double t_2 = (z + a) - b;
double tmp;
if (t_1 <= -1e-145) {
tmp = t_2;
} else if (t_1 <= 5e-29) {
tmp = a * (t / (x + t));
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = (((z * (x + y)) + ((y + t) * a)) - (y * b)) / (y + (x + t)) t_2 = (z + a) - b tmp = 0 if t_1 <= -1e-145: tmp = t_2 elif t_1 <= 5e-29: tmp = a * (t / (x + t)) else: tmp = t_2 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(z * Float64(x + y)) + Float64(Float64(y + t) * a)) - Float64(y * b)) / Float64(y + Float64(x + t))) t_2 = Float64(Float64(z + a) - b) tmp = 0.0 if (t_1 <= -1e-145) tmp = t_2; elseif (t_1 <= 5e-29) tmp = Float64(a * Float64(t / Float64(x + t))); else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = (((z * (x + y)) + ((y + t) * a)) - (y * b)) / (y + (x + t)); t_2 = (z + a) - b; tmp = 0.0; if (t_1 <= -1e-145) tmp = t_2; elseif (t_1 <= 5e-29) tmp = a * (t / (x + t)); else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(N[(y + t), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-145], t$95$2, If[LessEqual[t$95$1, 5e-29], N[(a * N[(t / N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(z \cdot \left(x + y\right) + \left(y + t\right) \cdot a\right) - y \cdot b}{y + \left(x + t\right)}\\
t_2 := \left(z + a\right) - b\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-145}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 5 \cdot 10^{-29}:\\
\;\;\;\;a \cdot \frac{t}{x + t}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -9.99999999999999915e-146 or 4.99999999999999986e-29 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 55.1%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6463.5
Applied rewrites63.5%
if -9.99999999999999915e-146 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.99999999999999986e-29Initial program 98.8%
Taylor expanded in a around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
Applied rewrites91.5%
Taylor expanded in a around inf
associate-*r/N/A
lower-/.f64N/A
mul-1-negN/A
lower-neg.f64N/A
lower-+.f64N/A
lower-+.f64N/A
lower-+.f6470.3
Applied rewrites70.3%
Taylor expanded in y around 0
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6470.3
Applied rewrites70.3%
Final simplification64.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma (+ y t) (/ a (+ t (+ x y))) (- z b))))
(if (<= x -9.2e+109)
t_1
(if (<= x 1.18e-57)
(fma y (/ (- z b) (+ y t)) a)
(if (<= x 3.7e+186)
t_1
(if (<= x 6.6e+268)
(- z (/ (fma (+ y t) z (- (fma a t (* y (- (+ z a) b))))) x))
(fma a (/ y (+ x y)) z)))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma((y + t), (a / (t + (x + y))), (z - b));
double tmp;
if (x <= -9.2e+109) {
tmp = t_1;
} else if (x <= 1.18e-57) {
tmp = fma(y, ((z - b) / (y + t)), a);
} else if (x <= 3.7e+186) {
tmp = t_1;
} else if (x <= 6.6e+268) {
tmp = z - (fma((y + t), z, -fma(a, t, (y * ((z + a) - b)))) / x);
} else {
tmp = fma(a, (y / (x + y)), z);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(Float64(y + t), Float64(a / Float64(t + Float64(x + y))), Float64(z - b)) tmp = 0.0 if (x <= -9.2e+109) tmp = t_1; elseif (x <= 1.18e-57) tmp = fma(y, Float64(Float64(z - b) / Float64(y + t)), a); elseif (x <= 3.7e+186) tmp = t_1; elseif (x <= 6.6e+268) tmp = Float64(z - Float64(fma(Float64(y + t), z, Float64(-fma(a, t, Float64(y * Float64(Float64(z + a) - b))))) / x)); else tmp = fma(a, Float64(y / Float64(x + y)), z); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y + t), $MachinePrecision] * N[(a / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.2e+109], t$95$1, If[LessEqual[x, 1.18e-57], N[(y * N[(N[(z - b), $MachinePrecision] / N[(y + t), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[x, 3.7e+186], t$95$1, If[LessEqual[x, 6.6e+268], N[(z - N[(N[(N[(y + t), $MachinePrecision] * z + (-N[(a * t + N[(y * N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(a * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y + t, \frac{a}{t + \left(x + y\right)}, z - b\right)\\
\mathbf{if}\;x \leq -9.2 \cdot 10^{+109}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 1.18 \cdot 10^{-57}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - b}{y + t}, a\right)\\
\mathbf{elif}\;x \leq 3.7 \cdot 10^{+186}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 6.6 \cdot 10^{+268}:\\
\;\;\;\;z - \frac{\mathsf{fma}\left(y + t, z, -\mathsf{fma}\left(a, t, y \cdot \left(\left(z + a\right) - b\right)\right)\right)}{x}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{x + y}, z\right)\\
\end{array}
\end{array}
if x < -9.20000000000000042e109 or 1.18e-57 < x < 3.7e186Initial program 55.6%
Taylor expanded in b around 0
mul-1-negN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-/l*N/A
sub-negN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites67.9%
Taylor expanded in y around inf
lower--.f6471.9
Applied rewrites71.9%
if -9.20000000000000042e109 < x < 1.18e-57Initial program 65.5%
Taylor expanded in b around 0
mul-1-negN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-/l*N/A
sub-negN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites68.6%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6485.4
Applied rewrites85.4%
if 3.7e186 < x < 6.6000000000000002e268Initial program 72.3%
Taylor expanded in x around -inf
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
Applied rewrites72.8%
if 6.6000000000000002e268 < x Initial program 31.7%
Taylor expanded in b around 0
mul-1-negN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-/l*N/A
sub-negN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites38.9%
Taylor expanded in z around -inf
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
neg-mul-1N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f64N/A
lower-/.f64N/A
mul-1-negN/A
+-commutativeN/A
unsub-negN/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f64100.0
Applied rewrites100.0%
Final simplification81.4%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ t (+ x y))))
(if (<= y -2.25e-38)
(* (+ a (- z b)) (/ y t_1))
(if (<= y 1.55e-79)
(* a (+ (/ z a) (/ (+ y t) t_1)))
(fma y (/ (- z b) (+ y t)) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t + (x + y);
double tmp;
if (y <= -2.25e-38) {
tmp = (a + (z - b)) * (y / t_1);
} else if (y <= 1.55e-79) {
tmp = a * ((z / a) + ((y + t) / t_1));
} else {
tmp = fma(y, ((z - b) / (y + t)), a);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(t + Float64(x + y)) tmp = 0.0 if (y <= -2.25e-38) tmp = Float64(Float64(a + Float64(z - b)) * Float64(y / t_1)); elseif (y <= 1.55e-79) tmp = Float64(a * Float64(Float64(z / a) + Float64(Float64(y + t) / t_1))); else tmp = fma(y, Float64(Float64(z - b) / Float64(y + t)), a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.25e-38], N[(N[(a + N[(z - b), $MachinePrecision]), $MachinePrecision] * N[(y / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.55e-79], N[(a * N[(N[(z / a), $MachinePrecision] + N[(N[(y + t), $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - b), $MachinePrecision] / N[(y + t), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := t + \left(x + y\right)\\
\mathbf{if}\;y \leq -2.25 \cdot 10^{-38}:\\
\;\;\;\;\left(a + \left(z - b\right)\right) \cdot \frac{y}{t\_1}\\
\mathbf{elif}\;y \leq 1.55 \cdot 10^{-79}:\\
\;\;\;\;a \cdot \left(\frac{z}{a} + \frac{y + t}{t\_1}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - b}{y + t}, a\right)\\
\end{array}
\end{array}
if y < -2.25000000000000004e-38Initial program 51.4%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f6444.2
Applied rewrites44.2%
lift-+.f64N/A
lift--.f64N/A
*-commutativeN/A
+-commutativeN/A
associate-+r+N/A
+-commutativeN/A
lift-+.f64N/A
lift-+.f64N/A
associate-/l*N/A
lower-*.f64N/A
lift--.f64N/A
lift-+.f64N/A
associate--l+N/A
lift--.f64N/A
lower-+.f64N/A
lower-/.f6481.9
Applied rewrites81.9%
if -2.25000000000000004e-38 < y < 1.55e-79Initial program 77.6%
Taylor expanded in a around -inf
associate-*r*N/A
lower-*.f64N/A
mul-1-negN/A
lower-neg.f64N/A
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
Applied rewrites78.3%
Taylor expanded in x around inf
lower-/.f6474.1
Applied rewrites74.1%
if 1.55e-79 < y Initial program 47.2%
Taylor expanded in b around 0
mul-1-negN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-/l*N/A
sub-negN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites58.6%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6486.4
Applied rewrites86.4%
Final simplification80.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma y (/ (- z b) (+ y t)) a)))
(if (<= t -1.15e-5)
t_1
(if (<= t 7.4e+143) (fma (+ y t) (/ a (+ t (+ x y))) (- z b)) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(y, ((z - b) / (y + t)), a);
double tmp;
if (t <= -1.15e-5) {
tmp = t_1;
} else if (t <= 7.4e+143) {
tmp = fma((y + t), (a / (t + (x + y))), (z - b));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(y, Float64(Float64(z - b) / Float64(y + t)), a) tmp = 0.0 if (t <= -1.15e-5) tmp = t_1; elseif (t <= 7.4e+143) tmp = fma(Float64(y + t), Float64(a / Float64(t + Float64(x + y))), Float64(z - b)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y * N[(N[(z - b), $MachinePrecision] / N[(y + t), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]}, If[LessEqual[t, -1.15e-5], t$95$1, If[LessEqual[t, 7.4e+143], N[(N[(y + t), $MachinePrecision] * N[(a / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z - b), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, \frac{z - b}{y + t}, a\right)\\
\mathbf{if}\;t \leq -1.15 \cdot 10^{-5}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 7.4 \cdot 10^{+143}:\\
\;\;\;\;\mathsf{fma}\left(y + t, \frac{a}{t + \left(x + y\right)}, z - b\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -1.15e-5 or 7.4000000000000003e143 < t Initial program 51.2%
Taylor expanded in b around 0
mul-1-negN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-/l*N/A
sub-negN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites63.1%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6485.1
Applied rewrites85.1%
if -1.15e-5 < t < 7.4000000000000003e143Initial program 66.7%
Taylor expanded in b around 0
mul-1-negN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-/l*N/A
sub-negN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites71.0%
Taylor expanded in y around inf
lower--.f6474.0
Applied rewrites74.0%
Final simplification78.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma a (/ y (+ x y)) z)))
(if (<= x -1.4e+110)
t_1
(if (<= x 2.05e+102) (fma y (/ (- z b) (+ y t)) a) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = fma(a, (y / (x + y)), z);
double tmp;
if (x <= -1.4e+110) {
tmp = t_1;
} else if (x <= 2.05e+102) {
tmp = fma(y, ((z - b) / (y + t)), a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = fma(a, Float64(y / Float64(x + y)), z) tmp = 0.0 if (x <= -1.4e+110) tmp = t_1; elseif (x <= 2.05e+102) tmp = fma(y, Float64(Float64(z - b) / Float64(y + t)), a); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]}, If[LessEqual[x, -1.4e+110], t$95$1, If[LessEqual[x, 2.05e+102], N[(y * N[(N[(z - b), $MachinePrecision] / N[(y + t), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, \frac{y}{x + y}, z\right)\\
\mathbf{if}\;x \leq -1.4 \cdot 10^{+110}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \leq 2.05 \cdot 10^{+102}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - b}{y + t}, a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if x < -1.39999999999999993e110 or 2.05e102 < x Initial program 44.1%
Taylor expanded in b around 0
mul-1-negN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-/l*N/A
sub-negN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites59.2%
Taylor expanded in z around -inf
mul-1-negN/A
associate-/l*N/A
distribute-lft-neg-inN/A
neg-mul-1N/A
lower-*.f64N/A
neg-mul-1N/A
lower-neg.f64N/A
lower-/.f64N/A
mul-1-negN/A
+-commutativeN/A
unsub-negN/A
lower--.f64N/A
mul-1-negN/A
lower-neg.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6483.4
Applied rewrites83.4%
Taylor expanded in t around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
lower-+.f6464.3
Applied rewrites64.3%
if -1.39999999999999993e110 < x < 2.05e102Initial program 67.5%
Taylor expanded in b around 0
mul-1-negN/A
+-commutativeN/A
associate-+l+N/A
*-commutativeN/A
associate-/l*N/A
sub-negN/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
Applied rewrites71.5%
Taylor expanded in x around 0
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6479.9
Applied rewrites79.9%
Final simplification75.6%
(FPCore (x y z t a b) :precision binary64 (if (<= z -5e-73) (+ z a) (if (<= z 5.4e+95) (- a b) (+ z a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -5e-73) {
tmp = z + a;
} else if (z <= 5.4e+95) {
tmp = a - b;
} else {
tmp = z + 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 (z <= (-5d-73)) then
tmp = z + a
else if (z <= 5.4d+95) then
tmp = a - b
else
tmp = z + 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 (z <= -5e-73) {
tmp = z + a;
} else if (z <= 5.4e+95) {
tmp = a - b;
} else {
tmp = z + a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -5e-73: tmp = z + a elif z <= 5.4e+95: tmp = a - b else: tmp = z + a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -5e-73) tmp = Float64(z + a); elseif (z <= 5.4e+95) tmp = Float64(a - b); else tmp = Float64(z + a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -5e-73) tmp = z + a; elseif (z <= 5.4e+95) tmp = a - b; else tmp = z + a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -5e-73], N[(z + a), $MachinePrecision], If[LessEqual[z, 5.4e+95], N[(a - b), $MachinePrecision], N[(z + a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{-73}:\\
\;\;\;\;z + a\\
\mathbf{elif}\;z \leq 5.4 \cdot 10^{+95}:\\
\;\;\;\;a - b\\
\mathbf{else}:\\
\;\;\;\;z + a\\
\end{array}
\end{array}
if z < -4.9999999999999998e-73 or 5.4e95 < z Initial program 48.6%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6462.5
Applied rewrites62.5%
Taylor expanded in b around 0
+-commutativeN/A
lower-+.f6458.8
Applied rewrites58.8%
if -4.9999999999999998e-73 < z < 5.4e95Initial program 71.4%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6454.4
Applied rewrites54.4%
Taylor expanded in z around 0
lower--.f6453.9
Applied rewrites53.9%
(FPCore (x y z t a b) :precision binary64 (if (<= t -9.2e+186) a (- (+ z a) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -9.2e+186) {
tmp = a;
} else {
tmp = (z + a) - b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (t <= (-9.2d+186)) then
tmp = a
else
tmp = (z + a) - b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -9.2e+186) {
tmp = a;
} else {
tmp = (z + a) - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if t <= -9.2e+186: tmp = a else: tmp = (z + a) - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -9.2e+186) tmp = a; else tmp = Float64(Float64(z + a) - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (t <= -9.2e+186) tmp = a; else tmp = (z + a) - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -9.2e+186], a, N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -9.2 \cdot 10^{+186}:\\
\;\;\;\;a\\
\mathbf{else}:\\
\;\;\;\;\left(z + a\right) - b\\
\end{array}
\end{array}
if t < -9.20000000000000054e186Initial program 59.7%
Taylor expanded in y around inf
lower-*.f64N/A
lower--.f64N/A
lower-+.f6416.2
Applied rewrites16.2%
Taylor expanded in a around inf
associate-/l*N/A
lower-*.f64N/A
lower-/.f64N/A
lower-+.f64N/A
lower-+.f643.8
Applied rewrites3.8%
Taylor expanded in y around inf
Applied rewrites67.9%
if -9.20000000000000054e186 < t Initial program 61.2%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6461.0
Applied rewrites61.0%
Final simplification61.7%
(FPCore (x y z t a b) :precision binary64 (if (<= b -6.2e+18) (- z b) (+ z a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -6.2e+18) {
tmp = z - b;
} else {
tmp = z + 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 (b <= (-6.2d+18)) then
tmp = z - b
else
tmp = z + 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 (b <= -6.2e+18) {
tmp = z - b;
} else {
tmp = z + a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -6.2e+18: tmp = z - b else: tmp = z + a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -6.2e+18) tmp = Float64(z - b); else tmp = Float64(z + a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -6.2e+18) tmp = z - b; else tmp = z + a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -6.2e+18], N[(z - b), $MachinePrecision], N[(z + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6.2 \cdot 10^{+18}:\\
\;\;\;\;z - b\\
\mathbf{else}:\\
\;\;\;\;z + a\\
\end{array}
\end{array}
if b < -6.2e18Initial program 60.3%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.8
Applied rewrites55.8%
Taylor expanded in a around 0
lower--.f6451.5
Applied rewrites51.5%
if -6.2e18 < b Initial program 61.3%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6458.7
Applied rewrites58.7%
Taylor expanded in b around 0
+-commutativeN/A
lower-+.f6456.6
Applied rewrites56.6%
(FPCore (x y z t a b) :precision binary64 (if (<= b -3.2e+208) (- b) (+ z a)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -3.2e+208) {
tmp = -b;
} else {
tmp = z + 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 (b <= (-3.2d+208)) then
tmp = -b
else
tmp = z + 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 (b <= -3.2e+208) {
tmp = -b;
} else {
tmp = z + a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -3.2e+208: tmp = -b else: tmp = z + a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -3.2e+208) tmp = Float64(-b); else tmp = Float64(z + a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -3.2e+208) tmp = -b; else tmp = z + a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -3.2e+208], (-b), N[(z + a), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.2 \cdot 10^{+208}:\\
\;\;\;\;-b\\
\mathbf{else}:\\
\;\;\;\;z + a\\
\end{array}
\end{array}
if b < -3.2000000000000001e208Initial program 40.4%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6469.0
Applied rewrites69.0%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6462.1
Applied rewrites62.1%
if -3.2000000000000001e208 < b Initial program 62.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6457.2
Applied rewrites57.2%
Taylor expanded in b around 0
+-commutativeN/A
lower-+.f6452.7
Applied rewrites52.7%
(FPCore (x y z t a b) :precision binary64 (- b))
double code(double x, double y, double z, double t, double a, double b) {
return -b;
}
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 = -b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return -b;
}
def code(x, y, z, t, a, b): return -b
function code(x, y, z, t, a, b) return Float64(-b) end
function tmp = code(x, y, z, t, a, b) tmp = -b; end
code[x_, y_, z_, t_, a_, b_] := (-b)
\begin{array}{l}
\\
-b
\end{array}
Initial program 61.1%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6458.1
Applied rewrites58.1%
Taylor expanded in b around inf
mul-1-negN/A
lower-neg.f6415.1
Applied rewrites15.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 2024219
(FPCore (x y z t a b)
:name "AI.Clustering.Hierarchical.Internal:ward from clustering-0.2.1"
:precision binary64
:alt
(! :herbie-platform default (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) -3581311708415056400000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (- (+ z a) b) (if (< (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)) 12285964308315609000000000000000000000000000000000000000000000000000000000000000000) (/ 1 (/ (+ (+ x t) y) (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)))) (- (+ z a) b))))
(/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y)))