
(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 (+ (* i c) (+ (* b a) (+ (* t z) (* y x)))))) (if (<= t_1 INFINITY) t_1 (fma y x (* b a)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (i * c) + ((b * a) + ((t * z) + (y * x)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(y, x, (b * a));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(i * c) + Float64(Float64(b * a) + Float64(Float64(t * z) + Float64(y * x)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(y, x, Float64(b * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(i * c), $MachinePrecision] + N[(N[(b * a), $MachinePrecision] + N[(N[(t * z), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(y * x + N[(b * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := i \cdot c + \left(b \cdot a + \left(t \cdot z + y \cdot x\right)\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, b \cdot a\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 t around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6450.0
Applied rewrites50.0%
Taylor expanded in c around 0
Applied rewrites75.2%
Final simplification98.8%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* t z) -3.8e+93)
(* t z)
(if (<= (* t z) -2.16e-113)
(* b a)
(if (<= (* t z) -4e-318)
(* y x)
(if (<= (* t z) 2.15e-164)
(* i c)
(if (<= (* t z) 1.6e+124) (* b a) (* t z)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((t * z) <= -3.8e+93) {
tmp = t * z;
} else if ((t * z) <= -2.16e-113) {
tmp = b * a;
} else if ((t * z) <= -4e-318) {
tmp = y * x;
} else if ((t * z) <= 2.15e-164) {
tmp = i * c;
} else if ((t * z) <= 1.6e+124) {
tmp = b * a;
} else {
tmp = t * z;
}
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 ((t * z) <= (-3.8d+93)) then
tmp = t * z
else if ((t * z) <= (-2.16d-113)) then
tmp = b * a
else if ((t * z) <= (-4d-318)) then
tmp = y * x
else if ((t * z) <= 2.15d-164) then
tmp = i * c
else if ((t * z) <= 1.6d+124) then
tmp = b * a
else
tmp = t * z
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 ((t * z) <= -3.8e+93) {
tmp = t * z;
} else if ((t * z) <= -2.16e-113) {
tmp = b * a;
} else if ((t * z) <= -4e-318) {
tmp = y * x;
} else if ((t * z) <= 2.15e-164) {
tmp = i * c;
} else if ((t * z) <= 1.6e+124) {
tmp = b * a;
} else {
tmp = t * z;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (t * z) <= -3.8e+93: tmp = t * z elif (t * z) <= -2.16e-113: tmp = b * a elif (t * z) <= -4e-318: tmp = y * x elif (t * z) <= 2.15e-164: tmp = i * c elif (t * z) <= 1.6e+124: tmp = b * a else: tmp = t * z return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(t * z) <= -3.8e+93) tmp = Float64(t * z); elseif (Float64(t * z) <= -2.16e-113) tmp = Float64(b * a); elseif (Float64(t * z) <= -4e-318) tmp = Float64(y * x); elseif (Float64(t * z) <= 2.15e-164) tmp = Float64(i * c); elseif (Float64(t * z) <= 1.6e+124) tmp = Float64(b * a); else tmp = Float64(t * z); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((t * z) <= -3.8e+93) tmp = t * z; elseif ((t * z) <= -2.16e-113) tmp = b * a; elseif ((t * z) <= -4e-318) tmp = y * x; elseif ((t * z) <= 2.15e-164) tmp = i * c; elseif ((t * z) <= 1.6e+124) tmp = b * a; else tmp = t * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(t * z), $MachinePrecision], -3.8e+93], N[(t * z), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], -2.16e-113], N[(b * a), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], -4e-318], N[(y * x), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 2.15e-164], N[(i * c), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 1.6e+124], N[(b * a), $MachinePrecision], N[(t * z), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -3.8 \cdot 10^{+93}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;t \cdot z \leq -2.16 \cdot 10^{-113}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;t \cdot z \leq -4 \cdot 10^{-318}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;t \cdot z \leq 2.15 \cdot 10^{-164}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;t \cdot z \leq 1.6 \cdot 10^{+124}:\\
\;\;\;\;b \cdot a\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < -3.7999999999999998e93 or 1.59999999999999996e124 < (*.f64 z t) Initial program 92.0%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6470.9
Applied rewrites70.9%
if -3.7999999999999998e93 < (*.f64 z t) < -2.16e-113 or 2.1499999999999999e-164 < (*.f64 z t) < 1.59999999999999996e124Initial program 96.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6442.1
Applied rewrites42.1%
if -2.16e-113 < (*.f64 z t) < -3.9999999e-318Initial program 97.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6454.7
Applied rewrites54.7%
if -3.9999999e-318 < (*.f64 z t) < 2.1499999999999999e-164Initial program 97.7%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6449.1
Applied rewrites49.1%
Final simplification54.9%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma y x (* b a))))
(if (<= (* t z) -5e+95)
(fma i c (* t z))
(if (<= (* t z) -1e-112)
t_1
(if (<= (* t z) 1e-164)
(fma i c (* y x))
(if (<= (* t z) 2e+126) t_1 (fma z t (* b a))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(y, x, (b * a));
double tmp;
if ((t * z) <= -5e+95) {
tmp = fma(i, c, (t * z));
} else if ((t * z) <= -1e-112) {
tmp = t_1;
} else if ((t * z) <= 1e-164) {
tmp = fma(i, c, (y * x));
} else if ((t * z) <= 2e+126) {
tmp = t_1;
} else {
tmp = fma(z, t, (b * a));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(y, x, Float64(b * a)) tmp = 0.0 if (Float64(t * z) <= -5e+95) tmp = fma(i, c, Float64(t * z)); elseif (Float64(t * z) <= -1e-112) tmp = t_1; elseif (Float64(t * z) <= 1e-164) tmp = fma(i, c, Float64(y * x)); elseif (Float64(t * z) <= 2e+126) tmp = t_1; else tmp = fma(z, t, Float64(b * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(y * x + N[(b * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t * z), $MachinePrecision], -5e+95], N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], -1e-112], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 1e-164], N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 2e+126], t$95$1, N[(z * t + N[(b * a), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, b \cdot a\right)\\
\mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(i, c, t \cdot z\right)\\
\mathbf{elif}\;t \cdot z \leq -1 \cdot 10^{-112}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \cdot z \leq 10^{-164}:\\
\;\;\;\;\mathsf{fma}\left(i, c, y \cdot x\right)\\
\mathbf{elif}\;t \cdot z \leq 2 \cdot 10^{+126}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t, b \cdot a\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -5.00000000000000025e95Initial program 93.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6477.6
Applied rewrites77.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6479.6
Applied rewrites79.6%
if -5.00000000000000025e95 < (*.f64 z t) < -9.9999999999999995e-113 or 9.99999999999999962e-165 < (*.f64 z t) < 1.99999999999999985e126Initial program 96.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6488.3
Applied rewrites88.3%
Taylor expanded in c around 0
Applied rewrites68.5%
if -9.9999999999999995e-113 < (*.f64 z t) < 9.99999999999999962e-165Initial program 97.4%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6498.7
Applied rewrites98.7%
Taylor expanded in b around 0
Applied rewrites77.0%
if 1.99999999999999985e126 < (*.f64 z t) Initial program 89.1%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6434.0
Applied rewrites34.0%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.1
Applied rewrites89.1%
Taylor expanded in x around 0
Applied rewrites89.2%
Final simplification76.2%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* t z) -2e+92) (fma b a (fma y x (* t z))) (if (<= (* t z) 2e+126) (fma b a (fma i c (* y x))) (fma z t (* b a)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((t * z) <= -2e+92) {
tmp = fma(b, a, fma(y, x, (t * z)));
} else if ((t * z) <= 2e+126) {
tmp = fma(b, a, fma(i, c, (y * x)));
} else {
tmp = fma(z, t, (b * a));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(t * z) <= -2e+92) tmp = fma(b, a, fma(y, x, Float64(t * z))); elseif (Float64(t * z) <= 2e+126) tmp = fma(b, a, fma(i, c, Float64(y * x))); else tmp = fma(z, t, Float64(b * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(t * z), $MachinePrecision], -2e+92], N[(b * a + N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 2e+126], N[(b * a + N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * t + N[(b * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -2 \cdot 10^{+92}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(y, x, t \cdot z\right)\right)\\
\mathbf{elif}\;t \cdot z \leq 2 \cdot 10^{+126}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t, b \cdot a\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -2.0000000000000001e92Initial program 92.1%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6439.8
Applied rewrites39.8%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.2
Applied rewrites89.2%
if -2.0000000000000001e92 < (*.f64 z t) < 1.99999999999999985e126Initial program 97.6%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6493.7
Applied rewrites93.7%
if 1.99999999999999985e126 < (*.f64 z t) Initial program 89.1%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6434.0
Applied rewrites34.0%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.1
Applied rewrites89.1%
Taylor expanded in x around 0
Applied rewrites89.2%
Final simplification92.1%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* t z) -5e+95) (fma b a (fma i c (* t z))) (if (<= (* t z) 2e+126) (fma b a (fma i c (* y x))) (fma z t (* b a)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((t * z) <= -5e+95) {
tmp = fma(b, a, fma(i, c, (t * z)));
} else if ((t * z) <= 2e+126) {
tmp = fma(b, a, fma(i, c, (y * x)));
} else {
tmp = fma(z, t, (b * a));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(t * z) <= -5e+95) tmp = fma(b, a, fma(i, c, Float64(t * z))); elseif (Float64(t * z) <= 2e+126) tmp = fma(b, a, fma(i, c, Float64(y * x))); else tmp = fma(z, t, Float64(b * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(t * z), $MachinePrecision], -5e+95], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 2e+126], N[(b * a + N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * t + N[(b * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\mathbf{elif}\;t \cdot z \leq 2 \cdot 10^{+126}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t, b \cdot a\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -5.00000000000000025e95Initial program 93.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6484.0
Applied rewrites84.0%
if -5.00000000000000025e95 < (*.f64 z t) < 1.99999999999999985e126Initial program 97.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6493.2
Applied rewrites93.2%
if 1.99999999999999985e126 < (*.f64 z t) Initial program 89.1%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6434.0
Applied rewrites34.0%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.1
Applied rewrites89.1%
Taylor expanded in x around 0
Applied rewrites89.2%
Final simplification90.8%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* t z) -5e+95) (fma i c (* t z)) (if (<= (* t z) 2e+126) (fma b a (fma i c (* y x))) (fma z t (* b a)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((t * z) <= -5e+95) {
tmp = fma(i, c, (t * z));
} else if ((t * z) <= 2e+126) {
tmp = fma(b, a, fma(i, c, (y * x)));
} else {
tmp = fma(z, t, (b * a));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(t * z) <= -5e+95) tmp = fma(i, c, Float64(t * z)); elseif (Float64(t * z) <= 2e+126) tmp = fma(b, a, fma(i, c, Float64(y * x))); else tmp = fma(z, t, Float64(b * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(t * z), $MachinePrecision], -5e+95], N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 2e+126], N[(b * a + N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * t + N[(b * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -5 \cdot 10^{+95}:\\
\;\;\;\;\mathsf{fma}\left(i, c, t \cdot z\right)\\
\mathbf{elif}\;t \cdot z \leq 2 \cdot 10^{+126}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t, b \cdot a\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -5.00000000000000025e95Initial program 93.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6477.6
Applied rewrites77.6%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6479.6
Applied rewrites79.6%
if -5.00000000000000025e95 < (*.f64 z t) < 1.99999999999999985e126Initial program 97.0%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6493.2
Applied rewrites93.2%
if 1.99999999999999985e126 < (*.f64 z t) Initial program 89.1%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6434.0
Applied rewrites34.0%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.1
Applied rewrites89.1%
Taylor expanded in x around 0
Applied rewrites89.2%
Final simplification90.0%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* b a) -1e+144) (* b a) (if (<= (* b a) -1e-249) (* i c) (if (<= (* b a) 2e+67) (* y x) (* b a)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((b * a) <= -1e+144) {
tmp = b * a;
} else if ((b * a) <= -1e-249) {
tmp = i * c;
} else if ((b * a) <= 2e+67) {
tmp = y * x;
} else {
tmp = b * a;
}
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 ((b * a) <= (-1d+144)) then
tmp = b * a
else if ((b * a) <= (-1d-249)) then
tmp = i * c
else if ((b * a) <= 2d+67) then
tmp = y * x
else
tmp = b * a
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 ((b * a) <= -1e+144) {
tmp = b * a;
} else if ((b * a) <= -1e-249) {
tmp = i * c;
} else if ((b * a) <= 2e+67) {
tmp = y * x;
} else {
tmp = b * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (b * a) <= -1e+144: tmp = b * a elif (b * a) <= -1e-249: tmp = i * c elif (b * a) <= 2e+67: tmp = y * x else: tmp = b * a return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(b * a) <= -1e+144) tmp = Float64(b * a); elseif (Float64(b * a) <= -1e-249) tmp = Float64(i * c); elseif (Float64(b * a) <= 2e+67) tmp = Float64(y * x); else tmp = Float64(b * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((b * a) <= -1e+144) tmp = b * a; elseif ((b * a) <= -1e-249) tmp = i * c; elseif ((b * a) <= 2e+67) tmp = y * x; else tmp = b * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(b * a), $MachinePrecision], -1e+144], N[(b * a), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], -1e-249], N[(i * c), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], 2e+67], N[(y * x), $MachinePrecision], N[(b * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+144}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;b \cdot a \leq -1 \cdot 10^{-249}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;b \cdot a \leq 2 \cdot 10^{+67}:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (*.f64 a b) < -1.00000000000000002e144 or 1.99999999999999997e67 < (*.f64 a b) Initial program 92.7%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6460.0
Applied rewrites60.0%
if -1.00000000000000002e144 < (*.f64 a b) < -1.00000000000000005e-249Initial program 98.2%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6442.6
Applied rewrites42.6%
if -1.00000000000000005e-249 < (*.f64 a b) < 1.99999999999999997e67Initial program 96.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6442.0
Applied rewrites42.0%
Final simplification48.9%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* b a) -5e-8) (fma z t (* b a)) (if (<= (* b a) 4e+20) (fma i c (* y x)) (fma y x (* b a)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((b * a) <= -5e-8) {
tmp = fma(z, t, (b * a));
} else if ((b * a) <= 4e+20) {
tmp = fma(i, c, (y * x));
} else {
tmp = fma(y, x, (b * a));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(b * a) <= -5e-8) tmp = fma(z, t, Float64(b * a)); elseif (Float64(b * a) <= 4e+20) tmp = fma(i, c, Float64(y * x)); else tmp = fma(y, x, Float64(b * a)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(b * a), $MachinePrecision], -5e-8], N[(z * t + N[(b * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], 4e+20], N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision], N[(y * x + N[(b * a), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -5 \cdot 10^{-8}:\\
\;\;\;\;\mathsf{fma}\left(z, t, b \cdot a\right)\\
\mathbf{elif}\;b \cdot a \leq 4 \cdot 10^{+20}:\\
\;\;\;\;\mathsf{fma}\left(i, c, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, b \cdot a\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -4.9999999999999998e-8Initial program 92.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6477.1
Applied rewrites77.1%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6485.6
Applied rewrites85.6%
Taylor expanded in x around 0
Applied rewrites75.1%
if -4.9999999999999998e-8 < (*.f64 a b) < 4e20Initial program 96.9%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6471.0
Applied rewrites71.0%
Taylor expanded in b around 0
Applied rewrites69.9%
if 4e20 < (*.f64 a b) Initial program 94.4%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6478.1
Applied rewrites78.1%
Taylor expanded in c around 0
Applied rewrites72.3%
Final simplification71.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma y x (* b a))))
(if (<= (* b a) -5e+126)
t_1
(if (<= (* b a) 4e+20) (fma i c (* y x)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(y, x, (b * a));
double tmp;
if ((b * a) <= -5e+126) {
tmp = t_1;
} else if ((b * a) <= 4e+20) {
tmp = fma(i, c, (y * x));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(y, x, Float64(b * a)) tmp = 0.0 if (Float64(b * a) <= -5e+126) tmp = t_1; elseif (Float64(b * a) <= 4e+20) tmp = fma(i, c, Float64(y * x)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(y * x + N[(b * a), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(b * a), $MachinePrecision], -5e+126], t$95$1, If[LessEqual[N[(b * a), $MachinePrecision], 4e+20], N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, b \cdot a\right)\\
\mathbf{if}\;b \cdot a \leq -5 \cdot 10^{+126}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \cdot a \leq 4 \cdot 10^{+20}:\\
\;\;\;\;\mathsf{fma}\left(i, c, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -4.99999999999999977e126 or 4e20 < (*.f64 a b) Initial program 92.8%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6481.5
Applied rewrites81.5%
Taylor expanded in c around 0
Applied rewrites75.9%
if -4.99999999999999977e126 < (*.f64 a b) < 4e20Initial program 97.2%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6468.9
Applied rewrites68.9%
Taylor expanded in b around 0
Applied rewrites66.9%
Final simplification70.8%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* t z) -1.9e+160) (* t z) (if (<= (* t z) 1.68e+134) (fma i c (* y x)) (* t z))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((t * z) <= -1.9e+160) {
tmp = t * z;
} else if ((t * z) <= 1.68e+134) {
tmp = fma(i, c, (y * x));
} else {
tmp = t * z;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(t * z) <= -1.9e+160) tmp = Float64(t * z); elseif (Float64(t * z) <= 1.68e+134) tmp = fma(i, c, Float64(y * x)); else tmp = Float64(t * z); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(t * z), $MachinePrecision], -1.9e+160], N[(t * z), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 1.68e+134], N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision], N[(t * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -1.9 \cdot 10^{+160}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;t \cdot z \leq 1.68 \cdot 10^{+134}:\\
\;\;\;\;\mathsf{fma}\left(i, c, y \cdot x\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < -1.90000000000000006e160 or 1.68e134 < (*.f64 z t) Initial program 91.7%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6477.0
Applied rewrites77.0%
if -1.90000000000000006e160 < (*.f64 z t) < 1.68e134Initial program 96.7%
Taylor expanded in t around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6490.5
Applied rewrites90.5%
Taylor expanded in b around 0
Applied rewrites63.1%
Final simplification67.1%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* b a) -1e+144) (* b a) (if (<= (* b a) 4e+20) (* i c) (* b a))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((b * a) <= -1e+144) {
tmp = b * a;
} else if ((b * a) <= 4e+20) {
tmp = i * c;
} else {
tmp = b * a;
}
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 ((b * a) <= (-1d+144)) then
tmp = b * a
else if ((b * a) <= 4d+20) then
tmp = i * c
else
tmp = b * a
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 ((b * a) <= -1e+144) {
tmp = b * a;
} else if ((b * a) <= 4e+20) {
tmp = i * c;
} else {
tmp = b * a;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (b * a) <= -1e+144: tmp = b * a elif (b * a) <= 4e+20: tmp = i * c else: tmp = b * a return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(b * a) <= -1e+144) tmp = Float64(b * a); elseif (Float64(b * a) <= 4e+20) tmp = Float64(i * c); else tmp = Float64(b * a); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((b * a) <= -1e+144) tmp = b * a; elseif ((b * a) <= 4e+20) tmp = i * c; else tmp = b * a; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(b * a), $MachinePrecision], -1e+144], N[(b * a), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], 4e+20], N[(i * c), $MachinePrecision], N[(b * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+144}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;b \cdot a \leq 4 \cdot 10^{+20}:\\
\;\;\;\;i \cdot c\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (*.f64 a b) < -1.00000000000000002e144 or 4e20 < (*.f64 a b) Initial program 93.4%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6456.5
Applied rewrites56.5%
if -1.00000000000000002e144 < (*.f64 a b) < 4e20Initial program 96.6%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6434.8
Applied rewrites34.8%
Final simplification43.9%
(FPCore (x y z t a b c i) :precision binary64 (* b a))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return b * a;
}
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 = b * a
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return b * a;
}
def code(x, y, z, t, a, b, c, i): return b * a
function code(x, y, z, t, a, b, c, i) return Float64(b * a) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = b * a; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(b * a), $MachinePrecision]
\begin{array}{l}
\\
b \cdot a
\end{array}
Initial program 95.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6426.5
Applied rewrites26.5%
herbie shell --seed 2024255
(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)))