
(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 x y (fma a b (* c i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(z, t, fma(x, y, fma(a, b, (c * i))));
}
function code(x, y, z, t, a, b, c, i) return fma(z, t, fma(x, y, fma(a, b, Float64(c * i)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(z * t + N[(x * y + N[(a * b + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(z, t, \mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b, c \cdot i\right)\right)\right)
\end{array}
Initial program 95.3%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6497.3
Applied rewrites97.3%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* z t) -5e+128)
(* z t)
(if (<= (* z t) -1e-27)
(* c i)
(if (<= (* z t) -2e-124)
(* a b)
(if (<= (* z t) 1e+58) (* x y) (* z t))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -5e+128) {
tmp = z * t;
} else if ((z * t) <= -1e-27) {
tmp = c * i;
} else if ((z * t) <= -2e-124) {
tmp = a * b;
} else if ((z * t) <= 1e+58) {
tmp = x * y;
} else {
tmp = z * t;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((z * t) <= (-5d+128)) then
tmp = z * t
else if ((z * t) <= (-1d-27)) then
tmp = c * i
else if ((z * t) <= (-2d-124)) then
tmp = a * b
else if ((z * t) <= 1d+58) then
tmp = x * y
else
tmp = z * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -5e+128) {
tmp = z * t;
} else if ((z * t) <= -1e-27) {
tmp = c * i;
} else if ((z * t) <= -2e-124) {
tmp = a * b;
} else if ((z * t) <= 1e+58) {
tmp = x * y;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z * t) <= -5e+128: tmp = z * t elif (z * t) <= -1e-27: tmp = c * i elif (z * t) <= -2e-124: tmp = a * b elif (z * t) <= 1e+58: tmp = x * y else: tmp = z * t return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -5e+128) tmp = Float64(z * t); elseif (Float64(z * t) <= -1e-27) tmp = Float64(c * i); elseif (Float64(z * t) <= -2e-124) tmp = Float64(a * b); elseif (Float64(z * t) <= 1e+58) tmp = Float64(x * y); else tmp = Float64(z * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((z * t) <= -5e+128) tmp = z * t; elseif ((z * t) <= -1e-27) tmp = c * i; elseif ((z * t) <= -2e-124) tmp = a * b; elseif ((z * t) <= 1e+58) tmp = x * y; else tmp = z * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+128], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -1e-27], N[(c * i), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -2e-124], N[(a * b), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+58], N[(x * y), $MachinePrecision], N[(z * t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+128}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-27}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;z \cdot t \leq -2 \cdot 10^{-124}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;z \cdot t \leq 10^{+58}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 z t) < -5e128 or 9.99999999999999944e57 < (*.f64 z t) Initial program 91.8%
Taylor expanded in z around inf
lower-*.f6467.9
Applied rewrites67.9%
if -5e128 < (*.f64 z t) < -1e-27Initial program 96.9%
Taylor expanded in c around inf
lower-*.f6444.6
Applied rewrites44.6%
if -1e-27 < (*.f64 z t) < -1.99999999999999987e-124Initial program 100.0%
Taylor expanded in a around inf
lower-*.f6463.8
Applied rewrites63.8%
if -1.99999999999999987e-124 < (*.f64 z t) < 9.99999999999999944e57Initial program 97.2%
Taylor expanded in x around inf
lower-*.f6441.9
Applied rewrites41.9%
Final simplification53.8%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* z t) -5e+112)
(fma z t (* c i))
(if (<= (* z t) -5e-120)
(fma i c (* a b))
(if (<= (* z t) 1e+58) (fma a b (* x y)) (fma z t (* a b))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -5e+112) {
tmp = fma(z, t, (c * i));
} else if ((z * t) <= -5e-120) {
tmp = fma(i, c, (a * b));
} else if ((z * t) <= 1e+58) {
tmp = fma(a, b, (x * y));
} else {
tmp = fma(z, t, (a * b));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -5e+112) tmp = fma(z, t, Float64(c * i)); elseif (Float64(z * t) <= -5e-120) tmp = fma(i, c, Float64(a * b)); elseif (Float64(z * t) <= 1e+58) tmp = fma(a, b, Float64(x * y)); else tmp = fma(z, t, Float64(a * b)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+112], N[(z * t + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -5e-120], N[(i * c + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+58], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+112}:\\
\;\;\;\;\mathsf{fma}\left(z, t, c \cdot i\right)\\
\mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-120}:\\
\;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{+58}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t, a \cdot b\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -5e112Initial program 95.5%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6497.8
Applied rewrites97.8%
Taylor expanded in c around inf
lower-*.f6478.8
Applied rewrites78.8%
if -5e112 < (*.f64 z t) < -5.00000000000000007e-120Initial program 97.8%
Taylor expanded in a around inf
lower-*.f6478.7
Applied rewrites78.7%
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6478.7
Applied rewrites78.7%
if -5.00000000000000007e-120 < (*.f64 z t) < 9.99999999999999944e57Initial program 97.2%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6497.2
Applied rewrites97.2%
Taylor expanded in a around inf
lower-*.f6473.5
Applied rewrites73.5%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-*.f6473.6
Applied rewrites73.6%
if 9.99999999999999944e57 < (*.f64 z t) Initial program 89.7%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6494.8
Applied rewrites94.8%
Taylor expanded in a around inf
lower-*.f6479.2
Applied rewrites79.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma z t (* a b))))
(if (<= (* z t) -5e+128)
t_1
(if (<= (* z t) -5e-120)
(fma i c (* a b))
(if (<= (* z t) 1e+58) (fma a b (* x y)) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(z, t, (a * b));
double tmp;
if ((z * t) <= -5e+128) {
tmp = t_1;
} else if ((z * t) <= -5e-120) {
tmp = fma(i, c, (a * b));
} else if ((z * t) <= 1e+58) {
tmp = fma(a, b, (x * y));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(z, t, Float64(a * b)) tmp = 0.0 if (Float64(z * t) <= -5e+128) tmp = t_1; elseif (Float64(z * t) <= -5e-120) tmp = fma(i, c, Float64(a * b)); elseif (Float64(z * t) <= 1e+58) tmp = fma(a, b, Float64(x * y)); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -5e+128], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], -5e-120], N[(i * c + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+58], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(z, t, a \cdot b\right)\\
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+128}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-120}:\\
\;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{+58}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -5e128 or 9.99999999999999944e57 < (*.f64 z t) Initial program 91.8%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6495.9
Applied rewrites95.9%
Taylor expanded in a around inf
lower-*.f6480.8
Applied rewrites80.8%
if -5e128 < (*.f64 z t) < -5.00000000000000007e-120Initial program 98.0%
Taylor expanded in a around inf
lower-*.f6474.5
Applied rewrites74.5%
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6474.5
Applied rewrites74.5%
if -5.00000000000000007e-120 < (*.f64 z t) < 9.99999999999999944e57Initial program 97.2%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6497.2
Applied rewrites97.2%
Taylor expanded in a around inf
lower-*.f6473.5
Applied rewrites73.5%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-*.f6473.6
Applied rewrites73.6%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* z t) -5e+128)
(* z t)
(if (<= (* z t) -5e-120)
(fma i c (* a b))
(if (<= (* z t) 1e+181) (fma a b (* x y)) (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -5e+128) {
tmp = z * t;
} else if ((z * t) <= -5e-120) {
tmp = fma(i, c, (a * b));
} else if ((z * t) <= 1e+181) {
tmp = fma(a, b, (x * y));
} else {
tmp = z * t;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -5e+128) tmp = Float64(z * t); elseif (Float64(z * t) <= -5e-120) tmp = fma(i, c, Float64(a * b)); elseif (Float64(z * t) <= 1e+181) tmp = fma(a, b, Float64(x * y)); else tmp = Float64(z * t); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+128], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -5e-120], N[(i * c + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+181], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(z * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+128}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq -5 \cdot 10^{-120}:\\
\;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{+181}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 z t) < -5e128 or 9.9999999999999992e180 < (*.f64 z t) Initial program 89.6%
Taylor expanded in z around inf
lower-*.f6476.4
Applied rewrites76.4%
if -5e128 < (*.f64 z t) < -5.00000000000000007e-120Initial program 98.0%
Taylor expanded in a around inf
lower-*.f6474.5
Applied rewrites74.5%
lift-*.f64N/A
lift-*.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6474.5
Applied rewrites74.5%
if -5.00000000000000007e-120 < (*.f64 z t) < 9.9999999999999992e180Initial program 97.7%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6497.7
Applied rewrites97.7%
Taylor expanded in a around inf
lower-*.f6473.6
Applied rewrites73.6%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-*.f6468.1
Applied rewrites68.1%
Final simplification71.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma y x (* c i))))
(if (<= (* c i) -5e+272)
t_1
(if (<= (* c i) 1e+183) (fma z t (fma x y (* a b))) t_1))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = fma(y, x, (c * i));
double tmp;
if ((c * i) <= -5e+272) {
tmp = t_1;
} else if ((c * i) <= 1e+183) {
tmp = fma(z, t, fma(x, y, (a * b)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(y, x, Float64(c * i)) tmp = 0.0 if (Float64(c * i) <= -5e+272) tmp = t_1; elseif (Float64(c * i) <= 1e+183) tmp = fma(z, t, fma(x, y, Float64(a * b))); else tmp = t_1; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(y * x + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -5e+272], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 1e+183], N[(z * t + N[(x * y + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, c \cdot i\right)\\
\mathbf{if}\;c \cdot i \leq -5 \cdot 10^{+272}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \cdot i \leq 10^{+183}:\\
\;\;\;\;\mathsf{fma}\left(z, t, \mathsf{fma}\left(x, y, a \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 c i) < -4.99999999999999973e272 or 9.99999999999999947e182 < (*.f64 c i) Initial program 88.6%
Taylor expanded in x around inf
lower-*.f6487.9
Applied rewrites87.9%
*-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.9
Applied rewrites87.9%
if -4.99999999999999973e272 < (*.f64 c i) < 9.99999999999999947e182Initial program 96.7%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6498.6
Applied rewrites98.6%
Taylor expanded in a around inf
lower-*.f6488.4
Applied rewrites88.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma y x (* c i))))
(if (<= (* c i) -5e+272)
t_1
(if (<= (* c i) 1e+183) (fma x y (fma a b (* z t))) 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, (c * i));
double tmp;
if ((c * i) <= -5e+272) {
tmp = t_1;
} else if ((c * i) <= 1e+183) {
tmp = fma(x, y, fma(a, b, (z * t)));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(y, x, Float64(c * i)) tmp = 0.0 if (Float64(c * i) <= -5e+272) tmp = t_1; elseif (Float64(c * i) <= 1e+183) tmp = fma(x, y, fma(a, b, Float64(z * t))); 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[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -5e+272], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 1e+183], N[(x * y + N[(a * b + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(y, x, c \cdot i\right)\\
\mathbf{if}\;c \cdot i \leq -5 \cdot 10^{+272}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \cdot i \leq 10^{+183}:\\
\;\;\;\;\mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b, z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 c i) < -4.99999999999999973e272 or 9.99999999999999947e182 < (*.f64 c i) Initial program 88.6%
Taylor expanded in x around inf
lower-*.f6487.9
Applied rewrites87.9%
*-commutativeN/A
lift-*.f64N/A
lower-fma.f6487.9
Applied rewrites87.9%
if -4.99999999999999973e272 < (*.f64 c i) < 9.99999999999999947e182Initial program 96.7%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6487.0
Applied rewrites87.0%
Final simplification87.2%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -5e+128) (* z t) (if (<= (* z t) -1e-27) (* c i) (if (<= (* z t) 5e+49) (* a b) (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -5e+128) {
tmp = z * t;
} else if ((z * t) <= -1e-27) {
tmp = c * i;
} else if ((z * t) <= 5e+49) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((z * t) <= (-5d+128)) then
tmp = z * t
else if ((z * t) <= (-1d-27)) then
tmp = c * i
else if ((z * t) <= 5d+49) then
tmp = a * b
else
tmp = z * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -5e+128) {
tmp = z * t;
} else if ((z * t) <= -1e-27) {
tmp = c * i;
} else if ((z * t) <= 5e+49) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z * t) <= -5e+128: tmp = z * t elif (z * t) <= -1e-27: tmp = c * i elif (z * t) <= 5e+49: tmp = a * b else: tmp = z * t return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -5e+128) tmp = Float64(z * t); elseif (Float64(z * t) <= -1e-27) tmp = Float64(c * i); elseif (Float64(z * t) <= 5e+49) tmp = Float64(a * b); else tmp = Float64(z * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((z * t) <= -5e+128) tmp = z * t; elseif ((z * t) <= -1e-27) tmp = c * i; elseif ((z * t) <= 5e+49) tmp = a * b; else tmp = z * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+128], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], -1e-27], N[(c * i), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+49], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+128}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq -1 \cdot 10^{-27}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+49}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 z t) < -5e128 or 5.0000000000000004e49 < (*.f64 z t) Initial program 92.0%
Taylor expanded in z around inf
lower-*.f6467.6
Applied rewrites67.6%
if -5e128 < (*.f64 z t) < -1e-27Initial program 96.9%
Taylor expanded in c around inf
lower-*.f6444.6
Applied rewrites44.6%
if -1e-27 < (*.f64 z t) < 5.0000000000000004e49Initial program 97.6%
Taylor expanded in a around inf
lower-*.f6439.0
Applied rewrites39.0%
Final simplification50.9%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -5e+121) (* z t) (if (<= (* z t) 1e+181) (fma a b (* x y)) (* z t))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z * t) <= -5e+121) {
tmp = z * t;
} else if ((z * t) <= 1e+181) {
tmp = fma(a, b, (x * y));
} else {
tmp = z * t;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(z * t) <= -5e+121) tmp = Float64(z * t); elseif (Float64(z * t) <= 1e+181) tmp = fma(a, b, Float64(x * y)); else tmp = Float64(z * t); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -5e+121], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+181], N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(z * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+121}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 10^{+181}:\\
\;\;\;\;\mathsf{fma}\left(a, b, x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 z t) < -5.00000000000000007e121 or 9.9999999999999992e180 < (*.f64 z t) Initial program 90.0%
Taylor expanded in z around inf
lower-*.f6474.9
Applied rewrites74.9%
if -5.00000000000000007e121 < (*.f64 z t) < 9.9999999999999992e180Initial program 97.7%
lift-*.f64N/A
lift-*.f64N/A
lift-+.f64N/A
lift-*.f64N/A
lift-*.f64N/A
associate-+l+N/A
lift-+.f64N/A
+-commutativeN/A
associate-+l+N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f64N/A
lift-*.f64N/A
lower-fma.f6498.3
Applied rewrites98.3%
Taylor expanded in a around inf
lower-*.f6471.8
Applied rewrites71.8%
Taylor expanded in z around 0
lower-fma.f64N/A
lower-*.f6465.0
Applied rewrites65.0%
Final simplification68.1%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -1e+140) (* a b) (if (<= (* a b) 1.05e+36) (* c i) (* a b))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -1e+140) {
tmp = a * b;
} else if ((a * b) <= 1.05e+36) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((a * b) <= (-1d+140)) then
tmp = a * b
else if ((a * b) <= 1.05d+36) then
tmp = c * i
else
tmp = a * b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -1e+140) {
tmp = a * b;
} else if ((a * b) <= 1.05e+36) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -1e+140: tmp = a * b elif (a * b) <= 1.05e+36: tmp = c * i else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -1e+140) tmp = Float64(a * b); elseif (Float64(a * b) <= 1.05e+36) tmp = Float64(c * i); else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((a * b) <= -1e+140) tmp = a * b; elseif ((a * b) <= 1.05e+36) tmp = c * i; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -1e+140], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.05e+36], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -1 \cdot 10^{+140}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 1.05 \cdot 10^{+36}:\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -1.00000000000000006e140 or 1.05000000000000002e36 < (*.f64 a b) Initial program 90.9%
Taylor expanded in a around inf
lower-*.f6458.4
Applied rewrites58.4%
if -1.00000000000000006e140 < (*.f64 a b) < 1.05000000000000002e36Initial program 98.6%
Taylor expanded in c around inf
lower-*.f6430.3
Applied rewrites30.3%
(FPCore (x y z t a b c i) :precision binary64 (* a b))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
code = a * b
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return a * b;
}
def code(x, y, z, t, a, b, c, i): return a * b
function code(x, y, z, t, a, b, c, i) return Float64(a * b) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = a * b; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(a * b), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b
\end{array}
Initial program 95.3%
Taylor expanded in a around inf
lower-*.f6428.3
Applied rewrites28.3%
herbie shell --seed 2024216
(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)))