
(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 (let* ((t_1 (+ (* c i) (+ (* a b) (+ (* x y) (* z t)))))) (if (<= t_1 INFINITY) t_1 (+ (* x y) (* c i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (c * i) + ((a * b) + ((x * y) + (z * t)));
double tmp;
if (t_1 <= ((double) INFINITY)) {
tmp = t_1;
} else {
tmp = (x * y) + (c * i);
}
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 = (c * i) + ((a * b) + ((x * y) + (z * t)));
double tmp;
if (t_1 <= Double.POSITIVE_INFINITY) {
tmp = t_1;
} else {
tmp = (x * y) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (c * i) + ((a * b) + ((x * y) + (z * t))) tmp = 0 if t_1 <= math.inf: tmp = t_1 else: tmp = (x * y) + (c * i) return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t)))) tmp = 0.0 if (t_1 <= Inf) tmp = t_1; else tmp = Float64(Float64(x * y) + Float64(c * i)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (c * i) + ((a * b) + ((x * y) + (z * t))); tmp = 0.0; if (t_1 <= Inf) tmp = t_1; else tmp = (x * y) + (c * i); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, Infinity], t$95$1, N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c \cdot i + \left(a \cdot b + \left(x \cdot y + z \cdot t\right)\right)\\
\mathbf{if}\;t\_1 \leq \infty:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + c \cdot i\\
\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 a around inf 50.0%
associate-+r+50.0%
associate-/l*50.0%
Simplified50.0%
Taylor expanded in x around inf 67.1%
Final simplification99.2%
(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 97.6%
+-commutative97.6%
fma-define97.6%
+-commutative97.6%
fma-define98.8%
fma-define98.8%
Simplified98.8%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -3.1e+90)
(* c i)
(if (<= (* c i) -1.9e-180)
(* z t)
(if (<= (* c i) -1.75e-307)
(* x y)
(if (<= (* c i) 9.5e-281)
(* z t)
(if (<= (* c i) 4.5e+147) (* x y) (* 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) <= -3.1e+90) {
tmp = c * i;
} else if ((c * i) <= -1.9e-180) {
tmp = z * t;
} else if ((c * i) <= -1.75e-307) {
tmp = x * y;
} else if ((c * i) <= 9.5e-281) {
tmp = z * t;
} else if ((c * i) <= 4.5e+147) {
tmp = x * y;
} 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) <= (-3.1d+90)) then
tmp = c * i
else if ((c * i) <= (-1.9d-180)) then
tmp = z * t
else if ((c * i) <= (-1.75d-307)) then
tmp = x * y
else if ((c * i) <= 9.5d-281) then
tmp = z * t
else if ((c * i) <= 4.5d+147) then
tmp = x * y
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) <= -3.1e+90) {
tmp = c * i;
} else if ((c * i) <= -1.9e-180) {
tmp = z * t;
} else if ((c * i) <= -1.75e-307) {
tmp = x * y;
} else if ((c * i) <= 9.5e-281) {
tmp = z * t;
} else if ((c * i) <= 4.5e+147) {
tmp = x * y;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -3.1e+90: tmp = c * i elif (c * i) <= -1.9e-180: tmp = z * t elif (c * i) <= -1.75e-307: tmp = x * y elif (c * i) <= 9.5e-281: tmp = z * t elif (c * i) <= 4.5e+147: tmp = x * y else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -3.1e+90) tmp = Float64(c * i); elseif (Float64(c * i) <= -1.9e-180) tmp = Float64(z * t); elseif (Float64(c * i) <= -1.75e-307) tmp = Float64(x * y); elseif (Float64(c * i) <= 9.5e-281) tmp = Float64(z * t); elseif (Float64(c * i) <= 4.5e+147) tmp = Float64(x * y); 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) <= -3.1e+90) tmp = c * i; elseif ((c * i) <= -1.9e-180) tmp = z * t; elseif ((c * i) <= -1.75e-307) tmp = x * y; elseif ((c * i) <= 9.5e-281) tmp = z * t; elseif ((c * i) <= 4.5e+147) tmp = x * y; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -3.1e+90], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -1.9e-180], N[(z * t), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -1.75e-307], N[(x * y), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 9.5e-281], N[(z * t), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 4.5e+147], N[(x * y), $MachinePrecision], N[(c * i), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -3.1 \cdot 10^{+90}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -1.9 \cdot 10^{-180}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;c \cdot i \leq -1.75 \cdot 10^{-307}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;c \cdot i \leq 9.5 \cdot 10^{-281}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 4.5 \cdot 10^{+147}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -3.09999999999999988e90 or 4.50000000000000008e147 < (*.f64 c i) Initial program 96.3%
+-commutative96.3%
fma-define96.3%
+-commutative96.3%
fma-define96.3%
fma-define96.3%
Simplified96.3%
Taylor expanded in c around inf 73.1%
if -3.09999999999999988e90 < (*.f64 c i) < -1.9e-180 or -1.7500000000000001e-307 < (*.f64 c i) < 9.5000000000000003e-281Initial program 100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around inf 47.1%
if -1.9e-180 < (*.f64 c i) < -1.7500000000000001e-307 or 9.5000000000000003e-281 < (*.f64 c i) < 4.50000000000000008e147Initial program 96.7%
+-commutative96.7%
fma-define96.7%
+-commutative96.7%
fma-define100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around inf 52.7%
Final simplification57.4%
(FPCore (x y z t a b c i)
:precision binary64
(if (or (<= (* x y) -2.8e+228)
(not
(or (<= (* x y) -2.6e+175)
(and (not (<= (* x y) -1.25e+90)) (<= (* x y) 9e+172)))))
(* 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) <= -2.8e+228) || !(((x * y) <= -2.6e+175) || (!((x * y) <= -1.25e+90) && ((x * y) <= 9e+172)))) {
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) <= (-2.8d+228)) .or. (.not. ((x * y) <= (-2.6d+175)) .or. (.not. ((x * y) <= (-1.25d+90))) .and. ((x * y) <= 9d+172))) 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) <= -2.8e+228) || !(((x * y) <= -2.6e+175) || (!((x * y) <= -1.25e+90) && ((x * y) <= 9e+172)))) {
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) <= -2.8e+228) or not (((x * y) <= -2.6e+175) or (not ((x * y) <= -1.25e+90) and ((x * y) <= 9e+172))): 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) <= -2.8e+228) || !((Float64(x * y) <= -2.6e+175) || (!(Float64(x * y) <= -1.25e+90) && (Float64(x * y) <= 9e+172)))) 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) <= -2.8e+228) || ~((((x * y) <= -2.6e+175) || (~(((x * y) <= -1.25e+90)) && ((x * y) <= 9e+172))))) 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], -2.8e+228], N[Not[Or[LessEqual[N[(x * y), $MachinePrecision], -2.6e+175], And[N[Not[LessEqual[N[(x * y), $MachinePrecision], -1.25e+90]], $MachinePrecision], LessEqual[N[(x * y), $MachinePrecision], 9e+172]]]], $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 -2.8 \cdot 10^{+228} \lor \neg \left(x \cdot y \leq -2.6 \cdot 10^{+175} \lor \neg \left(x \cdot y \leq -1.25 \cdot 10^{+90}\right) \land x \cdot y \leq 9 \cdot 10^{+172}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if (*.f64 x y) < -2.7999999999999999e228 or -2.6e175 < (*.f64 x y) < -1.2500000000000001e90 or 9.0000000000000004e172 < (*.f64 x y) Initial program 98.7%
+-commutative98.7%
fma-define98.7%
+-commutative98.7%
fma-define100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in x around inf 76.7%
if -2.7999999999999999e228 < (*.f64 x y) < -2.6e175 or -1.2500000000000001e90 < (*.f64 x y) < 9.0000000000000004e172Initial program 97.1%
Taylor expanded in a around inf 86.4%
associate-+r+86.4%
associate-/l*84.4%
Simplified84.4%
Taylor expanded in a around inf 60.5%
Final simplification65.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* a b))))
(if (<= (* c i) -6.8e+88)
(+ (* x y) (* c i))
(if (<= (* c i) -7.5e-118)
t_1
(if (<= (* c i) -6.2e-181)
(* z t)
(if (<= (* c i) 1.05e+146) t_1 (+ (* 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) + (a * b);
double tmp;
if ((c * i) <= -6.8e+88) {
tmp = (x * y) + (c * i);
} else if ((c * i) <= -7.5e-118) {
tmp = t_1;
} else if ((c * i) <= -6.2e-181) {
tmp = z * t;
} else if ((c * i) <= 1.05e+146) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (x * y) + (a * b)
if ((c * i) <= (-6.8d+88)) then
tmp = (x * y) + (c * i)
else if ((c * i) <= (-7.5d-118)) then
tmp = t_1
else if ((c * i) <= (-6.2d-181)) then
tmp = z * t
else if ((c * i) <= 1.05d+146) then
tmp = t_1
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 t_1 = (x * y) + (a * b);
double tmp;
if ((c * i) <= -6.8e+88) {
tmp = (x * y) + (c * i);
} else if ((c * i) <= -7.5e-118) {
tmp = t_1;
} else if ((c * i) <= -6.2e-181) {
tmp = z * t;
} else if ((c * i) <= 1.05e+146) {
tmp = t_1;
} else {
tmp = (a * b) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (x * y) + (a * b) tmp = 0 if (c * i) <= -6.8e+88: tmp = (x * y) + (c * i) elif (c * i) <= -7.5e-118: tmp = t_1 elif (c * i) <= -6.2e-181: tmp = z * t elif (c * i) <= 1.05e+146: tmp = t_1 else: tmp = (a * b) + (c * i) return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) + Float64(a * b)) tmp = 0.0 if (Float64(c * i) <= -6.8e+88) tmp = Float64(Float64(x * y) + Float64(c * i)); elseif (Float64(c * i) <= -7.5e-118) tmp = t_1; elseif (Float64(c * i) <= -6.2e-181) tmp = Float64(z * t); elseif (Float64(c * i) <= 1.05e+146) tmp = t_1; 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) t_1 = (x * y) + (a * b); tmp = 0.0; if ((c * i) <= -6.8e+88) tmp = (x * y) + (c * i); elseif ((c * i) <= -7.5e-118) tmp = t_1; elseif ((c * i) <= -6.2e-181) tmp = z * t; elseif ((c * i) <= 1.05e+146) tmp = t_1; else tmp = (a * b) + (c * i); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -6.8e+88], N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -7.5e-118], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], -6.2e-181], N[(z * t), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1.05e+146], t$95$1, N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + a \cdot b\\
\mathbf{if}\;c \cdot i \leq -6.8 \cdot 10^{+88}:\\
\;\;\;\;x \cdot y + c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -7.5 \cdot 10^{-118}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \cdot i \leq -6.2 \cdot 10^{-181}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 1.05 \cdot 10^{+146}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -6.80000000000000008e88Initial program 97.9%
Taylor expanded in a around inf 81.6%
associate-+r+81.6%
associate-/l*81.5%
Simplified81.5%
Taylor expanded in x around inf 80.1%
if -6.80000000000000008e88 < (*.f64 c i) < -7.49999999999999978e-118 or -6.20000000000000043e-181 < (*.f64 c i) < 1.05e146Initial program 98.1%
Taylor expanded in z around 0 71.4%
Taylor expanded in c around 0 66.9%
if -7.49999999999999978e-118 < (*.f64 c i) < -6.20000000000000043e-181Initial program 100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around inf 82.1%
if 1.05e146 < (*.f64 c i) Initial program 94.3%
Taylor expanded in a around inf 80.6%
associate-+r+80.6%
associate-/l*80.6%
Simplified80.6%
Taylor expanded in a around inf 89.0%
Final simplification73.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* a b))) (t_2 (+ (* a b) (* c i))))
(if (<= (* c i) -6.4e+87)
t_2
(if (<= (* c i) -4.2e-118)
t_1
(if (<= (* c i) -7e-181) (* z t) (if (<= (* c i) 7e+146) 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 = (x * y) + (a * b);
double t_2 = (a * b) + (c * i);
double tmp;
if ((c * i) <= -6.4e+87) {
tmp = t_2;
} else if ((c * i) <= -4.2e-118) {
tmp = t_1;
} else if ((c * i) <= -7e-181) {
tmp = z * t;
} else if ((c * i) <= 7e+146) {
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 = (x * y) + (a * b)
t_2 = (a * b) + (c * i)
if ((c * i) <= (-6.4d+87)) then
tmp = t_2
else if ((c * i) <= (-4.2d-118)) then
tmp = t_1
else if ((c * i) <= (-7d-181)) then
tmp = z * t
else if ((c * i) <= 7d+146) 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 = (x * y) + (a * b);
double t_2 = (a * b) + (c * i);
double tmp;
if ((c * i) <= -6.4e+87) {
tmp = t_2;
} else if ((c * i) <= -4.2e-118) {
tmp = t_1;
} else if ((c * i) <= -7e-181) {
tmp = z * t;
} else if ((c * i) <= 7e+146) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (x * y) + (a * b) t_2 = (a * b) + (c * i) tmp = 0 if (c * i) <= -6.4e+87: tmp = t_2 elif (c * i) <= -4.2e-118: tmp = t_1 elif (c * i) <= -7e-181: tmp = z * t elif (c * i) <= 7e+146: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) + Float64(a * b)) t_2 = Float64(Float64(a * b) + Float64(c * i)) tmp = 0.0 if (Float64(c * i) <= -6.4e+87) tmp = t_2; elseif (Float64(c * i) <= -4.2e-118) tmp = t_1; elseif (Float64(c * i) <= -7e-181) tmp = Float64(z * t); elseif (Float64(c * i) <= 7e+146) 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 = (x * y) + (a * b); t_2 = (a * b) + (c * i); tmp = 0.0; if ((c * i) <= -6.4e+87) tmp = t_2; elseif ((c * i) <= -4.2e-118) tmp = t_1; elseif ((c * i) <= -7e-181) tmp = z * t; elseif ((c * i) <= 7e+146) 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[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -6.4e+87], t$95$2, If[LessEqual[N[(c * i), $MachinePrecision], -4.2e-118], t$95$1, If[LessEqual[N[(c * i), $MachinePrecision], -7e-181], N[(z * t), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 7e+146], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + a \cdot b\\
t_2 := a \cdot b + c \cdot i\\
\mathbf{if}\;c \cdot i \leq -6.4 \cdot 10^{+87}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;c \cdot i \leq -4.2 \cdot 10^{-118}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \cdot i \leq -7 \cdot 10^{-181}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 7 \cdot 10^{+146}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 c i) < -6.4000000000000001e87 or 7.0000000000000002e146 < (*.f64 c i) Initial program 96.4%
Taylor expanded in a around inf 81.2%
associate-+r+81.2%
associate-/l*81.1%
Simplified81.1%
Taylor expanded in a around inf 82.5%
if -6.4000000000000001e87 < (*.f64 c i) < -4.2e-118 or -6.99999999999999993e-181 < (*.f64 c i) < 7.0000000000000002e146Initial program 98.1%
Taylor expanded in z around 0 71.4%
Taylor expanded in c around 0 66.9%
if -4.2e-118 < (*.f64 c i) < -6.99999999999999993e-181Initial program 100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around inf 82.1%
Final simplification72.6%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -1.25e+92)
(* c i)
(if (<= (* c i) -4.8e-190)
(* z t)
(if (<= (* c i) 0.0) (* a b) (if (<= (* c i) 4e+39) (* 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) <= -1.25e+92) {
tmp = c * i;
} else if ((c * i) <= -4.8e-190) {
tmp = z * t;
} else if ((c * i) <= 0.0) {
tmp = a * b;
} else if ((c * i) <= 4e+39) {
tmp = z * t;
} 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) <= (-1.25d+92)) then
tmp = c * i
else if ((c * i) <= (-4.8d-190)) then
tmp = z * t
else if ((c * i) <= 0.0d0) then
tmp = a * b
else if ((c * i) <= 4d+39) then
tmp = z * t
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) <= -1.25e+92) {
tmp = c * i;
} else if ((c * i) <= -4.8e-190) {
tmp = z * t;
} else if ((c * i) <= 0.0) {
tmp = a * b;
} else if ((c * i) <= 4e+39) {
tmp = z * t;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -1.25e+92: tmp = c * i elif (c * i) <= -4.8e-190: tmp = z * t elif (c * i) <= 0.0: tmp = a * b elif (c * i) <= 4e+39: tmp = z * t else: tmp = c * i return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -1.25e+92) tmp = Float64(c * i); elseif (Float64(c * i) <= -4.8e-190) tmp = Float64(z * t); elseif (Float64(c * i) <= 0.0) tmp = Float64(a * b); elseif (Float64(c * i) <= 4e+39) tmp = Float64(z * t); 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) <= -1.25e+92) tmp = c * i; elseif ((c * i) <= -4.8e-190) tmp = z * t; elseif ((c * i) <= 0.0) tmp = a * b; elseif ((c * i) <= 4e+39) tmp = z * t; else tmp = c * i; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -1.25e+92], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -4.8e-190], N[(z * t), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 0.0], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 4e+39], N[(z * t), $MachinePrecision], N[(c * i), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.25 \cdot 10^{+92}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -4.8 \cdot 10^{-190}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;c \cdot i \leq 0:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \cdot i \leq 4 \cdot 10^{+39}:\\
\;\;\;\;z \cdot t\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -1.25000000000000005e92 or 3.99999999999999976e39 < (*.f64 c i) Initial program 96.1%
+-commutative96.1%
fma-define96.1%
+-commutative96.1%
fma-define97.1%
fma-define97.1%
Simplified97.1%
Taylor expanded in c around inf 62.8%
if -1.25000000000000005e92 < (*.f64 c i) < -4.8000000000000001e-190 or -0.0 < (*.f64 c i) < 3.99999999999999976e39Initial program 98.2%
+-commutative98.2%
fma-define98.2%
+-commutative98.2%
fma-define100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in z around inf 42.2%
if -4.8000000000000001e-190 < (*.f64 c i) < -0.0Initial program 100.0%
+-commutative100.0%
fma-define100.0%
+-commutative100.0%
fma-define100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in a around inf 45.8%
Final simplification51.0%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -8.7e+89) (not (<= (* c i) 2.4e+37))) (+ (* c i) (+ (* x y) (* a b))) (+ (* a b) (+ (* x y) (* z t)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((c * i) <= -8.7e+89) || !((c * i) <= 2.4e+37)) {
tmp = (c * i) + ((x * y) + (a * b));
} else {
tmp = (a * b) + ((x * y) + (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 (((c * i) <= (-8.7d+89)) .or. (.not. ((c * i) <= 2.4d+37))) then
tmp = (c * i) + ((x * y) + (a * b))
else
tmp = (a * b) + ((x * y) + (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 (((c * i) <= -8.7e+89) || !((c * i) <= 2.4e+37)) {
tmp = (c * i) + ((x * y) + (a * b));
} else {
tmp = (a * b) + ((x * y) + (z * t));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -8.7e+89) or not ((c * i) <= 2.4e+37): tmp = (c * i) + ((x * y) + (a * b)) else: tmp = (a * b) + ((x * y) + (z * t)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(c * i) <= -8.7e+89) || !(Float64(c * i) <= 2.4e+37)) tmp = Float64(Float64(c * i) + Float64(Float64(x * y) + Float64(a * b))); else tmp = Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((c * i) <= -8.7e+89) || ~(((c * i) <= 2.4e+37))) tmp = (c * i) + ((x * y) + (a * b)); else tmp = (a * b) + ((x * y) + (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -8.7e+89], N[Not[LessEqual[N[(c * i), $MachinePrecision], 2.4e+37]], $MachinePrecision]], N[(N[(c * i), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -8.7 \cdot 10^{+89} \lor \neg \left(c \cdot i \leq 2.4 \cdot 10^{+37}\right):\\
\;\;\;\;c \cdot i + \left(x \cdot y + a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 c i) < -8.70000000000000019e89 or 2.4e37 < (*.f64 c i) Initial program 96.1%
Taylor expanded in z around 0 92.4%
if -8.70000000000000019e89 < (*.f64 c i) < 2.4e37Initial program 98.7%
+-commutative98.7%
fma-define98.7%
+-commutative98.7%
fma-define100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in c around 0 96.4%
Final simplification94.8%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -5.2e+92)
(+ (* x y) (* c i))
(if (<= (* c i) 7.5e+171)
(+ (* a b) (+ (* 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) {
double tmp;
if ((c * i) <= -5.2e+92) {
tmp = (x * y) + (c * i);
} else if ((c * i) <= 7.5e+171) {
tmp = (a * b) + ((x * y) + (z * t));
} 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 ((c * i) <= (-5.2d+92)) then
tmp = (x * y) + (c * i)
else if ((c * i) <= 7.5d+171) then
tmp = (a * b) + ((x * y) + (z * t))
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 ((c * i) <= -5.2e+92) {
tmp = (x * y) + (c * i);
} else if ((c * i) <= 7.5e+171) {
tmp = (a * b) + ((x * y) + (z * t));
} else {
tmp = (a * b) + (c * i);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -5.2e+92: tmp = (x * y) + (c * i) elif (c * i) <= 7.5e+171: tmp = (a * b) + ((x * y) + (z * t)) else: tmp = (a * b) + (c * i) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -5.2e+92) tmp = Float64(Float64(x * y) + Float64(c * i)); elseif (Float64(c * i) <= 7.5e+171) tmp = Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))); 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 ((c * i) <= -5.2e+92) tmp = (x * y) + (c * i); elseif ((c * i) <= 7.5e+171) tmp = (a * b) + ((x * y) + (z * t)); else tmp = (a * b) + (c * i); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -5.2e+92], N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 7.5e+171], N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -5.2 \cdot 10^{+92}:\\
\;\;\;\;x \cdot y + c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 7.5 \cdot 10^{+171}:\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -5.1999999999999998e92Initial program 97.8%
Taylor expanded in a around inf 81.2%
associate-+r+81.2%
associate-/l*81.2%
Simplified81.2%
Taylor expanded in x around inf 81.8%
if -5.1999999999999998e92 < (*.f64 c i) < 7.4999999999999998e171Initial program 98.3%
+-commutative98.3%
fma-define98.3%
+-commutative98.3%
fma-define100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in c around 0 93.7%
if 7.4999999999999998e171 < (*.f64 c i) Initial program 93.5%
Taylor expanded in a around inf 78.1%
associate-+r+78.1%
associate-/l*78.1%
Simplified78.1%
Taylor expanded in a around inf 97.0%
Final simplification91.9%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -1.46e+88) (not (<= (* c i) 9e+145))) (* 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 (((c * i) <= -1.46e+88) || !((c * i) <= 9e+145)) {
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 (((c * i) <= (-1.46d+88)) .or. (.not. ((c * i) <= 9d+145))) 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 (((c * i) <= -1.46e+88) || !((c * i) <= 9e+145)) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -1.46e+88) or not ((c * i) <= 9e+145): tmp = c * i else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(c * i) <= -1.46e+88) || !(Float64(c * i) <= 9e+145)) 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 (((c * i) <= -1.46e+88) || ~(((c * i) <= 9e+145))) tmp = c * i; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -1.46e+88], N[Not[LessEqual[N[(c * i), $MachinePrecision], 9e+145]], $MachinePrecision]], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.46 \cdot 10^{+88} \lor \neg \left(c \cdot i \leq 9 \cdot 10^{+145}\right):\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 c i) < -1.45999999999999999e88 or 8.9999999999999996e145 < (*.f64 c i) Initial program 96.4%
+-commutative96.4%
fma-define96.4%
+-commutative96.4%
fma-define96.4%
fma-define96.4%
Simplified96.4%
Taylor expanded in c around inf 72.3%
if -1.45999999999999999e88 < (*.f64 c i) < 8.9999999999999996e145Initial program 98.2%
+-commutative98.2%
fma-define98.2%
+-commutative98.2%
fma-define100.0%
fma-define100.0%
Simplified100.0%
Taylor expanded in a around inf 29.6%
Final simplification43.4%
(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 97.6%
+-commutative97.6%
fma-define97.6%
+-commutative97.6%
fma-define98.8%
fma-define98.8%
Simplified98.8%
Taylor expanded in a around inf 24.7%
herbie shell --seed 2024111
(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)))