
(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 9 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 (+ (+ (+ (* x y) (* z t)) (* a b)) (* c i)))) (if (<= t_1 INFINITY) t_1 (fma i c (* x y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (((x * y) + (z * t)) + (a * b)) + (c * i);
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = fma(i, c, (x * y));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) + Float64(c * i)) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = fma(i, c, Float64(x * y)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(i * c + N[(x * y), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(\left(x \cdot y + z \cdot t\right) + a \cdot b\right) + c \cdot i\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(i, c, x \cdot y\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 x around inf
lower-*.f6444.4
Applied rewrites44.4%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6466.7
Applied rewrites66.7%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma x y (* z t))) (t_2 (+ (* x y) (* z t)))) (if (<= t_2 -5e+186) t_1 (if (<= t_2 2e+75) (fma i c (* 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, (z * t));
double t_2 = (x * y) + (z * t);
double tmp;
if (t_2 <= -5e+186) {
tmp = t_1;
} else if (t_2 <= 2e+75) {
tmp = fma(i, c, (a * b));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(x, y, Float64(z * t)) t_2 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (t_2 <= -5e+186) tmp = t_1; elseif (t_2 <= 2e+75) tmp = fma(i, c, 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[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, -5e+186], t$95$1, If[LessEqual[t$95$2, 2e+75], N[(i * c + N[(a * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, y, z \cdot t\right)\\
t_2 := x \cdot y + z \cdot t\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{+186}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;t\_2 \leq 2 \cdot 10^{+75}:\\
\;\;\;\;\mathsf{fma}\left(i, c, a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (+.f64 (*.f64 x y) (*.f64 z t)) < -4.99999999999999954e186 or 1.99999999999999985e75 < (+.f64 (*.f64 x y) (*.f64 z t)) Initial program 93.5%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6483.2
Applied rewrites83.2%
Taylor expanded in a around 0
Applied rewrites76.5%
if -4.99999999999999954e186 < (+.f64 (*.f64 x y) (*.f64 z t)) < 1.99999999999999985e75Initial program 100.0%
Taylor expanded in a around inf
lower-*.f6476.8
Applied rewrites76.8%
lift-+.f64N/A
+-commutativeN/A
lift-*.f64N/A
*-commutativeN/A
lower-fma.f6476.8
Applied rewrites76.8%
Final simplification76.6%
(FPCore (x y z t a b c i) :precision binary64 (let* ((t_1 (fma a b (* z t))) (t_2 (fma c i t_1))) (if (<= (* c i) -1e+99) t_2 (if (<= (* c i) 2e+169) (fma x y 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(a, b, (z * t));
double t_2 = fma(c, i, t_1);
double tmp;
if ((c * i) <= -1e+99) {
tmp = t_2;
} else if ((c * i) <= 2e+169) {
tmp = fma(x, y, t_1);
} else {
tmp = t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(a, b, Float64(z * t)) t_2 = fma(c, i, t_1) tmp = 0.0 if (Float64(c * i) <= -1e+99) tmp = t_2; elseif (Float64(c * i) <= 2e+169) tmp = fma(x, y, t_1); else tmp = t_2; end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a * b + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c * i + t$95$1), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -1e+99], t$95$2, If[LessEqual[N[(c * i), $MachinePrecision], 2e+169], N[(x * y + t$95$1), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(a, b, z \cdot t\right)\\
t_2 := \mathsf{fma}\left(c, i, t\_1\right)\\
\mathbf{if}\;c \cdot i \leq -1 \cdot 10^{+99}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{+169}:\\
\;\;\;\;\mathsf{fma}\left(x, y, t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 c i) < -9.9999999999999997e98 or 1.99999999999999987e169 < (*.f64 c i) Initial program 92.4%
Taylor expanded in x around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6487.3
Applied rewrites87.3%
if -9.9999999999999997e98 < (*.f64 c i) < 1.99999999999999987e169Initial program 98.3%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6493.1
Applied rewrites93.1%
Final simplification91.3%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* x y) -2e+163) (fma x y (* a b)) (if (<= (* x y) 1e+65) (fma c i (fma a b (* z t))) (fma 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 ((x * y) <= -2e+163) {
tmp = fma(x, y, (a * b));
} else if ((x * y) <= 1e+65) {
tmp = fma(c, i, fma(a, b, (z * t)));
} else {
tmp = fma(x, y, (z * t));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -2e+163) tmp = fma(x, y, Float64(a * b)); elseif (Float64(x * y) <= 1e+65) tmp = fma(c, i, fma(a, b, Float64(z * t))); else tmp = fma(x, y, Float64(z * t)); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -2e+163], N[(x * y + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+65], N[(c * i + N[(a * b + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -2 \cdot 10^{+163}:\\
\;\;\;\;\mathsf{fma}\left(x, y, a \cdot b\right)\\
\mathbf{elif}\;x \cdot y \leq 10^{+65}:\\
\;\;\;\;\mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, y, z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1.9999999999999999e163Initial program 83.7%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6478.7
Applied rewrites78.7%
Taylor expanded in a around inf
Applied rewrites83.5%
if -1.9999999999999999e163 < (*.f64 x y) < 9.9999999999999999e64Initial program 98.2%
Taylor expanded in x around 0
+-commutativeN/A
associate-+l+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6492.7
Applied rewrites92.7%
if 9.9999999999999999e64 < (*.f64 x y) Initial program 100.0%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6488.4
Applied rewrites88.4%
Taylor expanded in a around 0
Applied rewrites80.1%
Final simplification89.1%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (fma x y (* z t))))
(if (<= (* z t) -4e+109)
t_1
(if (<= (* z t) 50000.0) (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(x, y, (z * t));
double tmp;
if ((z * t) <= -4e+109) {
tmp = t_1;
} else if ((z * t) <= 50000.0) {
tmp = fma(x, y, (a * b));
} else {
tmp = t_1;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = fma(x, y, Float64(z * t)) tmp = 0.0 if (Float64(z * t) <= -4e+109) tmp = t_1; elseif (Float64(z * t) <= 50000.0) tmp = 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[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(z * t), $MachinePrecision], -4e+109], t$95$1, If[LessEqual[N[(z * t), $MachinePrecision], 50000.0], N[(x * y + N[(a * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \mathsf{fma}\left(x, y, z \cdot t\right)\\
\mathbf{if}\;z \cdot t \leq -4 \cdot 10^{+109}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \cdot t \leq 50000:\\
\;\;\;\;\mathsf{fma}\left(x, y, a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 z t) < -3.99999999999999993e109 or 5e4 < (*.f64 z t) Initial program 95.0%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6482.7
Applied rewrites82.7%
Taylor expanded in a around 0
Applied rewrites72.6%
if -3.99999999999999993e109 < (*.f64 z t) < 5e4Initial program 97.7%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6471.0
Applied rewrites71.0%
Taylor expanded in a around inf
Applied rewrites69.6%
Final simplification71.0%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -5e+205) (* z t) (if (<= (* z t) 2e+75) (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) <= -5e+205) {
tmp = z * t;
} else if ((z * t) <= 2e+75) {
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) <= -5e+205) tmp = Float64(z * t); elseif (Float64(z * t) <= 2e+75) 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], -5e+205], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 2e+75], N[(x * y + N[(a * b), $MachinePrecision]), $MachinePrecision], N[(z * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+205}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 2 \cdot 10^{+75}:\\
\;\;\;\;\mathsf{fma}\left(x, y, a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 z t) < -5.0000000000000002e205 or 1.99999999999999985e75 < (*.f64 z t) Initial program 92.6%
Taylor expanded in z around inf
lower-*.f6473.5
Applied rewrites73.5%
if -5.0000000000000002e205 < (*.f64 z t) < 1.99999999999999985e75Initial program 98.3%
Taylor expanded in c around 0
associate-+r+N/A
+-commutativeN/A
lower-fma.f64N/A
lower-fma.f64N/A
lower-*.f6474.2
Applied rewrites74.2%
Taylor expanded in a around inf
Applied rewrites65.5%
Final simplification68.0%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* z t) -4e+109) (* z t) (if (<= (* z t) 5e+52) (* 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) <= -4e+109) {
tmp = z * t;
} else if ((z * t) <= 5e+52) {
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) <= (-4d+109)) then
tmp = z * t
else if ((z * t) <= 5d+52) 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) <= -4e+109) {
tmp = z * t;
} else if ((z * t) <= 5e+52) {
tmp = a * b;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z * t) <= -4e+109: tmp = z * t elif (z * t) <= 5e+52: 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) <= -4e+109) tmp = Float64(z * t); elseif (Float64(z * t) <= 5e+52) 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) <= -4e+109) tmp = z * t; elseif ((z * t) <= 5e+52) 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], -4e+109], N[(z * t), $MachinePrecision], If[LessEqual[N[(z * t), $MachinePrecision], 5e+52], N[(a * b), $MachinePrecision], N[(z * t), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -4 \cdot 10^{+109}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \cdot t \leq 5 \cdot 10^{+52}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if (*.f64 z t) < -3.99999999999999993e109 or 5e52 < (*.f64 z t) Initial program 94.3%
Taylor expanded in z around inf
lower-*.f6464.8
Applied rewrites64.8%
if -3.99999999999999993e109 < (*.f64 z t) < 5e52Initial program 98.0%
Taylor expanded in a around inf
lower-*.f6439.2
Applied rewrites39.2%
Final simplification49.7%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -5.2e+143) (* a b) (if (<= (* a b) 2.2e-42) (* 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) <= -5.2e+143) {
tmp = a * b;
} else if ((a * b) <= 2.2e-42) {
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) <= (-5.2d+143)) then
tmp = a * b
else if ((a * b) <= 2.2d-42) 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) <= -5.2e+143) {
tmp = a * b;
} else if ((a * b) <= 2.2e-42) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -5.2e+143: tmp = a * b elif (a * b) <= 2.2e-42: 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) <= -5.2e+143) tmp = Float64(a * b); elseif (Float64(a * b) <= 2.2e-42) 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) <= -5.2e+143) tmp = a * b; elseif ((a * b) <= 2.2e-42) 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], -5.2e+143], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2.2e-42], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5.2 \cdot 10^{+143}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 2.2 \cdot 10^{-42}:\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -5.1999999999999998e143 or 2.20000000000000005e-42 < (*.f64 a b) Initial program 95.4%
Taylor expanded in a around inf
lower-*.f6459.2
Applied rewrites59.2%
if -5.1999999999999998e143 < (*.f64 a b) < 2.20000000000000005e-42Initial program 97.2%
Taylor expanded in c around inf
lower-*.f6434.0
Applied rewrites34.0%
(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
lower-*.f6428.6
Applied rewrites28.6%
herbie shell --seed 2024232
(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)))