
(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 (/ t b) z (fma (/ y b) x a)) b))))
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((t / b), z, fma((y / b), x, a)) * b;
}
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 = Float64(fma(Float64(t / b), z, fma(Float64(y / b), x, a)) * b); 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[(N[(N[(t / b), $MachinePrecision] * z + N[(N[(y / b), $MachinePrecision] * x + a), $MachinePrecision]), $MachinePrecision] * b), $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(\frac{t}{b}, z, \mathsf{fma}\left(\frac{y}{b}, x, a\right)\right) \cdot b\\
\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
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6456.3
Applied rewrites56.3%
Taylor expanded in b around inf
Applied rewrites68.8%
Final simplification98.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma y x (* t z))) (t_2 (+ (* t z) (* y x))))
(if (<= t_2 -5e+109)
t_1
(if (<= t_2 -2e-24)
(fma b a (* y x))
(if (<= t_2 2e+150) (fma i c (* b a)) 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, (t * z));
double t_2 = (t * z) + (y * x);
double tmp;
if (t_2 <= -5e+109) {
tmp = t_1;
} else if (t_2 <= -2e-24) {
tmp = fma(b, a, (y * x));
} else if (t_2 <= 2e+150) {
tmp = fma(i, c, (b * a));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(y, x, Float64(t * z)) t_2 = Float64(Float64(t * z) + Float64(y * x)) tmp = 0.0 if (t_2 <= -5e+109) tmp = t_1; elseif (t_2 <= -2e-24) tmp = fma(b, a, Float64(y * x)); elseif (t_2 <= 2e+150) tmp = fma(i, c, Float64(b * a)); 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[(t * z), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t * z), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+109], t$95$1, If[LessEqual[t$95$2, -2e-24], N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+150], N[(i * c + N[(b * a), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, t \cdot z\right)\\
t_2 := t \cdot z + y \cdot x\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+109}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq -2 \cdot 10^{-24}:\\
\;\;\;\;\mathsf{fma}\left(b, a, y \cdot x\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+150}:\\
\;\;\;\;\mathsf{fma}\left(i, c, b \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -5.0000000000000001e109 or 1.99999999999999996e150 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 88.7%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6490.6
Applied rewrites90.6%
Taylor expanded in b around 0
Applied rewrites81.7%
if -5.0000000000000001e109 < (+.f64 (*.f64 x y) (*.f64 z t)) < -1.99999999999999985e-24Initial program 100.0%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6488.0
Applied rewrites88.0%
Taylor expanded in t around 0
Applied rewrites70.6%
if -1.99999999999999985e-24 < (+.f64 (*.f64 x y) (*.f64 z t)) < 1.99999999999999996e150Initial program 98.0%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6481.4
Applied rewrites81.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6482.4
Applied rewrites82.4%
Final simplification80.5%
(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 b a (fma y x (* t z))))))
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(b, a, fma(y, x, (t * z)));
}
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(b, a, fma(y, x, Float64(t * z))); 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[(b * a + N[(y * x + N[(t * z), $MachinePrecision]), $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(b, a, \mathsf{fma}\left(y, x, t \cdot z\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
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6456.3
Applied rewrites56.3%
Final simplification97.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma b a (fma y x (* t z)))))
(if (<= (* y x) -2e-24)
t_1
(if (<= (* y x) 2e+150) (fma b a (fma i c (* t z))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(b, a, fma(y, x, (t * z)));
double tmp;
if ((y * x) <= -2e-24) {
tmp = t_1;
} else if ((y * x) <= 2e+150) {
tmp = fma(b, a, fma(i, c, (t * z)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(b, a, fma(y, x, Float64(t * z))) tmp = 0.0 if (Float64(y * x) <= -2e-24) tmp = t_1; elseif (Float64(y * x) <= 2e+150) tmp = fma(b, a, fma(i, c, Float64(t * z))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(b * a + N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y * x), $MachinePrecision], -2e-24], t$95$1, If[LessEqual[N[(y * x), $MachinePrecision], 2e+150], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, \mathsf{fma}\left(y, x, t \cdot z\right)\right)\\
\mathbf{if}\;y \cdot x \leq -2 \cdot 10^{-24}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \cdot x \leq 2 \cdot 10^{+150}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999985e-24 or 1.99999999999999996e150 < (*.f64 x y) Initial program 90.6%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.9
Applied rewrites89.9%
if -1.99999999999999985e-24 < (*.f64 x y) < 1.99999999999999996e150Initial program 95.6%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6494.4
Applied rewrites94.4%
Final simplification92.7%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* y x) -5e+174) (fma b a (* y x)) (if (<= (* y x) 3e+220) (fma b a (fma i c (* t z))) (fma 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 ((y * x) <= -5e+174) {
tmp = fma(b, a, (y * x));
} else if ((y * x) <= 3e+220) {
tmp = fma(b, a, fma(i, c, (t * z)));
} else {
tmp = fma(y, x, (t * z));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(y * x) <= -5e+174) tmp = fma(b, a, Float64(y * x)); elseif (Float64(y * x) <= 3e+220) tmp = fma(b, a, fma(i, c, Float64(t * z))); else tmp = fma(y, x, Float64(t * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(y * x), $MachinePrecision], -5e+174], N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], 3e+220], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot x \leq -5 \cdot 10^{+174}:\\
\;\;\;\;\mathsf{fma}\left(b, a, y \cdot x\right)\\
\mathbf{elif}\;y \cdot x \leq 3 \cdot 10^{+220}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -4.9999999999999997e174Initial program 81.5%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6485.5
Applied rewrites85.5%
Taylor expanded in t around 0
Applied rewrites78.5%
if -4.9999999999999997e174 < (*.f64 x y) < 3.00000000000000024e220Initial program 95.7%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6488.3
Applied rewrites88.3%
if 3.00000000000000024e220 < (*.f64 x y) Initial program 90.0%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f64100.0
Applied rewrites100.0%
Taylor expanded in b around 0
Applied rewrites100.0%
Final simplification88.2%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* t z) -2.2e+39)
(* t z)
(if (<= (* t z) 2.85e-294)
(* y x)
(if (<= (* t z) 6.8e+91) (* 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) <= -2.2e+39) {
tmp = t * z;
} else if ((t * z) <= 2.85e-294) {
tmp = y * x;
} else if ((t * z) <= 6.8e+91) {
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) <= (-2.2d+39)) then
tmp = t * z
else if ((t * z) <= 2.85d-294) then
tmp = y * x
else if ((t * z) <= 6.8d+91) 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) <= -2.2e+39) {
tmp = t * z;
} else if ((t * z) <= 2.85e-294) {
tmp = y * x;
} else if ((t * z) <= 6.8e+91) {
tmp = b * a;
} else {
tmp = t * z;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (t * z) <= -2.2e+39: tmp = t * z elif (t * z) <= 2.85e-294: tmp = y * x elif (t * z) <= 6.8e+91: 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) <= -2.2e+39) tmp = Float64(t * z); elseif (Float64(t * z) <= 2.85e-294) tmp = Float64(y * x); elseif (Float64(t * z) <= 6.8e+91) 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) <= -2.2e+39) tmp = t * z; elseif ((t * z) <= 2.85e-294) tmp = y * x; elseif ((t * z) <= 6.8e+91) 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], -2.2e+39], N[(t * z), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 2.85e-294], N[(y * x), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 6.8e+91], N[(b * a), $MachinePrecision], N[(t * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -2.2 \cdot 10^{+39}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;t \cdot z \leq 2.85 \cdot 10^{-294}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;t \cdot z \leq 6.8 \cdot 10^{+91}:\\
\;\;\;\;b \cdot a\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < -2.2000000000000001e39 or 6.8000000000000002e91 < (*.f64 z t) Initial program 88.6%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6467.1
Applied rewrites67.1%
if -2.2000000000000001e39 < (*.f64 z t) < 2.85000000000000016e-294Initial program 95.1%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6443.1
Applied rewrites43.1%
if 2.85000000000000016e-294 < (*.f64 z t) < 6.8000000000000002e91Initial program 100.0%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6448.6
Applied rewrites48.6%
Final simplification54.4%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* b a) -1e+72) (* b a) (if (<= (* b a) 1e-244) (* i c) (if (<= (* b a) 1e+156) (* 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+72) {
tmp = b * a;
} else if ((b * a) <= 1e-244) {
tmp = i * c;
} else if ((b * a) <= 1e+156) {
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+72)) then
tmp = b * a
else if ((b * a) <= 1d-244) then
tmp = i * c
else if ((b * a) <= 1d+156) 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+72) {
tmp = b * a;
} else if ((b * a) <= 1e-244) {
tmp = i * c;
} else if ((b * a) <= 1e+156) {
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+72: tmp = b * a elif (b * a) <= 1e-244: tmp = i * c elif (b * a) <= 1e+156: 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+72) tmp = Float64(b * a); elseif (Float64(b * a) <= 1e-244) tmp = Float64(i * c); elseif (Float64(b * a) <= 1e+156) 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+72) tmp = b * a; elseif ((b * a) <= 1e-244) tmp = i * c; elseif ((b * a) <= 1e+156) 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+72], N[(b * a), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], 1e-244], N[(i * c), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], 1e+156], N[(y * x), $MachinePrecision], N[(b * a), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+72}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;b \cdot a \leq 10^{-244}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;b \cdot a \leq 10^{+156}:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (*.f64 a b) < -9.99999999999999944e71 or 9.9999999999999998e155 < (*.f64 a b) Initial program 91.5%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6462.9
Applied rewrites62.9%
if -9.99999999999999944e71 < (*.f64 a b) < 9.9999999999999993e-245Initial program 94.2%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6435.3
Applied rewrites35.3%
if 9.9999999999999993e-245 < (*.f64 a b) < 9.9999999999999998e155Initial program 96.6%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6435.6
Applied rewrites35.6%
Final simplification45.5%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* b a) -2e+91) (fma b a (* t z)) (if (<= (* b a) 1e+164) (fma y x (* t z)) (fma b a (* y x)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((b * a) <= -2e+91) {
tmp = fma(b, a, (t * z));
} else if ((b * a) <= 1e+164) {
tmp = fma(y, x, (t * z));
} else {
tmp = fma(b, a, (y * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(b * a) <= -2e+91) tmp = fma(b, a, Float64(t * z)); elseif (Float64(b * a) <= 1e+164) tmp = fma(y, x, Float64(t * z)); else tmp = fma(b, a, Float64(y * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(b * a), $MachinePrecision], -2e+91], N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], 1e+164], N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+91}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{elif}\;b \cdot a \leq 10^{+164}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -2.00000000000000016e91Initial program 91.8%
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 t around inf
Applied rewrites79.4%
if -2.00000000000000016e91 < (*.f64 a b) < 1e164Initial program 95.3%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6474.4
Applied rewrites74.4%
Taylor expanded in b around 0
Applied rewrites69.4%
if 1e164 < (*.f64 a b) Initial program 88.9%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6486.8
Applied rewrites86.8%
Taylor expanded in t around 0
Applied rewrites81.4%
Final simplification73.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma b a (* y x))))
(if (<= (* b a) -2e+214)
t_1
(if (<= (* b a) 1e+164) (fma y x (* t z)) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(b, a, (y * x));
double tmp;
if ((b * a) <= -2e+214) {
tmp = t_1;
} else if ((b * a) <= 1e+164) {
tmp = fma(y, x, (t * z));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(b, a, Float64(y * x)) tmp = 0.0 if (Float64(b * a) <= -2e+214) tmp = t_1; elseif (Float64(b * a) <= 1e+164) tmp = fma(y, x, Float64(t * z)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(b * a), $MachinePrecision], -2e+214], t$95$1, If[LessEqual[N[(b * a), $MachinePrecision], 1e+164], N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(b, a, y \cdot x\right)\\
\mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+214}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \cdot a \leq 10^{+164}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 a b) < -1.9999999999999999e214 or 1e164 < (*.f64 a b) Initial program 87.3%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6485.8
Applied rewrites85.8%
Taylor expanded in t around 0
Applied rewrites84.3%
if -1.9999999999999999e214 < (*.f64 a b) < 1e164Initial program 95.8%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6475.8
Applied rewrites75.8%
Taylor expanded in b around 0
Applied rewrites67.3%
Final simplification71.5%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* b a) -2e+214) (* b a) (if (<= (* b a) 1e+164) (fma y x (* t z)) (* 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) <= -2e+214) {
tmp = b * a;
} else if ((b * a) <= 1e+164) {
tmp = fma(y, x, (t * z));
} else {
tmp = b * a;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(b * a) <= -2e+214) tmp = Float64(b * a); elseif (Float64(b * a) <= 1e+164) tmp = fma(y, x, Float64(t * z)); else tmp = Float64(b * a); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(b * a), $MachinePrecision], -2e+214], N[(b * a), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], 1e+164], N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision], N[(b * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+214}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;b \cdot a \leq 10^{+164}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (*.f64 a b) < -1.9999999999999999e214 or 1e164 < (*.f64 a b) Initial program 87.3%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6478.1
Applied rewrites78.1%
if -1.9999999999999999e214 < (*.f64 a b) < 1e164Initial program 95.8%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6475.8
Applied rewrites75.8%
Taylor expanded in b around 0
Applied rewrites67.3%
Final simplification69.9%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* b a) -1e+72) (* b a) (if (<= (* b a) 1e+86) (* 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+72) {
tmp = b * a;
} else if ((b * a) <= 1e+86) {
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+72)) then
tmp = b * a
else if ((b * a) <= 1d+86) 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+72) {
tmp = b * a;
} else if ((b * a) <= 1e+86) {
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+72: tmp = b * a elif (b * a) <= 1e+86: 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+72) tmp = Float64(b * a); elseif (Float64(b * a) <= 1e+86) 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+72) tmp = b * a; elseif ((b * a) <= 1e+86) 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+72], N[(b * a), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], 1e+86], N[(i * c), $MachinePrecision], N[(b * a), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;b \cdot a \leq -1 \cdot 10^{+72}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;b \cdot a \leq 10^{+86}:\\
\;\;\;\;i \cdot c\\
\mathbf{else}:\\
\;\;\;\;b \cdot a\\
\end{array}
\end{array}
if (*.f64 a b) < -9.99999999999999944e71 or 1e86 < (*.f64 a b) Initial program 92.2%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6459.6
Applied rewrites59.6%
if -9.99999999999999944e71 < (*.f64 a b) < 1e86Initial program 94.8%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6431.0
Applied rewrites31.0%
Final simplification42.5%
(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 93.7%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6427.5
Applied rewrites27.5%
herbie shell --seed 2024243
(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)))