
(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 96.5%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6498.0
Applied egg-rr98.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma x y (* a b))))
(if (<= (* x y) -2e+50)
t_1
(if (<= (* x y) -1e-64)
(fma z t (* c i))
(if (<= (* x y) 1e+54) (fma z t (* 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(x, y, (a * b));
double tmp;
if ((x * y) <= -2e+50) {
tmp = t_1;
} else if ((x * y) <= -1e-64) {
tmp = fma(z, t, (c * i));
} else if ((x * y) <= 1e+54) {
tmp = fma(z, t, (a * b));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(x, y, Float64(a * b)) tmp = 0.0 if (Float64(x * y) <= -2e+50) tmp = t_1; elseif (Float64(x * y) <= -1e-64) tmp = fma(z, t, Float64(c * i)); elseif (Float64(x * y) <= 1e+54) tmp = fma(z, t, 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[(x * y + N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+50], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -1e-64], N[(z * t + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+54], N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, y, a \cdot b\right)\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+50}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq -1 \cdot 10^{-64}:\\
\;\;\;\;\mathsf{fma}\left(z, t, c \cdot i\right)\\
\mathbf{elif}\;x \cdot y \leq 10^{+54}:\\
\;\;\;\;\mathsf{fma}\left(z, t, a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -2.0000000000000002e50 or 1.0000000000000001e54 < (*.f64 x y) Initial program 94.2%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6492.0
Simplified92.0%
Taylor expanded in a around inf
*-lowering-*.f6481.9
Simplified81.9%
if -2.0000000000000002e50 < (*.f64 x y) < -9.99999999999999965e-65Initial program 90.8%
Taylor expanded in z around inf
*-lowering-*.f6470.0
Simplified70.0%
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6474.6
Applied egg-rr74.6%
if -9.99999999999999965e-65 < (*.f64 x y) < 1.0000000000000001e54Initial program 99.2%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6499.2
Applied egg-rr99.2%
Taylor expanded in a around inf
*-lowering-*.f6474.2
Simplified74.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma z t (fma x y (* c i)))))
(if (<= (* c i) -1.95e+63)
t_1
(if (<= (* c i) 7.5e+59) (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(z, t, fma(x, y, (c * i)));
double tmp;
if ((c * i) <= -1.95e+63) {
tmp = t_1;
} else if ((c * i) <= 7.5e+59) {
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(z, t, fma(x, y, Float64(c * i))) tmp = 0.0 if (Float64(c * i) <= -1.95e+63) tmp = t_1; elseif (Float64(c * i) <= 7.5e+59) 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[(z * t + N[(x * y + N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -1.95e+63], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 7.5e+59], 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(z, t, \mathsf{fma}\left(x, y, c \cdot i\right)\right)\\
\mathbf{if}\;c \cdot i \leq -1.95 \cdot 10^{+63}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \cdot i \leq 7.5 \cdot 10^{+59}:\\
\;\;\;\;\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) < -1.95e63 or 7.4999999999999996e59 < (*.f64 c i) Initial program 92.3%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6495.6
Applied egg-rr95.6%
Taylor expanded in a around 0
*-lowering-*.f6483.4
Simplified83.4%
if -1.95e63 < (*.f64 c i) < 7.4999999999999996e59Initial program 98.8%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6496.0
Simplified96.0%
Final simplification91.5%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* c i) -9.2e+120) (fma y x (* c i)) (if (<= (* c i) 3.4e+183) (fma x y (fma a b (* z t))) (fma z t (* c i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -9.2e+120) {
tmp = fma(y, x, (c * i));
} else if ((c * i) <= 3.4e+183) {
tmp = fma(x, y, fma(a, b, (z * t)));
} else {
tmp = fma(z, t, (c * i));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -9.2e+120) tmp = fma(y, x, Float64(c * i)); elseif (Float64(c * i) <= 3.4e+183) tmp = fma(x, y, fma(a, b, Float64(z * t))); else tmp = fma(z, t, Float64(c * i)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -9.2e+120], N[(y * x + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 3.4e+183], N[(x * y + N[(a * b + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * t + N[(c * i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -9.2 \cdot 10^{+120}:\\
\;\;\;\;\mathsf{fma}\left(y, x, c \cdot i\right)\\
\mathbf{elif}\;c \cdot i \leq 3.4 \cdot 10^{+183}:\\
\;\;\;\;\mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b, z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t, c \cdot i\right)\\
\end{array}
\end{array}
if (*.f64 c i) < -9.1999999999999997e120Initial program 87.1%
Taylor expanded in x around inf
*-lowering-*.f6478.0
Simplified78.0%
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6481.2
Applied egg-rr81.2%
if -9.1999999999999997e120 < (*.f64 c i) < 3.4e183Initial program 98.5%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6491.5
Simplified91.5%
if 3.4e183 < (*.f64 c i) Initial program 91.7%
Taylor expanded in z around inf
*-lowering-*.f6475.4
Simplified75.4%
*-commutativeN/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6475.4
Applied egg-rr75.4%
Final simplification88.7%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -1e+114) (* z t) (if (<= (* z t) 5e-285) (* a b) (if (<= (* z t) 1e+62) (* 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) <= -1e+114) {
tmp = z * t;
} else if ((z * t) <= 5e-285) {
tmp = a * b;
} else if ((z * t) <= 1e+62) {
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) <= (-1d+114)) then
tmp = z * t
else if ((z * t) <= 5d-285) then
tmp = a * b
else if ((z * t) <= 1d+62) 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) <= -1e+114) {
tmp = z * t;
} else if ((z * t) <= 5e-285) {
tmp = a * b;
} else if ((z * t) <= 1e+62) {
tmp = x * y;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z * t) <= -1e+114: tmp = z * t elif (z * t) <= 5e-285: tmp = a * b elif (z * t) <= 1e+62: 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) <= -1e+114) tmp = Float64(z * t); elseif (Float64(z * t) <= 5e-285) tmp = Float64(a * b); elseif (Float64(z * t) <= 1e+62) 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) <= -1e+114) tmp = z * t; elseif ((z * t) <= 5e-285) tmp = a * b; elseif ((z * t) <= 1e+62) 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], -1e+114], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e-285], N[(a * b), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+62], N[(x * y), $MachinePrecision], N[(z * t), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+114}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{-285}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;z \cdot t \leq 10^{+62}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 z t) < -1e114 or 1.00000000000000004e62 < (*.f64 z t) Initial program 96.6%
Taylor expanded in z around inf
*-lowering-*.f6467.6
Simplified67.6%
if -1e114 < (*.f64 z t) < 5.00000000000000018e-285Initial program 96.0%
Taylor expanded in a around inf
*-lowering-*.f6442.4
Simplified42.4%
if 5.00000000000000018e-285 < (*.f64 z t) < 1.00000000000000004e62Initial program 96.9%
Taylor expanded in x around inf
*-lowering-*.f6444.0
Simplified44.0%
Final simplification51.5%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -2e+116) (fma z t (* x y)) (if (<= (* z t) 1e+62) (fma x y (* a b)) (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) <= -2e+116) {
tmp = fma(z, t, (x * y));
} else if ((z * t) <= 1e+62) {
tmp = fma(x, y, (a * b));
} 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) <= -2e+116) tmp = fma(z, t, Float64(x * y)); elseif (Float64(z * t) <= 1e+62) tmp = fma(x, y, Float64(a * b)); 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], -2e+116], N[(z * t + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 1e+62], N[(x * y + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -2 \cdot 10^{+116}:\\
\;\;\;\;\mathsf{fma}\left(z, t, x \cdot y\right)\\
\mathbf{elif}\;z \cdot t \leq 10^{+62}:\\
\;\;\;\;\mathsf{fma}\left(x, y, a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(z, t, a \cdot b\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -2.00000000000000003e116Initial program 95.5%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6497.7
Applied egg-rr97.7%
Taylor expanded in x around inf
*-lowering-*.f6488.8
Simplified88.8%
if -2.00000000000000003e116 < (*.f64 z t) < 1.00000000000000004e62Initial program 96.4%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6478.4
Simplified78.4%
Taylor expanded in a around inf
*-lowering-*.f6473.1
Simplified73.1%
if 1.00000000000000004e62 < (*.f64 z t) Initial program 97.7%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f64100.0
Applied egg-rr100.0%
Taylor expanded in a around inf
*-lowering-*.f6481.7
Simplified81.7%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma x y (* a b)))) (if (<= (* x y) -2e+71) t_1 (if (<= (* x y) 1e+54) (fma z t (* 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(x, y, (a * b));
double tmp;
if ((x * y) <= -2e+71) {
tmp = t_1;
} else if ((x * y) <= 1e+54) {
tmp = fma(z, t, (a * b));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(x, y, Float64(a * b)) tmp = 0.0 if (Float64(x * y) <= -2e+71) tmp = t_1; elseif (Float64(x * y) <= 1e+54) tmp = fma(z, t, 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[(x * y + N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2e+71], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1e+54], N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, y, a \cdot b\right)\\
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+71}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 10^{+54}:\\
\;\;\;\;\mathsf{fma}\left(z, t, a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -2.0000000000000001e71 or 1.0000000000000001e54 < (*.f64 x y) Initial program 94.0%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6491.7
Simplified91.7%
Taylor expanded in a around inf
*-lowering-*.f6482.3
Simplified82.3%
if -2.0000000000000001e71 < (*.f64 x y) < 1.0000000000000001e54Initial program 98.0%
associate-+l+N/A
+-commutativeN/A
associate-+l+N/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6498.7
Applied egg-rr98.7%
Taylor expanded in a around inf
*-lowering-*.f6470.8
Simplified70.8%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -1e+255) (* z t) (if (<= (* z t) 5e+123) (fma x y (* 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) <= -1e+255) {
tmp = z * t;
} else if ((z * t) <= 5e+123) {
tmp = fma(x, y, (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) <= -1e+255) tmp = Float64(z * t); elseif (Float64(z * t) <= 5e+123) tmp = fma(x, y, Float64(a * b)); else tmp = Float64(z * t); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(z * t), $MachinePrecision], -1e+255], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+123], N[(x * y + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(z * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+255}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+123}:\\
\;\;\;\;\mathsf{fma}\left(x, y, a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 z t) < -9.99999999999999988e254 or 4.99999999999999974e123 < (*.f64 z t) Initial program 95.3%
Taylor expanded in z around inf
*-lowering-*.f6480.3
Simplified80.3%
if -9.99999999999999988e254 < (*.f64 z t) < 4.99999999999999974e123Initial program 96.8%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
accelerator-lowering-fma.f64N/A
accelerator-lowering-fma.f64N/A
*-lowering-*.f6478.7
Simplified78.7%
Taylor expanded in a around inf
*-lowering-*.f6469.8
Simplified69.8%
Final simplification72.4%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -1e+114) (* z t) (if (<= (* z t) 4e+101) (* 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) <= -1e+114) {
tmp = z * t;
} else if ((z * t) <= 4e+101) {
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) <= (-1d+114)) then
tmp = z * t
else if ((z * t) <= 4d+101) 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) <= -1e+114) {
tmp = z * t;
} else if ((z * t) <= 4e+101) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z * t) <= -1e+114: tmp = z * t elif (z * t) <= 4e+101: 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) <= -1e+114) tmp = Float64(z * t); elseif (Float64(z * t) <= 4e+101) 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) <= -1e+114) tmp = z * t; elseif ((z * t) <= 4e+101) 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], -1e+114], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 4e+101], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -1 \cdot 10^{+114}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 4 \cdot 10^{+101}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 z t) < -1e114 or 3.9999999999999999e101 < (*.f64 z t) Initial program 96.4%
Taylor expanded in z around inf
*-lowering-*.f6469.6
Simplified69.6%
if -1e114 < (*.f64 z t) < 3.9999999999999999e101Initial program 96.5%
Taylor expanded in a around inf
*-lowering-*.f6439.4
Simplified39.4%
Final simplification49.3%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* c i) -5.8e+110) (* c i) (if (<= (* c i) 9e+59) (* a b) (* c i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -5.8e+110) {
tmp = c * i;
} else if ((c * i) <= 9e+59) {
tmp = a * b;
} else {
tmp = c * i;
}
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) <= (-5.8d+110)) then
tmp = c * i
else if ((c * i) <= 9d+59) then
tmp = a * b
else
tmp = c * i
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) <= -5.8e+110) {
tmp = c * i;
} else if ((c * i) <= 9e+59) {
tmp = a * b;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -5.8e+110: tmp = c * i elif (c * i) <= 9e+59: tmp = a * b else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -5.8e+110) tmp = Float64(c * i); elseif (Float64(c * i) <= 9e+59) tmp = Float64(a * b); else tmp = Float64(c * i); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((c * i) <= -5.8e+110) tmp = c * i; elseif ((c * i) <= 9e+59) tmp = a * b; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -5.8e+110], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 9e+59], N[(a * b), $MachinePrecision], N[(c * i), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -5.8 \cdot 10^{+110}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 9 \cdot 10^{+59}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -5.7999999999999999e110 or 8.99999999999999919e59 < (*.f64 c i) Initial program 92.4%
Taylor expanded in c around inf
*-lowering-*.f6454.5
Simplified54.5%
if -5.7999999999999999e110 < (*.f64 c i) < 8.99999999999999919e59Initial program 98.3%
Taylor expanded in a around inf
*-lowering-*.f6435.5
Simplified35.5%
(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 96.5%
Taylor expanded in a around inf
*-lowering-*.f6430.0
Simplified30.0%
herbie shell --seed 2024196
(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)))