
(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 (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-*.f6478.6
Applied rewrites78.6%
Final simplification98.8%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* y x) -5e+97)
(* y x)
(if (<= (* y x) -5e-44)
(* i c)
(if (<= (* y x) -1e-199)
(* t z)
(if (<= (* y x) 1e-265)
(* b a)
(if (<= (* y x) 5e-84)
(* t z)
(if (<= (* y x) 5e+34) (* i c) (* y x))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((y * x) <= -5e+97) {
tmp = y * x;
} else if ((y * x) <= -5e-44) {
tmp = i * c;
} else if ((y * x) <= -1e-199) {
tmp = t * z;
} else if ((y * x) <= 1e-265) {
tmp = b * a;
} else if ((y * x) <= 5e-84) {
tmp = t * z;
} else if ((y * x) <= 5e+34) {
tmp = i * c;
} else {
tmp = y * x;
}
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 ((y * x) <= (-5d+97)) then
tmp = y * x
else if ((y * x) <= (-5d-44)) then
tmp = i * c
else if ((y * x) <= (-1d-199)) then
tmp = t * z
else if ((y * x) <= 1d-265) then
tmp = b * a
else if ((y * x) <= 5d-84) then
tmp = t * z
else if ((y * x) <= 5d+34) then
tmp = i * c
else
tmp = y * x
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 ((y * x) <= -5e+97) {
tmp = y * x;
} else if ((y * x) <= -5e-44) {
tmp = i * c;
} else if ((y * x) <= -1e-199) {
tmp = t * z;
} else if ((y * x) <= 1e-265) {
tmp = b * a;
} else if ((y * x) <= 5e-84) {
tmp = t * z;
} else if ((y * x) <= 5e+34) {
tmp = i * c;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (y * x) <= -5e+97: tmp = y * x elif (y * x) <= -5e-44: tmp = i * c elif (y * x) <= -1e-199: tmp = t * z elif (y * x) <= 1e-265: tmp = b * a elif (y * x) <= 5e-84: tmp = t * z elif (y * x) <= 5e+34: tmp = i * c else: tmp = y * x return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(y * x) <= -5e+97) tmp = Float64(y * x); elseif (Float64(y * x) <= -5e-44) tmp = Float64(i * c); elseif (Float64(y * x) <= -1e-199) tmp = Float64(t * z); elseif (Float64(y * x) <= 1e-265) tmp = Float64(b * a); elseif (Float64(y * x) <= 5e-84) tmp = Float64(t * z); elseif (Float64(y * x) <= 5e+34) tmp = Float64(i * c); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((y * x) <= -5e+97) tmp = y * x; elseif ((y * x) <= -5e-44) tmp = i * c; elseif ((y * x) <= -1e-199) tmp = t * z; elseif ((y * x) <= 1e-265) tmp = b * a; elseif ((y * x) <= 5e-84) tmp = t * z; elseif ((y * x) <= 5e+34) tmp = i * c; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(y * x), $MachinePrecision], -5e+97], N[(y * x), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], -5e-44], N[(i * c), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], -1e-199], N[(t * z), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], 1e-265], N[(b * a), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], 5e-84], N[(t * z), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], 5e+34], N[(i * c), $MachinePrecision], N[(y * x), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot x \leq -5 \cdot 10^{+97}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \cdot x \leq -5 \cdot 10^{-44}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;y \cdot x \leq -1 \cdot 10^{-199}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;y \cdot x \leq 10^{-265}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;y \cdot x \leq 5 \cdot 10^{-84}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;y \cdot x \leq 5 \cdot 10^{+34}:\\
\;\;\;\;i \cdot c\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999999e97 or 4.9999999999999998e34 < (*.f64 x y) Initial program 91.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6462.0
Applied rewrites62.0%
if -4.99999999999999999e97 < (*.f64 x y) < -5.00000000000000039e-44 or 5.0000000000000002e-84 < (*.f64 x y) < 4.9999999999999998e34Initial program 93.5%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6459.0
Applied rewrites59.0%
if -5.00000000000000039e-44 < (*.f64 x y) < -9.99999999999999982e-200 or 9.99999999999999985e-266 < (*.f64 x y) < 5.0000000000000002e-84Initial program 97.8%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6460.9
Applied rewrites60.9%
if -9.99999999999999982e-200 < (*.f64 x y) < 9.99999999999999985e-266Initial program 98.1%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6445.3
Applied rewrites45.3%
Final simplification57.7%
(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 -1e+97)
t_1
(if (<= t_2 4e+41)
(fma i c (* b a))
(if (<= t_2 2e+112) (fma y x (* 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 <= -1e+97) {
tmp = t_1;
} else if (t_2 <= 4e+41) {
tmp = fma(i, c, (b * a));
} else if (t_2 <= 2e+112) {
tmp = fma(y, x, (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 <= -1e+97) tmp = t_1; elseif (t_2 <= 4e+41) tmp = fma(i, c, Float64(b * a)); elseif (t_2 <= 2e+112) tmp = fma(y, x, 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, -1e+97], t$95$1, If[LessEqual[t$95$2, 4e+41], N[(i * c + N[(b * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+112], N[(y * x + 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 -1 \cdot 10^{+97}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+41}:\\
\;\;\;\;\mathsf{fma}\left(i, c, b \cdot a\right)\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+112}:\\
\;\;\;\;\mathsf{fma}\left(y, x, b \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -1.0000000000000001e97 or 1.9999999999999999e112 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 92.6%
Taylor expanded in b 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 c around 0
Applied rewrites79.9%
if -1.0000000000000001e97 < (+.f64 (*.f64 x y) (*.f64 z t)) < 4.00000000000000002e41Initial program 96.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6487.2
Applied rewrites87.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6489.5
Applied rewrites89.5%
if 4.00000000000000002e41 < (+.f64 (*.f64 x y) (*.f64 z t)) < 1.9999999999999999e112Initial program 99.9%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6496.0
Applied rewrites96.0%
Taylor expanded in t around 0
Applied rewrites82.1%
Final simplification83.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma i c (* y x))) (t_2 (fma b a (* t z))))
(if (<= (* b a) -2e+68)
t_2
(if (<= (* b a) -1e-275)
t_1
(if (<= (* b a) 2e-148)
(fma y x (* t z))
(if (<= (* b a) 5e+90) t_1 t_2))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(i, c, (y * x));
double t_2 = fma(b, a, (t * z));
double tmp;
if ((b * a) <= -2e+68) {
tmp = t_2;
} else if ((b * a) <= -1e-275) {
tmp = t_1;
} else if ((b * a) <= 2e-148) {
tmp = fma(y, x, (t * z));
} else if ((b * a) <= 5e+90) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(i, c, Float64(y * x)) t_2 = fma(b, a, Float64(t * z)) tmp = 0.0 if (Float64(b * a) <= -2e+68) tmp = t_2; elseif (Float64(b * a) <= -1e-275) tmp = t_1; elseif (Float64(b * a) <= 2e-148) tmp = fma(y, x, Float64(t * z)); elseif (Float64(b * a) <= 5e+90) tmp = t_1; else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(b * a), $MachinePrecision], -2e+68], t$95$2, If[LessEqual[N[(b * a), $MachinePrecision], -1e-275], t$95$1, If[LessEqual[N[(b * a), $MachinePrecision], 2e-148], N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(b * a), $MachinePrecision], 5e+90], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(i, c, y \cdot x\right)\\
t_2 := \mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{if}\;b \cdot a \leq -2 \cdot 10^{+68}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;b \cdot a \leq -1 \cdot 10^{-275}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;b \cdot a \leq 2 \cdot 10^{-148}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right)\\
\mathbf{elif}\;b \cdot a \leq 5 \cdot 10^{+90}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 a b) < -1.99999999999999991e68 or 5.0000000000000004e90 < (*.f64 a b) Initial program 88.5%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6487.2
Applied rewrites87.2%
Taylor expanded in t around inf
Applied rewrites78.0%
if -1.99999999999999991e68 < (*.f64 a b) < -9.99999999999999934e-276 or 1.99999999999999987e-148 < (*.f64 a b) < 5.0000000000000004e90Initial program 98.1%
Taylor expanded in b around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.8
Applied rewrites89.8%
Taylor expanded in t around 0
Applied rewrites73.3%
if -9.99999999999999934e-276 < (*.f64 a b) < 1.99999999999999987e-148Initial program 98.1%
Taylor expanded in b 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 c around 0
Applied rewrites86.6%
Final simplification77.8%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma b a (fma y x (* t z)))) (t_2 (+ (* t z) (* y x)))) (if (<= t_2 -1e+97) t_1 (if (<= t_2 4e+41) (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(b, a, fma(y, x, (t * z)));
double t_2 = (t * z) + (y * x);
double tmp;
if (t_2 <= -1e+97) {
tmp = t_1;
} else if (t_2 <= 4e+41) {
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(b, a, fma(y, x, Float64(t * z))) t_2 = Float64(Float64(t * z) + Float64(y * x)) tmp = 0.0 if (t_2 <= -1e+97) tmp = t_1; elseif (t_2 <= 4e+41) 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[(b * a + N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(t * z), $MachinePrecision] + N[(y * x), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -1e+97], t$95$1, If[LessEqual[t$95$2, 4e+41], N[(i * c + N[(b * a), $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)\\
t_2 := t \cdot z + y \cdot x\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+97}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 4 \cdot 10^{+41}:\\
\;\;\;\;\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)) < -1.0000000000000001e97 or 4.00000000000000002e41 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 93.4%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6488.8
Applied rewrites88.8%
if -1.0000000000000001e97 < (+.f64 (*.f64 x y) (*.f64 z t)) < 4.00000000000000002e41Initial program 96.6%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6487.2
Applied rewrites87.2%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6489.5
Applied rewrites89.5%
Final simplification89.1%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* y x) -5e+97)
(* y x)
(if (<= (* y x) -2e-9)
(* i c)
(if (<= (* y x) 5e-247)
(* b a)
(if (<= (* y x) 5e+34) (* i c) (* y x))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((y * x) <= -5e+97) {
tmp = y * x;
} else if ((y * x) <= -2e-9) {
tmp = i * c;
} else if ((y * x) <= 5e-247) {
tmp = b * a;
} else if ((y * x) <= 5e+34) {
tmp = i * c;
} else {
tmp = y * x;
}
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 ((y * x) <= (-5d+97)) then
tmp = y * x
else if ((y * x) <= (-2d-9)) then
tmp = i * c
else if ((y * x) <= 5d-247) then
tmp = b * a
else if ((y * x) <= 5d+34) then
tmp = i * c
else
tmp = y * x
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 ((y * x) <= -5e+97) {
tmp = y * x;
} else if ((y * x) <= -2e-9) {
tmp = i * c;
} else if ((y * x) <= 5e-247) {
tmp = b * a;
} else if ((y * x) <= 5e+34) {
tmp = i * c;
} else {
tmp = y * x;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (y * x) <= -5e+97: tmp = y * x elif (y * x) <= -2e-9: tmp = i * c elif (y * x) <= 5e-247: tmp = b * a elif (y * x) <= 5e+34: tmp = i * c else: tmp = y * x return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(y * x) <= -5e+97) tmp = Float64(y * x); elseif (Float64(y * x) <= -2e-9) tmp = Float64(i * c); elseif (Float64(y * x) <= 5e-247) tmp = Float64(b * a); elseif (Float64(y * x) <= 5e+34) tmp = Float64(i * c); else tmp = Float64(y * x); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((y * x) <= -5e+97) tmp = y * x; elseif ((y * x) <= -2e-9) tmp = i * c; elseif ((y * x) <= 5e-247) tmp = b * a; elseif ((y * x) <= 5e+34) tmp = i * c; else tmp = y * x; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(y * x), $MachinePrecision], -5e+97], N[(y * x), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], -2e-9], N[(i * c), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], 5e-247], N[(b * a), $MachinePrecision], If[LessEqual[N[(y * x), $MachinePrecision], 5e+34], N[(i * c), $MachinePrecision], N[(y * x), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y \cdot x \leq -5 \cdot 10^{+97}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;y \cdot x \leq -2 \cdot 10^{-9}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;y \cdot x \leq 5 \cdot 10^{-247}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;y \cdot x \leq 5 \cdot 10^{+34}:\\
\;\;\;\;i \cdot c\\
\mathbf{else}:\\
\;\;\;\;y \cdot x\\
\end{array}
\end{array}
if (*.f64 x y) < -4.99999999999999999e97 or 4.9999999999999998e34 < (*.f64 x y) Initial program 91.7%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6462.0
Applied rewrites62.0%
if -4.99999999999999999e97 < (*.f64 x y) < -2.00000000000000012e-9 or 4.99999999999999978e-247 < (*.f64 x y) < 4.9999999999999998e34Initial program 94.5%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6449.9
Applied rewrites49.9%
if -2.00000000000000012e-9 < (*.f64 x y) < 4.99999999999999978e-247Initial program 97.8%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6440.7
Applied rewrites40.7%
Final simplification51.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma y x (* t z))))
(if (<= (* t z) -1.4e+97)
(fma b a t_1)
(if (<= (* t z) 5e+43) (+ (fma y x (* b a)) (* i c)) (fma i c 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 tmp;
if ((t * z) <= -1.4e+97) {
tmp = fma(b, a, t_1);
} else if ((t * z) <= 5e+43) {
tmp = fma(y, x, (b * a)) + (i * c);
} else {
tmp = fma(i, c, t_1);
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(y, x, Float64(t * z)) tmp = 0.0 if (Float64(t * z) <= -1.4e+97) tmp = fma(b, a, t_1); elseif (Float64(t * z) <= 5e+43) tmp = Float64(fma(y, x, Float64(b * a)) + Float64(i * c)); else tmp = fma(i, c, 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]}, If[LessEqual[N[(t * z), $MachinePrecision], -1.4e+97], N[(b * a + t$95$1), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 5e+43], N[(N[(y * x + N[(b * a), $MachinePrecision]), $MachinePrecision] + N[(i * c), $MachinePrecision]), $MachinePrecision], N[(i * c + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, t \cdot z\right)\\
\mathbf{if}\;t \cdot z \leq -1.4 \cdot 10^{+97}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t\_1\right)\\
\mathbf{elif}\;t \cdot z \leq 5 \cdot 10^{+43}:\\
\;\;\;\;\mathsf{fma}\left(y, x, b \cdot a\right) + i \cdot c\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, c, t\_1\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -1.4e97Initial program 87.7%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6494.0
Applied rewrites94.0%
if -1.4e97 < (*.f64 z t) < 5.0000000000000004e43Initial program 96.8%
Taylor expanded in t around 0
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6492.7
Applied rewrites92.7%
if 5.0000000000000004e43 < (*.f64 z t) Initial program 93.8%
Taylor expanded in b around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6495.1
Applied rewrites95.1%
Final simplification93.4%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma y x (* t z))) (t_2 (fma i c t_1))) (if (<= (* i c) -1e+100) t_2 (if (<= (* i c) 2e+19) (fma b a t_1) t_2))))
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 = fma(i, c, t_1);
double tmp;
if ((i * c) <= -1e+100) {
tmp = t_2;
} else if ((i * c) <= 2e+19) {
tmp = fma(b, a, t_1);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(y, x, Float64(t * z)) t_2 = fma(i, c, t_1) tmp = 0.0 if (Float64(i * c) <= -1e+100) tmp = t_2; elseif (Float64(i * c) <= 2e+19) tmp = fma(b, a, t_1); else tmp = t_2; 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[(i * c + t$95$1), $MachinePrecision]}, If[LessEqual[N[(i * c), $MachinePrecision], -1e+100], t$95$2, If[LessEqual[N[(i * c), $MachinePrecision], 2e+19], N[(b * a + t$95$1), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, t \cdot z\right)\\
t_2 := \mathsf{fma}\left(i, c, t\_1\right)\\
\mathbf{if}\;i \cdot c \leq -1 \cdot 10^{+100}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;i \cdot c \leq 2 \cdot 10^{+19}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 c i) < -1.00000000000000002e100 or 2e19 < (*.f64 c i) Initial program 91.9%
Taylor expanded in b 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.00000000000000002e100 < (*.f64 c i) < 2e19Initial program 96.5%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6494.7
Applied rewrites94.7%
Final simplification92.6%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* t z) -7.5e+82) (fma b a (* t z)) (if (<= (* t z) 6.3e+62) (fma y x (* 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 tmp;
if ((t * z) <= -7.5e+82) {
tmp = fma(b, a, (t * z));
} else if ((t * z) <= 6.3e+62) {
tmp = fma(y, x, (b * a));
} else {
tmp = fma(y, x, (t * z));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(t * z) <= -7.5e+82) tmp = fma(b, a, Float64(t * z)); elseif (Float64(t * z) <= 6.3e+62) tmp = fma(y, x, Float64(b * a)); else tmp = fma(y, x, Float64(t * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(t * z), $MachinePrecision], -7.5e+82], N[(b * a + N[(t * z), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 6.3e+62], N[(y * x + N[(b * a), $MachinePrecision]), $MachinePrecision], N[(y * x + N[(t * z), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -7.5 \cdot 10^{+82}:\\
\;\;\;\;\mathsf{fma}\left(b, a, t \cdot z\right)\\
\mathbf{elif}\;t \cdot z \leq 6.3 \cdot 10^{+62}:\\
\;\;\;\;\mathsf{fma}\left(y, x, b \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(y, x, t \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -7.4999999999999999e82Initial program 88.6%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6490.8
Applied rewrites90.8%
Taylor expanded in t around inf
Applied rewrites83.5%
if -7.4999999999999999e82 < (*.f64 z t) < 6.29999999999999998e62Initial program 96.8%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6467.5
Applied rewrites67.5%
Taylor expanded in t around 0
Applied rewrites64.1%
if 6.29999999999999998e62 < (*.f64 z t) Initial program 93.2%
Taylor expanded in b around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6496.8
Applied rewrites96.8%
Taylor expanded in c around 0
Applied rewrites83.7%
Final simplification71.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma y x (* t z))))
(if (<= (* t z) -1.45e+97)
t_1
(if (<= (* t z) 6.3e+62) (fma y x (* 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 tmp;
if ((t * z) <= -1.45e+97) {
tmp = t_1;
} else if ((t * z) <= 6.3e+62) {
tmp = fma(y, x, (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)) tmp = 0.0 if (Float64(t * z) <= -1.45e+97) tmp = t_1; elseif (Float64(t * z) <= 6.3e+62) tmp = fma(y, x, 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]}, If[LessEqual[N[(t * z), $MachinePrecision], -1.45e+97], t$95$1, If[LessEqual[N[(t * z), $MachinePrecision], 6.3e+62], N[(y * x + 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)\\
\mathbf{if}\;t \cdot z \leq -1.45 \cdot 10^{+97}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t \cdot z \leq 6.3 \cdot 10^{+62}:\\
\;\;\;\;\mathsf{fma}\left(y, x, b \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -1.44999999999999994e97 or 6.29999999999999998e62 < (*.f64 z t) Initial program 90.3%
Taylor expanded in b around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6491.1
Applied rewrites91.1%
Taylor expanded in c around 0
Applied rewrites83.9%
if -1.44999999999999994e97 < (*.f64 z t) < 6.29999999999999998e62Initial program 96.9%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6467.1
Applied rewrites67.1%
Taylor expanded in t around 0
Applied rewrites63.6%
Final simplification71.0%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* t z) -1.35e+158) (* t z) (if (<= (* t z) 2e+115) (fma y x (* 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) <= -1.35e+158) {
tmp = t * z;
} else if ((t * z) <= 2e+115) {
tmp = fma(y, x, (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) <= -1.35e+158) tmp = Float64(t * z); elseif (Float64(t * z) <= 2e+115) tmp = fma(y, x, Float64(b * a)); 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.35e+158], N[(t * z), $MachinePrecision], If[LessEqual[N[(t * z), $MachinePrecision], 2e+115], N[(y * x + N[(b * a), $MachinePrecision]), $MachinePrecision], N[(t * z), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;t \cdot z \leq -1.35 \cdot 10^{+158}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;t \cdot z \leq 2 \cdot 10^{+115}:\\
\;\;\;\;\mathsf{fma}\left(y, x, b \cdot a\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < -1.34999999999999989e158 or 2e115 < (*.f64 z t) Initial program 88.5%
Taylor expanded in t around inf
*-commutativeN/A
lower-*.f6477.2
Applied rewrites77.2%
if -1.34999999999999989e158 < (*.f64 z t) < 2e115Initial program 97.1%
Taylor expanded in c around 0
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6468.8
Applied rewrites68.8%
Taylor expanded in t around 0
Applied rewrites63.8%
Final simplification67.9%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* i c) -1e+100) (* i c) (if (<= (* i c) 5e+22) (* b a) (* i c))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((i * c) <= -1e+100) {
tmp = i * c;
} else if ((i * c) <= 5e+22) {
tmp = b * a;
} else {
tmp = i * c;
}
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 ((i * c) <= (-1d+100)) then
tmp = i * c
else if ((i * c) <= 5d+22) then
tmp = b * a
else
tmp = i * c
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 ((i * c) <= -1e+100) {
tmp = i * c;
} else if ((i * c) <= 5e+22) {
tmp = b * a;
} else {
tmp = i * c;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (i * c) <= -1e+100: tmp = i * c elif (i * c) <= 5e+22: tmp = b * a else: tmp = i * c return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(i * c) <= -1e+100) tmp = Float64(i * c); elseif (Float64(i * c) <= 5e+22) tmp = Float64(b * a); else tmp = Float64(i * c); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((i * c) <= -1e+100) tmp = i * c; elseif ((i * c) <= 5e+22) tmp = b * a; else tmp = i * c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(i * c), $MachinePrecision], -1e+100], N[(i * c), $MachinePrecision], If[LessEqual[N[(i * c), $MachinePrecision], 5e+22], N[(b * a), $MachinePrecision], N[(i * c), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;i \cdot c \leq -1 \cdot 10^{+100}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;i \cdot c \leq 5 \cdot 10^{+22}:\\
\;\;\;\;b \cdot a\\
\mathbf{else}:\\
\;\;\;\;i \cdot c\\
\end{array}
\end{array}
if (*.f64 c i) < -1.00000000000000002e100 or 4.9999999999999996e22 < (*.f64 c i) Initial program 91.8%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6455.9
Applied rewrites55.9%
if -1.00000000000000002e100 < (*.f64 c i) < 4.9999999999999996e22Initial program 96.5%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6435.4
Applied rewrites35.4%
Final simplification44.2%
(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 94.5%
Taylor expanded in b around inf
*-commutativeN/A
lower-*.f6426.2
Applied rewrites26.2%
herbie shell --seed 2024249
(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)))