
(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 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-define96.1%
+-commutative96.1%
fma-define97.7%
fma-define98.8%
Simplified98.8%
(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 (* z (+ (+ t (* a (/ b z))) (* x (/ y z)))))))
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 = z * ((t + (a * (b / z))) + (x * (y / z)));
}
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 = z * ((t + (a * (b / z))) + (x * (y / z)));
}
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 = z * ((t + (a * (b / z))) + (x * (y / z))) 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(z * Float64(Float64(t + Float64(a * Float64(b / z))) + Float64(x * Float64(y / z)))); 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 = z * ((t + (a * (b / z))) + (x * (y / z))); 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[(z * N[(N[(t + N[(a * N[(b / z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * N[(y / z), $MachinePrecision]), $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}:\\
\;\;\;\;z \cdot \left(\left(t + a \cdot \frac{b}{z}\right) + x \cdot \frac{y}{z}\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 c around 0 37.5%
Taylor expanded in z around inf 37.5%
associate-+r+37.5%
associate-/l*56.3%
associate-/l*75.0%
Simplified75.0%
Final simplification98.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -3.7e+115) (not (<= (* c i) 8e+121))) (+ (* c i) (* z t)) (+ (* 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) <= -3.7e+115) || !((c * i) <= 8e+121)) {
tmp = (c * i) + (z * t);
} 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) <= (-3.7d+115)) .or. (.not. ((c * i) <= 8d+121))) then
tmp = (c * i) + (z * t)
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) <= -3.7e+115) || !((c * i) <= 8e+121)) {
tmp = (c * i) + (z * t);
} 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) <= -3.7e+115) or not ((c * i) <= 8e+121): tmp = (c * i) + (z * t) 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) <= -3.7e+115) || !(Float64(c * i) <= 8e+121)) tmp = Float64(Float64(c * i) + Float64(z * t)); 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) <= -3.7e+115) || ~(((c * i) <= 8e+121))) tmp = (c * i) + (z * t); 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], -3.7e+115], N[Not[LessEqual[N[(c * i), $MachinePrecision], 8e+121]], $MachinePrecision]], N[(N[(c * i), $MachinePrecision] + N[(z * t), $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 -3.7 \cdot 10^{+115} \lor \neg \left(c \cdot i \leq 8 \cdot 10^{+121}\right):\\
\;\;\;\;c \cdot i + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + \left(x \cdot y + z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 c i) < -3.70000000000000006e115 or 8.0000000000000003e121 < (*.f64 c i) Initial program 86.0%
Taylor expanded in z around inf 79.2%
associate-/l*77.1%
Simplified77.1%
Taylor expanded in z around inf 79.1%
*-commutative79.1%
Simplified79.1%
if -3.70000000000000006e115 < (*.f64 c i) < 8.0000000000000003e121Initial program 97.6%
Taylor expanded in c around 0 91.6%
Final simplification87.4%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))))
(if (<= (* c i) -6.4e+72)
(+ (* c i) t_1)
(if (<= (* c i) 1.55e+120) (+ (* a b) t_1) (+ (* c i) (* 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);
double tmp;
if ((c * i) <= -6.4e+72) {
tmp = (c * i) + t_1;
} else if ((c * i) <= 1.55e+120) {
tmp = (a * b) + t_1;
} else {
tmp = (c * i) + (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 = (x * y) + (z * t)
if ((c * i) <= (-6.4d+72)) then
tmp = (c * i) + t_1
else if ((c * i) <= 1.55d+120) then
tmp = (a * b) + t_1
else
tmp = (c * i) + (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 = (x * y) + (z * t);
double tmp;
if ((c * i) <= -6.4e+72) {
tmp = (c * i) + t_1;
} else if ((c * i) <= 1.55e+120) {
tmp = (a * b) + t_1;
} else {
tmp = (c * i) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (x * y) + (z * t) tmp = 0 if (c * i) <= -6.4e+72: tmp = (c * i) + t_1 elif (c * i) <= 1.55e+120: tmp = (a * b) + t_1 else: tmp = (c * i) + (z * t) 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) <= -6.4e+72) tmp = Float64(Float64(c * i) + t_1); elseif (Float64(c * i) <= 1.55e+120) tmp = Float64(Float64(a * b) + t_1); else tmp = Float64(Float64(c * i) + 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); tmp = 0.0; if ((c * i) <= -6.4e+72) tmp = (c * i) + t_1; elseif ((c * i) <= 1.55e+120) tmp = (a * b) + t_1; else tmp = (c * i) + (z * t); 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], -6.4e+72], N[(N[(c * i), $MachinePrecision] + t$95$1), $MachinePrecision], If[LessEqual[N[(c * i), $MachinePrecision], 1.55e+120], N[(N[(a * b), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;c \cdot i \leq -6.4 \cdot 10^{+72}:\\
\;\;\;\;c \cdot i + t\_1\\
\mathbf{elif}\;c \cdot i \leq 1.55 \cdot 10^{+120}:\\
\;\;\;\;a \cdot b + t\_1\\
\mathbf{else}:\\
\;\;\;\;c \cdot i + z \cdot t\\
\end{array}
\end{array}
if (*.f64 c i) < -6.4000000000000003e72Initial program 93.3%
Taylor expanded in a around 0 86.9%
if -6.4000000000000003e72 < (*.f64 c i) < 1.54999999999999987e120Initial program 98.2%
Taylor expanded in c around 0 91.9%
if 1.54999999999999987e120 < (*.f64 c i) Initial program 78.7%
Taylor expanded in z around inf 70.4%
associate-/l*68.6%
Simplified68.6%
Taylor expanded in z around inf 76.7%
*-commutative76.7%
Simplified76.7%
Final simplification88.3%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* a b) -6.2e+140)
(* a b)
(if (<= (* a b) 8.6e-142)
(* z t)
(if (<= (* a b) 2.75e+200) (* c i) (* a b)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -6.2e+140) {
tmp = a * b;
} else if ((a * b) <= 8.6e-142) {
tmp = z * t;
} else if ((a * b) <= 2.75e+200) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if ((a * b) <= (-6.2d+140)) then
tmp = a * b
else if ((a * b) <= 8.6d-142) then
tmp = z * t
else if ((a * b) <= 2.75d+200) then
tmp = c * i
else
tmp = a * b
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((a * b) <= -6.2e+140) {
tmp = a * b;
} else if ((a * b) <= 8.6e-142) {
tmp = z * t;
} else if ((a * b) <= 2.75e+200) {
tmp = c * i;
} else {
tmp = a * b;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (a * b) <= -6.2e+140: tmp = a * b elif (a * b) <= 8.6e-142: tmp = z * t elif (a * b) <= 2.75e+200: tmp = c * i else: tmp = a * b return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(a * b) <= -6.2e+140) tmp = Float64(a * b); elseif (Float64(a * b) <= 8.6e-142) tmp = Float64(z * t); elseif (Float64(a * b) <= 2.75e+200) tmp = Float64(c * i); else tmp = Float64(a * b); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((a * b) <= -6.2e+140) tmp = a * b; elseif ((a * b) <= 8.6e-142) tmp = z * t; elseif ((a * b) <= 2.75e+200) tmp = c * i; else tmp = a * b; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(a * b), $MachinePrecision], -6.2e+140], N[(a * b), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 8.6e-142], N[(z * t), $MachinePrecision], If[LessEqual[N[(a * b), $MachinePrecision], 2.75e+200], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;a \cdot b \leq -6.2 \cdot 10^{+140}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;a \cdot b \leq 8.6 \cdot 10^{-142}:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;a \cdot b \leq 2.75 \cdot 10^{+200}:\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 a b) < -6.2000000000000001e140 or 2.75e200 < (*.f64 a b) Initial program 89.2%
Taylor expanded in a around inf 69.9%
if -6.2000000000000001e140 < (*.f64 a b) < 8.5999999999999995e-142Initial program 95.5%
Taylor expanded in z around inf 45.5%
if 8.5999999999999995e-142 < (*.f64 a b) < 2.75e200Initial program 94.8%
Taylor expanded in c around inf 37.8%
Final simplification49.9%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= z -26000000000000.0)
(* z t)
(if (<= z -9.2e-153)
(* a b)
(if (<= z 8e-132) (* x y) (if (<= z 2.1e-28) (* c i) (* z t))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (z <= -26000000000000.0) {
tmp = z * t;
} else if (z <= -9.2e-153) {
tmp = a * b;
} else if (z <= 8e-132) {
tmp = x * y;
} else if (z <= 2.1e-28) {
tmp = c * i;
} else {
tmp = z * t;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (z <= (-26000000000000.0d0)) then
tmp = z * t
else if (z <= (-9.2d-153)) then
tmp = a * b
else if (z <= 8d-132) then
tmp = x * y
else if (z <= 2.1d-28) then
tmp = c * i
else
tmp = z * t
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (z <= -26000000000000.0) {
tmp = z * t;
} else if (z <= -9.2e-153) {
tmp = a * b;
} else if (z <= 8e-132) {
tmp = x * y;
} else if (z <= 2.1e-28) {
tmp = c * i;
} else {
tmp = z * t;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if z <= -26000000000000.0: tmp = z * t elif z <= -9.2e-153: tmp = a * b elif z <= 8e-132: tmp = x * y elif z <= 2.1e-28: tmp = c * i else: tmp = z * t return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (z <= -26000000000000.0) tmp = Float64(z * t); elseif (z <= -9.2e-153) tmp = Float64(a * b); elseif (z <= 8e-132) tmp = Float64(x * y); elseif (z <= 2.1e-28) tmp = Float64(c * i); else tmp = Float64(z * t); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (z <= -26000000000000.0) tmp = z * t; elseif (z <= -9.2e-153) tmp = a * b; elseif (z <= 8e-132) tmp = x * y; elseif (z <= 2.1e-28) tmp = c * i; else tmp = z * t; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[z, -26000000000000.0], N[(z * t), $MachinePrecision], If[LessEqual[z, -9.2e-153], N[(a * b), $MachinePrecision], If[LessEqual[z, 8e-132], N[(x * y), $MachinePrecision], If[LessEqual[z, 2.1e-28], N[(c * i), $MachinePrecision], N[(z * t), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -26000000000000:\\
\;\;\;\;z \cdot t\\
\mathbf{elif}\;z \leq -9.2 \cdot 10^{-153}:\\
\;\;\;\;a \cdot b\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-132}:\\
\;\;\;\;x \cdot y\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{-28}:\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;z \cdot t\\
\end{array}
\end{array}
if z < -2.6e13 or 2.10000000000000006e-28 < z Initial program 90.8%
Taylor expanded in z around inf 52.5%
if -2.6e13 < z < -9.19999999999999988e-153Initial program 94.1%
Taylor expanded in a around inf 34.3%
if -9.19999999999999988e-153 < z < 7.9999999999999999e-132Initial program 98.2%
Taylor expanded in x around inf 34.0%
if 7.9999999999999999e-132 < z < 2.10000000000000006e-28Initial program 100.0%
Taylor expanded in c around inf 58.3%
Final simplification46.6%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* a b) (* z t))))
(if (<= z -0.003)
t_1
(if (<= z -3e-132)
(+ (* x y) (* a b))
(if (<= z 8.6e-114) (+ (* 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 (z <= -0.003) {
tmp = t_1;
} else if (z <= -3e-132) {
tmp = (x * y) + (a * b);
} else if (z <= 8.6e-114) {
tmp = (x * y) + (c * i);
} else {
tmp = 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 (z <= (-0.003d0)) then
tmp = t_1
else if (z <= (-3d-132)) then
tmp = (x * y) + (a * b)
else if (z <= 8.6d-114) then
tmp = (x * y) + (c * i)
else
tmp = 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 (z <= -0.003) {
tmp = t_1;
} else if (z <= -3e-132) {
tmp = (x * y) + (a * b);
} else if (z <= 8.6e-114) {
tmp = (x * y) + (c * i);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (a * b) + (z * t) tmp = 0 if z <= -0.003: tmp = t_1 elif z <= -3e-132: tmp = (x * y) + (a * b) elif z <= 8.6e-114: tmp = (x * y) + (c * i) else: tmp = 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 (z <= -0.003) tmp = t_1; elseif (z <= -3e-132) tmp = Float64(Float64(x * y) + Float64(a * b)); elseif (z <= 8.6e-114) tmp = Float64(Float64(x * y) + Float64(c * i)); else tmp = 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 (z <= -0.003) tmp = t_1; elseif (z <= -3e-132) tmp = (x * y) + (a * b); elseif (z <= 8.6e-114) tmp = (x * y) + (c * i); else tmp = 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[z, -0.003], t$95$1, If[LessEqual[z, -3e-132], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.6e-114], N[(N[(x * y), $MachinePrecision] + N[(c * i), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a \cdot b + z \cdot t\\
\mathbf{if}\;z \leq -0.003:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -3 \cdot 10^{-132}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\mathbf{elif}\;z \leq 8.6 \cdot 10^{-114}:\\
\;\;\;\;x \cdot y + c \cdot i\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -0.0030000000000000001 or 8.6000000000000001e-114 < z Initial program 92.1%
Taylor expanded in c around 0 77.0%
Taylor expanded in x around 0 62.3%
if -0.0030000000000000001 < z < -3e-132Initial program 96.0%
Taylor expanded in c around 0 72.4%
Taylor expanded in t around 0 61.2%
if -3e-132 < z < 8.6000000000000001e-114Initial program 97.0%
Taylor expanded in z around inf 67.6%
associate-/l*57.6%
Simplified57.6%
Taylor expanded in x around inf 60.2%
Final simplification61.6%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* z t) -5e+40) (not (<= (* z t) 5e+52))) (+ (* c i) (* z t)) (+ (* 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 (((z * t) <= -5e+40) || !((z * t) <= 5e+52)) {
tmp = (c * i) + (z * t);
} else {
tmp = (x * y) + (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 (((z * t) <= (-5d+40)) .or. (.not. ((z * t) <= 5d+52))) then
tmp = (c * i) + (z * t)
else
tmp = (x * y) + (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 (((z * t) <= -5e+40) || !((z * t) <= 5e+52)) {
tmp = (c * i) + (z * t);
} else {
tmp = (x * y) + (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((z * t) <= -5e+40) or not ((z * t) <= 5e+52): tmp = (c * i) + (z * t) else: tmp = (x * y) + (a * b) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(z * t) <= -5e+40) || !(Float64(z * t) <= 5e+52)) tmp = Float64(Float64(c * i) + Float64(z * t)); else tmp = Float64(Float64(x * y) + Float64(a * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((z * t) <= -5e+40) || ~(((z * t) <= 5e+52))) tmp = (c * i) + (z * t); else tmp = (x * y) + (a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], -5e+40], N[Not[LessEqual[N[(z * t), $MachinePrecision], 5e+52]], $MachinePrecision]], N[(N[(c * i), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{+40} \lor \neg \left(z \cdot t \leq 5 \cdot 10^{+52}\right):\\
\;\;\;\;c \cdot i + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\end{array}
\end{array}
if (*.f64 z t) < -5.00000000000000003e40 or 5e52 < (*.f64 z t) Initial program 92.2%
Taylor expanded in z around inf 91.4%
associate-/l*93.0%
Simplified93.0%
Taylor expanded in z around inf 77.0%
*-commutative77.0%
Simplified77.0%
if -5.00000000000000003e40 < (*.f64 z t) < 5e52Initial program 95.3%
Taylor expanded in c around 0 71.5%
Taylor expanded in t around 0 68.1%
Final simplification72.5%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -1.6e+248) (not (<= (* c i) 5.3e+228))) (* c i) (+ (* a b) (* z t))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((c * i) <= -1.6e+248) || !((c * i) <= 5.3e+228)) {
tmp = c * i;
} 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) :: tmp
if (((c * i) <= (-1.6d+248)) .or. (.not. ((c * i) <= 5.3d+228))) then
tmp = c * i
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 tmp;
if (((c * i) <= -1.6e+248) || !((c * i) <= 5.3e+228)) {
tmp = c * i;
} else {
tmp = (a * b) + (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((c * i) <= -1.6e+248) or not ((c * i) <= 5.3e+228): tmp = c * i else: tmp = (a * b) + (z * t) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(c * i) <= -1.6e+248) || !(Float64(c * i) <= 5.3e+228)) tmp = Float64(c * i); 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) tmp = 0.0; if (((c * i) <= -1.6e+248) || ~(((c * i) <= 5.3e+228))) tmp = c * i; else tmp = (a * b) + (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(c * i), $MachinePrecision], -1.6e+248], N[Not[LessEqual[N[(c * i), $MachinePrecision], 5.3e+228]], $MachinePrecision]], N[(c * i), $MachinePrecision], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.6 \cdot 10^{+248} \lor \neg \left(c \cdot i \leq 5.3 \cdot 10^{+228}\right):\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b + z \cdot t\\
\end{array}
\end{array}
if (*.f64 c i) < -1.59999999999999992e248 or 5.2999999999999999e228 < (*.f64 c i) Initial program 79.2%
Taylor expanded in c around inf 81.3%
if -1.59999999999999992e248 < (*.f64 c i) < 5.2999999999999999e228Initial program 97.5%
Taylor expanded in c around 0 86.6%
Taylor expanded in x around 0 64.1%
Final simplification67.7%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= z -9.2e-8) (not (<= z 1.4e-120))) (+ (* a b) (* z t)) (+ (* 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 ((z <= -9.2e-8) || !(z <= 1.4e-120)) {
tmp = (a * b) + (z * t);
} else {
tmp = (x * y) + (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 ((z <= (-9.2d-8)) .or. (.not. (z <= 1.4d-120))) then
tmp = (a * b) + (z * t)
else
tmp = (x * y) + (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 ((z <= -9.2e-8) || !(z <= 1.4e-120)) {
tmp = (a * b) + (z * t);
} else {
tmp = (x * y) + (a * b);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z <= -9.2e-8) or not (z <= 1.4e-120): tmp = (a * b) + (z * t) else: tmp = (x * y) + (a * b) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((z <= -9.2e-8) || !(z <= 1.4e-120)) tmp = Float64(Float64(a * b) + Float64(z * t)); else tmp = Float64(Float64(x * y) + Float64(a * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((z <= -9.2e-8) || ~((z <= 1.4e-120))) tmp = (a * b) + (z * t); else tmp = (x * y) + (a * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[z, -9.2e-8], N[Not[LessEqual[z, 1.4e-120]], $MachinePrecision]], N[(N[(a * b), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision], N[(N[(x * y), $MachinePrecision] + N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -9.2 \cdot 10^{-8} \lor \neg \left(z \leq 1.4 \cdot 10^{-120}\right):\\
\;\;\;\;a \cdot b + z \cdot t\\
\mathbf{else}:\\
\;\;\;\;x \cdot y + a \cdot b\\
\end{array}
\end{array}
if z < -9.2000000000000003e-8 or 1.39999999999999997e-120 < z Initial program 92.1%
Taylor expanded in c around 0 77.0%
Taylor expanded in x around 0 62.3%
if -9.2000000000000003e-8 < z < 1.39999999999999997e-120Initial program 96.7%
Taylor expanded in c around 0 69.9%
Taylor expanded in t around 0 62.2%
Final simplification62.2%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* c i) -1.16e+115) (not (<= (* c i) 6.8e+61))) (* 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.16e+115) || !((c * i) <= 6.8e+61)) {
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.16d+115)) .or. (.not. ((c * i) <= 6.8d+61))) 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.16e+115) || !((c * i) <= 6.8e+61)) {
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.16e+115) or not ((c * i) <= 6.8e+61): 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.16e+115) || !(Float64(c * i) <= 6.8e+61)) 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.16e+115) || ~(((c * i) <= 6.8e+61))) 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.16e+115], N[Not[LessEqual[N[(c * i), $MachinePrecision], 6.8e+61]], $MachinePrecision]], N[(c * i), $MachinePrecision], N[(a * b), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \cdot i \leq -1.16 \cdot 10^{+115} \lor \neg \left(c \cdot i \leq 6.8 \cdot 10^{+61}\right):\\
\;\;\;\;c \cdot i\\
\mathbf{else}:\\
\;\;\;\;a \cdot b\\
\end{array}
\end{array}
if (*.f64 c i) < -1.16e115 or 6.80000000000000051e61 < (*.f64 c i) Initial program 87.5%
Taylor expanded in c around inf 61.2%
if -1.16e115 < (*.f64 c i) < 6.80000000000000051e61Initial program 97.5%
Taylor expanded in a around inf 31.6%
Final simplification42.7%
(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 25.1%
herbie shell --seed 2024123
(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)))