
(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 (let* ((t_1 (+ (* c i) (+ (* a b) (+ (* x y) (* z t)))))) (if (<= t_1 INFINITY) t_1 (* a (+ b (/ (* c i) a))))))
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 = a * (b + ((c * i) / a));
}
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 = a * (b + ((c * i) / a));
}
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 = a * (b + ((c * i) / a)) 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(a * Float64(b + Float64(Float64(c * i) / a))); 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 = a * (b + ((c * i) / a)); 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[(a * N[(b + N[(N[(c * i), $MachinePrecision] / a), $MachinePrecision]), $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}:\\
\;\;\;\;a \cdot \left(b + \frac{c \cdot i}{a}\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 z around inf 17.6%
associate-/l*29.4%
Simplified29.4%
Taylor expanded in a around inf 53.0%
Taylor expanded in a around inf 58.9%
Final simplification97.3%
(FPCore (x y z t a b c i) :precision binary64 (fma c i (fma x y (fma z t (* a b)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return fma(c, i, fma(x, y, fma(z, t, (a * b))));
}
function code(x, y, z, t, a, b, c, i) return fma(c, i, fma(x, y, fma(z, t, Float64(a * b)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(c * i + N[(x * y + N[(z * t + N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\mathsf{fma}\left(c, i, \mathsf{fma}\left(x, y, \mathsf{fma}\left(z, t, a \cdot b\right)\right)\right)
\end{array}
Initial program 93.4%
+-commutative93.4%
fma-define94.5%
associate-+l+94.5%
fma-define96.1%
fma-define96.5%
Simplified96.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))))
(if (<= (* c i) -5.5e+215)
(+ (* a b) (* c i))
(if (or (<= (* c i) -6.8e+31) (not (<= (* c i) 2.7e+72)))
(+ (* c i) t_1)
(+ (* 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 = (x * y) + (z * t);
double tmp;
if ((c * i) <= -5.5e+215) {
tmp = (a * b) + (c * i);
} else if (((c * i) <= -6.8e+31) || !((c * i) <= 2.7e+72)) {
tmp = (c * i) + t_1;
} else {
tmp = (a * b) + 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 = (x * y) + (z * t)
if ((c * i) <= (-5.5d+215)) then
tmp = (a * b) + (c * i)
else if (((c * i) <= (-6.8d+31)) .or. (.not. ((c * i) <= 2.7d+72))) then
tmp = (c * i) + t_1
else
tmp = (a * b) + 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 = (x * y) + (z * t);
double tmp;
if ((c * i) <= -5.5e+215) {
tmp = (a * b) + (c * i);
} else if (((c * i) <= -6.8e+31) || !((c * i) <= 2.7e+72)) {
tmp = (c * i) + t_1;
} else {
tmp = (a * b) + t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (x * y) + (z * t) tmp = 0 if (c * i) <= -5.5e+215: tmp = (a * b) + (c * i) elif ((c * i) <= -6.8e+31) or not ((c * i) <= 2.7e+72): tmp = (c * i) + t_1 else: tmp = (a * b) + t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (Float64(c * i) <= -5.5e+215) tmp = Float64(Float64(a * b) + Float64(c * i)); elseif ((Float64(c * i) <= -6.8e+31) || !(Float64(c * i) <= 2.7e+72)) tmp = Float64(Float64(c * i) + t_1); else tmp = Float64(Float64(a * b) + t_1); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (x * y) + (z * t); tmp = 0.0; if ((c * i) <= -5.5e+215) tmp = (a * b) + (c * i); elseif (((c * i) <= -6.8e+31) || ~(((c * i) <= 2.7e+72))) tmp = (c * i) + t_1; else tmp = (a * b) + t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(c * i), $MachinePrecision], -5.5e+215], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(c * i), $MachinePrecision], -6.8e+31], N[Not[LessEqual[N[(c * i), $MachinePrecision], 2.7e+72]], $MachinePrecision]], N[(N[(c * i), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + t$95$1), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;c \cdot i \leq -5.5 \cdot 10^{+215}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -6.8 \cdot 10^{+31} \lor \neg \left(c \cdot i \leq 2.7 \cdot 10^{+72}\right):\\
\;\;\;\;c \cdot i + t\_1\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + t\_1\\
\end{array}
\end{array}
if (*.f64 c i) < -5.5e215Initial program 81.8%
Taylor expanded in z around inf 73.0%
associate-/l*70.3%
Simplified70.3%
Taylor expanded in a around inf 93.9%
if -5.5e215 < (*.f64 c i) < -6.7999999999999996e31 or 2.7000000000000001e72 < (*.f64 c i) Initial program 93.2%
Taylor expanded in a around 0 89.5%
if -6.7999999999999996e31 < (*.f64 c i) < 2.7000000000000001e72Initial program 96.0%
Taylor expanded in c around 0 95.3%
Final simplification93.4%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -4.15e+99)
(* c i)
(if (<= (* c i) -1.12e+18)
(* x y)
(if (<= (* c i) 5.2e+72)
(* a b)
(if (<= (* c i) 2.3e+140) (* 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) <= -4.15e+99) {
tmp = c * i;
} else if ((c * i) <= -1.12e+18) {
tmp = x * y;
} else if ((c * i) <= 5.2e+72) {
tmp = a * b;
} else if ((c * i) <= 2.3e+140) {
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) <= (-4.15d+99)) then
tmp = c * i
else if ((c * i) <= (-1.12d+18)) then
tmp = x * y
else if ((c * i) <= 5.2d+72) then
tmp = a * b
else if ((c * i) <= 2.3d+140) 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) <= -4.15e+99) {
tmp = c * i;
} else if ((c * i) <= -1.12e+18) {
tmp = x * y;
} else if ((c * i) <= 5.2e+72) {
tmp = a * b;
} else if ((c * i) <= 2.3e+140) {
tmp = x * y;
} else {
tmp = c * i;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -4.15e+99: tmp = c * i elif (c * i) <= -1.12e+18: tmp = x * y elif (c * i) <= 5.2e+72: tmp = a * b elif (c * i) <= 2.3e+140: 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) <= -4.15e+99) tmp = Float64(c * i); elseif (Float64(c * i) <= -1.12e+18) tmp = Float64(x * y); elseif (Float64(c * i) <= 5.2e+72) tmp = Float64(a * b); elseif (Float64(c * i) <= 2.3e+140) 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) <= -4.15e+99) tmp = c * i; elseif ((c * i) <= -1.12e+18) tmp = x * y; elseif ((c * i) <= 5.2e+72) tmp = a * b; elseif ((c * i) <= 2.3e+140) 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], -4.15e+99], N[(c * i), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], -1.12e+18], N[(x * y), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 5.2e+72], N[(a * b), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2.3e+140], N[(x * y), $MachinePrecision], N[(c * i), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -4.15 \cdot 10^{+99}:\\
\;\;\;\;c \cdot i\\
\mathbf{elif}\;c \cdot i \leq -1.12 \cdot 10^{+18}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;c \cdot i \leq 5.2 \cdot 10^{+72}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;c \cdot i \leq 2.3 \cdot 10^{+140}:\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;c \cdot i\\
\end{array}
\end{array}
if (*.f64 c i) < -4.15e99 or 2.2999999999999999e140 < (*.f64 c i) Initial program 87.2%
Taylor expanded in c around inf 68.7%
if -4.15e99 < (*.f64 c i) < -1.12e18 or 5.19999999999999963e72 < (*.f64 c i) < 2.2999999999999999e140Initial program 100.0%
Taylor expanded in x around inf 61.6%
if -1.12e18 < (*.f64 c i) < 5.19999999999999963e72Initial program 95.8%
Taylor expanded in a around inf 43.4%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* x y) -1.7e+154)
(* x y)
(if (<= (* x y) 6.6e-83)
(+ (* a b) (* c i))
(if (<= (* x y) 4.4e+103) (+ (* c i) (* z t)) (* x y)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -1.7e+154) {
tmp = x * y;
} else if ((x * y) <= 6.6e-83) {
tmp = (a * b) + (c * i);
} else if ((x * y) <= 4.4e+103) {
tmp = (c * i) + (z * t);
} else {
tmp = x * y;
}
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.7d+154)) then
tmp = x * y
else if ((x * y) <= 6.6d-83) then
tmp = (a * b) + (c * i)
else if ((x * y) <= 4.4d+103) then
tmp = (c * i) + (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 c, double i) {
double tmp;
if ((x * y) <= -1.7e+154) {
tmp = x * y;
} else if ((x * y) <= 6.6e-83) {
tmp = (a * b) + (c * i);
} else if ((x * y) <= 4.4e+103) {
tmp = (c * i) + (z * t);
} else {
tmp = x * y;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (x * y) <= -1.7e+154: tmp = x * y elif (x * y) <= 6.6e-83: tmp = (a * b) + (c * i) elif (x * y) <= 4.4e+103: tmp = (c * i) + (z * t) else: tmp = x * y return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -1.7e+154) tmp = Float64(x * y); elseif (Float64(x * y) <= 6.6e-83) tmp = Float64(Float64(a * b) + Float64(c * i)); elseif (Float64(x * y) <= 4.4e+103) tmp = Float64(Float64(c * i) + Float64(z * t)); else tmp = Float64(x * y); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((x * y) <= -1.7e+154) tmp = x * y; elseif ((x * y) <= 6.6e-83) tmp = (a * b) + (c * i); elseif ((x * y) <= 4.4e+103) tmp = (c * i) + (z * t); else tmp = x * y; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -1.7e+154], N[(x * y), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 6.6e-83], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 4.4e+103], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(x * y), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1.7 \cdot 10^{+154}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;x \cdot y \leq 6.6 \cdot 10^{-83}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;x \cdot y \leq 4.4 \cdot 10^{+103}:\\
\;\;\;\;c \cdot i + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y\\
\end{array}
\end{array}
if (*.f64 x y) < -1.69999999999999987e154 or 4.39999999999999985e103 < (*.f64 x y) Initial program 88.4%
Taylor expanded in x around inf 70.6%
if -1.69999999999999987e154 < (*.f64 x y) < 6.5999999999999999e-83Initial program 95.8%
Taylor expanded in z around inf 85.2%
associate-/l*81.2%
Simplified81.2%
Taylor expanded in a around inf 69.1%
if 6.5999999999999999e-83 < (*.f64 x y) < 4.39999999999999985e103Initial program 96.2%
Taylor expanded in z around inf 85.0%
associate-/l*88.8%
Simplified88.8%
Taylor expanded in z around inf 67.0%
Final simplification69.4%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -1.05e+198)
(+ (* a b) (* c i))
(if (<= (* c i) 8.6e+125)
(+ (* a b) (+ (* x y) (* z t)))
(+ (* c i) (+ (* a b) (* x y))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -1.05e+198) {
tmp = (a * b) + (c * i);
} else if ((c * i) <= 8.6e+125) {
tmp = (a * b) + ((x * y) + (z * t));
} else {
tmp = (c * i) + ((a * b) + (x * y));
}
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.05d+198)) then
tmp = (a * b) + (c * i)
else if ((c * i) <= 8.6d+125) then
tmp = (a * b) + ((x * y) + (z * t))
else
tmp = (c * i) + ((a * b) + (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 c, double i) {
double tmp;
if ((c * i) <= -1.05e+198) {
tmp = (a * b) + (c * i);
} else if ((c * i) <= 8.6e+125) {
tmp = (a * b) + ((x * y) + (z * t));
} else {
tmp = (c * i) + ((a * b) + (x * y));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -1.05e+198: tmp = (a * b) + (c * i) elif (c * i) <= 8.6e+125: tmp = (a * b) + ((x * y) + (z * t)) else: tmp = (c * i) + ((a * b) + (x * y)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -1.05e+198) tmp = Float64(Float64(a * b) + Float64(c * i)); elseif (Float64(c * i) <= 8.6e+125) tmp = Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))); else tmp = Float64(Float64(c * i) + Float64(Float64(a * b) + Float64(x * y))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((c * i) <= -1.05e+198) tmp = (a * b) + (c * i); elseif ((c * i) <= 8.6e+125) tmp = (a * b) + ((x * y) + (z * t)); else tmp = (c * i) + ((a * b) + (x * y)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -1.05e+198], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 8.6e+125], N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(N[(a * b), $MachinePrecision] + N[(x * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.05 \cdot 10^{+198}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 8.6 \cdot 10^{+125}:\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + \left(a \cdot b + x \cdot y\right)\\
\end{array}
\end{array}
if (*.f64 c i) < -1.05000000000000006e198Initial program 83.8%
Taylor expanded in z around inf 73.4%
associate-/l*70.9%
Simplified70.9%
Taylor expanded in a around inf 91.6%
if -1.05000000000000006e198 < (*.f64 c i) < 8.60000000000000071e125Initial program 96.3%
Taylor expanded in c around 0 90.4%
if 8.60000000000000071e125 < (*.f64 c i) Initial program 86.2%
Taylor expanded in z around 0 84.8%
Final simplification90.0%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* c i) -4.4e+195)
(+ (* a b) (* c i))
(if (<= (* c i) 2.9e+141)
(+ (* a b) (+ (* x y) (* z t)))
(* a (+ b (/ (* c i) a))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c * i) <= -4.4e+195) {
tmp = (a * b) + (c * i);
} else if ((c * i) <= 2.9e+141) {
tmp = (a * b) + ((x * y) + (z * t));
} else {
tmp = a * (b + ((c * i) / a));
}
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) <= (-4.4d+195)) then
tmp = (a * b) + (c * i)
else if ((c * i) <= 2.9d+141) then
tmp = (a * b) + ((x * y) + (z * t))
else
tmp = a * (b + ((c * i) / a))
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) <= -4.4e+195) {
tmp = (a * b) + (c * i);
} else if ((c * i) <= 2.9e+141) {
tmp = (a * b) + ((x * y) + (z * t));
} else {
tmp = a * (b + ((c * i) / a));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c * i) <= -4.4e+195: tmp = (a * b) + (c * i) elif (c * i) <= 2.9e+141: tmp = (a * b) + ((x * y) + (z * t)) else: tmp = a * (b + ((c * i) / a)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(c * i) <= -4.4e+195) tmp = Float64(Float64(a * b) + Float64(c * i)); elseif (Float64(c * i) <= 2.9e+141) tmp = Float64(Float64(a * b) + Float64(Float64(x * y) + Float64(z * t))); else tmp = Float64(a * Float64(b + Float64(Float64(c * i) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((c * i) <= -4.4e+195) tmp = (a * b) + (c * i); elseif ((c * i) <= 2.9e+141) tmp = (a * b) + ((x * y) + (z * t)); else tmp = a * (b + ((c * i) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(c * i), $MachinePrecision], -4.4e+195], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 2.9e+141], N[(N[(a * b), $MachinePrecision] + N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(b + N[(N[(c * i), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -4.4 \cdot 10^{+195}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;c \cdot i \leq 2.9 \cdot 10^{+141}:\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(b + \frac{c \cdot i}{a}\right)\\
\end{array}
\end{array}
if (*.f64 c i) < -4.4e195Initial program 83.8%
Taylor expanded in z around inf 73.4%
associate-/l*70.9%
Simplified70.9%
Taylor expanded in a around inf 91.6%
if -4.4e195 < (*.f64 c i) < 2.90000000000000007e141Initial program 96.3%
Taylor expanded in c around 0 90.5%
if 2.90000000000000007e141 < (*.f64 c i) Initial program 85.7%
Taylor expanded in z around inf 78.7%
associate-/l*75.1%
Simplified75.1%
Taylor expanded in a around inf 81.0%
Taylor expanded in a around inf 81.1%
Final simplification89.6%
(FPCore (x y z t a b c i) :precision binary64 (if (<= (* a b) -2e-129) (+ (* a b) (* c i)) (if (<= (* a b) 1e+181) (+ (* x y) (* z t)) (* a (+ b (/ (* c i) a))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -2e-129) {
tmp = (a * b) + (c * i);
} else if ((a * b) <= 1e+181) {
tmp = (x * y) + (z * t);
} else {
tmp = a * (b + ((c * i) / a));
}
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) <= (-2d-129)) then
tmp = (a * b) + (c * i)
else if ((a * b) <= 1d+181) then
tmp = (x * y) + (z * t)
else
tmp = a * (b + ((c * i) / a))
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) <= -2e-129) {
tmp = (a * b) + (c * i);
} else if ((a * b) <= 1e+181) {
tmp = (x * y) + (z * t);
} else {
tmp = a * (b + ((c * i) / a));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -2e-129: tmp = (a * b) + (c * i) elif (a * b) <= 1e+181: tmp = (x * y) + (z * t) else: tmp = a * (b + ((c * i) / a)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -2e-129) tmp = Float64(Float64(a * b) + Float64(c * i)); elseif (Float64(a * b) <= 1e+181) tmp = Float64(Float64(x * y) + Float64(z * t)); else tmp = Float64(a * Float64(b + Float64(Float64(c * i) / a))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((a * b) <= -2e-129) tmp = (a * b) + (c * i); elseif ((a * b) <= 1e+181) tmp = (x * y) + (z * t); else tmp = a * (b + ((c * i) / a)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -2e-129], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 1e+181], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(a * N[(b + N[(N[(c * i), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2 \cdot 10^{-129}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{elif}\;a \cdot b \leq 10^{+181}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(b + \frac{c \cdot i}{a}\right)\\
\end{array}
\end{array}
if (*.f64 a b) < -1.9999999999999999e-129Initial program 92.0%
Taylor expanded in z around inf 77.0%
associate-/l*73.6%
Simplified73.6%
Taylor expanded in a around inf 70.0%
if -1.9999999999999999e-129 < (*.f64 a b) < 9.9999999999999992e180Initial program 94.6%
Taylor expanded in c around 0 77.7%
Taylor expanded in a around 0 70.5%
if 9.9999999999999992e180 < (*.f64 a b) Initial program 92.3%
Taylor expanded in z around inf 77.7%
associate-/l*77.7%
Simplified77.7%
Taylor expanded in a around inf 81.8%
Taylor expanded in a around inf 81.8%
Final simplification72.1%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* a b) -2.15e-129) (not (<= (* a b) 1e+181))) (+ (* a b) (* c i)) (+ (* 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 (((a * b) <= -2.15e-129) || !((a * b) <= 1e+181)) {
tmp = (a * b) + (c * i);
} else {
tmp = (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 (((a * b) <= (-2.15d-129)) .or. (.not. ((a * b) <= 1d+181))) then
tmp = (a * b) + (c * i)
else
tmp = (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 (((a * b) <= -2.15e-129) || !((a * b) <= 1e+181)) {
tmp = (a * b) + (c * i);
} else {
tmp = (x * y) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((a * b) <= -2.15e-129) or not ((a * b) <= 1e+181): tmp = (a * b) + (c * i) else: tmp = (x * y) + (z * t) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(a * b) <= -2.15e-129) || !(Float64(a * b) <= 1e+181)) tmp = Float64(Float64(a * b) + Float64(c * i)); else tmp = 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 (((a * b) <= -2.15e-129) || ~(((a * b) <= 1e+181))) tmp = (a * b) + (c * i); else tmp = (x * y) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(a * b), $MachinePrecision], -2.15e-129], N[Not[LessEqual[N[(a * b), $MachinePrecision], 1e+181]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -2.15 \cdot 10^{-129} \lor \neg \left(a \cdot b \leq 10^{+181}\right):\\
\;\;\;\;a \cdot b + c \cdot i\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + z \cdot t\\
\end{array}
\end{array}
if (*.f64 a b) < -2.1499999999999999e-129 or 9.9999999999999992e180 < (*.f64 a b) Initial program 92.1%
Taylor expanded in z around inf 77.2%
associate-/l*74.8%
Simplified74.8%
Taylor expanded in a around inf 73.6%
if -2.1499999999999999e-129 < (*.f64 a b) < 9.9999999999999992e180Initial program 94.6%
Taylor expanded in c around 0 77.7%
Taylor expanded in a around 0 70.5%
Final simplification72.1%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -4e+152) (not (<= (* x y) 9.5e+103))) (* 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) <= -4e+152) || !((x * y) <= 9.5e+103)) {
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) <= (-4d+152)) .or. (.not. ((x * y) <= 9.5d+103))) 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) <= -4e+152) || !((x * y) <= 9.5e+103)) {
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) <= -4e+152) or not ((x * y) <= 9.5e+103): 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) <= -4e+152) || !(Float64(x * y) <= 9.5e+103)) 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) <= -4e+152) || ~(((x * y) <= 9.5e+103))) 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], -4e+152], N[Not[LessEqual[N[(x * y), $MachinePrecision], 9.5e+103]], $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 -4 \cdot 10^{+152} \lor \neg \left(x \cdot y \leq 9.5 \cdot 10^{+103}\right):\\
\;\;\;\;x \cdot y\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + c \cdot i\\
\end{array}
\end{array}
if (*.f64 x y) < -4.0000000000000002e152 or 9.49999999999999922e103 < (*.f64 x y) Initial program 88.4%
Taylor expanded in x around inf 70.6%
if -4.0000000000000002e152 < (*.f64 x y) < 9.49999999999999922e103Initial program 95.9%
Taylor expanded in z around inf 85.2%
associate-/l*82.3%
Simplified82.3%
Taylor expanded in a around inf 66.1%
Final simplification67.6%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -2.16e+24) (not (<= (* c i) 1.05e+83))) (* 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) <= -2.16e+24) || !((c * i) <= 1.05e+83)) {
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) <= (-2.16d+24)) .or. (.not. ((c * i) <= 1.05d+83))) 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) <= -2.16e+24) || !((c * i) <= 1.05e+83)) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -2.16e+24) or not ((c * i) <= 1.05e+83): 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) <= -2.16e+24) || !(Float64(c * i) <= 1.05e+83)) 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) <= -2.16e+24) || ~(((c * i) <= 1.05e+83))) 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], -2.16e+24], N[Not[LessEqual[N[(c * i), $MachinePrecision], 1.05e+83]], $MachinePrecision]], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -2.16 \cdot 10^{+24} \lor \neg \left(c \cdot i \leq 1.05 \cdot 10^{+83}\right):\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 c i) < -2.1599999999999999e24 or 1.05000000000000001e83 < (*.f64 c i) Initial program 89.6%
Taylor expanded in c around inf 58.9%
if -2.1599999999999999e24 < (*.f64 c i) < 1.05000000000000001e83Initial program 96.0%
Taylor expanded in a around inf 41.8%
Final simplification48.9%
(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.4%
Taylor expanded in a around inf 29.7%
herbie shell --seed 2024131
(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)))