
(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 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b c i) :precision binary64 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = (((x * y) + (z * t)) + (a * b)) + (c * i)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return (((x * y) + (z * t)) + (a * b)) + (c * i);
}
def code(x, y, z, t, a, b, c, i): return (((x * y) + (z * t)) + (a * b)) + (c * i)
function code(x, y, z, t, a, b, c, i) return Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = (((x * y) + (z * t)) + (a * b)) + (c * i); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i
\end{array}
(FPCore (x y z t a b c i) :precision binary64 (fma z t (fma y x (fma i c (* b a)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(z, t, fma(y, x, fma(i, c, (b * a))));
}
function code(x, y, z, t, a, b, c, i) return fma(z, t, fma(y, x, fma(i, c, Float64(b * a)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(z * t + N[(y * x + N[(i * c + N[(b * a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, t, \mathsf{fma}\left(y, x, \mathsf{fma}\left(i, c, b \cdot a\right)\right)\right)
\end{array}
Initial program 94.5%
lift-+.f64N/A
lift-+.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6496.5
lift-*.f64N/A
*-commutativeN/A
lower-*.f6496.5
Applied rewrites96.5%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -5e+114)
(* i c)
(if (<= (* c i) -0.2)
(* t z)
(if (<= (* c i) -2e-80)
(* b a)
(if (<= (* c i) -1e-246)
(* y x)
(if (<= (* c i) 2e-143)
(* t z)
(if (<= (* c i) 5e+137) (* y x) (* i c))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -5e+114) {
tmp = i * c;
} else if ((c * i) <= -0.2) {
tmp = t * z;
} else if ((c * i) <= -2e-80) {
tmp = b * a;
} else if ((c * i) <= -1e-246) {
tmp = y * x;
} else if ((c * i) <= 2e-143) {
tmp = t * z;
} else if ((c * i) <= 5e+137) {
tmp = y * x;
} 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 ((c * i) <= (-5d+114)) then
tmp = i * c
else if ((c * i) <= (-0.2d0)) then
tmp = t * z
else if ((c * i) <= (-2d-80)) then
tmp = b * a
else if ((c * i) <= (-1d-246)) then
tmp = y * x
else if ((c * i) <= 2d-143) then
tmp = t * z
else if ((c * i) <= 5d+137) then
tmp = y * x
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 ((c * i) <= -5e+114) {
tmp = i * c;
} else if ((c * i) <= -0.2) {
tmp = t * z;
} else if ((c * i) <= -2e-80) {
tmp = b * a;
} else if ((c * i) <= -1e-246) {
tmp = y * x;
} else if ((c * i) <= 2e-143) {
tmp = t * z;
} else if ((c * i) <= 5e+137) {
tmp = y * x;
} else {
tmp = i * c;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -5e+114: tmp = i * c elif (c * i) <= -0.2: tmp = t * z elif (c * i) <= -2e-80: tmp = b * a elif (c * i) <= -1e-246: tmp = y * x elif (c * i) <= 2e-143: tmp = t * z elif (c * i) <= 5e+137: tmp = y * x else: tmp = i * c return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -5e+114) tmp = Float64(i * c); elseif (Float64(c * i) <= -0.2) tmp = Float64(t * z); elseif (Float64(c * i) <= -2e-80) tmp = Float64(b * a); elseif (Float64(c * i) <= -1e-246) tmp = Float64(y * x); elseif (Float64(c * i) <= 2e-143) tmp = Float64(t * z); elseif (Float64(c * i) <= 5e+137) tmp = Float64(y * x); 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 ((c * i) <= -5e+114) tmp = i * c; elseif ((c * i) <= -0.2) tmp = t * z; elseif ((c * i) <= -2e-80) tmp = b * a; elseif ((c * i) <= -1e-246) tmp = y * x; elseif ((c * i) <= 2e-143) tmp = t * z; elseif ((c * i) <= 5e+137) tmp = y * x; else tmp = i * c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -5e+114], N[(i * c), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -0.2], N[(t * z), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -2e-80], N[(b * a), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -1e-246], N[(y * x), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2e-143], N[(t * z), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 5e+137], N[(y * x), $MachinePrecision], N[(i * c), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -5 \cdot 10^{+114}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;c \cdot i \leq -0.2:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;c \cdot i \leq -2 \cdot 10^{-80}:\\
\;\;\;\;b \cdot a\\
\mathbf{elif}\;c \cdot i \leq -1 \cdot 10^{-246}:\\
\;\;\;\;y \cdot x\\
\mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{-143}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;c \cdot i \leq 5 \cdot 10^{+137}:\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;i \cdot c\\
\end{array}
\end{array}
if (*.f64 c i) < -5.0000000000000001e114 or 5.0000000000000002e137 < (*.f64 c i) Initial program 88.6%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6465.9
Applied rewrites65.9%
if -5.0000000000000001e114 < (*.f64 c i) < -0.20000000000000001 or -9.99999999999999956e-247 < (*.f64 c i) < 1.9999999999999999e-143Initial program 95.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6474.8
Applied rewrites74.8%
Taylor expanded in c around 0
Applied rewrites70.5%
Taylor expanded in z around 0
Applied rewrites29.0%
Taylor expanded in z around inf
lower-*.f6446.6
Applied rewrites46.6%
if -0.20000000000000001 < (*.f64 c i) < -1.99999999999999992e-80Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6484.9
Applied rewrites84.9%
Taylor expanded in c around 0
Applied rewrites77.5%
Taylor expanded in z around 0
Applied rewrites70.6%
if -1.99999999999999992e-80 < (*.f64 c i) < -9.99999999999999956e-247 or 1.9999999999999999e-143 < (*.f64 c i) < 5.0000000000000002e137Initial program 100.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6455.7
Applied rewrites55.7%
Taylor expanded in c around 0
Applied rewrites45.5%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6444.4
Applied rewrites44.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* z t) -1e+94) (not (<= (* z t) 5e+141))) (fma b a (fma i c (* t z))) (fma b a (fma 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 (((z * t) <= -1e+94) || !((z * t) <= 5e+141)) {
tmp = fma(b, a, fma(i, c, (t * z)));
} else {
tmp = fma(b, a, fma(i, c, (y * x)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(z * t) <= -1e+94) || !(Float64(z * t) <= 5e+141)) tmp = fma(b, a, fma(i, c, Float64(t * z))); else tmp = fma(b, a, fma(i, c, Float64(y * x))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], -1e+94], N[Not[LessEqual[N[(z * t), $MachinePrecision], 5e+141]], $MachinePrecision]], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+94} \lor \neg \left(z \cdot t \leq 5 \cdot 10^{+141}\right):\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, y \cdot x\right)\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -1e94 or 5.00000000000000025e141 < (*.f64 z t) Initial program 90.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6486.3
Applied rewrites86.3%
if -1e94 < (*.f64 z t) < 5.00000000000000025e141Initial program 97.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6493.0
Applied rewrites93.0%
Final simplification90.6%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* z t) -1e+94)
(fma b a (fma i c (* t z)))
(if (<= (* z t) 1e+103)
(fma b a (fma i c (* y x)))
(fma i c (fma t z (* y x))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -1e+94) {
tmp = fma(b, a, fma(i, c, (t * z)));
} else if ((z * t) <= 1e+103) {
tmp = fma(b, a, fma(i, c, (y * x)));
} else {
tmp = fma(i, c, fma(t, z, (y * x)));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -1e+94) tmp = fma(b, a, fma(i, c, Float64(t * z))); elseif (Float64(z * t) <= 1e+103) tmp = fma(b, a, fma(i, c, Float64(y * x))); else tmp = fma(i, c, fma(t, z, Float64(y * x))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -1e+94], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+103], N[(b * a + N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(i * c + N[(t * z + N[(y * x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+94}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{+103}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, y \cdot x\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, c, \mathsf{fma}\left(t, z, y \cdot x\right)\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -1e94Initial program 93.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6486.4
Applied rewrites86.4%
if -1e94 < (*.f64 z t) < 1e103Initial program 96.8%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6494.0
Applied rewrites94.0%
if 1e103 < (*.f64 z t) Initial program 87.5%
Taylor expanded in a around 0
*-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6485.5
Applied rewrites85.5%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* x y) -1e+211) (fma y x (* b a)) (if (<= (* x y) 2e+244) (fma b a (fma i c (* 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 ((x * y) <= -1e+211) {
tmp = fma(y, x, (b * a));
} else if ((x * y) <= 2e+244) {
tmp = fma(b, a, fma(i, c, (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(x * y) <= -1e+211) tmp = fma(y, x, Float64(b * a)); elseif (Float64(x * y) <= 2e+244) tmp = fma(b, a, fma(i, c, 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[(x * y), $MachinePrecision], -1e+211], N[(y * x + N[(b * a), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+244], N[(b * a + N[(i * c + N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+211}:\\
\;\;\;\;\mathsf{fma}\left(y, x, b \cdot a\right)\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+244}:\\
\;\;\;\;\mathsf{fma}\left(b, a, \mathsf{fma}\left(i, c, t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -9.9999999999999996e210Initial program 90.3%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6490.9
Applied rewrites90.9%
Taylor expanded in x around 0
Applied rewrites11.6%
Taylor expanded in c around 0
Applied rewrites90.9%
Applied rewrites91.0%
if -9.9999999999999996e210 < (*.f64 x y) < 2.00000000000000015e244Initial program 96.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6488.8
Applied rewrites88.8%
if 2.00000000000000015e244 < (*.f64 x y) Initial program 88.8%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6489.2
Applied rewrites89.2%
Taylor expanded in x around 0
Applied rewrites22.5%
Taylor expanded in c around 0
Applied rewrites85.9%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -5e+63) (* t z) (if (<= (* z t) 4e-274) (* i c) (if (<= (* z t) 1e+103) (* 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 ((z * t) <= -5e+63) {
tmp = t * z;
} else if ((z * t) <= 4e-274) {
tmp = i * c;
} else if ((z * t) <= 1e+103) {
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 ((z * t) <= (-5d+63)) then
tmp = t * z
else if ((z * t) <= 4d-274) then
tmp = i * c
else if ((z * t) <= 1d+103) 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 ((z * t) <= -5e+63) {
tmp = t * z;
} else if ((z * t) <= 4e-274) {
tmp = i * c;
} else if ((z * t) <= 1e+103) {
tmp = b * a;
} else {
tmp = t * z;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z * t) <= -5e+63: tmp = t * z elif (z * t) <= 4e-274: tmp = i * c elif (z * t) <= 1e+103: tmp = b * a else: tmp = t * z return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -5e+63) tmp = Float64(t * z); elseif (Float64(z * t) <= 4e-274) tmp = Float64(i * c); elseif (Float64(z * t) <= 1e+103) 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 ((z * t) <= -5e+63) tmp = t * z; elseif ((z * t) <= 4e-274) tmp = i * c; elseif ((z * t) <= 1e+103) tmp = b * a; else tmp = t * z; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+63], N[(t * z), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 4e-274], N[(i * c), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+103], N[(b * a), $MachinePrecision], N[(t * z), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+63}:\\
\;\;\;\;t \cdot z\\
\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{-274}:\\
\;\;\;\;i \cdot c\\
\mathbf{elif}\;z \cdot t \leq 10^{+103}:\\
\;\;\;\;b \cdot a\\
\mathbf{else}:\\
\;\;\;\;t \cdot z\\
\end{array}
\end{array}
if (*.f64 z t) < -5.00000000000000011e63 or 1e103 < (*.f64 z t) Initial program 91.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6483.6
Applied rewrites83.6%
Taylor expanded in c around 0
Applied rewrites74.9%
Taylor expanded in z around 0
Applied rewrites17.0%
Taylor expanded in z around inf
lower-*.f6462.9
Applied rewrites62.9%
if -5.00000000000000011e63 < (*.f64 z t) < 3.99999999999999986e-274Initial program 96.6%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6443.2
Applied rewrites43.2%
if 3.99999999999999986e-274 < (*.f64 z t) < 1e103Initial program 97.1%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6472.9
Applied rewrites72.9%
Taylor expanded in c around 0
Applied rewrites44.5%
Taylor expanded in z around 0
Applied rewrites36.1%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* a b) -2e+141) (not (<= (* a b) 1e+18))) (fma a b (* t z)) (fma 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 (((a * b) <= -2e+141) || !((a * b) <= 1e+18)) {
tmp = fma(a, b, (t * z));
} else {
tmp = fma(i, c, (y * x));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(a * b) <= -2e+141) || !(Float64(a * b) <= 1e+18)) tmp = fma(a, b, Float64(t * z)); else tmp = fma(i, c, Float64(y * x)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -2e+141], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1e+18]], $MachinePrecision]], N[(a * b + N[(t * z), $MachinePrecision]), $MachinePrecision], N[(i * c + N[(y * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+141} \lor \neg \left(a \cdot b \leq 10^{+18}\right):\\
\;\;\;\;\mathsf{fma}\left(a, b, t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, c, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -2.00000000000000003e141 or 1e18 < (*.f64 a b) Initial program 93.3%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6486.6
Applied rewrites86.6%
Taylor expanded in c around 0
Applied rewrites75.4%
if -2.00000000000000003e141 < (*.f64 a b) < 1e18Initial program 95.4%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6473.7
Applied rewrites73.7%
Taylor expanded in x around 0
Applied rewrites41.7%
Taylor expanded in c around 0
Applied rewrites40.8%
Taylor expanded in a around 0
Applied rewrites68.8%
Final simplification71.5%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* z t) -1e+94) (not (<= (* z t) 5e+142))) (fma a b (* 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 (((z * t) <= -1e+94) || !((z * t) <= 5e+142)) {
tmp = fma(a, b, (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(z * t) <= -1e+94) || !(Float64(z * t) <= 5e+142)) tmp = fma(a, b, 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[Or[LessEqual[N[(z * t), $MachinePrecision], -1e+94], N[Not[LessEqual[N[(z * t), $MachinePrecision], 5e+142]], $MachinePrecision]], N[(a * b + N[(t * z), $MachinePrecision]), $MachinePrecision], N[(b * a + N[(y * x), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+94} \lor \neg \left(z \cdot t \leq 5 \cdot 10^{+142}\right):\\
\;\;\;\;\mathsf{fma}\left(a, b, t \cdot z\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(b, a, y \cdot x\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -1e94 or 5.0000000000000001e142 < (*.f64 z t) Initial program 90.0%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6486.1
Applied rewrites86.1%
Taylor expanded in c around 0
Applied rewrites78.6%
if -1e94 < (*.f64 z t) < 5.0000000000000001e142Initial program 97.0%
Taylor expanded in z around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-*.f6492.9
Applied rewrites92.9%
Taylor expanded in x around 0
Applied rewrites63.7%
Taylor expanded in c around 0
Applied rewrites60.4%
Final simplification66.8%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -2e+169) (not (<= (* x y) 5e+282))) (* y x) (fma a b (* t z))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -2e+169) || !((x * y) <= 5e+282)) {
tmp = y * x;
} else {
tmp = fma(a, b, (t * z));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -2e+169) || !(Float64(x * y) <= 5e+282)) tmp = Float64(y * x); else tmp = fma(a, b, Float64(t * z)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -2e+169], N[Not[LessEqual[N[(x * y), $MachinePrecision], 5e+282]], $MachinePrecision]], N[(y * x), $MachinePrecision], N[(a * b + N[(t * z), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+169} \lor \neg \left(x \cdot y \leq 5 \cdot 10^{+282}\right):\\
\;\;\;\;y \cdot x\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, b, t \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.99999999999999987e169 or 4.99999999999999978e282 < (*.f64 x y) Initial program 89.8%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6429.1
Applied rewrites29.1%
Taylor expanded in c around 0
Applied rewrites20.8%
Taylor expanded in x around inf
*-commutativeN/A
lower-*.f6478.2
Applied rewrites78.2%
if -1.99999999999999987e169 < (*.f64 x y) < 4.99999999999999978e282Initial program 95.9%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6489.0
Applied rewrites89.0%
Taylor expanded in c around 0
Applied rewrites59.5%
Final simplification63.8%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* a b) -2e+141) (not (<= (* a b) 4e+159))) (* 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 (((a * b) <= -2e+141) || !((a * b) <= 4e+159)) {
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 (((a * b) <= (-2d+141)) .or. (.not. ((a * b) <= 4d+159))) 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 (((a * b) <= -2e+141) || !((a * b) <= 4e+159)) {
tmp = b * a;
} else {
tmp = i * c;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((a * b) <= -2e+141) or not ((a * b) <= 4e+159): tmp = b * a else: tmp = i * c return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(a * b) <= -2e+141) || !(Float64(a * b) <= 4e+159)) 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 (((a * b) <= -2e+141) || ~(((a * b) <= 4e+159))) tmp = b * a; else tmp = i * c; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -2e+141], N[Not[LessEqual[N[(a * b), $MachinePrecision], 4e+159]], $MachinePrecision]], N[(b * a), $MachinePrecision], N[(i * c), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{+141} \lor \neg \left(a \cdot b \leq 4 \cdot 10^{+159}\right):\\
\;\;\;\;b \cdot a\\
\mathbf{else}:\\
\;\;\;\;i \cdot c\\
\end{array}
\end{array}
if (*.f64 a b) < -2.00000000000000003e141 or 3.9999999999999997e159 < (*.f64 a b) Initial program 91.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6488.5
Applied rewrites88.5%
Taylor expanded in c around 0
Applied rewrites80.1%
Taylor expanded in z around 0
Applied rewrites61.6%
if -2.00000000000000003e141 < (*.f64 a b) < 3.9999999999999997e159Initial program 95.9%
Taylor expanded in c around inf
*-commutativeN/A
lower-*.f6435.4
Applied rewrites35.4%
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 94.5%
Taylor expanded in x around 0
*-commutativeN/A
lower-fma.f64N/A
*-commutativeN/A
lower-fma.f64N/A
lower-*.f6475.2
Applied rewrites75.2%
Taylor expanded in c around 0
Applied rewrites50.6%
Taylor expanded in z around 0
Applied rewrites25.2%
herbie shell --seed 2024318
(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)))