
(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 (/ y (+ x y)))
(t_2 (+ y (+ x t)))
(t_3 (/ (- (+ (* z (+ x y)) (* a (+ y t))) (* y b)) t_2))
(t_4 (* (+ x y) (+ x y)))
(t_5
(-
(fma
t
(- (fma y (/ b t_4) (/ a (+ x y))) (fma a (/ y t_4) (/ z (+ x y))))
(fma a t_1 z))
(* b t_1))))
(if (<= t_3 (- INFINITY))
t_5
(if (<= t_3 1e+298)
(/ (fma a t (fma y (- (+ z a) b) (* x z))) t_2)
t_5))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y / (x + y);
double t_2 = y + (x + t);
double t_3 = (((z * (x + y)) + (a * (y + t))) - (y * b)) / t_2;
double t_4 = (x + y) * (x + y);
double t_5 = fma(t, (fma(y, (b / t_4), (a / (x + y))) - fma(a, (y / t_4), (z / (x + y)))), fma(a, t_1, z)) - (b * t_1);
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = t_5;
} else if (t_3 <= 1e+298) {
tmp = fma(a, t, fma(y, ((z + a) - b), (x * z))) / t_2;
} else {
tmp = t_5;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(y / Float64(x + y)) t_2 = Float64(y + Float64(x + t)) t_3 = Float64(Float64(Float64(Float64(z * Float64(x + y)) + Float64(a * Float64(y + t))) - Float64(y * b)) / t_2) t_4 = Float64(Float64(x + y) * Float64(x + y)) t_5 = Float64(fma(t, Float64(fma(y, Float64(b / t_4), Float64(a / Float64(x + y))) - fma(a, Float64(y / t_4), Float64(z / Float64(x + y)))), fma(a, t_1, z)) - Float64(b * t_1)) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = t_5; elseif (t_3 <= 1e+298) tmp = Float64(fma(a, t, fma(y, Float64(Float64(z + a) - b), Float64(x * z))) / t_2); else tmp = t_5; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(a * N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision]}, Block[{t$95$4 = N[(N[(x + y), $MachinePrecision] * N[(x + y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$5 = N[(N[(t * N[(N[(y * N[(b / t$95$4), $MachinePrecision] + N[(a / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(a * N[(y / t$95$4), $MachinePrecision] + N[(z / N[(x + y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * t$95$1 + z), $MachinePrecision]), $MachinePrecision] - N[(b * t$95$1), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], t$95$5, If[LessEqual[t$95$3, 1e+298], N[(N[(a * t + N[(y * N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision] + N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$2), $MachinePrecision], t$95$5]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{y}{x + y}\\
t_2 := y + \left(x + t\right)\\
t_3 := \frac{\left(z \cdot \left(x + y\right) + a \cdot \left(y + t\right)\right) - y \cdot b}{t\_2}\\
t_4 := \left(x + y\right) \cdot \left(x + y\right)\\
t_5 := \mathsf{fma}\left(t, \mathsf{fma}\left(y, \frac{b}{t\_4}, \frac{a}{x + y}\right) - \mathsf{fma}\left(a, \frac{y}{t\_4}, \frac{z}{x + y}\right), \mathsf{fma}\left(a, t\_1, z\right)\right) - b \cdot t\_1\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;t\_5\\
\mathbf{elif}\;t\_3 \leq 10^{+298}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, \mathsf{fma}\left(y, \left(z + a\right) - b, x \cdot z\right)\right)}{t\_2}\\
\mathbf{else}:\\
\;\;\;\;t\_5\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -inf.0 or 9.9999999999999996e297 < (/.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 rewrites71.1%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.9999999999999996e297Initial program 99.6%
Taylor expanded in y around 0
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6499.6
Applied rewrites99.6%
Final simplification88.3%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (+ x t)))
(t_2 (/ (- (+ (* z (+ x y)) (* a (+ y t))) (* y b)) t_1))
(t_3 (- (+ z a) b)))
(if (<= t_2 -1e+235)
t_3
(if (<= t_2 2000000000.0)
(/ (fma a t (* x z)) (+ x t))
(if (<= t_2 5e+97) (/ (fma z x (* y (- z b))) t_1) t_3)))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (x + t);
double t_2 = (((z * (x + y)) + (a * (y + t))) - (y * b)) / t_1;
double t_3 = (z + a) - b;
double tmp;
if (t_2 <= -1e+235) {
tmp = t_3;
} else if (t_2 <= 2000000000.0) {
tmp = fma(a, t, (x * z)) / (x + t);
} else if (t_2 <= 5e+97) {
tmp = fma(z, x, (y * (z - b))) / t_1;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(x + t)) t_2 = Float64(Float64(Float64(Float64(z * Float64(x + y)) + Float64(a * Float64(y + t))) - Float64(y * b)) / t_1) t_3 = Float64(Float64(z + a) - b) tmp = 0.0 if (t_2 <= -1e+235) tmp = t_3; elseif (t_2 <= 2000000000.0) tmp = Float64(fma(a, t, Float64(x * z)) / Float64(x + t)); elseif (t_2 <= 5e+97) tmp = Float64(fma(z, x, Float64(y * Float64(z - b))) / t_1); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(a * N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+235], t$95$3, If[LessEqual[t$95$2, 2000000000.0], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(x + t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 5e+97], N[(N[(z * x + N[(y * N[(z - b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + \left(x + t\right)\\
t_2 := \frac{\left(z \cdot \left(x + y\right) + a \cdot \left(y + t\right)\right) - y \cdot b}{t\_1}\\
t_3 := \left(z + a\right) - b\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+235}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 2000000000:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{x + t}\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+97}:\\
\;\;\;\;\frac{\mathsf{fma}\left(z, x, y \cdot \left(z - b\right)\right)}{t\_1}\\
\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)) < -1.0000000000000001e235 or 4.99999999999999999e97 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 20.5%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6471.7
Applied rewrites71.7%
if -1.0000000000000001e235 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 2e9Initial program 99.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6470.8
Applied rewrites70.8%
if 2e9 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 4.99999999999999999e97Initial program 99.6%
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--.f6474.8
Applied rewrites74.8%
Final simplification71.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (+ x t)))
(t_2 (/ (- (+ (* z (+ x y)) (* a (+ y t))) (* y b)) t_1))
(t_3 (- (+ z a) b)))
(if (<= t_2 (- INFINITY))
t_3
(if (<= t_2 5e+268) (/ (fma a t (fma y t_3 (* x z))) t_1) t_3))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (x + t);
double t_2 = (((z * (x + y)) + (a * (y + t))) - (y * b)) / t_1;
double t_3 = (z + a) - b;
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = t_3;
} else if (t_2 <= 5e+268) {
tmp = fma(a, t, fma(y, t_3, (x * z))) / t_1;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(x + t)) t_2 = Float64(Float64(Float64(Float64(z * Float64(x + y)) + Float64(a * Float64(y + t))) - Float64(y * b)) / t_1) t_3 = Float64(Float64(z + a) - b) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = t_3; elseif (t_2 <= 5e+268) tmp = Float64(fma(a, t, fma(y, t_3, Float64(x * z))) / t_1); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(a * N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], t$95$3, If[LessEqual[t$95$2, 5e+268], N[(N[(a * t + N[(y * t$95$3 + N[(x * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + \left(x + t\right)\\
t_2 := \frac{\left(z \cdot \left(x + y\right) + a \cdot \left(y + t\right)\right) - y \cdot b}{t\_1}\\
t_3 := \left(z + a\right) - b\\
\mathbf{if}\;t\_2 \leq -\infty:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 5 \cdot 10^{+268}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, \mathsf{fma}\left(y, t\_3, x \cdot z\right)\right)}{t\_1}\\
\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)) < -inf.0 or 5.0000000000000002e268 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 5.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6470.0
Applied rewrites70.0%
if -inf.0 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 5.0000000000000002e268Initial program 99.6%
Taylor expanded in y around 0
lower-fma.f64N/A
+-commutativeN/A
lower-fma.f64N/A
lower--.f64N/A
lower-+.f64N/A
*-commutativeN/A
lower-*.f6499.6
Applied rewrites99.6%
Final simplification87.7%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ y (+ x t)))
(t_2 (/ (- (+ (* z (+ x y)) (* a (+ y t))) (* y b)) t_1))
(t_3 (- (+ z a) b)))
(if (<= t_2 -1e+235)
t_3
(if (<= t_2 1.3e+90) (/ (- (fma a t (* x z)) (* y b)) t_1) t_3))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y + (x + t);
double t_2 = (((z * (x + y)) + (a * (y + t))) - (y * b)) / t_1;
double t_3 = (z + a) - b;
double tmp;
if (t_2 <= -1e+235) {
tmp = t_3;
} else if (t_2 <= 1.3e+90) {
tmp = (fma(a, t, (x * z)) - (y * b)) / t_1;
} else {
tmp = t_3;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(y + Float64(x + t)) t_2 = Float64(Float64(Float64(Float64(z * Float64(x + y)) + Float64(a * Float64(y + t))) - Float64(y * b)) / t_1) t_3 = Float64(Float64(z + a) - b) tmp = 0.0 if (t_2 <= -1e+235) tmp = t_3; elseif (t_2 <= 1.3e+90) tmp = Float64(Float64(fma(a, t, Float64(x * z)) - Float64(y * b)) / t_1); else tmp = t_3; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(a * N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+235], t$95$3, If[LessEqual[t$95$2, 1.3e+90], N[(N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / t$95$1), $MachinePrecision], t$95$3]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := y + \left(x + t\right)\\
t_2 := \frac{\left(z \cdot \left(x + y\right) + a \cdot \left(y + t\right)\right) - y \cdot b}{t\_1}\\
t_3 := \left(z + a\right) - b\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+235}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;t\_2 \leq 1.3 \cdot 10^{+90}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right) - y \cdot b}{t\_1}\\
\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)) < -1.0000000000000001e235 or 1.2999999999999999e90 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 21.7%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6471.4
Applied rewrites71.4%
if -1.0000000000000001e235 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 1.2999999999999999e90Initial program 99.6%
Taylor expanded in y around 0
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6477.5
Applied rewrites77.5%
Final simplification74.5%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (/ (- (+ (* z (+ x y)) (* a (+ y t))) (* y b)) (+ y (+ x t))))
(t_2 (- (+ z a) b)))
(if (<= t_1 -1e+235)
t_2
(if (<= t_1 1e+38) (/ (fma a t (* x z)) (+ x t)) t_2))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (((z * (x + y)) + (a * (y + t))) - (y * b)) / (y + (x + t));
double t_2 = (z + a) - b;
double tmp;
if (t_1 <= -1e+235) {
tmp = t_2;
} else if (t_1 <= 1e+38) {
tmp = fma(a, t, (x * z)) / (x + t);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(Float64(Float64(Float64(z * Float64(x + y)) + Float64(a * Float64(y + t))) - Float64(y * b)) / Float64(y + Float64(x + t))) t_2 = Float64(Float64(z + a) - b) tmp = 0.0 if (t_1 <= -1e+235) tmp = t_2; elseif (t_1 <= 1e+38) tmp = Float64(fma(a, t, Float64(x * z)) / Float64(x + t)); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(N[(N[(z * N[(x + y), $MachinePrecision]), $MachinePrecision] + N[(a * N[(y + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * b), $MachinePrecision]), $MachinePrecision] / N[(y + N[(x + t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision]}, If[LessEqual[t$95$1, -1e+235], t$95$2, If[LessEqual[t$95$1, 1e+38], N[(N[(a * t + N[(x * z), $MachinePrecision]), $MachinePrecision] / N[(x + t), $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \frac{\left(z \cdot \left(x + y\right) + a \cdot \left(y + t\right)\right) - y \cdot b}{y + \left(x + t\right)}\\
t_2 := \left(z + a\right) - b\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{+235}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;t\_1 \leq 10^{+38}:\\
\;\;\;\;\frac{\mathsf{fma}\left(a, t, x \cdot z\right)}{x + t}\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < -1.0000000000000001e235 or 9.99999999999999977e37 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) Initial program 27.5%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6469.1
Applied rewrites69.1%
if -1.0000000000000001e235 < (/.f64 (-.f64 (+.f64 (*.f64 (+.f64 x y) z) (*.f64 (+.f64 t y) a)) (*.f64 y b)) (+.f64 (+.f64 x t) y)) < 9.99999999999999977e37Initial program 99.6%
Taylor expanded in y around 0
lower-/.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64N/A
lower-+.f6469.3
Applied rewrites69.3%
Final simplification69.2%
(FPCore (x y z t a b) :precision binary64 (if (<= t -4.2e+116) (fma y (/ (- z b) t) a) (if (<= t 2.85e+54) (fma a (/ y (+ x y)) z) (- a (* z (/ (- (- x) y) t))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -4.2e+116) {
tmp = fma(y, ((z - b) / t), a);
} else if (t <= 2.85e+54) {
tmp = fma(a, (y / (x + y)), z);
} else {
tmp = a - (z * ((-x - y) / t));
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -4.2e+116) tmp = fma(y, Float64(Float64(z - b) / t), a); elseif (t <= 2.85e+54) tmp = fma(a, Float64(y / Float64(x + y)), z); else tmp = Float64(a - Float64(z * Float64(Float64(Float64(-x) - y) / t))); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -4.2e+116], N[(y * N[(N[(z - b), $MachinePrecision] / t), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[t, 2.85e+54], N[(a * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision], N[(a - N[(z * N[(N[((-x) - y), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.2 \cdot 10^{+116}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - b}{t}, a\right)\\
\mathbf{elif}\;t \leq 2.85 \cdot 10^{+54}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{x + y}, z\right)\\
\mathbf{else}:\\
\;\;\;\;a - z \cdot \frac{\left(-x\right) - y}{t}\\
\end{array}
\end{array}
if t < -4.2000000000000002e116Initial program 54.4%
Taylor expanded in t around -inf
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
Applied rewrites62.6%
Taylor expanded in x around 0
Applied rewrites71.9%
if -4.2000000000000002e116 < t < 2.8499999999999998e54Initial program 67.7%
Taylor expanded in b around inf
lower-*.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites73.6%
Taylor expanded in a around -inf
Applied rewrites18.1%
Taylor expanded in b around 0
Applied rewrites61.8%
Taylor expanded in t around 0
Applied rewrites67.7%
if 2.8499999999999998e54 < t Initial program 51.4%
Taylor expanded in t around -inf
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
Applied rewrites47.2%
Taylor expanded in z around inf
Applied rewrites62.5%
Final simplification67.3%
(FPCore (x y z t a b) :precision binary64 (if (<= t -4.2e+116) (fma y (/ (- z b) t) a) (if (<= t 3.1e+47) (fma a (/ y (+ x y)) z) (fma y (/ z (+ y t)) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -4.2e+116) {
tmp = fma(y, ((z - b) / t), a);
} else if (t <= 3.1e+47) {
tmp = fma(a, (y / (x + y)), z);
} else {
tmp = fma(y, (z / (y + t)), a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -4.2e+116) tmp = fma(y, Float64(Float64(z - b) / t), a); elseif (t <= 3.1e+47) tmp = fma(a, Float64(y / Float64(x + y)), z); else tmp = fma(y, Float64(z / Float64(y + t)), a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -4.2e+116], N[(y * N[(N[(z - b), $MachinePrecision] / t), $MachinePrecision] + a), $MachinePrecision], If[LessEqual[t, 3.1e+47], N[(a * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision], N[(y * N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.2 \cdot 10^{+116}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z - b}{t}, a\right)\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{x + y}, z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{y + t}, a\right)\\
\end{array}
\end{array}
if t < -4.2000000000000002e116Initial program 54.4%
Taylor expanded in t around -inf
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
Applied rewrites62.6%
Taylor expanded in x around 0
Applied rewrites71.9%
if -4.2000000000000002e116 < t < 3.1000000000000001e47Initial program 67.5%
Taylor expanded in b around inf
lower-*.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites73.4%
Taylor expanded in a around -inf
Applied rewrites18.2%
Taylor expanded in b around 0
Applied rewrites61.5%
Taylor expanded in t around 0
Applied rewrites67.5%
if 3.1000000000000001e47 < t Initial program 52.3%
Taylor expanded in b around inf
lower-*.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites51.8%
Taylor expanded in a around -inf
Applied rewrites25.5%
Taylor expanded in b around 0
Applied rewrites71.3%
Taylor expanded in x around 0
Applied rewrites60.8%
(FPCore (x y z t a b) :precision binary64 (if (<= t -7.5e+116) (- a (/ (* y b) t)) (if (<= t 3.1e+47) (fma a (/ y (+ x y)) z) (fma y (/ z (+ y t)) a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= -7.5e+116) {
tmp = a - ((y * b) / t);
} else if (t <= 3.1e+47) {
tmp = fma(a, (y / (x + y)), z);
} else {
tmp = fma(y, (z / (y + t)), a);
}
return tmp;
}
function code(x, y, z, t, a, b) tmp = 0.0 if (t <= -7.5e+116) tmp = Float64(a - Float64(Float64(y * b) / t)); elseif (t <= 3.1e+47) tmp = fma(a, Float64(y / Float64(x + y)), z); else tmp = fma(y, Float64(z / Float64(y + t)), a); end return tmp end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, -7.5e+116], N[(a - N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 3.1e+47], N[(a * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision], N[(y * N[(z / N[(y + t), $MachinePrecision]), $MachinePrecision] + a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \leq -7.5 \cdot 10^{+116}:\\
\;\;\;\;a - \frac{y \cdot b}{t}\\
\mathbf{elif}\;t \leq 3.1 \cdot 10^{+47}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{x + y}, z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, \frac{z}{y + t}, a\right)\\
\end{array}
\end{array}
if t < -7.5e116Initial program 54.4%
Taylor expanded in t around -inf
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
Applied rewrites62.6%
Taylor expanded in b around inf
Applied rewrites59.9%
if -7.5e116 < t < 3.1000000000000001e47Initial program 67.5%
Taylor expanded in b around inf
lower-*.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites73.4%
Taylor expanded in a around -inf
Applied rewrites18.2%
Taylor expanded in b around 0
Applied rewrites61.5%
Taylor expanded in t around 0
Applied rewrites67.5%
if 3.1000000000000001e47 < t Initial program 52.3%
Taylor expanded in b around inf
lower-*.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites51.8%
Taylor expanded in a around -inf
Applied rewrites25.5%
Taylor expanded in b around 0
Applied rewrites71.3%
Taylor expanded in x around 0
Applied rewrites60.8%
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (- a (/ (* y b) t))))
(if (<= t -7.5e+116)
t_1
(if (<= t 1.15e+193) (fma a (/ y (+ x y)) z) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a - ((y * b) / t);
double tmp;
if (t <= -7.5e+116) {
tmp = t_1;
} else if (t <= 1.15e+193) {
tmp = fma(a, (y / (x + y)), z);
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b) t_1 = Float64(a - Float64(Float64(y * b) / t)) tmp = 0.0 if (t <= -7.5e+116) tmp = t_1; elseif (t <= 1.15e+193) tmp = fma(a, Float64(y / Float64(x + y)), z); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a - N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -7.5e+116], t$95$1, If[LessEqual[t, 1.15e+193], N[(a * N[(y / N[(x + y), $MachinePrecision]), $MachinePrecision] + z), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a - \frac{y \cdot b}{t}\\
\mathbf{if}\;t \leq -7.5 \cdot 10^{+116}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 1.15 \cdot 10^{+193}:\\
\;\;\;\;\mathsf{fma}\left(a, \frac{y}{x + y}, z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -7.5e116 or 1.15000000000000007e193 < t Initial program 49.6%
Taylor expanded in t around -inf
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
Applied rewrites58.2%
Taylor expanded in b around inf
Applied rewrites60.6%
if -7.5e116 < t < 1.15000000000000007e193Initial program 66.9%
Taylor expanded in b around inf
lower-*.f64N/A
+-commutativeN/A
associate-+l+N/A
associate-/l*N/A
lower-fma.f64N/A
Applied rewrites71.9%
Taylor expanded in a around -inf
Applied rewrites19.2%
Taylor expanded in b around 0
Applied rewrites62.3%
Taylor expanded in t around 0
Applied rewrites63.2%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (- a (/ (* y b) t)))) (if (<= t -7.5e+116) t_1 (if (<= t 2.2e+185) (- (+ z a) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a - ((y * b) / t);
double tmp;
if (t <= -7.5e+116) {
tmp = t_1;
} else if (t <= 2.2e+185) {
tmp = (z + a) - b;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = a - ((y * b) / t)
if (t <= (-7.5d+116)) then
tmp = t_1
else if (t <= 2.2d+185) then
tmp = (z + a) - b
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a - ((y * b) / t);
double tmp;
if (t <= -7.5e+116) {
tmp = t_1;
} else if (t <= 2.2e+185) {
tmp = (z + a) - b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a - ((y * b) / t) tmp = 0 if t <= -7.5e+116: tmp = t_1 elif t <= 2.2e+185: tmp = (z + a) - b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a - Float64(Float64(y * b) / t)) tmp = 0.0 if (t <= -7.5e+116) tmp = t_1; elseif (t <= 2.2e+185) tmp = Float64(Float64(z + a) - b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a - ((y * b) / t); tmp = 0.0; if (t <= -7.5e+116) tmp = t_1; elseif (t <= 2.2e+185) tmp = (z + a) - b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a - N[(N[(y * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -7.5e+116], t$95$1, If[LessEqual[t, 2.2e+185], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a - \frac{y \cdot b}{t}\\
\mathbf{if}\;t \leq -7.5 \cdot 10^{+116}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{+185}:\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -7.5e116 or 2.2000000000000001e185 < t Initial program 49.6%
Taylor expanded in t around -inf
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
Applied rewrites58.2%
Taylor expanded in b around inf
Applied rewrites60.6%
if -7.5e116 < t < 2.2000000000000001e185Initial program 66.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6460.8
Applied rewrites60.8%
Final simplification60.7%
(FPCore (x y z t a b) :precision binary64 (let* ((t_1 (- a (* a (/ x t))))) (if (<= t -5.3e+119) t_1 (if (<= t 5e+193) (- (+ z a) b) t_1))))
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a - (a * (x / t));
double tmp;
if (t <= -5.3e+119) {
tmp = t_1;
} else if (t <= 5e+193) {
tmp = (z + a) - b;
} else {
tmp = t_1;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = a - (a * (x / t))
if (t <= (-5.3d+119)) then
tmp = t_1
else if (t <= 5d+193) then
tmp = (z + a) - b
else
tmp = t_1
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a - (a * (x / t));
double tmp;
if (t <= -5.3e+119) {
tmp = t_1;
} else if (t <= 5e+193) {
tmp = (z + a) - b;
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b): t_1 = a - (a * (x / t)) tmp = 0 if t <= -5.3e+119: tmp = t_1 elif t <= 5e+193: tmp = (z + a) - b else: tmp = t_1 return tmp
function code(x, y, z, t, a, b) t_1 = Float64(a - Float64(a * Float64(x / t))) tmp = 0.0 if (t <= -5.3e+119) tmp = t_1; elseif (t <= 5e+193) tmp = Float64(Float64(z + a) - b); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b) t_1 = a - (a * (x / t)); tmp = 0.0; if (t <= -5.3e+119) tmp = t_1; elseif (t <= 5e+193) tmp = (z + a) - b; else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a - N[(a * N[(x / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -5.3e+119], t$95$1, If[LessEqual[t, 5e+193], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a - a \cdot \frac{x}{t}\\
\mathbf{if}\;t \leq -5.3 \cdot 10^{+119}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \leq 5 \cdot 10^{+193}:\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if t < -5.29999999999999972e119 or 4.99999999999999972e193 < t Initial program 49.0%
Taylor expanded in t around -inf
mul-1-negN/A
unsub-negN/A
lower--.f64N/A
lower-/.f64N/A
Applied rewrites57.7%
Taylor expanded in a around inf
Applied rewrites53.0%
if -5.29999999999999972e119 < t < 4.99999999999999972e193Initial program 67.1%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6460.5
Applied rewrites60.5%
Final simplification58.3%
(FPCore (x y z t a b) :precision binary64 (if (<= x -1.4e+201) (* z 1.0) (if (<= x 1.05e+164) (- (+ z a) b) (* z 1.0))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1.4e+201) {
tmp = z * 1.0;
} else if (x <= 1.05e+164) {
tmp = (z + a) - b;
} else {
tmp = z * 1.0;
}
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.4d+201)) then
tmp = z * 1.0d0
else if (x <= 1.05d+164) then
tmp = (z + a) - b
else
tmp = z * 1.0d0
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.4e+201) {
tmp = z * 1.0;
} else if (x <= 1.05e+164) {
tmp = (z + a) - b;
} else {
tmp = z * 1.0;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -1.4e+201: tmp = z * 1.0 elif x <= 1.05e+164: tmp = (z + a) - b else: tmp = z * 1.0 return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -1.4e+201) tmp = Float64(z * 1.0); elseif (x <= 1.05e+164) tmp = Float64(Float64(z + a) - b); else tmp = Float64(z * 1.0); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -1.4e+201) tmp = z * 1.0; elseif (x <= 1.05e+164) tmp = (z + a) - b; else tmp = z * 1.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1.4e+201], N[(z * 1.0), $MachinePrecision], If[LessEqual[x, 1.05e+164], N[(N[(z + a), $MachinePrecision] - b), $MachinePrecision], N[(z * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.4 \cdot 10^{+201}:\\
\;\;\;\;z \cdot 1\\
\mathbf{elif}\;x \leq 1.05 \cdot 10^{+164}:\\
\;\;\;\;\left(z + a\right) - b\\
\mathbf{else}:\\
\;\;\;\;z \cdot 1\\
\end{array}
\end{array}
if x < -1.40000000000000003e201 or 1.04999999999999995e164 < x Initial program 51.2%
Taylor expanded in y around inf
associate--l+N/A
lower-+.f64N/A
lower--.f64N/A
associate-+r+N/A
+-commutativeN/A
*-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
associate-/l*N/A
lower-fma.f64N/A
lower-/.f64N/A
+-commutativeN/A
Applied rewrites10.0%
Taylor expanded in z around inf
Applied rewrites28.7%
Taylor expanded in t around 0
Applied rewrites60.0%
if -1.40000000000000003e201 < x < 1.04999999999999995e164Initial program 64.3%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6455.0
Applied rewrites55.0%
Final simplification55.9%
(FPCore (x y z t a b) :precision binary64 (if (<= a -3.4e+94) (+ z a) (if (<= a 1.35e-55) (- z b) (+ z a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -3.4e+94) {
tmp = z + a;
} else if (a <= 1.35e-55) {
tmp = z - b;
} else {
tmp = z + a;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-3.4d+94)) then
tmp = z + a
else if (a <= 1.35d-55) then
tmp = z - b
else
tmp = z + a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -3.4e+94) {
tmp = z + a;
} else if (a <= 1.35e-55) {
tmp = z - b;
} else {
tmp = z + a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if a <= -3.4e+94: tmp = z + a elif a <= 1.35e-55: tmp = z - b else: tmp = z + a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -3.4e+94) tmp = Float64(z + a); elseif (a <= 1.35e-55) tmp = Float64(z - b); else tmp = Float64(z + a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (a <= -3.4e+94) tmp = z + a; elseif (a <= 1.35e-55) tmp = z - b; else tmp = z + a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -3.4e+94], N[(z + a), $MachinePrecision], If[LessEqual[a, 1.35e-55], N[(z - b), $MachinePrecision], N[(z + a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.4 \cdot 10^{+94}:\\
\;\;\;\;z + a\\
\mathbf{elif}\;a \leq 1.35 \cdot 10^{-55}:\\
\;\;\;\;z - b\\
\mathbf{else}:\\
\;\;\;\;z + a\\
\end{array}
\end{array}
if a < -3.4000000000000002e94 or 1.35000000000000002e-55 < a Initial program 54.1%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6453.6
Applied rewrites53.6%
Taylor expanded in b around 0
Applied rewrites58.6%
if -3.4000000000000002e94 < a < 1.35000000000000002e-55Initial program 68.3%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6449.9
Applied rewrites49.9%
Taylor expanded in a around 0
Applied rewrites49.1%
Final simplification53.4%
(FPCore (x y z t a b) :precision binary64 (if (<= z -3.15e-124) (+ z a) (if (<= z 1.05e-129) (- a b) (+ z a))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.15e-124) {
tmp = z + a;
} else if (z <= 1.05e-129) {
tmp = a - b;
} else {
tmp = z + a;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-3.15d-124)) then
tmp = z + a
else if (z <= 1.05d-129) then
tmp = a - b
else
tmp = z + a
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -3.15e-124) {
tmp = z + a;
} else if (z <= 1.05e-129) {
tmp = a - b;
} else {
tmp = z + a;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if z <= -3.15e-124: tmp = z + a elif z <= 1.05e-129: tmp = a - b else: tmp = z + a return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -3.15e-124) tmp = Float64(z + a); elseif (z <= 1.05e-129) tmp = Float64(a - b); else tmp = Float64(z + a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (z <= -3.15e-124) tmp = z + a; elseif (z <= 1.05e-129) tmp = a - b; else tmp = z + a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -3.15e-124], N[(z + a), $MachinePrecision], If[LessEqual[z, 1.05e-129], N[(a - b), $MachinePrecision], N[(z + a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -3.15 \cdot 10^{-124}:\\
\;\;\;\;z + a\\
\mathbf{elif}\;z \leq 1.05 \cdot 10^{-129}:\\
\;\;\;\;a - b\\
\mathbf{else}:\\
\;\;\;\;z + a\\
\end{array}
\end{array}
if z < -3.15000000000000014e-124 or 1.05e-129 < z Initial program 59.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6451.4
Applied rewrites51.4%
Taylor expanded in b around 0
Applied rewrites51.6%
if -3.15000000000000014e-124 < z < 1.05e-129Initial program 67.0%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6452.0
Applied rewrites52.0%
Taylor expanded in z around 0
Applied rewrites53.0%
Final simplification52.0%
(FPCore (x y z t a b) :precision binary64 (+ z a))
double code(double x, double y, double z, double t, double a, double b) {
return z + a;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = z + a
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return z + a;
}
def code(x, y, z, t, a, b): return z + a
function code(x, y, z, t, a, b) return Float64(z + a) end
function tmp = code(x, y, z, t, a, b) tmp = z + a; end
code[x_, y_, z_, t_, a_, b_] := N[(z + a), $MachinePrecision]
\begin{array}{l}
\\
z + a
\end{array}
Initial program 61.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6451.6
Applied rewrites51.6%
Taylor expanded in b around 0
Applied rewrites47.7%
Final simplification47.7%
(FPCore (x y z t a b) :precision binary64 (- b))
double code(double x, double y, double z, double t, double a, double b) {
return -b;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = -b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return -b;
}
def code(x, y, z, t, a, b): return -b
function code(x, y, z, t, a, b) return Float64(-b) end
function tmp = code(x, y, z, t, a, b) tmp = -b; end
code[x_, y_, z_, t_, a_, b_] := (-b)
\begin{array}{l}
\\
-b
\end{array}
Initial program 61.9%
Taylor expanded in y around inf
lower--.f64N/A
lower-+.f6451.6
Applied rewrites51.6%
Taylor expanded in b around inf
Applied rewrites12.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_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 2024226
(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)))