
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i): return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((x * y) + (z * t)) + (a * b)) + (c * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i): return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((x * y) + (z * t)) + (a * b)) + (c * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))) (if (<= t_1 INFINITY) t_1 (fma x y (fma a b (* z t))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (((x * y) + (z * t)) + (a * b)) + (c * i);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(x, y, fma(a, b, (z * t)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(x, y, fma(a, b, Float64(z * t))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(x * y + N[(a * b + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b, z \cdot t\right)\right)\\
\end{array}
\end{array}
if (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) < +inf.0Initial program 100.0%
if +inf.0 < (+.f64 (+.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 a b)) (*.f64 c i)) Initial program 0.0%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6490.0
Applied rewrites90.0%
Final simplification99.6%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* x y) -8.2e+106)
(* x y)
(if (<= (* x y) -1.35e-97)
(* c i)
(if (<= (* x y) -2e-310)
(* z t)
(if (<= (* x y) 1.65e-137)
(* a b)
(if (<= (* x y) 3.6e-72)
(* c i)
(if (<= (* x y) 3.4e+78) (* z t) (* x y))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -8.2e+106) {
tmp = x * y;
} else if ((x * y) <= -1.35e-97) {
tmp = c * i;
} else if ((x * y) <= -2e-310) {
tmp = z * t;
} else if ((x * y) <= 1.65e-137) {
tmp = a * b;
} else if ((x * y) <= 3.6e-72) {
tmp = c * i;
} else if ((x * y) <= 3.4e+78) {
tmp = z * t;
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((x * y) <= (-8.2d+106)) then
tmp = x * y
else if ((x * y) <= (-1.35d-97)) then
tmp = c * i
else if ((x * y) <= (-2d-310)) then
tmp = z * t
else if ((x * y) <= 1.65d-137) then
tmp = a * b
else if ((x * y) <= 3.6d-72) then
tmp = c * i
else if ((x * y) <= 3.4d+78) then
tmp = z * t
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -8.2e+106) {
tmp = x * y;
} else if ((x * y) <= -1.35e-97) {
tmp = c * i;
} else if ((x * y) <= -2e-310) {
tmp = z * t;
} else if ((x * y) <= 1.65e-137) {
tmp = a * b;
} else if ((x * y) <= 3.6e-72) {
tmp = c * i;
} else if ((x * y) <= 3.4e+78) {
tmp = z * t;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (x * y) <= -8.2e+106: tmp = x * y elif (x * y) <= -1.35e-97: tmp = c * i elif (x * y) <= -2e-310: tmp = z * t elif (x * y) <= 1.65e-137: tmp = a * b elif (x * y) <= 3.6e-72: tmp = c * i elif (x * y) <= 3.4e+78: tmp = z * t else: tmp = x * y return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -8.2e+106) tmp = Float64(x * y); elseif (Float64(x * y) <= -1.35e-97) tmp = Float64(c * i); elseif (Float64(x * y) <= -2e-310) tmp = Float64(z * t); elseif (Float64(x * y) <= 1.65e-137) tmp = Float64(a * b); elseif (Float64(x * y) <= 3.6e-72) tmp = Float64(c * i); elseif (Float64(x * y) <= 3.4e+78) tmp = Float64(z * t); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((x * y) <= -8.2e+106) tmp = x * y; elseif ((x * y) <= -1.35e-97) tmp = c * i; elseif ((x * y) <= -2e-310) tmp = z * t; elseif ((x * y) <= 1.65e-137) tmp = a * b; elseif ((x * y) <= 3.6e-72) tmp = c * i; elseif ((x * y) <= 3.4e+78) tmp = z * t; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -8.2e+106], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -1.35e-97], N[(c * i), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -2e-310], N[(z * t), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1.65e-137], N[(a * b), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3.6e-72], N[(c * i), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3.4e+78], N[(z * t), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -8.2 \cdot 10^{+106}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq -1.35 \cdot 10^{-97}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;x \cdot y \leq -2 \cdot 10^{-310}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \cdot y \leq 1.65 \cdot 10^{-137}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;x \cdot y \leq 3.6 \cdot 10^{-72}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;x \cdot y \leq 3.4 \cdot 10^{+78}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -8.2000000000000005e106 or 3.40000000000000007e78 < (*.f64 x y) Initial program 92.6%
Taylor expanded in x around inf
lower-*.f6470.1
Applied rewrites70.1%
if -8.2000000000000005e106 < (*.f64 x y) < -1.34999999999999993e-97 or 1.6500000000000001e-137 < (*.f64 x y) < 3.6e-72Initial program 98.2%
Taylor expanded in c around inf
lower-*.f6454.1
Applied rewrites54.1%
if -1.34999999999999993e-97 < (*.f64 x y) < -1.999999999999994e-310 or 3.6e-72 < (*.f64 x y) < 3.40000000000000007e78Initial program 97.8%
Taylor expanded in z around inf
lower-*.f6451.5
Applied rewrites51.5%
if -1.999999999999994e-310 < (*.f64 x y) < 1.6500000000000001e-137Initial program 98.3%
Taylor expanded in a around inf
lower-*.f6448.1
Applied rewrites48.1%
Final simplification58.1%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma x y (* z t))) (t_2 (+ (* x y) (* z t))))
(if (<= t_2 -5e+185)
t_1
(if (<= t_2 -2e+87)
(fma y x (* c i))
(if (<= t_2 4e+50) (fma i c (* a b)) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(x, y, (z * t));
double t_2 = (x * y) + (z * t);
double tmp;
if (t_2 <= -5e+185) {
tmp = t_1;
} else if (t_2 <= -2e+87) {
tmp = fma(y, x, (c * i));
} else if (t_2 <= 4e+50) {
tmp = fma(i, c, (a * b));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(x, y, Float64(z * t)) t_2 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (t_2 <= -5e+185) tmp = t_1; elseif (t_2 <= -2e+87) tmp = fma(y, x, Float64(c * i)); elseif (t_2 <= 4e+50) tmp = fma(i, c, Float64(a * b)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+185], t$95$1, If[LessEqual[t$95$2, -2e+87], N[(y * x + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 4e+50], N[(i * c + N[(a * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, y, z \cdot t\right)\\
t_2 := x \cdot y + z \cdot t\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+185}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{+87}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c \cdot i\right)\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+50}:\\
\;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -4.9999999999999999e185 or 4.0000000000000003e50 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 92.5%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6488.8
Applied rewrites88.8%
Taylor expanded in a around 0
lower-*.f6482.5
Applied rewrites82.5%
if -4.9999999999999999e185 < (+.f64 (*.f64 x y) (*.f64 z t)) < -1.9999999999999999e87Initial program 100.0%
Taylor expanded in x around inf
lower-*.f6481.2
Applied rewrites81.2%
*-commutativeN/A
lift-*.f64N/A
lower-fma.f6481.2
Applied rewrites81.2%
if -1.9999999999999999e87 < (+.f64 (*.f64 x y) (*.f64 z t)) < 4.0000000000000003e50Initial program 100.0%
Taylor expanded in a around inf
lower-*.f6484.3
Applied rewrites84.3%
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6484.3
Applied rewrites84.3%
Final simplification83.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma a b (* z t))))
(if (<= (* x y) -6.8e+78)
(* x y)
(if (<= (* x y) 3.3e-137)
t_1
(if (<= (* x y) 3e-72)
(* c i)
(if (<= (* x y) 3.5e+79) t_1 (* x y)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(a, b, (z * t));
double tmp;
if ((x * y) <= -6.8e+78) {
tmp = x * y;
} else if ((x * y) <= 3.3e-137) {
tmp = t_1;
} else if ((x * y) <= 3e-72) {
tmp = c * i;
} else if ((x * y) <= 3.5e+79) {
tmp = t_1;
} else {
tmp = x * y;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(a, b, Float64(z * t)) tmp = 0.0 if (Float64(x * y) <= -6.8e+78) tmp = Float64(x * y); elseif (Float64(x * y) <= 3.3e-137) tmp = t_1; elseif (Float64(x * y) <= 3e-72) tmp = Float64(c * i); elseif (Float64(x * y) <= 3.5e+79) tmp = t_1; else tmp = Float64(x * y); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a * b + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -6.8e+78], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3.3e-137], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 3e-72], N[(c * i), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3.5e+79], t$95$1, N[(x * y), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b, z \cdot t\right)\\
\mathbf{if}\;x \cdot y \leq -6.8 \cdot 10^{+78}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 3.3 \cdot 10^{-137}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 3 \cdot 10^{-72}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;x \cdot y \leq 3.5 \cdot 10^{+79}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -6.80000000000000014e78 or 3.4999999999999998e79 < (*.f64 x y) Initial program 92.2%
Taylor expanded in x around inf
lower-*.f6467.1
Applied rewrites67.1%
if -6.80000000000000014e78 < (*.f64 x y) < 3.3000000000000002e-137 or 3e-72 < (*.f64 x y) < 3.4999999999999998e79Initial program 98.5%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.4
Applied rewrites74.4%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6469.8
Applied rewrites69.8%
if 3.3000000000000002e-137 < (*.f64 x y) < 3e-72Initial program 100.0%
Taylor expanded in c around inf
lower-*.f6479.0
Applied rewrites79.0%
Final simplification69.2%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma x y (* z t))) (t_2 (+ (* x y) (* z t)))) (if (<= t_2 -5e+104) t_1 (if (<= t_2 4e+50) (fma i c (* a b)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(x, y, (z * t));
double t_2 = (x * y) + (z * t);
double tmp;
if (t_2 <= -5e+104) {
tmp = t_1;
} else if (t_2 <= 4e+50) {
tmp = fma(i, c, (a * b));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(x, y, Float64(z * t)) t_2 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (t_2 <= -5e+104) tmp = t_1; elseif (t_2 <= 4e+50) tmp = fma(i, c, Float64(a * b)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+104], t$95$1, If[LessEqual[t$95$2, 4e+50], N[(i * c + N[(a * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, y, z \cdot t\right)\\
t_2 := x \cdot y + z \cdot t\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+104}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+50}:\\
\;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -4.9999999999999997e104 or 4.0000000000000003e50 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 93.5%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6486.4
Applied rewrites86.4%
Taylor expanded in a around 0
lower-*.f6479.0
Applied rewrites79.0%
if -4.9999999999999997e104 < (+.f64 (*.f64 x y) (*.f64 z t)) < 4.0000000000000003e50Initial program 100.0%
Taylor expanded in a around inf
lower-*.f6482.5
Applied rewrites82.5%
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6482.5
Applied rewrites82.5%
Final simplification80.4%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -5e+185) (fma c i (fma t z (* x y))) (if (<= (* z t) 4e+129) (fma a b (fma c i (* x y))) (fma c i (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -5e+185) {
tmp = fma(c, i, fma(t, z, (x * y)));
} else if ((z * t) <= 4e+129) {
tmp = fma(a, b, fma(c, i, (x * y)));
} else {
tmp = fma(c, i, (z * t));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -5e+185) tmp = fma(c, i, fma(t, z, Float64(x * y))); elseif (Float64(z * t) <= 4e+129) tmp = fma(a, b, fma(c, i, Float64(x * y))); else tmp = fma(c, i, Float64(z * t)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+185], N[(c * i + N[(t * z + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 4e+129], N[(a * b + N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * i + N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+185}:\\
\;\;\;\;\mathsf{fma}\left(c, i, \mathsf{fma}\left(t, z, x \cdot y\right)\right)\\
\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+129}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, i, z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -4.9999999999999999e185Initial program 94.1%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6497.1
Applied rewrites97.1%
if -4.9999999999999999e185 < (*.f64 z t) < 4e129Initial program 99.4%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6494.4
Applied rewrites94.4%
if 4e129 < (*.f64 z t) Initial program 82.1%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6489.7
Applied rewrites89.7%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6490.1
Applied rewrites90.1%
Final simplification94.1%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -5e+185) (fma x y (* z t)) (if (<= (* z t) 4e+129) (fma a b (fma c i (* x y))) (fma c i (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -5e+185) {
tmp = fma(x, y, (z * t));
} else if ((z * t) <= 4e+129) {
tmp = fma(a, b, fma(c, i, (x * y)));
} else {
tmp = fma(c, i, (z * t));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -5e+185) tmp = fma(x, y, Float64(z * t)); elseif (Float64(z * t) <= 4e+129) tmp = fma(a, b, fma(c, i, Float64(x * y))); else tmp = fma(c, i, Float64(z * t)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+185], N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 4e+129], N[(a * b + N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * i + N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+185}:\\
\;\;\;\;\mathsf{fma}\left(x, y, z \cdot t\right)\\
\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+129}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, i, z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -4.9999999999999999e185Initial program 94.1%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6494.1
Applied rewrites94.1%
Taylor expanded in a around 0
lower-*.f6494.1
Applied rewrites94.1%
if -4.9999999999999999e185 < (*.f64 z t) < 4e129Initial program 99.4%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6494.4
Applied rewrites94.4%
if 4e129 < (*.f64 z t) Initial program 82.1%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6489.7
Applied rewrites89.7%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6490.1
Applied rewrites90.1%
Final simplification93.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma c i (* z t))))
(if (<= (* z t) -2e+127)
t_1
(if (<= (* z t) 2e+86) (fma a b (* x y)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(c, i, (z * t));
double tmp;
if ((z * t) <= -2e+127) {
tmp = t_1;
} else if ((z * t) <= 2e+86) {
tmp = fma(a, b, (x * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(c, i, Float64(z * t)) tmp = 0.0 if (Float64(z * t) <= -2e+127) tmp = t_1; elseif (Float64(z * t) <= 2e+86) tmp = fma(a, b, Float64(x * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(c * i + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -2e+127], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 2e+86], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(c, i, z \cdot t\right)\\
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+127}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -1.99999999999999991e127 or 2e86 < (*.f64 z t) Initial program 89.2%
Taylor expanded in a around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6491.7
Applied rewrites91.7%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6486.8
Applied rewrites86.8%
if -1.99999999999999991e127 < (*.f64 z t) < 2e86Initial program 99.4%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.9
Applied rewrites75.9%
Taylor expanded in t around 0
lower-fma.f64N/A
lower-*.f6470.5
Applied rewrites70.5%
Final simplification75.7%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -2e+269) (* z t) (if (<= (* z t) 2e+86) (fma a b (* x y)) (fma a b (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -2e+269) {
tmp = z * t;
} else if ((z * t) <= 2e+86) {
tmp = fma(a, b, (x * y));
} else {
tmp = fma(a, b, (z * t));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -2e+269) tmp = Float64(z * t); elseif (Float64(z * t) <= 2e+86) tmp = fma(a, b, Float64(x * y)); else tmp = fma(a, b, Float64(z * t)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -2e+269], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+86], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(a * b + N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+269}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+86}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b, z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -2.0000000000000001e269Initial program 96.0%
Taylor expanded in z around inf
lower-*.f6498.8
Applied rewrites98.8%
if -2.0000000000000001e269 < (*.f64 z t) < 2e86Initial program 98.9%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.7
Applied rewrites74.7%
Taylor expanded in t around 0
lower-fma.f64N/A
lower-*.f6468.1
Applied rewrites68.1%
if 2e86 < (*.f64 z t) Initial program 83.7%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6475.1
Applied rewrites75.1%
Taylor expanded in x around 0
lower-fma.f64N/A
lower-*.f6467.6
Applied rewrites67.6%
Final simplification71.0%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -2e+175) (* z t) (if (<= (* z t) 2e+66) (* a b) (* z t))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -2e+175) {
tmp = z * t;
} else if ((z * t) <= 2e+66) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((z * t) <= (-2d+175)) then
tmp = z * t
else if ((z * t) <= 2d+66) then
tmp = a * b
else
tmp = z * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -2e+175) {
tmp = z * t;
} else if ((z * t) <= 2e+66) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z * t) <= -2e+175: tmp = z * t elif (z * t) <= 2e+66: tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -2e+175) tmp = Float64(z * t); elseif (Float64(z * t) <= 2e+66) tmp = Float64(a * b); else tmp = Float64(z * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((z * t) <= -2e+175) tmp = z * t; elseif ((z * t) <= 2e+66) tmp = a * b; else tmp = z * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -2e+175], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+66], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+175}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+66}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 z t) < -1.9999999999999999e175 or 1.99999999999999989e66 < (*.f64 z t) Initial program 88.9%
Taylor expanded in z around inf
lower-*.f6468.6
Applied rewrites68.6%
if -1.9999999999999999e175 < (*.f64 z t) < 1.99999999999999989e66Initial program 99.4%
Taylor expanded in a around inf
lower-*.f6433.2
Applied rewrites33.2%
Final simplification44.4%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -8.1e+40) (* a b) (if (<= (* a b) 1.6e+122) (* c i) (* a b))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -8.1e+40) {
tmp = a * b;
} else if ((a * b) <= 1.6e+122) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((a * b) <= (-8.1d+40)) then
tmp = a * b
else if ((a * b) <= 1.6d+122) then
tmp = c * i
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 c, double i) {
double tmp;
if ((a * b) <= -8.1e+40) {
tmp = a * b;
} else if ((a * b) <= 1.6e+122) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -8.1e+40: tmp = a * b elif (a * b) <= 1.6e+122: tmp = c * i else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -8.1e+40) tmp = Float64(a * b); elseif (Float64(a * b) <= 1.6e+122) tmp = Float64(c * i); else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((a * b) <= -8.1e+40) tmp = a * b; elseif ((a * b) <= 1.6e+122) tmp = c * i; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -8.1e+40], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.6e+122], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -8.1 \cdot 10^{+40}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 1.6 \cdot 10^{+122}:\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -8.0999999999999998e40 or 1.60000000000000006e122 < (*.f64 a b) Initial program 91.2%
Taylor expanded in a around inf
lower-*.f6459.5
Applied rewrites59.5%
if -8.0999999999999998e40 < (*.f64 a b) < 1.60000000000000006e122Initial program 98.8%
Taylor expanded in c around inf
lower-*.f6432.1
Applied rewrites32.1%
(FPCore (x y z t a b c i) :precision binary64 (* a b))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
real(8) function code(x, y, z, t, a, b, c, i)
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), intent (in) :: c
real(8), intent (in) :: i
code = a * b
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
def code(x, y, z, t, a, b, c, i): return a * b
function code(x, y, z, t, a, b, c, i) return Float64(a * b) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = a * b; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(a * b), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b
\end{array}
Initial program 96.1%
Taylor expanded in a around inf
lower-*.f6425.6
Applied rewrites25.6%
herbie shell --seed 2024214
(FPCore (x y z t a b c i)
:name "Linear.V4:$cdot from linear-1.19.1.3, C"
:precision binary64
(+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))