
(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 13 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 (fma z t (fma x y (fma a b (* c i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(z, t, fma(x, y, fma(a, b, (c * i))));
}
function code(x, y, z, t, a, b, c, i) return fma(z, t, fma(x, y, fma(a, b, Float64(c * i)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(z * t + N[(x * y + N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, t, \mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b, c \cdot i\right)\right)\right)
\end{array}
Initial program 96.1%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6497.6
Applied egg-rr97.6%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma y x (* c i))))
(if (<= (* z t) -5e+226)
(* z t)
(if (<= (* z t) 5e-281)
t_1
(if (<= (* z t) 5e-105)
(fma i c (* a b))
(if (<= (* z t) 5e+36) t_1 (fma z t (* a b))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(y, x, (c * i));
double tmp;
if ((z * t) <= -5e+226) {
tmp = z * t;
} else if ((z * t) <= 5e-281) {
tmp = t_1;
} else if ((z * t) <= 5e-105) {
tmp = fma(i, c, (a * b));
} else if ((z * t) <= 5e+36) {
tmp = t_1;
} else {
tmp = fma(z, t, (a * b));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(y, x, Float64(c * i)) tmp = 0.0 if (Float64(z * t) <= -5e+226) tmp = Float64(z * t); elseif (Float64(z * t) <= 5e-281) tmp = t_1; elseif (Float64(z * t) <= 5e-105) tmp = fma(i, c, Float64(a * b)); elseif (Float64(z * t) <= 5e+36) tmp = t_1; else tmp = fma(z, t, Float64(a * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(y * x + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -5e+226], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e-281], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e-105], N[(i * c + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+36], t$95$1, N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, c \cdot i\right)\\
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+226}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-281}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-105}:\\
\;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+36}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t, a \cdot b\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -5.0000000000000005e226Initial program 85.7%
Taylor expanded in z around inf
lower-*.f6496.4
Simplified96.4%
if -5.0000000000000005e226 < (*.f64 z t) < 4.9999999999999998e-281 or 4.99999999999999963e-105 < (*.f64 z t) < 4.99999999999999977e36Initial program 100.0%
Taylor expanded in x around inf
lower-*.f6470.4
Simplified70.4%
*-commutativeN/A
lift-*.f64N/A
lower-fma.f6470.4
Applied egg-rr70.4%
if 4.9999999999999998e-281 < (*.f64 z t) < 4.99999999999999963e-105Initial program 96.7%
Taylor expanded in a around inf
lower-*.f6481.4
Simplified81.4%
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6484.6
Applied egg-rr84.6%
if 4.99999999999999977e36 < (*.f64 z t) Initial program 89.6%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6495.8
Applied egg-rr95.8%
Taylor expanded in a around inf
lower-*.f6470.8
Simplified70.8%
Final simplification75.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma y x (* c i))))
(if (<= (* z t) -5e+226)
(* z t)
(if (<= (* z t) 5e-281)
t_1
(if (<= (* z t) 5e-105)
(fma i c (* a b))
(if (<= (* z t) 4e+231) t_1 (* z t)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(y, x, (c * i));
double tmp;
if ((z * t) <= -5e+226) {
tmp = z * t;
} else if ((z * t) <= 5e-281) {
tmp = t_1;
} else if ((z * t) <= 5e-105) {
tmp = fma(i, c, (a * b));
} else if ((z * t) <= 4e+231) {
tmp = t_1;
} else {
tmp = z * t;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(y, x, Float64(c * i)) tmp = 0.0 if (Float64(z * t) <= -5e+226) tmp = Float64(z * t); elseif (Float64(z * t) <= 5e-281) tmp = t_1; elseif (Float64(z * t) <= 5e-105) tmp = fma(i, c, Float64(a * b)); elseif (Float64(z * t) <= 4e+231) tmp = t_1; else tmp = Float64(z * t); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(y * x + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -5e+226], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e-281], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e-105], N[(i * c + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 4e+231], t$95$1, N[(z * t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, c \cdot i\right)\\
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+226}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-281}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-105}:\\
\;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\
\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+231}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 z t) < -5.0000000000000005e226 or 4.0000000000000002e231 < (*.f64 z t) Initial program 85.7%
Taylor expanded in z around inf
lower-*.f6495.2
Simplified95.2%
if -5.0000000000000005e226 < (*.f64 z t) < 4.9999999999999998e-281 or 4.99999999999999963e-105 < (*.f64 z t) < 4.0000000000000002e231Initial program 98.8%
Taylor expanded in x around inf
lower-*.f6466.7
Simplified66.7%
*-commutativeN/A
lift-*.f64N/A
lower-fma.f6466.7
Applied egg-rr66.7%
if 4.9999999999999998e-281 < (*.f64 z t) < 4.99999999999999963e-105Initial program 96.7%
Taylor expanded in a around inf
lower-*.f6481.4
Simplified81.4%
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6484.6
Applied egg-rr84.6%
Final simplification74.3%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* z t) -5e+226)
(* z t)
(if (<= (* z t) 2e-72)
(fma i c (* a b))
(if (<= (* z t) 5e+36)
(* x y)
(if (<= (* z t) 4e+231) (fma b a (* 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+226) {
tmp = z * t;
} else if ((z * t) <= 2e-72) {
tmp = fma(i, c, (a * b));
} else if ((z * t) <= 5e+36) {
tmp = x * y;
} else if ((z * t) <= 4e+231) {
tmp = fma(b, a, (c * i));
} else {
tmp = z * t;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -5e+226) tmp = Float64(z * t); elseif (Float64(z * t) <= 2e-72) tmp = fma(i, c, Float64(a * b)); elseif (Float64(z * t) <= 5e+36) tmp = Float64(x * y); elseif (Float64(z * t) <= 4e+231) tmp = fma(b, a, Float64(c * i)); else tmp = Float64(z * t); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+226], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e-72], N[(i * c + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+36], N[(x * y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 4e+231], N[(b * a + N[(c * i), $MachinePrecision]), $MachinePrecision], N[(z * t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+226}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-72}:\\
\;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+36}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+231}:\\
\;\;\;\;\mathsf{fma}\left(b, a, c \cdot i\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 z t) < -5.0000000000000005e226 or 4.0000000000000002e231 < (*.f64 z t) Initial program 85.7%
Taylor expanded in z around inf
lower-*.f6495.2
Simplified95.2%
if -5.0000000000000005e226 < (*.f64 z t) < 1.9999999999999999e-72Initial program 99.3%
Taylor expanded in a around inf
lower-*.f6463.8
Simplified63.8%
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6464.4
Applied egg-rr64.4%
if 1.9999999999999999e-72 < (*.f64 z t) < 4.99999999999999977e36Initial program 100.0%
Taylor expanded in x around inf
lower-*.f6466.2
Simplified66.2%
if 4.99999999999999977e36 < (*.f64 z t) < 4.0000000000000002e231Initial program 92.5%
Taylor expanded in a around inf
lower-*.f6446.1
Simplified46.1%
*-commutativeN/A
lift-*.f64N/A
lower-fma.f6449.8
Applied egg-rr49.8%
Final simplification68.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma b a (* c i))))
(if (<= (* z t) -5e+226)
(* z t)
(if (<= (* z t) 2e-72)
t_1
(if (<= (* z t) 5e+36) (* x y) (if (<= (* z t) 4e+231) t_1 (* z t)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(b, a, (c * i));
double tmp;
if ((z * t) <= -5e+226) {
tmp = z * t;
} else if ((z * t) <= 2e-72) {
tmp = t_1;
} else if ((z * t) <= 5e+36) {
tmp = x * y;
} else if ((z * t) <= 4e+231) {
tmp = t_1;
} else {
tmp = z * t;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(b, a, Float64(c * i)) tmp = 0.0 if (Float64(z * t) <= -5e+226) tmp = Float64(z * t); elseif (Float64(z * t) <= 2e-72) tmp = t_1; elseif (Float64(z * t) <= 5e+36) tmp = Float64(x * y); elseif (Float64(z * t) <= 4e+231) tmp = t_1; else tmp = Float64(z * t); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(b * a + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -5e+226], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e-72], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 5e+36], N[(x * y), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 4e+231], t$95$1, N[(z * t), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, c \cdot i\right)\\
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+226}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{-72}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+36}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+231}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 z t) < -5.0000000000000005e226 or 4.0000000000000002e231 < (*.f64 z t) Initial program 85.7%
Taylor expanded in z around inf
lower-*.f6495.2
Simplified95.2%
if -5.0000000000000005e226 < (*.f64 z t) < 1.9999999999999999e-72 or 4.99999999999999977e36 < (*.f64 z t) < 4.0000000000000002e231Initial program 98.4%
Taylor expanded in a around inf
lower-*.f6461.2
Simplified61.2%
*-commutativeN/A
lift-*.f64N/A
lower-fma.f6461.8
Applied egg-rr61.8%
if 1.9999999999999999e-72 < (*.f64 z t) < 4.99999999999999977e36Initial program 100.0%
Taylor expanded in x around inf
lower-*.f6466.2
Simplified66.2%
Final simplification68.5%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma z t (* x y))) (t_2 (+ (* x y) (* z t)))) (if (<= t_2 -5e+120) t_1 (if (<= t_2 1e+68) (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(z, t, (x * y));
double t_2 = (x * y) + (z * t);
double tmp;
if (t_2 <= -5e+120) {
tmp = t_1;
} else if (t_2 <= 1e+68) {
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(z, t, Float64(x * y)) t_2 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (t_2 <= -5e+120) tmp = t_1; elseif (t_2 <= 1e+68) 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[(z * t + N[(x * y), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+120], t$95$1, If[LessEqual[t$95$2, 1e+68], N[(i * c + N[(a * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, t, x \cdot y\right)\\
t_2 := x \cdot y + z \cdot t\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+120}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 10^{+68}:\\
\;\;\;\;\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)) < -5.00000000000000019e120 or 9.99999999999999953e67 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 93.0%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6495.8
Applied egg-rr95.8%
Taylor expanded in x around inf
lower-*.f6482.0
Simplified82.0%
if -5.00000000000000019e120 < (+.f64 (*.f64 x y) (*.f64 z t)) < 9.99999999999999953e67Initial program 100.0%
Taylor expanded in a around inf
lower-*.f6477.6
Simplified77.6%
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6477.7
Applied egg-rr77.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma a b (* z t))))
(if (<= (* c i) -5e-108)
(fma a b (fma c i (* x y)))
(if (<= (* c i) 10000000000.0) (fma x y t_1) (fma c i t_1)))))
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 ((c * i) <= -5e-108) {
tmp = fma(a, b, fma(c, i, (x * y)));
} else if ((c * i) <= 10000000000.0) {
tmp = fma(x, y, t_1);
} else {
tmp = fma(c, i, t_1);
}
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(c * i) <= -5e-108) tmp = fma(a, b, fma(c, i, Float64(x * y))); elseif (Float64(c * i) <= 10000000000.0) tmp = fma(x, y, t_1); else tmp = fma(c, i, t_1); 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[(c * i), $MachinePrecision], -5e-108], N[(a * b + N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 10000000000.0], N[(x * y + t$95$1), $MachinePrecision], N[(c * i + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b, z \cdot t\right)\\
\mathbf{if}\;c \cdot i \leq -5 \cdot 10^{-108}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\
\mathbf{elif}\;c \cdot i \leq 10000000000:\\
\;\;\;\;\mathsf{fma}\left(x, y, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, i, t\_1\right)\\
\end{array}
\end{array}
if (*.f64 c i) < -5e-108Initial program 96.4%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6489.5
Simplified89.5%
if -5e-108 < (*.f64 c i) < 1e10Initial program 95.7%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6497.3
Simplified97.3%
if 1e10 < (*.f64 c i) Initial program 96.3%
Taylor expanded in x around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6487.1
Simplified87.1%
Final simplification92.5%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* z t) -5e+226)
(* z t)
(if (<= (* z t) 6e+68)
(fma a b (fma c i (* x y)))
(fma c i (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) <= -5e+226) {
tmp = z * t;
} else if ((z * t) <= 6e+68) {
tmp = fma(a, b, fma(c, i, (x * y)));
} else {
tmp = fma(c, i, fma(a, b, (z * t)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -5e+226) tmp = Float64(z * t); elseif (Float64(z * t) <= 6e+68) tmp = fma(a, b, fma(c, i, Float64(x * y))); else tmp = fma(c, i, 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], -5e+226], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 6e+68], N[(a * b + N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c * i + N[(a * b + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+226}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 6 \cdot 10^{+68}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, z \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -5.0000000000000005e226Initial program 85.7%
Taylor expanded in z around inf
lower-*.f6496.4
Simplified96.4%
if -5.0000000000000005e226 < (*.f64 z t) < 6.0000000000000004e68Initial program 99.4%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6492.5
Simplified92.5%
if 6.0000000000000004e68 < (*.f64 z t) Initial program 88.1%
Taylor expanded in x around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6481.5
Simplified81.5%
Final simplification91.1%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -5e+226) (* z t) (if (<= (* z t) 4e+231) (fma a b (fma c i (* x y))) (fma 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 ((z * t) <= -5e+226) {
tmp = z * t;
} else if ((z * t) <= 4e+231) {
tmp = fma(a, b, fma(c, i, (x * y)));
} else {
tmp = fma(z, t, (x * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -5e+226) tmp = Float64(z * t); elseif (Float64(z * t) <= 4e+231) tmp = fma(a, b, fma(c, i, Float64(x * y))); else tmp = fma(z, t, Float64(x * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+226], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 4e+231], N[(a * b + N[(c * i + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * t + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+226}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+231}:\\
\;\;\;\;\mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, x \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t, x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -5.0000000000000005e226Initial program 85.7%
Taylor expanded in z around inf
lower-*.f6496.4
Simplified96.4%
if -5.0000000000000005e226 < (*.f64 z t) < 4.0000000000000002e231Initial program 98.5%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6489.6
Simplified89.6%
if 4.0000000000000002e231 < (*.f64 z t) Initial program 85.7%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6490.5
Applied egg-rr90.5%
Taylor expanded in x around inf
lower-*.f6498.2
Simplified98.2%
Final simplification91.0%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -5.7e+106)
(* c i)
(if (<= (* c i) -3e-131)
(* a b)
(if (<= (* c i) 2.9e+36) (* z t) (* c i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -5.7e+106) {
tmp = c * i;
} else if ((c * i) <= -3e-131) {
tmp = a * b;
} else if ((c * i) <= 2.9e+36) {
tmp = z * t;
} else {
tmp = c * i;
}
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 ((c * i) <= (-5.7d+106)) then
tmp = c * i
else if ((c * i) <= (-3d-131)) then
tmp = a * b
else if ((c * i) <= 2.9d+36) then
tmp = z * t
else
tmp = c * i
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 ((c * i) <= -5.7e+106) {
tmp = c * i;
} else if ((c * i) <= -3e-131) {
tmp = a * b;
} else if ((c * i) <= 2.9e+36) {
tmp = z * t;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -5.7e+106: tmp = c * i elif (c * i) <= -3e-131: tmp = a * b elif (c * i) <= 2.9e+36: tmp = z * t else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -5.7e+106) tmp = Float64(c * i); elseif (Float64(c * i) <= -3e-131) tmp = Float64(a * b); elseif (Float64(c * i) <= 2.9e+36) tmp = Float64(z * t); else tmp = Float64(c * i); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((c * i) <= -5.7e+106) tmp = c * i; elseif ((c * i) <= -3e-131) tmp = a * b; elseif ((c * i) <= 2.9e+36) tmp = z * t; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -5.7e+106], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -3e-131], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2.9e+36], N[(z * t), $MachinePrecision], N[(c * i), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -5.7 \cdot 10^{+106}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -3 \cdot 10^{-131}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \cdot i \leq 2.9 \cdot 10^{+36}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -5.6999999999999997e106 or 2.9e36 < (*.f64 c i) Initial program 95.8%
Taylor expanded in c around inf
lower-*.f6455.1
Simplified55.1%
if -5.6999999999999997e106 < (*.f64 c i) < -2.99999999999999996e-131Initial program 97.7%
Taylor expanded in a around inf
lower-*.f6437.8
Simplified37.8%
if -2.99999999999999996e-131 < (*.f64 c i) < 2.9e36Initial program 95.6%
Taylor expanded in z around inf
lower-*.f6444.4
Simplified44.4%
Final simplification47.3%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -2e+207) (* z t) (if (<= (* z t) 4e+231) (* x y) (* 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+207) {
tmp = z * t;
} else if ((z * t) <= 4e+231) {
tmp = x * y;
} 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+207)) then
tmp = z * t
else if ((z * t) <= 4d+231) then
tmp = x * y
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+207) {
tmp = z * t;
} else if ((z * t) <= 4e+231) {
tmp = x * y;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z * t) <= -2e+207: tmp = z * t elif (z * t) <= 4e+231: tmp = x * y else: tmp = z * t return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -2e+207) tmp = Float64(z * t); elseif (Float64(z * t) <= 4e+231) tmp = Float64(x * y); 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+207) tmp = z * t; elseif ((z * t) <= 4e+231) tmp = x * y; 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+207], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 4e+231], N[(x * y), $MachinePrecision], N[(z * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+207}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+231}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 z t) < -2.0000000000000001e207 or 4.0000000000000002e231 < (*.f64 z t) Initial program 86.0%
Taylor expanded in z around inf
lower-*.f6493.4
Simplified93.4%
if -2.0000000000000001e207 < (*.f64 z t) < 4.0000000000000002e231Initial program 98.5%
Taylor expanded in x around inf
lower-*.f6438.5
Simplified38.5%
Final simplification49.2%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -1.5e+48) (* a b) (if (<= (* a b) 3.8e+280) (* 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) <= -1.5e+48) {
tmp = a * b;
} else if ((a * b) <= 3.8e+280) {
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) <= (-1.5d+48)) then
tmp = a * b
else if ((a * b) <= 3.8d+280) 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) <= -1.5e+48) {
tmp = a * b;
} else if ((a * b) <= 3.8e+280) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -1.5e+48: tmp = a * b elif (a * b) <= 3.8e+280: 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) <= -1.5e+48) tmp = Float64(a * b); elseif (Float64(a * b) <= 3.8e+280) 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) <= -1.5e+48) tmp = a * b; elseif ((a * b) <= 3.8e+280) 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], -1.5e+48], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 3.8e+280], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1.5 \cdot 10^{+48}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 3.8 \cdot 10^{+280}:\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -1.5e48 or 3.79999999999999964e280 < (*.f64 a b) Initial program 91.4%
Taylor expanded in a around inf
lower-*.f6461.1
Simplified61.1%
if -1.5e48 < (*.f64 a b) < 3.79999999999999964e280Initial program 98.2%
Taylor expanded in c around inf
lower-*.f6432.1
Simplified32.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-*.f6424.4
Simplified24.4%
herbie shell --seed 2024208
(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)))