
(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 16 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 y) a))
(t_2 (+ (+ y x) t))
(t_3 (/ (- (+ (* (+ x y) z) t_1) (* y b)) (+ (+ x t) y))))
(if (or (<= t_3 (- INFINITY)) (not (<= t_3 5e+301)))
(- (+ z a) (* y (/ b (+ (+ t x) y))))
(fma (+ (/ y t_2) (/ x t_2)) z (/ (fma (- b) y t_1) t_2)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t + y) * a;
double t_2 = (y + x) + t;
double t_3 = ((((x + y) * z) + t_1) - (y * b)) / ((x + t) + y);
double tmp;
if ((t_3 <= -((double) INFINITY)) || !(t_3 <= 5e+301)) {
tmp = (z + a) - (y * (b / ((t + x) + y)));
} else {
tmp = fma(((y / t_2) + (x / t_2)), z, (fma(-b, y, t_1) / t_2));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t + y) * a) t_2 = Float64(Float64(y + x) + t) t_3 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + t_1) - Float64(y * b)) / Float64(Float64(x + t) + y)) tmp = 0.0 if ((t_3 <= Float64(-Inf)) || !(t_3 <= 5e+301)) tmp = Float64(Float64(z + a) - Float64(y * Float64(b / Float64(Float64(t + x) + y)))); else tmp = fma(Float64(Float64(y / t_2) + Float64(x / t_2)), z, Float64(fma(Float64(-b), y, t_1) / t_2)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + t$95$1), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$3, (-Infinity)], N[Not[LessEqual[t$95$3, 5e+301]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - N[(y * N[(b / N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(y / t$95$2), $MachinePrecision] + N[(x / t$95$2), $MachinePrecision]), $MachinePrecision] * z + N[(N[((-b) * y + t$95$1), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t + y\right) \cdot a\\
t_2 := \left(y + x\right) + t\\
t_3 := \frac{\left(\left(x + y\right) \cdot z + t\_1\right) - y \cdot b}{\left(x + t\right) + y}\\
\mathbf{if}\;t\_3 \leq -\infty \lor \neg \left(t\_3 \leq 5 \cdot 10^{+301}\right):\\
\;\;\;\;\left(z + a\right) - y \cdot \frac{b}{\left(t + x\right) + y}\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(\frac{y}{t\_2} + \frac{x}{t\_2}, z, \frac{\mathsf{fma}\left(-b, y, t\_1\right)}{t\_2}\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.0 or 5.0000000000000004e301 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 5.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
associate-/l*N/A
cancel-sign-sub-invN/A
lower-+.f64N/A
Applied rewrites24.9%
Taylor expanded in y around inf
+-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)) < 5.0000000000000004e301Initial program 99.6%
Taylor expanded in z around 0
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
Applied rewrites99.7%
Final simplification94.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (+ t y) a))
(t_2 (+ (+ x t) y))
(t_3 (/ (- (+ (* (+ x y) z) t_1) (* y b)) t_2))
(t_4 (- (+ z a) (* y (/ b (+ (+ t x) y))))))
(if (<= t_3 -5e+99)
t_4
(if (<= t_3 -5e-178)
(/ (fma z x (* y (- z b))) t_2)
(if (<= t_3 5e+301) (/ (fma (+ y x) z t_1) (+ (+ y x) t)) t_4)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (t + y) * a;
double t_2 = (x + t) + y;
double t_3 = ((((x + y) * z) + t_1) - (y * b)) / t_2;
double t_4 = (z + a) - (y * (b / ((t + x) + y)));
double tmp;
if (t_3 <= -5e+99) {
tmp = t_4;
} else if (t_3 <= -5e-178) {
tmp = fma(z, x, (y * (z - b))) / t_2;
} else if (t_3 <= 5e+301) {
tmp = fma((y + x), z, t_1) / ((y + x) + t);
} else {
tmp = t_4;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(t + y) * a) t_2 = Float64(Float64(x + t) + y) t_3 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + t_1) - Float64(y * b)) / t_2) t_4 = Float64(Float64(z + a) - Float64(y * Float64(b / Float64(Float64(t + x) + y)))) tmp = 0.0 if (t_3 <= -5e+99) tmp = t_4; elseif (t_3 <= -5e-178) tmp = Float64(fma(z, x, Float64(y * Float64(z - b))) / t_2); elseif (t_3 <= 5e+301) tmp = Float64(fma(Float64(y + x), z, t_1) / Float64(Float64(y + x) + t)); else tmp = t_4; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x + t), $MachinePrecision] + y), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + t$95$1), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[(z + a), $MachinePrecision] - N[(y * N[(b / N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, -5e+99], t$95$4, If[LessEqual[t$95$3, -5e-178], N[(N[(z * x + N[(y * N[(z - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], If[LessEqual[t$95$3, 5e+301], N[(N[(N[(y + x), $MachinePrecision] * z + t$95$1), $MachinePrecision] / N[(N[(y + x), $MachinePrecision] + t), $MachinePrecision]), $MachinePrecision], t$95$4]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(t + y\right) \cdot a\\
t_2 := \left(x + t\right) + y\\
t_3 := \frac{\left(\left(x + y\right) \cdot z + t\_1\right) - y \cdot b}{t\_2}\\
t_4 := \left(z + a\right) - y \cdot \frac{b}{\left(t + x\right) + y}\\
\mathbf{if}\;t\_3 \leq -5 \cdot 10^{+99}:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_3 \leq -5 \cdot 10^{-178}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, x, y \cdot \left(z - b\right)\right)}{t\_2}\\
\mathbf{elif}\;t\_3 \leq 5 \cdot 10^{+301}:\\
\;\;\;\;\frac{\mathsf{fma}\left(y + x, z, t\_1\right)}{\left(y + x\right) + t}\\
\mathbf{else}:\\
\;\;\;\;t\_4\\
\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)) < -5.00000000000000008e99 or 5.0000000000000004e301 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 21.9%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
associate-/l*N/A
cancel-sign-sub-invN/A
lower-+.f64N/A
Applied rewrites37.4%
Taylor expanded in y around inf
+-commutativeN/A
lower-+.f6485.0
Applied rewrites85.0%
if -5.00000000000000008e99 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -4.99999999999999976e-178Initial program 99.7%
Taylor expanded in a around 0
distribute-rgt-inN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f6482.8
Applied rewrites82.8%
if -4.99999999999999976e-178 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.0000000000000004e301Initial program 99.7%
Taylor expanded in b around 0
lower-/.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f6484.9
Applied rewrites84.9%
Final simplification84.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1))
(t_3 (- (+ z a) (* y (/ b (+ (+ t x) y))))))
(if (<= t_2 -5e+99)
t_3
(if (<= t_2 -5e-178)
(/ (fma z x (* y (- z b))) t_1)
(if (<= t_2 5e-49) (/ (fma a t (* z x)) (+ t x)) t_3)))))
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)) / t_1;
double t_3 = (z + a) - (y * (b / ((t + x) + y)));
double tmp;
if (t_2 <= -5e+99) {
tmp = t_3;
} else if (t_2 <= -5e-178) {
tmp = fma(z, x, (y * (z - b))) / t_1;
} else if (t_2 <= 5e-49) {
tmp = fma(a, t, (z * x)) / (t + x);
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) t_3 = Float64(Float64(z + a) - Float64(y * Float64(b / Float64(Float64(t + x) + y)))) tmp = 0.0 if (t_2 <= -5e+99) tmp = t_3; elseif (t_2 <= -5e-178) tmp = Float64(fma(z, x, Float64(y * Float64(z - b))) / t_1); elseif (t_2 <= 5e-49) tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); else tmp = t_3; end return 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[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(z + a), $MachinePrecision] - N[(y * N[(b / N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+99], t$95$3, If[LessEqual[t$95$2, -5e-178], N[(N[(z * x + N[(y * N[(z - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 5e-49], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
t_3 := \left(z + a\right) - y \cdot \frac{b}{\left(t + x\right) + y}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+99}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq -5 \cdot 10^{-178}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, x, y \cdot \left(z - b\right)\right)}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{-49}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -5.00000000000000008e99 or 4.9999999999999999e-49 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 42.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
associate-/l*N/A
cancel-sign-sub-invN/A
lower-+.f64N/A
Applied rewrites52.7%
Taylor expanded in y around inf
+-commutativeN/A
lower-+.f6478.5
Applied rewrites78.5%
if -5.00000000000000008e99 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -4.99999999999999976e-178Initial program 99.7%
Taylor expanded in a around 0
distribute-rgt-inN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f6482.8
Applied rewrites82.8%
if -4.99999999999999976e-178 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.9999999999999999e-49Initial program 99.9%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6481.8
Applied rewrites81.8%
Final simplification79.7%
(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_1)))
(if (<= t_2 -5e+99)
(- (+ z a) (* y (/ b (+ y t))))
(if (<= t_2 -2e+36)
(/ (* (- (+ a z) b) y) t_1)
(if (<= t_2 2e+157)
(/ (fma a t (* z x)) (+ t x))
(- (+ z a) (* y (/ b (+ x y)))))))))
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)) / t_1;
double tmp;
if (t_2 <= -5e+99) {
tmp = (z + a) - (y * (b / (y + t)));
} else if (t_2 <= -2e+36) {
tmp = (((a + z) - b) * y) / t_1;
} else if (t_2 <= 2e+157) {
tmp = fma(a, t, (z * x)) / (t + x);
} else {
tmp = (z + a) - (y * (b / (x + y)));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) tmp = 0.0 if (t_2 <= -5e+99) tmp = Float64(Float64(z + a) - Float64(y * Float64(b / Float64(y + t)))); elseif (t_2 <= -2e+36) tmp = Float64(Float64(Float64(Float64(a + z) - b) * y) / t_1); elseif (t_2 <= 2e+157) tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); else tmp = Float64(Float64(z + a) - Float64(y * Float64(b / Float64(x + y)))); end return 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[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+99], N[(N[(z + a), $MachinePrecision] - N[(y * N[(b / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, -2e+36], N[(N[(N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision] * y), $MachinePrecision] / t$95$1), $MachinePrecision], If[LessEqual[t$95$2, 2e+157], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], N[(N[(z + a), $MachinePrecision] - N[(y * N[(b / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+99}:\\
\;\;\;\;\left(z + a\right) - y \cdot \frac{b}{y + t}\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{+36}:\\
\;\;\;\;\frac{\left(\left(a + z\right) - b\right) \cdot y}{t\_1}\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+157}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\mathbf{else}:\\
\;\;\;\;\left(z + a\right) - y \cdot \frac{b}{x + y}\\
\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)) < -5.00000000000000008e99Initial program 38.2%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
associate-/l*N/A
cancel-sign-sub-invN/A
lower-+.f64N/A
Applied rewrites46.6%
Taylor expanded in y around inf
+-commutativeN/A
lower-+.f6482.6
Applied rewrites82.6%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f6478.2
Applied rewrites78.2%
if -5.00000000000000008e99 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -2.00000000000000008e36Initial program 99.6%
Taylor expanded in y around inf
*-commutativeN/A
lower-*.f64N/A
lower--.f64N/A
lower-+.f6492.2
Applied rewrites92.2%
if -2.00000000000000008e36 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.99999999999999997e157Initial program 99.7%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6465.4
Applied rewrites65.4%
if 1.99999999999999997e157 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 18.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
associate-/l*N/A
cancel-sign-sub-invN/A
lower-+.f64N/A
Applied rewrites36.9%
Taylor expanded in y around inf
+-commutativeN/A
lower-+.f6485.8
Applied rewrites85.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-+.f6480.6
Applied rewrites80.6%
Final simplification74.6%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (+ x t) y))
(t_2 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) t_1)))
(if (or (<= t_2 (- INFINITY)) (not (<= t_2 5e+301)))
(- (+ z a) (* y (/ b (+ (+ t x) y))))
(/ (fma (- (+ a z) b) y (fma a t (* z x))) 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 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / t_1;
double tmp;
if ((t_2 <= -((double) INFINITY)) || !(t_2 <= 5e+301)) {
tmp = (z + a) - (y * (b / ((t + x) + y)));
} else {
tmp = fma(((a + z) - b), y, fma(a, t, (z * x))) / t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(x + t) + y) t_2 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / t_1) tmp = 0.0 if ((t_2 <= Float64(-Inf)) || !(t_2 <= 5e+301)) tmp = Float64(Float64(z + a) - Float64(y * Float64(b / Float64(Float64(t + x) + y)))); else tmp = Float64(fma(Float64(Float64(a + z) - b), y, fma(a, t, Float64(z * x))) / t_1); end return 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[(N[(x + y), $MachinePrecision] * z), $MachinePrecision] + N[(N[(t + y), $MachinePrecision] * a), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, If[Or[LessEqual[t$95$2, (-Infinity)], N[Not[LessEqual[t$95$2, 5e+301]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - N[(y * N[(b / N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision] * y + N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x + t\right) + y\\
t_2 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{t\_1}\\
\mathbf{if}\;t\_2 \leq -\infty \lor \neg \left(t\_2 \leq 5 \cdot 10^{+301}\right):\\
\;\;\;\;\left(z + a\right) - y \cdot \frac{b}{\left(t + x\right) + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(\left(a + z\right) - b, y, \mathsf{fma}\left(a, t, z \cdot x\right)\right)}{t\_1}\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 5.0000000000000004e301 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 5.4%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
associate-/l*N/A
cancel-sign-sub-invN/A
lower-+.f64N/A
Applied rewrites24.9%
Taylor expanded in y around inf
+-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)) < 5.0000000000000004e301Initial program 99.6%
Taylor expanded in y around 0
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6499.7
Applied rewrites99.7%
Final simplification94.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y))))
(if (or (<= t_1 -2e-138) (not (<= t_1 5e-49)))
(- (+ z a) (* y (/ b (+ (+ t x) y))))
(/ (fma a t (* z x)) (+ t x)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double tmp;
if ((t_1 <= -2e-138) || !(t_1 <= 5e-49)) {
tmp = (z + a) - (y * (b / ((t + x) + y)));
} else {
tmp = fma(a, t, (z * x)) / (t + x);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) tmp = 0.0 if ((t_1 <= -2e-138) || !(t_1 <= 5e-49)) tmp = Float64(Float64(z + a) - Float64(y * Float64(b / Float64(Float64(t + x) + y)))); else tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[Or[LessEqual[t$95$1, -2e-138], N[Not[LessEqual[t$95$1, 5e-49]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - N[(y * N[(b / N[(N[(t + x), $MachinePrecision] + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{-138} \lor \neg \left(t\_1 \leq 5 \cdot 10^{-49}\right):\\
\;\;\;\;\left(z + a\right) - y \cdot \frac{b}{\left(t + x\right) + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\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)) < -2.00000000000000013e-138 or 4.9999999999999999e-49 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 53.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
associate-/l*N/A
cancel-sign-sub-invN/A
lower-+.f64N/A
Applied rewrites61.5%
Taylor expanded in y around inf
+-commutativeN/A
lower-+.f6476.5
Applied rewrites76.5%
if -2.00000000000000013e-138 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.9999999999999999e-49Initial program 100.0%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6478.6
Applied rewrites78.6%
Final simplification76.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y))))
(if (or (<= t_1 -4e+51) (not (<= t_1 2e+157)))
(- (+ z a) (* y (/ b (+ x y))))
(/ (fma a t (* z x)) (+ t x)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double tmp;
if ((t_1 <= -4e+51) || !(t_1 <= 2e+157)) {
tmp = (z + a) - (y * (b / (x + y)));
} else {
tmp = fma(a, t, (z * x)) / (t + x);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) tmp = 0.0 if ((t_1 <= -4e+51) || !(t_1 <= 2e+157)) tmp = Float64(Float64(z + a) - Float64(y * Float64(b / Float64(x + y)))); else tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[Or[LessEqual[t$95$1, -4e+51], N[Not[LessEqual[t$95$1, 2e+157]], $MachinePrecision]], N[(N[(z + a), $MachinePrecision] - N[(y * N[(b / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
\mathbf{if}\;t\_1 \leq -4 \cdot 10^{+51} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+157}\right):\\
\;\;\;\;\left(z + a\right) - y \cdot \frac{b}{x + y}\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\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)) < -4e51 or 1.99999999999999997e157 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 32.2%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
associate-/l*N/A
cancel-sign-sub-invN/A
lower-+.f64N/A
Applied rewrites45.0%
Taylor expanded in y around inf
+-commutativeN/A
lower-+.f6483.3
Applied rewrites83.3%
Taylor expanded in t around 0
lower-/.f64N/A
lower-+.f6477.6
Applied rewrites77.6%
if -4e51 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.99999999999999997e157Initial program 99.7%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6464.0
Applied rewrites64.0%
Final simplification72.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y))))
(if (or (<= t_1 -5e+47) (not (<= t_1 2e+157)))
(- (+ a z) b)
(/ (fma a t (* z x)) (+ t x)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double tmp;
if ((t_1 <= -5e+47) || !(t_1 <= 2e+157)) {
tmp = (a + z) - b;
} else {
tmp = fma(a, t, (z * x)) / (t + x);
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) tmp = 0.0 if ((t_1 <= -5e+47) || !(t_1 <= 2e+157)) tmp = Float64(Float64(a + z) - b); else tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[Or[LessEqual[t$95$1, -5e+47], N[Not[LessEqual[t$95$1, 2e+157]], $MachinePrecision]], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
\mathbf{if}\;t\_1 \leq -5 \cdot 10^{+47} \lor \neg \left(t\_1 \leq 2 \cdot 10^{+157}\right):\\
\;\;\;\;\left(a + z\right) - b\\
\mathbf{else}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\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)) < -5.00000000000000022e47 or 1.99999999999999997e157 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 32.6%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6470.3
Applied rewrites70.3%
if -5.00000000000000022e47 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.99999999999999997e157Initial program 99.7%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6464.6
Applied rewrites64.6%
Final simplification68.0%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* (+ x y) z) (* (+ t y) a)) (* y b)) (+ (+ x t) y))))
(if (<= t_1 -2e+36)
(- (+ z a) (* y (/ b (+ y t))))
(if (<= t_1 2e+157)
(/ (fma a t (* z x)) (+ t x))
(- (+ z a) (* y (/ b (+ x y))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = ((((x + y) * z) + ((t + y) * a)) - (y * b)) / ((x + t) + y);
double tmp;
if (t_1 <= -2e+36) {
tmp = (z + a) - (y * (b / (y + t)));
} else if (t_1 <= 2e+157) {
tmp = fma(a, t, (z * x)) / (t + x);
} else {
tmp = (z + a) - (y * (b / (x + y)));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(Float64(x + y) * z) + Float64(Float64(t + y) * a)) - Float64(y * b)) / Float64(Float64(x + t) + y)) tmp = 0.0 if (t_1 <= -2e+36) tmp = Float64(Float64(z + a) - Float64(y * Float64(b / Float64(y + t)))); elseif (t_1 <= 2e+157) tmp = Float64(fma(a, t, Float64(z * x)) / Float64(t + x)); else tmp = Float64(Float64(z + a) - Float64(y * Float64(b / Float64(x + y)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = 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]}, If[LessEqual[t$95$1, -2e+36], N[(N[(z + a), $MachinePrecision] - N[(y * N[(b / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+157], N[(N[(a * t + N[(z * x), $MachinePrecision]), $MachinePrecision] / N[(t + x), $MachinePrecision]), $MachinePrecision], N[(N[(z + a), $MachinePrecision] - N[(y * N[(b / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(\left(x + y\right) \cdot z + \left(t + y\right) \cdot a\right) - y \cdot b}{\left(x + t\right) + y}\\
\mathbf{if}\;t\_1 \leq -2 \cdot 10^{+36}:\\
\;\;\;\;\left(z + a\right) - y \cdot \frac{b}{y + t}\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+157}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, z \cdot x\right)}{t + x}\\
\mathbf{else}:\\
\;\;\;\;\left(z + a\right) - y \cdot \frac{b}{x + y}\\
\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)) < -2.00000000000000008e36Initial program 48.1%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
associate-/l*N/A
cancel-sign-sub-invN/A
lower-+.f64N/A
Applied rewrites55.1%
Taylor expanded in y around inf
+-commutativeN/A
lower-+.f6479.5
Applied rewrites79.5%
Taylor expanded in x around 0
lower-/.f64N/A
+-commutativeN/A
lower-+.f6473.5
Applied rewrites73.5%
if -2.00000000000000008e36 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.99999999999999997e157Initial program 99.7%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6465.4
Applied rewrites65.4%
if 1.99999999999999997e157 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 18.5%
lift-/.f64N/A
lift--.f64N/A
div-subN/A
lift-*.f64N/A
associate-/l*N/A
cancel-sign-sub-invN/A
lower-+.f64N/A
Applied rewrites36.9%
Taylor expanded in y around inf
+-commutativeN/A
lower-+.f6485.8
Applied rewrites85.8%
Taylor expanded in t around 0
lower-/.f64N/A
lower-+.f6480.6
Applied rewrites80.6%
Final simplification72.4%
(FPCore (x y z t a b) :precision binary64 (if (or (<= x -1.3e+20) (not (<= x 1.25e+183))) (fma (/ (- b) x) y z) (- (+ a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -1.3e+20) || !(x <= 1.25e+183)) {
tmp = fma((-b / x), y, z);
} else {
tmp = (a + z) - b;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if ((x <= -1.3e+20) || !(x <= 1.25e+183)) tmp = fma(Float64(Float64(-b) / x), y, z); else tmp = Float64(Float64(a + z) - b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[x, -1.3e+20], N[Not[LessEqual[x, 1.25e+183]], $MachinePrecision]], N[(N[((-b) / x), $MachinePrecision] * y + z), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{+20} \lor \neg \left(x \leq 1.25 \cdot 10^{+183}\right):\\
\;\;\;\;\mathsf{fma}\left(\frac{-b}{x}, y, z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\
\end{array}
\end{array}
if x < -1.3e20 or 1.25000000000000002e183 < x Initial program 61.1%
Taylor expanded in t around 0
lower-/.f64N/A
associate--l+N/A
lower-fma.f64N/A
distribute-rgt-inN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6447.1
Applied rewrites47.1%
Taylor expanded in y around 0
Applied rewrites63.4%
Taylor expanded in a around 0
Applied rewrites61.9%
if -1.3e20 < x < 1.25000000000000002e183Initial program 59.3%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6464.9
Applied rewrites64.9%
Final simplification63.9%
(FPCore (x y z t a b) :precision binary64 (if (or (<= x -1.3e+20) (not (<= x 1.25e+183))) (- z (/ (* b y) x)) (- (+ a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -1.3e+20) || !(x <= 1.25e+183)) {
tmp = z - ((b * y) / x);
} else {
tmp = (a + z) - b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((x <= (-1.3d+20)) .or. (.not. (x <= 1.25d+183))) then
tmp = z - ((b * y) / x)
else
tmp = (a + z) - b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -1.3e+20) || !(x <= 1.25e+183)) {
tmp = z - ((b * y) / x);
} else {
tmp = (a + z) - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x <= -1.3e+20) or not (x <= 1.25e+183): tmp = z - ((b * y) / x) else: tmp = (a + z) - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((x <= -1.3e+20) || !(x <= 1.25e+183)) tmp = Float64(z - Float64(Float64(b * y) / x)); else tmp = Float64(Float64(a + z) - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x <= -1.3e+20) || ~((x <= 1.25e+183))) tmp = z - ((b * y) / x); else tmp = (a + z) - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[x, -1.3e+20], N[Not[LessEqual[x, 1.25e+183]], $MachinePrecision]], N[(z - N[(N[(b * y), $MachinePrecision] / x), $MachinePrecision]), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{+20} \lor \neg \left(x \leq 1.25 \cdot 10^{+183}\right):\\
\;\;\;\;z - \frac{b \cdot y}{x}\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\
\end{array}
\end{array}
if x < -1.3e20 or 1.25000000000000002e183 < x Initial program 61.1%
Taylor expanded in t around 0
lower-/.f64N/A
associate--l+N/A
lower-fma.f64N/A
distribute-rgt-inN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6447.1
Applied rewrites47.1%
Taylor expanded in y around 0
Applied rewrites63.4%
Taylor expanded in a around 0
Applied rewrites58.5%
if -1.3e20 < x < 1.25000000000000002e183Initial program 59.3%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6464.9
Applied rewrites64.9%
Final simplification62.7%
(FPCore (x y z t a b) :precision binary64 (if (<= x -1.3e+20) (fma a (/ y x) z) (- (+ a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.3e+20) {
tmp = fma(a, (y / x), z);
} else {
tmp = (a + z) - b;
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -1.3e+20) tmp = fma(a, Float64(y / x), z); else tmp = Float64(Float64(a + z) - b); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.3e+20], N[(a * N[(y / x), $MachinePrecision] + z), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{+20}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{x}, z\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\
\end{array}
\end{array}
if x < -1.3e20Initial program 65.9%
Taylor expanded in t around 0
lower-/.f64N/A
associate--l+N/A
lower-fma.f64N/A
distribute-rgt-inN/A
associate--l+N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
distribute-lft-out--N/A
lower-*.f64N/A
lower--.f64N/A
+-commutativeN/A
lower-+.f6448.8
Applied rewrites48.8%
Taylor expanded in y around 0
Applied rewrites60.3%
Taylor expanded in b around 0
Applied rewrites51.6%
if -1.3e20 < x Initial program 57.8%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6462.6
Applied rewrites62.6%
(FPCore (x y z t a b) :precision binary64 (if (or (<= a -2.15e+101) (not (<= a 6.5e+65))) (- a b) (- z b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -2.15e+101) || !(a <= 6.5e+65)) {
tmp = a - b;
} else {
tmp = z - b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-2.15d+101)) .or. (.not. (a <= 6.5d+65))) then
tmp = a - b
else
tmp = z - b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -2.15e+101) || !(a <= 6.5e+65)) {
tmp = a - b;
} else {
tmp = z - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a <= -2.15e+101) or not (a <= 6.5e+65): tmp = a - b else: tmp = z - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -2.15e+101) || !(a <= 6.5e+65)) tmp = Float64(a - b); else tmp = Float64(z - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a <= -2.15e+101) || ~((a <= 6.5e+65))) tmp = a - b; else tmp = z - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -2.15e+101], N[Not[LessEqual[a, 6.5e+65]], $MachinePrecision]], N[(a - b), $MachinePrecision], N[(z - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.15 \cdot 10^{+101} \lor \neg \left(a \leq 6.5 \cdot 10^{+65}\right):\\
\;\;\;\;a - b\\
\mathbf{else}:\\
\;\;\;\;z - b\\
\end{array}
\end{array}
if a < -2.15e101 or 6.5000000000000003e65 < a Initial program 49.5%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6461.9
Applied rewrites61.9%
Taylor expanded in z around 0
Applied rewrites63.7%
if -2.15e101 < a < 6.5000000000000003e65Initial program 65.4%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6452.0
Applied rewrites52.0%
Taylor expanded in a around 0
Applied rewrites51.3%
Final simplification55.6%
(FPCore (x y z t a b) :precision binary64 (if (<= x -1.3e+20) (- z b) (- (+ a z) b)))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.3e+20) {
tmp = z - b;
} else {
tmp = (a + z) - b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (x <= (-1.3d+20)) then
tmp = z - b
else
tmp = (a + z) - b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.3e+20) {
tmp = z - b;
} else {
tmp = (a + z) - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -1.3e+20: tmp = z - b else: tmp = (a + z) - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -1.3e+20) tmp = Float64(z - b); else tmp = Float64(Float64(a + z) - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -1.3e+20) tmp = z - b; else tmp = (a + z) - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.3e+20], N[(z - b), $MachinePrecision], N[(N[(a + z), $MachinePrecision] - b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.3 \cdot 10^{+20}:\\
\;\;\;\;z - b\\
\mathbf{else}:\\
\;\;\;\;\left(a + z\right) - b\\
\end{array}
\end{array}
if x < -1.3e20Initial program 65.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6435.3
Applied rewrites35.3%
Taylor expanded in a around 0
Applied rewrites41.7%
if -1.3e20 < x Initial program 57.8%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6462.6
Applied rewrites62.6%
(FPCore (x y z t a b) :precision binary64 (- a b))
double code(double x, double y, double z, double t, double a, double b) {
return a - 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 = a - b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a - b;
}
def code(x, y, z, t, a, b): return a - b
function code(x, y, z, t, a, b) return Float64(a - b) end
function tmp = code(x, y, z, t, a, b) tmp = a - b; end
code[x_, y_, z_, t_, a_, b_] := N[(a - b), $MachinePrecision]
\begin{array}{l}
\\
a - b
\end{array}
Initial program 59.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.5
Applied rewrites55.5%
Taylor expanded in z around 0
Applied rewrites37.4%
(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 59.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.5
Applied rewrites55.5%
Taylor expanded in b around inf
Applied rewrites17.4%
(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 2024296
(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)))