
(FPCore (x y z t a b) :precision binary64 (+ (+ (* x y) (* z t)) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
real(8) function code(x, y, z, t, a, b)
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
code = ((x * y) + (z * t)) + (a * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
def code(x, y, z, t, a, b): return ((x * y) + (z * t)) + (a * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * t)) + (a * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y + z \cdot t\right) + a \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 10 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (+ (* x y) (* z t)) (* a b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
real(8) function code(x, y, z, t, a, b)
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
code = ((x * y) + (z * t)) + (a * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * y) + (z * t)) + (a * b);
}
def code(x, y, z, t, a, b): return ((x * y) + (z * t)) + (a * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * y) + Float64(z * t)) + Float64(a * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * y) + (z * t)) + (a * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot y + z \cdot t\right) + a \cdot b
\end{array}
(FPCore (x y z t a b) :precision binary64 (fma x y (fma z t (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
return fma(x, y, fma(z, t, (a * b)));
}
function code(x, y, z, t, a, b) return fma(x, y, fma(z, t, Float64(a * b))) end
code[x_, y_, z_, t_, a_, b_] := N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)
\end{array}
Initial program 97.6%
associate-+l+97.6%
fma-def98.4%
fma-def98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t a b) :precision binary64 (+ (fma a b (* x y)) (* z t)))
double code(double x, double y, double z, double t, double a, double b) {
return fma(a, b, (x * y)) + (z * t);
}
function code(x, y, z, t, a, b) return Float64(fma(a, b, Float64(x * y)) + Float64(z * t)) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a * b + N[(x * y), $MachinePrecision]), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(a, b, x \cdot y\right) + z \cdot t
\end{array}
Initial program 97.6%
associate-+l+97.6%
fma-def98.4%
fma-def98.4%
Simplified98.4%
fma-udef97.6%
fma-udef97.6%
associate-+l+97.6%
+-commutative97.6%
associate-+r+97.6%
fma-def97.6%
Applied egg-rr97.6%
Final simplification97.6%
(FPCore (x y z t a b) :precision binary64 (+ (* a b) (fma x y (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
return (a * b) + fma(x, y, (z * t));
}
function code(x, y, z, t, a, b) return Float64(Float64(a * b) + fma(x, y, Float64(z * t))) end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a * b), $MachinePrecision] + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b + \mathsf{fma}\left(x, y, z \cdot t\right)
\end{array}
Initial program 97.6%
fma-def98.4%
Simplified98.4%
Final simplification98.4%
(FPCore (x y z t a b)
:precision binary64
(if (<= x -2.3e+167)
(* x y)
(if (<= x -1.7e+148)
(* z t)
(if (<= x -8e+103)
(* x y)
(if (<= x -5.2e-174)
(* z t)
(if (<= x 1.75e-256)
(* a b)
(if (<= x 8.2e-48)
(* z t)
(if (<= x 7.4e-16) (* a b) (* x y)))))))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -2.3e+167) {
tmp = x * y;
} else if (x <= -1.7e+148) {
tmp = z * t;
} else if (x <= -8e+103) {
tmp = x * y;
} else if (x <= -5.2e-174) {
tmp = z * t;
} else if (x <= 1.75e-256) {
tmp = a * b;
} else if (x <= 8.2e-48) {
tmp = z * t;
} else if (x <= 7.4e-16) {
tmp = a * b;
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (x <= (-2.3d+167)) then
tmp = x * y
else if (x <= (-1.7d+148)) then
tmp = z * t
else if (x <= (-8d+103)) then
tmp = x * y
else if (x <= (-5.2d-174)) then
tmp = z * t
else if (x <= 1.75d-256) then
tmp = a * b
else if (x <= 8.2d-48) then
tmp = z * t
else if (x <= 7.4d-16) then
tmp = a * b
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -2.3e+167) {
tmp = x * y;
} else if (x <= -1.7e+148) {
tmp = z * t;
} else if (x <= -8e+103) {
tmp = x * y;
} else if (x <= -5.2e-174) {
tmp = z * t;
} else if (x <= 1.75e-256) {
tmp = a * b;
} else if (x <= 8.2e-48) {
tmp = z * t;
} else if (x <= 7.4e-16) {
tmp = a * b;
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -2.3e+167: tmp = x * y elif x <= -1.7e+148: tmp = z * t elif x <= -8e+103: tmp = x * y elif x <= -5.2e-174: tmp = z * t elif x <= 1.75e-256: tmp = a * b elif x <= 8.2e-48: tmp = z * t elif x <= 7.4e-16: tmp = a * b else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -2.3e+167) tmp = Float64(x * y); elseif (x <= -1.7e+148) tmp = Float64(z * t); elseif (x <= -8e+103) tmp = Float64(x * y); elseif (x <= -5.2e-174) tmp = Float64(z * t); elseif (x <= 1.75e-256) tmp = Float64(a * b); elseif (x <= 8.2e-48) tmp = Float64(z * t); elseif (x <= 7.4e-16) tmp = Float64(a * b); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -2.3e+167) tmp = x * y; elseif (x <= -1.7e+148) tmp = z * t; elseif (x <= -8e+103) tmp = x * y; elseif (x <= -5.2e-174) tmp = z * t; elseif (x <= 1.75e-256) tmp = a * b; elseif (x <= 8.2e-48) tmp = z * t; elseif (x <= 7.4e-16) tmp = a * b; else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -2.3e+167], N[(x * y), $MachinePrecision], If[LessEqual[x, -1.7e+148], N[(z * t), $MachinePrecision], If[LessEqual[x, -8e+103], N[(x * y), $MachinePrecision], If[LessEqual[x, -5.2e-174], N[(z * t), $MachinePrecision], If[LessEqual[x, 1.75e-256], N[(a * b), $MachinePrecision], If[LessEqual[x, 8.2e-48], N[(z * t), $MachinePrecision], If[LessEqual[x, 7.4e-16], N[(a * b), $MachinePrecision], N[(x * y), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.3 \cdot 10^{+167}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq -1.7 \cdot 10^{+148}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \leq -8 \cdot 10^{+103}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq -5.2 \cdot 10^{-174}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-256}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;x \leq 8.2 \cdot 10^{-48}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;x \leq 7.4 \cdot 10^{-16}:\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if x < -2.29999999999999988e167 or -1.7000000000000001e148 < x < -8e103 or 7.3999999999999999e-16 < x Initial program 94.8%
associate-+l+94.8%
fma-def95.9%
fma-def95.9%
Simplified95.9%
fma-udef94.8%
fma-udef94.8%
associate-+l+94.8%
+-commutative94.8%
associate-+r+94.8%
fma-def94.8%
Applied egg-rr94.8%
Taylor expanded in x around inf 63.5%
if -2.29999999999999988e167 < x < -1.7000000000000001e148 or -8e103 < x < -5.2000000000000004e-174 or 1.75000000000000007e-256 < x < 8.20000000000000028e-48Initial program 99.1%
associate-+l+99.1%
fma-def100.0%
fma-def100.0%
Simplified100.0%
fma-udef99.1%
fma-udef99.1%
associate-+l+99.1%
+-commutative99.1%
associate-+r+99.1%
fma-def99.1%
Applied egg-rr99.1%
Taylor expanded in z around inf 53.6%
if -5.2000000000000004e-174 < x < 1.75000000000000007e-256 or 8.20000000000000028e-48 < x < 7.3999999999999999e-16Initial program 100.0%
Taylor expanded in a around inf 54.9%
Final simplification57.5%
(FPCore (x y z t a b)
:precision binary64
(if (or (<= x -4.4e+167)
(not
(or (<= x -1.95e+149) (and (not (<= x -3.6e+112)) (<= x 8.2e-48)))))
(+ (* a b) (* x y))
(+ (* a b) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -4.4e+167) || !((x <= -1.95e+149) || (!(x <= -3.6e+112) && (x <= 8.2e-48)))) {
tmp = (a * b) + (x * y);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if ((x <= (-4.4d+167)) .or. (.not. (x <= (-1.95d+149)) .or. (.not. (x <= (-3.6d+112))) .and. (x <= 8.2d-48))) then
tmp = (a * b) + (x * y)
else
tmp = (a * b) + (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 tmp;
if ((x <= -4.4e+167) || !((x <= -1.95e+149) || (!(x <= -3.6e+112) && (x <= 8.2e-48)))) {
tmp = (a * b) + (x * y);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (x <= -4.4e+167) or not ((x <= -1.95e+149) or (not (x <= -3.6e+112) and (x <= 8.2e-48))): tmp = (a * b) + (x * y) else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if ((x <= -4.4e+167) || !((x <= -1.95e+149) || (!(x <= -3.6e+112) && (x <= 8.2e-48)))) tmp = Float64(Float64(a * b) + Float64(x * y)); else tmp = Float64(Float64(a * b) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((x <= -4.4e+167) || ~(((x <= -1.95e+149) || (~((x <= -3.6e+112)) && (x <= 8.2e-48))))) tmp = (a * b) + (x * y); else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[x, -4.4e+167], N[Not[Or[LessEqual[x, -1.95e+149], And[N[Not[LessEqual[x, -3.6e+112]], $MachinePrecision], LessEqual[x, 8.2e-48]]]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.4 \cdot 10^{+167} \lor \neg \left(x \leq -1.95 \cdot 10^{+149} \lor \neg \left(x \leq -3.6 \cdot 10^{+112}\right) \land x \leq 8.2 \cdot 10^{-48}\right):\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if x < -4.40000000000000007e167 or -1.95e149 < x < -3.6e112 or 8.20000000000000028e-48 < x Initial program 95.2%
Taylor expanded in x around inf 86.0%
if -4.40000000000000007e167 < x < -1.95e149 or -3.6e112 < x < 8.20000000000000028e-48Initial program 99.3%
Taylor expanded in x around 0 84.1%
Final simplification84.9%
(FPCore (x y z t a b) :precision binary64 (if (<= (* a b) -2.8e+123) (+ (* a b) (* x y)) (if (<= (* a b) 2900000000000.0) (+ (* x y) (* z t)) (+ (* a b) (* z t)))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -2.8e+123) {
tmp = (a * b) + (x * y);
} else if ((a * b) <= 2900000000000.0) {
tmp = (x * y) + (z * t);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if ((a * b) <= (-2.8d+123)) then
tmp = (a * b) + (x * y)
else if ((a * b) <= 2900000000000.0d0) then
tmp = (x * y) + (z * t)
else
tmp = (a * b) + (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 tmp;
if ((a * b) <= -2.8e+123) {
tmp = (a * b) + (x * y);
} else if ((a * b) <= 2900000000000.0) {
tmp = (x * y) + (z * t);
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -2.8e+123: tmp = (a * b) + (x * y) elif (a * b) <= 2900000000000.0: tmp = (x * y) + (z * t) else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -2.8e+123) tmp = Float64(Float64(a * b) + Float64(x * y)); elseif (Float64(a * b) <= 2900000000000.0) tmp = Float64(Float64(x * y) + Float64(z * t)); else tmp = Float64(Float64(a * b) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a * b) <= -2.8e+123) tmp = (a * b) + (x * y); elseif ((a * b) <= 2900000000000.0) tmp = (x * y) + (z * t); else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a * b), $MachinePrecision], -2.8e+123], N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2900000000000.0], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2.8 \cdot 10^{+123}:\\
\;\;\;\;a \cdot b + x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 2900000000000:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -2.80000000000000011e123Initial program 99.9%
Taylor expanded in x around inf 92.8%
if -2.80000000000000011e123 < (*.f64 a b) < 2.9e12Initial program 97.3%
associate-+l+97.3%
fma-def98.0%
fma-def98.0%
Simplified98.0%
fma-udef97.3%
fma-udef97.3%
associate-+l+97.3%
+-commutative97.3%
associate-+r+97.3%
fma-def97.3%
Applied egg-rr97.3%
Taylor expanded in a around 0 87.9%
if 2.9e12 < (*.f64 a b) Initial program 97.0%
Taylor expanded in x around 0 83.6%
Final simplification87.5%
(FPCore (x y z t a b) :precision binary64 (if (<= (* a b) -2.8e+123) (* a b) (if (<= (* a b) 1.75e+40) (* z t) (* a b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a * b) <= -2.8e+123) {
tmp = a * b;
} else if ((a * b) <= 1.75e+40) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if ((a * b) <= (-2.8d+123)) then
tmp = a * b
else if ((a * b) <= 1.75d+40) then
tmp = z * t
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 tmp;
if ((a * b) <= -2.8e+123) {
tmp = a * b;
} else if ((a * b) <= 1.75e+40) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if (a * b) <= -2.8e+123: tmp = a * b elif (a * b) <= 1.75e+40: tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(a * b) <= -2.8e+123) tmp = Float64(a * b); elseif (Float64(a * b) <= 1.75e+40) tmp = Float64(z * t); else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if ((a * b) <= -2.8e+123) tmp = a * b; elseif ((a * b) <= 1.75e+40) tmp = z * t; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(a * b), $MachinePrecision], -2.8e+123], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.75e+40], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2.8 \cdot 10^{+123}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 1.75 \cdot 10^{+40}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -2.80000000000000011e123 or 1.75e40 < (*.f64 a b) Initial program 98.0%
Taylor expanded in a around inf 70.2%
if -2.80000000000000011e123 < (*.f64 a b) < 1.75e40Initial program 97.4%
associate-+l+97.4%
fma-def98.1%
fma-def98.1%
Simplified98.1%
fma-udef97.4%
fma-udef97.4%
associate-+l+97.4%
+-commutative97.4%
associate-+r+97.4%
fma-def97.4%
Applied egg-rr97.4%
Taylor expanded in z around inf 48.7%
Final simplification57.2%
(FPCore (x y z t a b) :precision binary64 (if (<= x -2.4e+198) (* x y) (if (<= x 0.00035) (+ (* a b) (* z t)) (* x y))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -2.4e+198) {
tmp = x * y;
} else if (x <= 0.00035) {
tmp = (a * b) + (z * t);
} else {
tmp = x * y;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (x <= (-2.4d+198)) then
tmp = x * y
else if (x <= 0.00035d0) then
tmp = (a * b) + (z * t)
else
tmp = x * y
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -2.4e+198) {
tmp = x * y;
} else if (x <= 0.00035) {
tmp = (a * b) + (z * t);
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if x <= -2.4e+198: tmp = x * y elif x <= 0.00035: tmp = (a * b) + (z * t) else: tmp = x * y return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -2.4e+198) tmp = Float64(x * y); elseif (x <= 0.00035) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (x <= -2.4e+198) tmp = x * y; elseif (x <= 0.00035) tmp = (a * b) + (z * t); else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -2.4e+198], N[(x * y), $MachinePrecision], If[LessEqual[x, 0.00035], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \leq -2.4 \cdot 10^{+198}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \leq 0.00035:\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if x < -2.4000000000000001e198 or 3.49999999999999996e-4 < x Initial program 94.0%
associate-+l+94.0%
fma-def95.2%
fma-def95.2%
Simplified95.2%
fma-udef94.0%
fma-udef94.0%
associate-+l+94.0%
+-commutative94.0%
associate-+r+94.0%
fma-def94.0%
Applied egg-rr94.0%
Taylor expanded in x around inf 63.6%
if -2.4000000000000001e198 < x < 3.49999999999999996e-4Initial program 99.4%
Taylor expanded in x around 0 81.4%
Final simplification75.6%
(FPCore (x y z t a b) :precision binary64 (+ (* a b) (+ (* x y) (* z t))))
double code(double x, double y, double z, double t, double a, double b) {
return (a * b) + ((x * y) + (z * t));
}
real(8) function code(x, y, z, t, a, b)
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
code = (a * b) + ((x * y) + (z * t))
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return (a * b) + ((x * y) + (z * t));
}
def code(x, y, z, t, a, b): return (a * b) + ((x * y) + (z * t))
function code(x, y, z, t, a, b) return Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))) end
function tmp = code(x, y, z, t, a, b) tmp = (a * b) + ((x * y) + (z * t)); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b + \left(x \cdot y + z \cdot t\right)
\end{array}
Initial program 97.6%
Final simplification97.6%
(FPCore (x y z t a b) :precision binary64 (* a b))
double code(double x, double y, double z, double t, double a, double b) {
return a * b;
}
real(8) function code(x, y, z, t, a, b)
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
code = a * b
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return a * b;
}
def code(x, y, z, t, a, b): return a * b
function code(x, y, z, t, a, b) return Float64(a * b) end
function tmp = code(x, y, z, t, a, b) tmp = a * b; end
code[x_, y_, z_, t_, a_, b_] := N[(a * b), $MachinePrecision]
\begin{array}{l}
\\
a \cdot b
\end{array}
Initial program 97.6%
Taylor expanded in a around inf 35.0%
Final simplification35.0%
herbie shell --seed 2023229
(FPCore (x y z t a b)
:name "Linear.V3:$cdot from linear-1.19.1.3, B"
:precision binary64
(+ (+ (* x y) (* z t)) (* a b)))