
(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 12 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 x y (fma a b (fma c i (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(x, y, fma(a, b, fma(c, i, (z * t))));
}
function code(x, y, z, t, a, b, c, i) return fma(x, y, fma(a, b, fma(c, i, Float64(z * t)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(x * y + N[(a * b + N[(c * i + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(x, y, \mathsf{fma}\left(a, b, \mathsf{fma}\left(c, i, z \cdot t\right)\right)\right)
\end{array}
Initial program 93.7%
associate-+l+93.7%
associate-+l+93.7%
fma-def95.3%
associate-+r+95.3%
+-commutative95.3%
associate-+l+95.3%
fma-def96.1%
+-commutative96.1%
fma-def97.3%
Simplified97.3%
Final simplification97.3%
(FPCore (x y z t a b c i) :precision binary64 (fma c i (fma a b (fma x y (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(c, i, fma(a, b, fma(x, y, (z * t))));
}
function code(x, y, z, t, a, b, c, i) return fma(c, i, fma(a, b, fma(x, y, Float64(z * t)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i + N[(a * b + N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(c, i, \mathsf{fma}\left(a, b, \mathsf{fma}\left(x, y, z \cdot t\right)\right)\right)
\end{array}
Initial program 93.7%
+-commutative93.7%
fma-def95.7%
+-commutative95.7%
fma-def96.9%
fma-def96.9%
Simplified96.9%
Final simplification96.9%
(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 z t (fma a b (* c i))))))
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(z, t, fma(a, b, (c * i)));
}
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(z, t, fma(a, b, Float64(c * i))); 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[(z * t + N[(a * b + N[(c * i), $MachinePrecision]), $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(z, t, \mathsf{fma}\left(a, b, c \cdot i\right)\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%
fma-def0.0%
add-cube-cbrt0.0%
pow30.0%
Applied egg-rr0.0%
Taylor expanded in x around 0 25.0%
associate-*r*25.0%
pow-base-125.0%
*-lft-identity25.0%
Simplified25.0%
associate-+l+25.0%
*-commutative25.0%
fma-def43.8%
fma-def50.0%
Applied egg-rr50.0%
Final simplification96.9%
(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 (+ (* a b) (* z t)))))
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 = (a * b) + (z * t);
}
return tmp;
}
public static 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.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (((x * y) + (z * t)) + (a * b)) + (c * i) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = (a * b) + (z * t) 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 = Float64(Float64(a * b) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (((x * y) + (z * t)) + (a * b)) + (c * i); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = (a * b) + (z * t); end tmp_2 = 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[(N[(a * b), $MachinePrecision] + N[(z * t), $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}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\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%
fma-def0.0%
add-cube-cbrt0.0%
pow30.0%
Applied egg-rr0.0%
Taylor expanded in x around 0 25.0%
associate-*r*25.0%
pow-base-125.0%
*-lft-identity25.0%
Simplified25.0%
Taylor expanded in c around 0 44.2%
Final simplification96.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* a b) (* z t))))
(if (<= (* x y) -2.15e+238)
(* x y)
(if (<= (* x y) -3.4e+199)
t_1
(if (or (<= (* x y) -2.2e+106) (not (<= (* x y) 7.2e+133)))
(* x y)
(+ (* c i) t_1))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (a * b) + (z * t);
double tmp;
if ((x * y) <= -2.15e+238) {
tmp = x * y;
} else if ((x * y) <= -3.4e+199) {
tmp = t_1;
} else if (((x * y) <= -2.2e+106) || !((x * y) <= 7.2e+133)) {
tmp = x * y;
} else {
tmp = (c * i) + t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = (a * b) + (z * t)
if ((x * y) <= (-2.15d+238)) then
tmp = x * y
else if ((x * y) <= (-3.4d+199)) then
tmp = t_1
else if (((x * y) <= (-2.2d+106)) .or. (.not. ((x * y) <= 7.2d+133))) then
tmp = x * y
else
tmp = (c * i) + t_1
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 t_1 = (a * b) + (z * t);
double tmp;
if ((x * y) <= -2.15e+238) {
tmp = x * y;
} else if ((x * y) <= -3.4e+199) {
tmp = t_1;
} else if (((x * y) <= -2.2e+106) || !((x * y) <= 7.2e+133)) {
tmp = x * y;
} else {
tmp = (c * i) + t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (a * b) + (z * t) tmp = 0 if (x * y) <= -2.15e+238: tmp = x * y elif (x * y) <= -3.4e+199: tmp = t_1 elif ((x * y) <= -2.2e+106) or not ((x * y) <= 7.2e+133): tmp = x * y else: tmp = (c * i) + t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(a * b) + Float64(z * t)) tmp = 0.0 if (Float64(x * y) <= -2.15e+238) tmp = Float64(x * y); elseif (Float64(x * y) <= -3.4e+199) tmp = t_1; elseif ((Float64(x * y) <= -2.2e+106) || !(Float64(x * y) <= 7.2e+133)) tmp = Float64(x * y); else tmp = Float64(Float64(c * i) + t_1); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (a * b) + (z * t); tmp = 0.0; if ((x * y) <= -2.15e+238) tmp = x * y; elseif ((x * y) <= -3.4e+199) tmp = t_1; elseif (((x * y) <= -2.2e+106) || ~(((x * y) <= 7.2e+133))) tmp = x * y; else tmp = (c * i) + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -2.15e+238], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -3.4e+199], t$95$1, If[Or[LessEqual[N[(x * y), $MachinePrecision], -2.2e+106], N[Not[LessEqual[N[(x * y), $MachinePrecision], 7.2e+133]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
\mathbf{if}\;x \cdot y \leq -2.15 \cdot 10^{+238}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq -3.4 \cdot 10^{+199}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq -2.2 \cdot 10^{+106} \lor \neg \left(x \cdot y \leq 7.2 \cdot 10^{+133}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + t_1\\
\end{array}
\end{array}
if (*.f64 x y) < -2.14999999999999992e238 or -3.4e199 < (*.f64 x y) < -2.19999999999999992e106 or 7.19999999999999956e133 < (*.f64 x y) Initial program 88.6%
Taylor expanded in x around inf 77.7%
if -2.14999999999999992e238 < (*.f64 x y) < -3.4e199Initial program 83.3%
fma-def83.3%
add-cube-cbrt83.3%
pow383.3%
Applied egg-rr83.3%
Taylor expanded in x around 0 68.0%
associate-*r*68.0%
pow-base-168.0%
*-lft-identity68.0%
Simplified68.0%
Taylor expanded in c around 0 84.7%
if -2.19999999999999992e106 < (*.f64 x y) < 7.19999999999999956e133Initial program 96.1%
Taylor expanded in x around 0 89.7%
Final simplification86.3%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -5.4e+112)
(* a b)
(if (<= (* a b) -9.2e+86)
(* x y)
(if (<= (* a b) -1.3e-27)
(* z t)
(if (<= (* a b) -4.4e-264)
(* c i)
(if (<= (* a b) 1.66e+121) (* x y) (* 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.4e+112) {
tmp = a * b;
} else if ((a * b) <= -9.2e+86) {
tmp = x * y;
} else if ((a * b) <= -1.3e-27) {
tmp = z * t;
} else if ((a * b) <= -4.4e-264) {
tmp = c * i;
} else if ((a * b) <= 1.66e+121) {
tmp = x * y;
} 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.4d+112)) then
tmp = a * b
else if ((a * b) <= (-9.2d+86)) then
tmp = x * y
else if ((a * b) <= (-1.3d-27)) then
tmp = z * t
else if ((a * b) <= (-4.4d-264)) then
tmp = c * i
else if ((a * b) <= 1.66d+121) then
tmp = x * y
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.4e+112) {
tmp = a * b;
} else if ((a * b) <= -9.2e+86) {
tmp = x * y;
} else if ((a * b) <= -1.3e-27) {
tmp = z * t;
} else if ((a * b) <= -4.4e-264) {
tmp = c * i;
} else if ((a * b) <= 1.66e+121) {
tmp = x * y;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -5.4e+112: tmp = a * b elif (a * b) <= -9.2e+86: tmp = x * y elif (a * b) <= -1.3e-27: tmp = z * t elif (a * b) <= -4.4e-264: tmp = c * i elif (a * b) <= 1.66e+121: tmp = x * y else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -5.4e+112) tmp = Float64(a * b); elseif (Float64(a * b) <= -9.2e+86) tmp = Float64(x * y); elseif (Float64(a * b) <= -1.3e-27) tmp = Float64(z * t); elseif (Float64(a * b) <= -4.4e-264) tmp = Float64(c * i); elseif (Float64(a * b) <= 1.66e+121) tmp = Float64(x * y); 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.4e+112) tmp = a * b; elseif ((a * b) <= -9.2e+86) tmp = x * y; elseif ((a * b) <= -1.3e-27) tmp = z * t; elseif ((a * b) <= -4.4e-264) tmp = c * i; elseif ((a * b) <= 1.66e+121) tmp = x * y; 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.4e+112], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -9.2e+86], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -1.3e-27], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -4.4e-264], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.66e+121], N[(x * y), $MachinePrecision], N[(a * b), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -5.4 \cdot 10^{+112}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -9.2 \cdot 10^{+86}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq -1.3 \cdot 10^{-27}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq -4.4 \cdot 10^{-264}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;a \cdot b \leq 1.66 \cdot 10^{+121}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -5.4000000000000002e112 or 1.66000000000000002e121 < (*.f64 a b) Initial program 87.8%
Taylor expanded in a around inf 63.3%
if -5.4000000000000002e112 < (*.f64 a b) < -9.19999999999999958e86 or -4.39999999999999988e-264 < (*.f64 a b) < 1.66000000000000002e121Initial program 98.2%
Taylor expanded in x around inf 42.1%
if -9.19999999999999958e86 < (*.f64 a b) < -1.30000000000000009e-27Initial program 92.9%
Taylor expanded in z around inf 54.3%
if -1.30000000000000009e-27 < (*.f64 a b) < -4.39999999999999988e-264Initial program 96.3%
Taylor expanded in c around inf 56.9%
Final simplification52.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* a b) (* z t))) (t_2 (+ (* a b) (* c i))))
(if (<= (* c i) -2.4e+143)
t_2
(if (<= (* c i) 7.6e-87)
t_1
(if (<= (* c i) 5.6e-40) (* x y) (if (<= (* c i) 2e+206) 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 = (a * b) + (z * t);
double t_2 = (a * b) + (c * i);
double tmp;
if ((c * i) <= -2.4e+143) {
tmp = t_2;
} else if ((c * i) <= 7.6e-87) {
tmp = t_1;
} else if ((c * i) <= 5.6e-40) {
tmp = x * y;
} else if ((c * i) <= 2e+206) {
tmp = t_1;
} else {
tmp = t_2;
}
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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (a * b) + (z * t)
t_2 = (a * b) + (c * i)
if ((c * i) <= (-2.4d+143)) then
tmp = t_2
else if ((c * i) <= 7.6d-87) then
tmp = t_1
else if ((c * i) <= 5.6d-40) then
tmp = x * y
else if ((c * i) <= 2d+206) then
tmp = t_1
else
tmp = t_2
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 t_1 = (a * b) + (z * t);
double t_2 = (a * b) + (c * i);
double tmp;
if ((c * i) <= -2.4e+143) {
tmp = t_2;
} else if ((c * i) <= 7.6e-87) {
tmp = t_1;
} else if ((c * i) <= 5.6e-40) {
tmp = x * y;
} else if ((c * i) <= 2e+206) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (a * b) + (z * t) t_2 = (a * b) + (c * i) tmp = 0 if (c * i) <= -2.4e+143: tmp = t_2 elif (c * i) <= 7.6e-87: tmp = t_1 elif (c * i) <= 5.6e-40: tmp = x * y elif (c * i) <= 2e+206: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(a * b) + Float64(z * t)) t_2 = Float64(Float64(a * b) + Float64(c * i)) tmp = 0.0 if (Float64(c * i) <= -2.4e+143) tmp = t_2; elseif (Float64(c * i) <= 7.6e-87) tmp = t_1; elseif (Float64(c * i) <= 5.6e-40) tmp = Float64(x * y); elseif (Float64(c * i) <= 2e+206) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (a * b) + (z * t); t_2 = (a * b) + (c * i); tmp = 0.0; if ((c * i) <= -2.4e+143) tmp = t_2; elseif ((c * i) <= 7.6e-87) tmp = t_1; elseif ((c * i) <= 5.6e-40) tmp = x * y; elseif ((c * i) <= 2e+206) tmp = t_1; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -2.4e+143], t$95$2, If[LessEqual[N[(c * i), $MachinePrecision], 7.6e-87], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], 5.6e-40], N[(x * y), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2e+206], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
t_2 := a \cdot b + c \cdot i\\
\mathbf{if}\;c \cdot i \leq -2.4 \cdot 10^{+143}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \cdot i \leq 7.6 \cdot 10^{-87}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \cdot i \leq 5.6 \cdot 10^{-40}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;c \cdot i \leq 2 \cdot 10^{+206}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if (*.f64 c i) < -2.3999999999999998e143 or 2.0000000000000001e206 < (*.f64 c i) Initial program 85.1%
fma-def85.1%
add-cube-cbrt85.1%
pow385.1%
Applied egg-rr85.1%
Taylor expanded in x around inf 77.0%
if -2.3999999999999998e143 < (*.f64 c i) < 7.6e-87 or 5.5999999999999999e-40 < (*.f64 c i) < 2.0000000000000001e206Initial program 96.7%
fma-def96.7%
add-cube-cbrt95.8%
pow395.8%
Applied egg-rr95.8%
Taylor expanded in x around 0 71.8%
associate-*r*71.8%
pow-base-171.8%
*-lft-identity71.8%
Simplified71.8%
Taylor expanded in c around 0 64.8%
if 7.6e-87 < (*.f64 c i) < 5.5999999999999999e-40Initial program 100.0%
Taylor expanded in x around inf 85.9%
Final simplification68.6%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* c i) (* z t))))
(if (<= (* a b) -9.2e+86)
(+ (* a b) (* c i))
(if (<= (* a b) 4200000000.0)
t_1
(if (<= (* a b) 1.65e+56)
(* x y)
(if (<= (* a b) 1.04e+77) t_1 (+ (* a b) (* z t))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (c * i) + (z * t);
double tmp;
if ((a * b) <= -9.2e+86) {
tmp = (a * b) + (c * i);
} else if ((a * b) <= 4200000000.0) {
tmp = t_1;
} else if ((a * b) <= 1.65e+56) {
tmp = x * y;
} else if ((a * b) <= 1.04e+77) {
tmp = t_1;
} else {
tmp = (a * b) + (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) :: t_1
real(8) :: tmp
t_1 = (c * i) + (z * t)
if ((a * b) <= (-9.2d+86)) then
tmp = (a * b) + (c * i)
else if ((a * b) <= 4200000000.0d0) then
tmp = t_1
else if ((a * b) <= 1.65d+56) then
tmp = x * y
else if ((a * b) <= 1.04d+77) then
tmp = t_1
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 c, double i) {
double t_1 = (c * i) + (z * t);
double tmp;
if ((a * b) <= -9.2e+86) {
tmp = (a * b) + (c * i);
} else if ((a * b) <= 4200000000.0) {
tmp = t_1;
} else if ((a * b) <= 1.65e+56) {
tmp = x * y;
} else if ((a * b) <= 1.04e+77) {
tmp = t_1;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (c * i) + (z * t) tmp = 0 if (a * b) <= -9.2e+86: tmp = (a * b) + (c * i) elif (a * b) <= 4200000000.0: tmp = t_1 elif (a * b) <= 1.65e+56: tmp = x * y elif (a * b) <= 1.04e+77: tmp = t_1 else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(c * i) + Float64(z * t)) tmp = 0.0 if (Float64(a * b) <= -9.2e+86) tmp = Float64(Float64(a * b) + Float64(c * i)); elseif (Float64(a * b) <= 4200000000.0) tmp = t_1; elseif (Float64(a * b) <= 1.65e+56) tmp = Float64(x * y); elseif (Float64(a * b) <= 1.04e+77) tmp = t_1; else tmp = Float64(Float64(a * b) + Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (c * i) + (z * t); tmp = 0.0; if ((a * b) <= -9.2e+86) tmp = (a * b) + (c * i); elseif ((a * b) <= 4200000000.0) tmp = t_1; elseif ((a * b) <= 1.65e+56) tmp = x * y; elseif ((a * b) <= 1.04e+77) tmp = t_1; else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(a * b), $MachinePrecision], -9.2e+86], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 4200000000.0], t$95$1, If[LessEqual[N[(a * b), $MachinePrecision], 1.65e+56], N[(x * y), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1.04e+77], t$95$1, N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c \cdot i + z \cdot t\\
\mathbf{if}\;a \cdot b \leq -9.2 \cdot 10^{+86}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;a \cdot b \leq 4200000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \cdot b \leq 1.65 \cdot 10^{+56}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;a \cdot b \leq 1.04 \cdot 10^{+77}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -9.19999999999999958e86Initial program 85.5%
fma-def85.5%
add-cube-cbrt85.3%
pow385.2%
Applied egg-rr85.2%
Taylor expanded in x around inf 68.0%
if -9.19999999999999958e86 < (*.f64 a b) < 4.2e9 or 1.65000000000000001e56 < (*.f64 a b) < 1.04e77Initial program 97.2%
fma-def97.2%
add-cube-cbrt96.3%
pow396.4%
Applied egg-rr96.4%
Taylor expanded in x around 0 72.7%
associate-*r*72.7%
pow-base-172.7%
*-lft-identity72.7%
Simplified72.7%
Taylor expanded in a around 0 67.5%
if 4.2e9 < (*.f64 a b) < 1.65000000000000001e56Initial program 85.7%
Taylor expanded in x around inf 86.5%
if 1.04e77 < (*.f64 a b) Initial program 93.9%
fma-def93.9%
add-cube-cbrt93.6%
pow393.6%
Applied egg-rr93.6%
Taylor expanded in x around 0 90.0%
associate-*r*90.0%
pow-base-190.0%
*-lft-identity90.0%
Simplified90.0%
Taylor expanded in c around 0 82.1%
Final simplification70.9%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -4.9e+194)
(* a b)
(if (<= (* a b) -2.75e-263)
(* c i)
(if (<= (* a b) 3.4e+148) (* 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 ((a * b) <= -4.9e+194) {
tmp = a * b;
} else if ((a * b) <= -2.75e-263) {
tmp = c * i;
} else if ((a * b) <= 3.4e+148) {
tmp = z * t;
} 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) <= (-4.9d+194)) then
tmp = a * b
else if ((a * b) <= (-2.75d-263)) then
tmp = c * i
else if ((a * b) <= 3.4d+148) 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 c, double i) {
double tmp;
if ((a * b) <= -4.9e+194) {
tmp = a * b;
} else if ((a * b) <= -2.75e-263) {
tmp = c * i;
} else if ((a * b) <= 3.4e+148) {
tmp = z * t;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -4.9e+194: tmp = a * b elif (a * b) <= -2.75e-263: tmp = c * i elif (a * b) <= 3.4e+148: tmp = z * t else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -4.9e+194) tmp = Float64(a * b); elseif (Float64(a * b) <= -2.75e-263) tmp = Float64(c * i); elseif (Float64(a * b) <= 3.4e+148) tmp = Float64(z * t); 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) <= -4.9e+194) tmp = a * b; elseif ((a * b) <= -2.75e-263) tmp = c * i; elseif ((a * b) <= 3.4e+148) tmp = z * t; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -4.9e+194], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], -2.75e-263], N[(c * i), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 3.4e+148], N[(z * t), $MachinePrecision], N[(a * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -4.9 \cdot 10^{+194}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq -2.75 \cdot 10^{-263}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;a \cdot b \leq 3.4 \cdot 10^{+148}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -4.90000000000000026e194 or 3.4000000000000003e148 < (*.f64 a b) Initial program 87.8%
Taylor expanded in a around inf 69.9%
if -4.90000000000000026e194 < (*.f64 a b) < -2.74999999999999986e-263Initial program 93.1%
Taylor expanded in c around inf 41.7%
if -2.74999999999999986e-263 < (*.f64 a b) < 3.4000000000000003e148Initial program 98.2%
Taylor expanded in z around inf 38.5%
Final simplification48.5%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -1.38e+79) (not (<= (* x y) 3.7e+119))) (* x y) (+ (* 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 (((x * y) <= -1.38e+79) || !((x * y) <= 3.7e+119)) {
tmp = x * y;
} else {
tmp = (a * b) + (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 (((x * y) <= (-1.38d+79)) .or. (.not. ((x * y) <= 3.7d+119))) then
tmp = x * y
else
tmp = (a * b) + (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 (((x * y) <= -1.38e+79) || !((x * y) <= 3.7e+119)) {
tmp = x * y;
} else {
tmp = (a * b) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -1.38e+79) or not ((x * y) <= 3.7e+119): tmp = x * y else: tmp = (a * b) + (c * i) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -1.38e+79) || !(Float64(x * y) <= 3.7e+119)) tmp = Float64(x * y); else tmp = Float64(Float64(a * b) + Float64(c * i)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((x * y) <= -1.38e+79) || ~(((x * y) <= 3.7e+119))) tmp = x * y; else tmp = (a * b) + (c * i); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -1.38e+79], N[Not[LessEqual[N[(x * y), $MachinePrecision], 3.7e+119]], $MachinePrecision]], N[(x * y), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.38 \cdot 10^{+79} \lor \neg \left(x \cdot y \leq 3.7 \cdot 10^{+119}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if (*.f64 x y) < -1.38e79 or 3.7e119 < (*.f64 x y) Initial program 89.0%
Taylor expanded in x around inf 70.3%
if -1.38e79 < (*.f64 x y) < 3.7e119Initial program 96.0%
fma-def96.0%
add-cube-cbrt95.5%
pow395.5%
Applied egg-rr95.5%
Taylor expanded in x around inf 62.9%
Final simplification65.3%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* a b) -4.9e+194) (not (<= (* a b) 1.08e+76))) (* 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 (((a * b) <= -4.9e+194) || !((a * b) <= 1.08e+76)) {
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 (((a * b) <= (-4.9d+194)) .or. (.not. ((a * b) <= 1.08d+76))) 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 (((a * b) <= -4.9e+194) || !((a * b) <= 1.08e+76)) {
tmp = a * b;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((a * b) <= -4.9e+194) or not ((a * b) <= 1.08e+76): tmp = a * b else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(a * b) <= -4.9e+194) || !(Float64(a * b) <= 1.08e+76)) 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 (((a * b) <= -4.9e+194) || ~(((a * b) <= 1.08e+76))) tmp = a * b; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -4.9e+194], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1.08e+76]], $MachinePrecision]], N[(a * b), $MachinePrecision], N[(c * i), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -4.9 \cdot 10^{+194} \lor \neg \left(a \cdot b \leq 1.08 \cdot 10^{+76}\right):\\
\;\;\;\;a \cdot b\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 a b) < -4.90000000000000026e194 or 1.07999999999999999e76 < (*.f64 a b) Initial program 89.7%
Taylor expanded in a around inf 63.2%
if -4.90000000000000026e194 < (*.f64 a b) < 1.07999999999999999e76Initial program 95.8%
Taylor expanded in c around inf 32.8%
Final simplification43.2%
(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 93.7%
Taylor expanded in a around inf 26.9%
Final simplification26.9%
herbie shell --seed 2023301
(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)))