
(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 (+ y t)))
(t_2 (+ t (+ x y)))
(t_3 (* (+ y t) (+ y t)))
(t_4 (/ (- (+ (* z (+ x y)) (* (+ y t) a)) (* y b)) (+ y (+ x t))))
(t_5 (* (+ x y) (+ x y))))
(if (<= t_4 (- INFINITY))
(-
(fma
x
(- (fma y (/ b t_3) t_1) (fma y (/ z t_3) (/ a (+ y t))))
(fma y t_1 a))
(* y (/ b (+ y t))))
(if (<= t_4 2e+307)
(fma z (+ (/ x t_2) (/ y t_2)) (/ (fma a (+ y t) (* y (- b))) t_2))
(-
(fma
t
(- (fma y (/ b t_5) (/ a (+ x y))) (fma a (/ y t_5) (/ z (+ x y))))
(fma a (/ y (+ x y)) z))
(* y (/ b (+ x y))))))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = z / (y + t);
double t_2 = t + (x + y);
double t_3 = (y + t) * (y + t);
double t_4 = (((z * (x + y)) + ((y + t) * a)) - (y * b)) / (y + (x + t));
double t_5 = (x + y) * (x + y);
double tmp;
if (t_4 <= -((double) INFINITY)) {
tmp = fma(x, (fma(y, (b / t_3), t_1) - fma(y, (z / t_3), (a / (y + t)))), fma(y, t_1, a)) - (y * (b / (y + t)));
} else if (t_4 <= 2e+307) {
tmp = fma(z, ((x / t_2) + (y / t_2)), (fma(a, (y + t), (y * -b)) / t_2));
} else {
tmp = fma(t, (fma(y, (b / t_5), (a / (x + y))) - fma(a, (y / t_5), (z / (x + y)))), fma(a, (y / (x + y)), z)) - (y * (b / (x + y)));
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(z / Float64(y + t)) t_2 = Float64(t + Float64(x + y)) t_3 = Float64(Float64(y + t) * Float64(y + t)) t_4 = Float64(Float64(Float64(Float64(z * Float64(x + y)) + Float64(Float64(y + t) * a)) - Float64(y * b)) / Float64(y + Float64(x + t))) t_5 = Float64(Float64(x + y) * Float64(x + y)) tmp = 0.0 if (t_4 <= Float64(-Inf)) tmp = Float64(fma(x, Float64(fma(y, Float64(b / t_3), t_1) - fma(y, Float64(z / t_3), Float64(a / Float64(y + t)))), fma(y, t_1, a)) - Float64(y * Float64(b / Float64(y + t)))); elseif (t_4 <= 2e+307) tmp = fma(z, Float64(Float64(x / t_2) + Float64(y / t_2)), Float64(fma(a, Float64(y + t), Float64(y * Float64(-b))) / t_2)); else tmp = Float64(fma(t, Float64(fma(y, Float64(b / t_5), Float64(a / Float64(x + y))) - fma(a, Float64(y / t_5), Float64(z / Float64(x + y)))), fma(a, Float64(y / Float64(x + y)), z)) - Float64(y * Float64(b / Float64(x + y)))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(y + t), $MachinePrecision] * N[(y + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = 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$5 = N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$4, (-Infinity)], N[(N[(x * N[(N[(y * N[(b / t$95$3), $MachinePrecision] + t$95$1), $MachinePrecision] - N[(y * N[(z / t$95$3), $MachinePrecision] + N[(a / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * t$95$1 + a), $MachinePrecision]), $MachinePrecision] - N[(y * N[(b / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$4, 2e+307], N[(z * N[(N[(x / t$95$2), $MachinePrecision] + N[(y / t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(a * N[(y + t), $MachinePrecision] + N[(y * (-b)), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], N[(N[(t * N[(N[(y * N[(b / t$95$5), $MachinePrecision] + N[(a / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * N[(y / t$95$5), $MachinePrecision] + N[(z / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision] - N[(y * N[(b / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{z}{y + t}\\
t_2 := t + \left(x + y\right)\\
t_3 := \left(y + t\right) \cdot \left(y + t\right)\\
t_4 := \frac{\left(z \cdot \left(x + y\right) + \left(y + t\right) \cdot a\right) - y \cdot b}{y + \left(x + t\right)}\\
t_5 := \left(x + y\right) \cdot \left(x + y\right)\\
\mathbf{if}\;t\_4 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(x, \mathsf{fma}\left(y, \frac{b}{t\_3}, t\_1\right) - \mathsf{fma}\left(y, \frac{z}{t\_3}, \frac{a}{y + t}\right), \mathsf{fma}\left(y, t\_1, a\right)\right) - y \cdot \frac{b}{y + t}\\
\mathbf{elif}\;t\_4 \leq 2 \cdot 10^{+307}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{x}{t\_2} + \frac{y}{t\_2}, \frac{\mathsf{fma}\left(a, y + t, y \cdot \left(-b\right)\right)}{t\_2}\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(t, \mathsf{fma}\left(y, \frac{b}{t\_5}, \frac{a}{x + y}\right) - \mathsf{fma}\left(a, \frac{y}{t\_5}, \frac{z}{x + y}\right), \mathsf{fma}\left(a, \frac{y}{x + y}, z\right)\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)) < -inf.0Initial program 5.7%
Taylor expanded in x around 0
lower--.f64N/A
Applied rewrites83.8%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.99999999999999997e307Initial program 97.9%
Taylor expanded in z around 0
associate--l+N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
div-subN/A
lower-/.f64N/A
Applied rewrites98.0%
if 1.99999999999999997e307 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 4.3%
Taylor expanded in t around 0
lower--.f64N/A
Applied rewrites79.6%
Final simplification91.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 (+ t (+ x y)))
(t_3 (* (+ x y) (+ x y)))
(t_4
(-
(fma
t
(- (fma y (/ b t_3) (/ a (+ x y))) (fma a (/ y t_3) (/ z (+ x y))))
(fma a (/ y (+ x y)) z))
(* y (/ b (+ x y))))))
(if (<= t_1 (- INFINITY))
t_4
(if (<= t_1 2e+307)
(fma z (+ (/ x t_2) (/ y t_2)) (/ (fma a (+ y t) (* y (- b))) t_2))
t_4))))
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 = (x + y) * (x + y);
double t_4 = fma(t, (fma(y, (b / t_3), (a / (x + y))) - fma(a, (y / t_3), (z / (x + y)))), fma(a, (y / (x + y)), z)) - (y * (b / (x + y)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = t_4;
} else if (t_1 <= 2e+307) {
tmp = fma(z, ((x / t_2) + (y / t_2)), (fma(a, (y + t), (y * -b)) / t_2));
} else {
tmp = t_4;
}
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(Float64(x + y) * Float64(x + y)) t_4 = Float64(fma(t, Float64(fma(y, Float64(b / t_3), Float64(a / Float64(x + y))) - fma(a, Float64(y / t_3), Float64(z / Float64(x + y)))), fma(a, Float64(y / Float64(x + y)), z)) - Float64(y * Float64(b / Float64(x + y)))) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = t_4; elseif (t_1 <= 2e+307) tmp = fma(z, Float64(Float64(x / t_2) + Float64(y / t_2)), Float64(fma(a, Float64(y + t), Float64(y * Float64(-b))) / t_2)); else tmp = t_4; 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[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(N[(t * N[(N[(y * N[(b / t$95$3), $MachinePrecision] + N[(a / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * N[(y / t$95$3), $MachinePrecision] + N[(z / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision]), $MachinePrecision] - N[(y * N[(b / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], t$95$4, If[LessEqual[t$95$1, 2e+307], N[(z * N[(N[(x / t$95$2), $MachinePrecision] + N[(y / t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(a * N[(y + t), $MachinePrecision] + N[(y * (-b)), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], t$95$4]]]]]]
\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 := \left(x + y\right) \cdot \left(x + y\right)\\
t_4 := \mathsf{fma}\left(t, \mathsf{fma}\left(y, \frac{b}{t\_3}, \frac{a}{x + y}\right) - \mathsf{fma}\left(a, \frac{y}{t\_3}, \frac{z}{x + y}\right), \mathsf{fma}\left(a, \frac{y}{x + y}, z\right)\right) - y \cdot \frac{b}{x + y}\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;t\_4\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+307}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{x}{t\_2} + \frac{y}{t\_2}, \frac{\mathsf{fma}\left(a, y + t, y \cdot \left(-b\right)\right)}{t\_2}\right)\\
\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)) < -inf.0 or 1.99999999999999997e307 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 4.9%
Taylor expanded in t around 0
lower--.f64N/A
Applied rewrites81.4%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.99999999999999997e307Initial program 97.9%
Taylor expanded in z around 0
associate--l+N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
div-subN/A
lower-/.f64N/A
Applied rewrites98.0%
Final simplification91.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 (+ t (+ x y))))
(if (<= t_1 (- INFINITY))
(fma (+ y t) (/ a t_2) (- z b))
(if (<= t_1 2e+194)
(fma z (+ (/ x t_2) (/ y t_2)) (/ (fma a (+ y t) (* y (- b))) t_2))
(+ a (fma y (/ z (+ y t)) (- (* b (/ y (+ y t))))))))))
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 tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = fma((y + t), (a / t_2), (z - b));
} else if (t_1 <= 2e+194) {
tmp = fma(z, ((x / t_2) + (y / t_2)), (fma(a, (y + t), (y * -b)) / t_2));
} else {
tmp = a + fma(y, (z / (y + t)), -(b * (y / (y + t))));
}
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)) tmp = 0.0 if (t_1 <= Float64(-Inf)) tmp = fma(Float64(y + t), Float64(a / t_2), Float64(z - b)); elseif (t_1 <= 2e+194) tmp = fma(z, Float64(Float64(x / t_2) + Float64(y / t_2)), Float64(fma(a, Float64(y + t), Float64(y * Float64(-b))) / t_2)); else tmp = Float64(a + fma(y, Float64(z / Float64(y + t)), Float64(-Float64(b * Float64(y / Float64(y + t)))))); 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]}, If[LessEqual[t$95$1, (-Infinity)], N[(N[(y + t), $MachinePrecision] * N[(a / t$95$2), $MachinePrecision] + N[(z - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e+194], N[(z * N[(N[(x / t$95$2), $MachinePrecision] + N[(y / t$95$2), $MachinePrecision]), $MachinePrecision] + N[(N[(a * N[(y + t), $MachinePrecision] + N[(y * (-b)), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]), $MachinePrecision], N[(a + N[(y * N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision] + (-N[(b * N[(y / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $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)\\
\mathbf{if}\;t\_1 \leq -\infty:\\
\;\;\;\;\mathsf{fma}\left(y + t, \frac{a}{t\_2}, z - b\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+194}:\\
\;\;\;\;\mathsf{fma}\left(z, \frac{x}{t\_2} + \frac{y}{t\_2}, \frac{\mathsf{fma}\left(a, y + t, y \cdot \left(-b\right)\right)}{t\_2}\right)\\
\mathbf{else}:\\
\;\;\;\;a + \mathsf{fma}\left(y, \frac{z}{y + t}, -b \cdot \frac{y}{y + t}\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 5.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 rewrites36.0%
Taylor expanded in y around inf
Applied rewrites81.9%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.99999999999999989e194Initial program 97.9%
Taylor expanded in z around 0
associate--l+N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
div-subN/A
lower-/.f64N/A
Applied rewrites97.9%
if 1.99999999999999989e194 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 13.8%
Taylor expanded in z around 0
associate--l+N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
div-subN/A
lower-/.f64N/A
Applied rewrites36.0%
Taylor expanded in b around inf
Applied rewrites59.6%
Taylor expanded in x around 0
Applied rewrites80.5%
Final simplification91.2%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* z (+ x y)) (* (+ y t) a)) (* y b)) (+ y (+ x t)))))
(if (<= t_1 -1e+291)
(fma (+ y t) (/ a (+ t (+ x y))) (- z b))
(if (<= t_1 2e+194)
t_1
(+ a (fma y (/ z (+ y t)) (- (* b (/ y (+ y t))))))))))
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 tmp;
if (t_1 <= -1e+291) {
tmp = fma((y + t), (a / (t + (x + y))), (z - b));
} else if (t_1 <= 2e+194) {
tmp = t_1;
} else {
tmp = a + fma(y, (z / (y + t)), -(b * (y / (y + t))));
}
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))) tmp = 0.0 if (t_1 <= -1e+291) tmp = fma(Float64(y + t), Float64(a / Float64(t + Float64(x + y))), Float64(z - b)); elseif (t_1 <= 2e+194) tmp = t_1; else tmp = Float64(a + fma(y, Float64(z / Float64(y + t)), Float64(-Float64(b * Float64(y / Float64(y + t)))))); 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]}, If[LessEqual[t$95$1, -1e+291], 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, 2e+194], t$95$1, N[(a + N[(y * N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision] + (-N[(b * N[(y / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $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)}\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+291}:\\
\;\;\;\;\mathsf{fma}\left(y + t, \frac{a}{t + \left(x + y\right)}, z - b\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{+194}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;a + \mathsf{fma}\left(y, \frac{z}{y + t}, -b \cdot \frac{y}{y + t}\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)) < -9.9999999999999996e290Initial program 9.8%
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.8%
Taylor expanded in y around inf
Applied rewrites82.7%
if -9.9999999999999996e290 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.99999999999999989e194Initial program 97.8%
if 1.99999999999999989e194 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 13.8%
Taylor expanded in z around 0
associate--l+N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
div-subN/A
lower-/.f64N/A
Applied rewrites36.0%
Taylor expanded in b around inf
Applied rewrites59.6%
Taylor expanded in x around 0
Applied rewrites80.5%
Final simplification91.1%
(FPCore (x y z t a b)
:precision binary64
(if (<= y -1.6e-66)
(fma (+ y t) (/ a (+ t (+ x y))) (- z b))
(if (<= y 7.5e-138)
(fma a (/ t (+ x t)) (* x (/ z (+ x t))))
(+ a (fma y (/ z (+ y t)) (- (* b (/ y (+ y t)))))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.6e-66) {
tmp = fma((y + t), (a / (t + (x + y))), (z - b));
} else if (y <= 7.5e-138) {
tmp = fma(a, (t / (x + t)), (x * (z / (x + t))));
} else {
tmp = a + fma(y, (z / (y + t)), -(b * (y / (y + t))));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.6e-66) tmp = fma(Float64(y + t), Float64(a / Float64(t + Float64(x + y))), Float64(z - b)); elseif (y <= 7.5e-138) tmp = fma(a, Float64(t / Float64(x + t)), Float64(x * Float64(z / Float64(x + t)))); else tmp = Float64(a + fma(y, Float64(z / Float64(y + t)), Float64(-Float64(b * Float64(y / Float64(y + t)))))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.6e-66], N[(N[(y + t), $MachinePrecision] * N[(a / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 7.5e-138], N[(a * N[(t / N[(x + t), $MachinePrecision]), $MachinePrecision] + N[(x * N[(z / N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a + N[(y * N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision] + (-N[(b * N[(y / N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{-66}:\\
\;\;\;\;\mathsf{fma}\left(y + t, \frac{a}{t + \left(x + y\right)}, z - b\right)\\
\mathbf{elif}\;y \leq 7.5 \cdot 10^{-138}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{t}{x + t}, x \cdot \frac{z}{x + t}\right)\\
\mathbf{else}:\\
\;\;\;\;a + \mathsf{fma}\left(y, \frac{z}{y + t}, -b \cdot \frac{y}{y + t}\right)\\
\end{array}
\end{array}
if y < -1.59999999999999991e-66Initial program 50.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 rewrites58.9%
Taylor expanded in y around inf
Applied rewrites83.1%
if -1.59999999999999991e-66 < y < 7.4999999999999995e-138Initial program 79.4%
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 rewrites80.4%
Taylor expanded in y around 0
Applied rewrites71.0%
if 7.4999999999999995e-138 < y Initial program 58.5%
Taylor expanded in z around 0
associate--l+N/A
lower-fma.f64N/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
lower-/.f64N/A
lower-+.f64N/A
+-commutativeN/A
lower-+.f64N/A
div-subN/A
lower-/.f64N/A
Applied rewrites67.7%
Taylor expanded in b around inf
Applied rewrites77.9%
Taylor expanded in x around 0
Applied rewrites79.4%
Final simplification77.8%
(FPCore (x y z t a b)
:precision binary64
(if (<= y -1.6e-66)
(fma (+ y t) (/ a (+ t (+ x y))) (- z b))
(if (<= y 2.9e-130)
(fma a (/ t (+ x t)) (* x (/ z (+ x t))))
(if (<= y 4.5e-6) (+ a (- z b)) (fma y (/ (- z b) (+ y t)) a)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -1.6e-66) {
tmp = fma((y + t), (a / (t + (x + y))), (z - b));
} else if (y <= 2.9e-130) {
tmp = fma(a, (t / (x + t)), (x * (z / (x + t))));
} else if (y <= 4.5e-6) {
tmp = a + (z - b);
} else {
tmp = fma(y, ((z - b) / (y + t)), a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -1.6e-66) tmp = fma(Float64(y + t), Float64(a / Float64(t + Float64(x + y))), Float64(z - b)); elseif (y <= 2.9e-130) tmp = fma(a, Float64(t / Float64(x + t)), Float64(x * Float64(z / Float64(x + t)))); elseif (y <= 4.5e-6) tmp = Float64(a + Float64(z - b)); else tmp = fma(y, Float64(Float64(z - b) / Float64(y + t)), a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -1.6e-66], N[(N[(y + t), $MachinePrecision] * N[(a / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(z - b), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 2.9e-130], N[(a * N[(t / N[(x + t), $MachinePrecision]), $MachinePrecision] + N[(x * N[(z / N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 4.5e-6], N[(a + N[(z - b), $MachinePrecision]), $MachinePrecision], N[(y * N[(N[(z - b), $MachinePrecision] / N[(y + t), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.6 \cdot 10^{-66}:\\
\;\;\;\;\mathsf{fma}\left(y + t, \frac{a}{t + \left(x + y\right)}, z - b\right)\\
\mathbf{elif}\;y \leq 2.9 \cdot 10^{-130}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{t}{x + t}, x \cdot \frac{z}{x + t}\right)\\
\mathbf{elif}\;y \leq 4.5 \cdot 10^{-6}:\\
\;\;\;\;a + \left(z - b\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - b}{y + t}, a\right)\\
\end{array}
\end{array}
if y < -1.59999999999999991e-66Initial program 50.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 rewrites58.9%
Taylor expanded in y around inf
Applied rewrites83.1%
if -1.59999999999999991e-66 < y < 2.9e-130Initial program 79.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 rewrites79.5%
Taylor expanded in y around 0
Applied rewrites71.3%
if 2.9e-130 < y < 4.50000000000000011e-6Initial program 82.0%
Taylor expanded in y around inf
associate--l+N/A
lower-+.f64N/A
lower--.f6472.0
Applied rewrites72.0%
if 4.50000000000000011e-6 < y Initial program 50.3%
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 rewrites62.2%
Taylor expanded in x around 0
Applied rewrites83.2%
Final simplification78.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (fma y (/ (- z b) (+ y t)) a)))
(if (<= t -2.65e-30)
t_1
(if (<= t 1.5e+31) (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 <= -2.65e-30) {
tmp = t_1;
} else if (t <= 1.5e+31) {
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 <= -2.65e-30) tmp = t_1; elseif (t <= 1.5e+31) 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, -2.65e-30], t$95$1, If[LessEqual[t, 1.5e+31], 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 -2.65 \cdot 10^{-30}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.5 \cdot 10^{+31}:\\
\;\;\;\;\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 < -2.64999999999999987e-30 or 1.49999999999999995e31 < t Initial program 58.3%
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 rewrites69.5%
Taylor expanded in x around 0
Applied rewrites74.1%
if -2.64999999999999987e-30 < t < 1.49999999999999995e31Initial program 66.3%
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 rewrites69.0%
Taylor expanded in y around inf
Applied rewrites76.6%
Final simplification75.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (- a) (/ (- (- y) t) (+ t (+ x y))))))
(if (<= a -2.7e+198)
t_1
(if (<= a 9.6e+144) (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 = -a * ((-y - t) / (t + (x + y)));
double tmp;
if (a <= -2.7e+198) {
tmp = t_1;
} else if (a <= 9.6e+144) {
tmp = fma(y, ((z - b) / (y + t)), a);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(-a) * Float64(Float64(Float64(-y) - t) / Float64(t + Float64(x + y)))) tmp = 0.0 if (a <= -2.7e+198) tmp = t_1; elseif (a <= 9.6e+144) 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[(N[((-y) - t), $MachinePrecision] / N[(t + N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -2.7e+198], t$95$1, If[LessEqual[a, 9.6e+144], 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 := \left(-a\right) \cdot \frac{\left(-y\right) - t}{t + \left(x + y\right)}\\
\mathbf{if}\;a \leq -2.7 \cdot 10^{+198}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;a \leq 9.6 \cdot 10^{+144}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - b}{y + t}, a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if a < -2.6999999999999999e198 or 9.6000000000000002e144 < a Initial program 51.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 rewrites72.6%
Taylor expanded in a around inf
Applied rewrites78.6%
if -2.6999999999999999e198 < a < 9.6000000000000002e144Initial program 65.4%
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 rewrites69.5%
Taylor expanded in x around 0
Applied rewrites70.4%
Final simplification72.0%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (fma y (/ (- z b) (+ y t)) a))) (if (<= t -7.4e-62) t_1 (if (<= t 3.2e-32) (+ a (- 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 <= -7.4e-62) {
tmp = t_1;
} else if (t <= 3.2e-32) {
tmp = a + (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 <= -7.4e-62) tmp = t_1; elseif (t <= 3.2e-32) tmp = Float64(a + 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, -7.4e-62], t$95$1, If[LessEqual[t, 3.2e-32], N[(a + 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 -7.4 \cdot 10^{-62}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 3.2 \cdot 10^{-32}:\\
\;\;\;\;a + \left(z - b\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -7.3999999999999996e-62 or 3.2000000000000002e-32 < t Initial program 57.9%
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 rewrites69.7%
Taylor expanded in x around 0
Applied rewrites71.6%
if -7.3999999999999996e-62 < t < 3.2000000000000002e-32Initial program 67.8%
Taylor expanded in y around inf
associate--l+N/A
lower-+.f64N/A
lower--.f6468.9
Applied rewrites68.9%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (+ a (- z b)))) (if (<= y -1.4e-13) t_1 (if (<= y 3.45e-130) (+ z a) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a + (z - b);
double tmp;
if (y <= -1.4e-13) {
tmp = t_1;
} else if (y <= 3.45e-130) {
tmp = z + a;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = a + (z - b)
if (y <= (-1.4d-13)) then
tmp = t_1
else if (y <= 3.45d-130) then
tmp = z + a
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a + (z - b);
double tmp;
if (y <= -1.4e-13) {
tmp = t_1;
} else if (y <= 3.45e-130) {
tmp = z + a;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a + (z - b) tmp = 0 if y <= -1.4e-13: tmp = t_1 elif y <= 3.45e-130: tmp = z + a else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a + Float64(z - b)) tmp = 0.0 if (y <= -1.4e-13) tmp = t_1; elseif (y <= 3.45e-130) tmp = Float64(z + a); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a + (z - b); tmp = 0.0; if (y <= -1.4e-13) tmp = t_1; elseif (y <= 3.45e-130) tmp = z + a; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a + N[(z - b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -1.4e-13], t$95$1, If[LessEqual[y, 3.45e-130], N[(z + a), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a + \left(z - b\right)\\
\mathbf{if}\;y \leq -1.4 \cdot 10^{-13}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 3.45 \cdot 10^{-130}:\\
\;\;\;\;z + a\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -1.4000000000000001e-13 or 3.45000000000000018e-130 < y Initial program 52.3%
Taylor expanded in y around inf
associate--l+N/A
lower-+.f64N/A
lower--.f6473.6
Applied rewrites73.6%
if -1.4000000000000001e-13 < y < 3.45000000000000018e-130Initial program 79.9%
Taylor expanded in y around inf
associate--l+N/A
lower-+.f64N/A
lower--.f6433.5
Applied rewrites33.5%
Taylor expanded in b around 0
Applied rewrites45.8%
Final simplification63.2%
(FPCore (x y z t a b) :precision binary64 (if (<= b -6e+120) (- a b) (if (<= b 1.32e+174) (+ z a) (- z b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -6e+120) {
tmp = a - b;
} else if (b <= 1.32e+174) {
tmp = z + a;
} else {
tmp = z - b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-6d+120)) then
tmp = a - b
else if (b <= 1.32d+174) then
tmp = z + a
else
tmp = z - b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -6e+120) {
tmp = a - b;
} else if (b <= 1.32e+174) {
tmp = z + a;
} else {
tmp = z - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -6e+120: tmp = a - b elif b <= 1.32e+174: tmp = z + a else: tmp = z - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -6e+120) tmp = Float64(a - b); elseif (b <= 1.32e+174) tmp = Float64(z + a); else tmp = Float64(z - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -6e+120) tmp = a - b; elseif (b <= 1.32e+174) tmp = z + a; else tmp = z - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -6e+120], N[(a - b), $MachinePrecision], If[LessEqual[b, 1.32e+174], N[(z + a), $MachinePrecision], N[(z - b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6 \cdot 10^{+120}:\\
\;\;\;\;a - b\\
\mathbf{elif}\;b \leq 1.32 \cdot 10^{+174}:\\
\;\;\;\;z + a\\
\mathbf{else}:\\
\;\;\;\;z - b\\
\end{array}
\end{array}
if b < -6e120Initial program 50.6%
Taylor expanded in y around inf
associate--l+N/A
lower-+.f64N/A
lower--.f6449.6
Applied rewrites49.6%
Taylor expanded in z around 0
Applied rewrites46.2%
if -6e120 < b < 1.31999999999999999e174Initial program 68.9%
Taylor expanded in y around inf
associate--l+N/A
lower-+.f64N/A
lower--.f6460.3
Applied rewrites60.3%
Taylor expanded in b around 0
Applied rewrites59.2%
if 1.31999999999999999e174 < b Initial program 43.7%
Taylor expanded in y around inf
associate--l+N/A
lower-+.f64N/A
lower--.f6459.1
Applied rewrites59.1%
Taylor expanded in a around 0
Applied rewrites51.3%
Final simplification56.2%
(FPCore (x y z t a b) :precision binary64 (if (<= b -6e+120) (- a b) (if (<= b 1.15e+174) (+ z a) (- a b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -6e+120) {
tmp = a - b;
} else if (b <= 1.15e+174) {
tmp = z + a;
} else {
tmp = a - b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-6d+120)) then
tmp = a - b
else if (b <= 1.15d+174) then
tmp = z + a
else
tmp = a - b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -6e+120) {
tmp = a - b;
} else if (b <= 1.15e+174) {
tmp = z + a;
} else {
tmp = a - b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -6e+120: tmp = a - b elif b <= 1.15e+174: tmp = z + a else: tmp = a - b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -6e+120) tmp = Float64(a - b); elseif (b <= 1.15e+174) tmp = Float64(z + a); else tmp = Float64(a - b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -6e+120) tmp = a - b; elseif (b <= 1.15e+174) tmp = z + a; else tmp = a - b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -6e+120], N[(a - b), $MachinePrecision], If[LessEqual[b, 1.15e+174], N[(z + a), $MachinePrecision], N[(a - b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -6 \cdot 10^{+120}:\\
\;\;\;\;a - b\\
\mathbf{elif}\;b \leq 1.15 \cdot 10^{+174}:\\
\;\;\;\;z + a\\
\mathbf{else}:\\
\;\;\;\;a - b\\
\end{array}
\end{array}
if b < -6e120 or 1.1499999999999999e174 < b Initial program 47.2%
Taylor expanded in y around inf
associate--l+N/A
lower-+.f64N/A
lower--.f6454.3
Applied rewrites54.3%
Taylor expanded in z around 0
Applied rewrites48.2%
if -6e120 < b < 1.1499999999999999e174Initial program 68.9%
Taylor expanded in y around inf
associate--l+N/A
lower-+.f64N/A
lower--.f6460.3
Applied rewrites60.3%
Taylor expanded in b around 0
Applied rewrites59.2%
Final simplification56.1%
(FPCore (x y z t a b) :precision binary64 (if (<= b -3.3e+277) (- b) (if (<= b 1.22e+175) (+ z a) (- b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -3.3e+277) {
tmp = -b;
} else if (b <= 1.22e+175) {
tmp = z + a;
} else {
tmp = -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 (b <= (-3.3d+277)) then
tmp = -b
else if (b <= 1.22d+175) then
tmp = z + a
else
tmp = -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 (b <= -3.3e+277) {
tmp = -b;
} else if (b <= 1.22e+175) {
tmp = z + a;
} else {
tmp = -b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if b <= -3.3e+277: tmp = -b elif b <= 1.22e+175: tmp = z + a else: tmp = -b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -3.3e+277) tmp = Float64(-b); elseif (b <= 1.22e+175) tmp = Float64(z + a); else tmp = Float64(-b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (b <= -3.3e+277) tmp = -b; elseif (b <= 1.22e+175) tmp = z + a; else tmp = -b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -3.3e+277], (-b), If[LessEqual[b, 1.22e+175], N[(z + a), $MachinePrecision], (-b)]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \leq -3.3 \cdot 10^{+277}:\\
\;\;\;\;-b\\
\mathbf{elif}\;b \leq 1.22 \cdot 10^{+175}:\\
\;\;\;\;z + a\\
\mathbf{else}:\\
\;\;\;\;-b\\
\end{array}
\end{array}
if b < -3.3000000000000001e277 or 1.22e175 < b Initial program 40.9%
Taylor expanded in y around inf
associate--l+N/A
lower-+.f64N/A
lower--.f6462.1
Applied rewrites62.1%
Taylor expanded in b around inf
Applied rewrites47.6%
if -3.3000000000000001e277 < b < 1.22e175Initial program 67.2%
Taylor expanded in y around inf
associate--l+N/A
lower-+.f64N/A
lower--.f6457.8
Applied rewrites57.8%
Taylor expanded in b around 0
Applied rewrites56.1%
Final simplification54.6%
(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 62.7%
Taylor expanded in y around inf
associate--l+N/A
lower-+.f64N/A
lower--.f6458.6
Applied rewrites58.6%
Taylor expanded in b around inf
Applied rewrites18.8%
(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 2024238
(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)))