
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * 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 = 2.0d0 * (((x * y) + (z * t)) - (((a + (b * c)) * 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 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(a + Float64(b * c)) * c) * i))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i)); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\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 (* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * 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 = 2.0d0 * (((x * y) + (z * t)) - (((a + (b * c)) * 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 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i));
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i))
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(Float64(a + Float64(b * c)) * c) * i))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (((x * y) + (z * t)) - (((a + (b * c)) * c) * i)); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(\left(a + b \cdot c\right) \cdot c\right) \cdot i\right)
\end{array}
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ a (* b c))) (t_2 (+ (* x y) (* z t))))
(if (<= (- t_2 (* (* c t_1) i)) INFINITY)
(* 2.0 (- t_2 (* t_1 (* c i))))
(* 2.0 (* y (- x (* a (/ (* c i) y))))))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = a + (b * c);
double t_2 = (x * y) + (z * t);
double tmp;
if ((t_2 - ((c * t_1) * i)) <= ((double) INFINITY)) {
tmp = 2.0 * (t_2 - (t_1 * (c * i)));
} else {
tmp = 2.0 * (y * (x - (a * ((c * i) / y))));
}
return tmp;
}
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i;
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 * c);
double t_2 = (x * y) + (z * t);
double tmp;
if ((t_2 - ((c * t_1) * i)) <= Double.POSITIVE_INFINITY) {
tmp = 2.0 * (t_2 - (t_1 * (c * i)));
} else {
tmp = 2.0 * (y * (x - (a * ((c * i) / y))));
}
return tmp;
}
[x, y, z, t, a, b, c, i] = sort([x, y, z, t, a, b, c, i]) def code(x, y, z, t, a, b, c, i): t_1 = a + (b * c) t_2 = (x * y) + (z * t) tmp = 0 if (t_2 - ((c * t_1) * i)) <= math.inf: tmp = 2.0 * (t_2 - (t_1 * (c * i))) else: tmp = 2.0 * (y * (x - (a * ((c * i) / y)))) return tmp
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) t_1 = Float64(a + Float64(b * c)) t_2 = Float64(Float64(x * y) + Float64(z * t)) tmp = 0.0 if (Float64(t_2 - Float64(Float64(c * t_1) * i)) <= Inf) tmp = Float64(2.0 * Float64(t_2 - Float64(t_1 * Float64(c * i)))); else tmp = Float64(2.0 * Float64(y * Float64(x - Float64(a * Float64(Float64(c * i) / y))))); end return tmp end
x, y, z, t, a, b, c, i = num2cell(sort([x, y, z, t, a, b, c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
t_1 = a + (b * c);
t_2 = (x * y) + (z * t);
tmp = 0.0;
if ((t_2 - ((c * t_1) * i)) <= Inf)
tmp = 2.0 * (t_2 - (t_1 * (c * i)));
else
tmp = 2.0 * (y * (x - (a * ((c * i) / y))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(t$95$2 - N[(N[(c * t$95$1), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision], Infinity], N[(2.0 * N[(t$95$2 - N[(t$95$1 * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(y * N[(x - N[(a * N[(N[(c * i), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
t_1 := a + b \cdot c\\
t_2 := x \cdot y + z \cdot t\\
\mathbf{if}\;t\_2 - \left(c \cdot t\_1\right) \cdot i \leq \infty:\\
\;\;\;\;2 \cdot \left(t\_2 - t\_1 \cdot \left(c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(y \cdot \left(x - a \cdot \frac{c \cdot i}{y}\right)\right)\\
\end{array}
\end{array}
if (-.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)) < +inf.0Initial program 93.8%
fma-define93.8%
associate-*l*99.5%
Simplified99.5%
fma-define99.5%
+-commutative99.5%
Applied egg-rr99.5%
if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)) Initial program 0.0%
Taylor expanded in a around inf 27.3%
*-commutative27.3%
Simplified27.3%
Taylor expanded in x around inf 46.4%
Taylor expanded in y around inf 64.9%
mul-1-neg64.9%
unsub-neg64.9%
associate-/l*64.9%
Simplified64.9%
Final simplification98.0%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ a (* b c))) (t_2 (* (* c t_1) i)))
(if (or (<= t_2 -1e+303) (not (<= t_2 5e+200)))
(* 2.0 (- (* x y) (* c (* t_1 i))))
(* 2.0 (- (+ (* x y) (* z t)) (* i (* a c)))))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = a + (b * c);
double t_2 = (c * t_1) * i;
double tmp;
if ((t_2 <= -1e+303) || !(t_2 <= 5e+200)) {
tmp = 2.0 * ((x * y) - (c * (t_1 * i)));
} else {
tmp = 2.0 * (((x * y) + (z * t)) - (i * (a * c)));
}
return tmp;
}
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = a + (b * c)
t_2 = (c * t_1) * i
if ((t_2 <= (-1d+303)) .or. (.not. (t_2 <= 5d+200))) then
tmp = 2.0d0 * ((x * y) - (c * (t_1 * i)))
else
tmp = 2.0d0 * (((x * y) + (z * t)) - (i * (a * c)))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i;
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 * c);
double t_2 = (c * t_1) * i;
double tmp;
if ((t_2 <= -1e+303) || !(t_2 <= 5e+200)) {
tmp = 2.0 * ((x * y) - (c * (t_1 * i)));
} else {
tmp = 2.0 * (((x * y) + (z * t)) - (i * (a * c)));
}
return tmp;
}
[x, y, z, t, a, b, c, i] = sort([x, y, z, t, a, b, c, i]) def code(x, y, z, t, a, b, c, i): t_1 = a + (b * c) t_2 = (c * t_1) * i tmp = 0 if (t_2 <= -1e+303) or not (t_2 <= 5e+200): tmp = 2.0 * ((x * y) - (c * (t_1 * i))) else: tmp = 2.0 * (((x * y) + (z * t)) - (i * (a * c))) return tmp
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) t_1 = Float64(a + Float64(b * c)) t_2 = Float64(Float64(c * t_1) * i) tmp = 0.0 if ((t_2 <= -1e+303) || !(t_2 <= 5e+200)) tmp = Float64(2.0 * Float64(Float64(x * y) - Float64(c * Float64(t_1 * i)))); else tmp = Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(i * Float64(a * c)))); end return tmp end
x, y, z, t, a, b, c, i = num2cell(sort([x, y, z, t, a, b, c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
t_1 = a + (b * c);
t_2 = (c * t_1) * i;
tmp = 0.0;
if ((t_2 <= -1e+303) || ~((t_2 <= 5e+200)))
tmp = 2.0 * ((x * y) - (c * (t_1 * i)));
else
tmp = 2.0 * (((x * y) + (z * t)) - (i * (a * c)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * t$95$1), $MachinePrecision] * i), $MachinePrecision]}, If[Or[LessEqual[t$95$2, -1e+303], N[Not[LessEqual[t$95$2, 5e+200]], $MachinePrecision]], N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(c * N[(t$95$1 * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(i * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
t_1 := a + b \cdot c\\
t_2 := \left(c \cdot t\_1\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -1 \cdot 10^{+303} \lor \neg \left(t\_2 \leq 5 \cdot 10^{+200}\right):\\
\;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(t\_1 \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - i \cdot \left(a \cdot c\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -1e303 or 5.00000000000000019e200 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 72.8%
associate--l+72.8%
*-commutative72.8%
associate--l+72.8%
associate--l+72.8%
*-commutative72.8%
associate--l+72.8%
fma-define73.9%
*-commutative73.9%
associate-*l*92.3%
+-commutative92.3%
fma-define92.3%
Simplified92.3%
Taylor expanded in z around 0 88.2%
if -1e303 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.00000000000000019e200Initial program 99.3%
Taylor expanded in a around inf 91.5%
*-commutative91.5%
Simplified91.5%
Final simplification90.3%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ a (* b c))) (t_2 (* (* c t_1) i)))
(if (or (<= t_2 -5e-28) (not (<= t_2 5e+200)))
(* 2.0 (- (* x y) (* c (* t_1 i))))
(* (+ (* x y) (* z t)) 2.0))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = a + (b * c);
double t_2 = (c * t_1) * i;
double tmp;
if ((t_2 <= -5e-28) || !(t_2 <= 5e+200)) {
tmp = 2.0 * ((x * y) - (c * (t_1 * i)));
} else {
tmp = ((x * y) + (z * t)) * 2.0;
}
return tmp;
}
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = a + (b * c)
t_2 = (c * t_1) * i
if ((t_2 <= (-5d-28)) .or. (.not. (t_2 <= 5d+200))) then
tmp = 2.0d0 * ((x * y) - (c * (t_1 * i)))
else
tmp = ((x * y) + (z * t)) * 2.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i;
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 * c);
double t_2 = (c * t_1) * i;
double tmp;
if ((t_2 <= -5e-28) || !(t_2 <= 5e+200)) {
tmp = 2.0 * ((x * y) - (c * (t_1 * i)));
} else {
tmp = ((x * y) + (z * t)) * 2.0;
}
return tmp;
}
[x, y, z, t, a, b, c, i] = sort([x, y, z, t, a, b, c, i]) def code(x, y, z, t, a, b, c, i): t_1 = a + (b * c) t_2 = (c * t_1) * i tmp = 0 if (t_2 <= -5e-28) or not (t_2 <= 5e+200): tmp = 2.0 * ((x * y) - (c * (t_1 * i))) else: tmp = ((x * y) + (z * t)) * 2.0 return tmp
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) t_1 = Float64(a + Float64(b * c)) t_2 = Float64(Float64(c * t_1) * i) tmp = 0.0 if ((t_2 <= -5e-28) || !(t_2 <= 5e+200)) tmp = Float64(2.0 * Float64(Float64(x * y) - Float64(c * Float64(t_1 * i)))); else tmp = Float64(Float64(Float64(x * y) + Float64(z * t)) * 2.0); end return tmp end
x, y, z, t, a, b, c, i = num2cell(sort([x, y, z, t, a, b, c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
t_1 = a + (b * c);
t_2 = (c * t_1) * i;
tmp = 0.0;
if ((t_2 <= -5e-28) || ~((t_2 <= 5e+200)))
tmp = 2.0 * ((x * y) - (c * (t_1 * i)));
else
tmp = ((x * y) + (z * t)) * 2.0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * t$95$1), $MachinePrecision] * i), $MachinePrecision]}, If[Or[LessEqual[t$95$2, -5e-28], N[Not[LessEqual[t$95$2, 5e+200]], $MachinePrecision]], N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(c * N[(t$95$1 * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
t_1 := a + b \cdot c\\
t_2 := \left(c \cdot t\_1\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -5 \cdot 10^{-28} \lor \neg \left(t\_2 \leq 5 \cdot 10^{+200}\right):\\
\;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(t\_1 \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -5.0000000000000002e-28 or 5.00000000000000019e200 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 79.4%
associate--l+79.4%
*-commutative79.4%
associate--l+79.4%
associate--l+79.4%
*-commutative79.4%
associate--l+79.4%
fma-define80.3%
*-commutative80.3%
associate-*l*92.6%
+-commutative92.6%
fma-define92.6%
Simplified92.6%
Taylor expanded in z around 0 85.6%
if -5.0000000000000002e-28 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 5.00000000000000019e200Initial program 99.2%
associate--l+99.2%
*-commutative99.2%
associate--l+99.2%
associate--l+99.2%
*-commutative99.2%
associate--l+99.2%
fma-define99.2%
*-commutative99.2%
associate-*l*96.3%
+-commutative96.3%
fma-define96.3%
Simplified96.3%
Taylor expanded in c around 0 85.4%
Final simplification85.5%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* z t) -5e-69) (not (<= (* z t) 4e-76))) (* 2.0 (- (+ (* x y) (* z t)) (* (* c i) (* b c)))) (* 2.0 (- (* x y) (* c (* (+ a (* b c)) i))))))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((z * t) <= -5e-69) || !((z * t) <= 4e-76)) {
tmp = 2.0 * (((x * y) + (z * t)) - ((c * i) * (b * c)));
} else {
tmp = 2.0 * ((x * y) - (c * ((a + (b * c)) * i)));
}
return tmp;
}
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
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-69)) .or. (.not. ((z * t) <= 4d-76))) then
tmp = 2.0d0 * (((x * y) + (z * t)) - ((c * i) * (b * c)))
else
tmp = 2.0d0 * ((x * y) - (c * ((a + (b * c)) * i)))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i;
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-69) || !((z * t) <= 4e-76)) {
tmp = 2.0 * (((x * y) + (z * t)) - ((c * i) * (b * c)));
} else {
tmp = 2.0 * ((x * y) - (c * ((a + (b * c)) * i)));
}
return tmp;
}
[x, y, z, t, a, b, c, i] = sort([x, y, z, t, a, b, c, i]) def code(x, y, z, t, a, b, c, i): tmp = 0 if ((z * t) <= -5e-69) or not ((z * t) <= 4e-76): tmp = 2.0 * (((x * y) + (z * t)) - ((c * i) * (b * c))) else: tmp = 2.0 * ((x * y) - (c * ((a + (b * c)) * i))) return tmp
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(z * t) <= -5e-69) || !(Float64(z * t) <= 4e-76)) tmp = Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(c * i) * Float64(b * c)))); else tmp = Float64(2.0 * Float64(Float64(x * y) - Float64(c * Float64(Float64(a + Float64(b * c)) * i)))); end return tmp end
x, y, z, t, a, b, c, i = num2cell(sort([x, y, z, t, a, b, c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if (((z * t) <= -5e-69) || ~(((z * t) <= 4e-76)))
tmp = 2.0 * (((x * y) + (z * t)) - ((c * i) * (b * c)));
else
tmp = 2.0 * ((x * y) - (c * ((a + (b * c)) * i)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(z * t), $MachinePrecision], -5e-69], N[Not[LessEqual[N[(z * t), $MachinePrecision], 4e-76]], $MachinePrecision]], N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(c * i), $MachinePrecision] * N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(c * N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot t \leq -5 \cdot 10^{-69} \lor \neg \left(z \cdot t \leq 4 \cdot 10^{-76}\right):\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(c \cdot i\right) \cdot \left(b \cdot c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\
\end{array}
\end{array}
if (*.f64 z t) < -5.00000000000000033e-69 or 3.99999999999999971e-76 < (*.f64 z t) Initial program 89.1%
fma-define89.8%
associate-*l*95.3%
Simplified95.3%
fma-define94.7%
+-commutative94.7%
Applied egg-rr94.7%
Taylor expanded in a around 0 89.3%
*-commutative89.3%
Simplified89.3%
if -5.00000000000000033e-69 < (*.f64 z t) < 3.99999999999999971e-76Initial program 90.7%
associate--l+90.7%
*-commutative90.7%
associate--l+90.7%
associate--l+90.7%
*-commutative90.7%
associate--l+90.7%
fma-define90.7%
*-commutative90.7%
associate-*l*96.2%
+-commutative96.2%
fma-define96.2%
Simplified96.2%
Taylor expanded in z around 0 96.2%
Final simplification92.1%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))) (t_2 (* c (+ a (* b c)))))
(if (<= t_2 1e+261)
(* (- t_1 (* t_2 i)) 2.0)
(* 2.0 (- t_1 (* (* c i) (* b c)))))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) + (z * t);
double t_2 = c * (a + (b * c));
double tmp;
if (t_2 <= 1e+261) {
tmp = (t_1 - (t_2 * i)) * 2.0;
} else {
tmp = 2.0 * (t_1 - ((c * i) * (b * c)));
}
return tmp;
}
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
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) + (z * t)
t_2 = c * (a + (b * c))
if (t_2 <= 1d+261) then
tmp = (t_1 - (t_2 * i)) * 2.0d0
else
tmp = 2.0d0 * (t_1 - ((c * i) * (b * c)))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i;
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 t_2 = c * (a + (b * c));
double tmp;
if (t_2 <= 1e+261) {
tmp = (t_1 - (t_2 * i)) * 2.0;
} else {
tmp = 2.0 * (t_1 - ((c * i) * (b * c)));
}
return tmp;
}
[x, y, z, t, a, b, c, i] = sort([x, y, z, t, a, b, c, i]) def code(x, y, z, t, a, b, c, i): t_1 = (x * y) + (z * t) t_2 = c * (a + (b * c)) tmp = 0 if t_2 <= 1e+261: tmp = (t_1 - (t_2 * i)) * 2.0 else: tmp = 2.0 * (t_1 - ((c * i) * (b * c))) return tmp
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) + Float64(z * t)) t_2 = Float64(c * Float64(a + Float64(b * c))) tmp = 0.0 if (t_2 <= 1e+261) tmp = Float64(Float64(t_1 - Float64(t_2 * i)) * 2.0); else tmp = Float64(2.0 * Float64(t_1 - Float64(Float64(c * i) * Float64(b * c)))); end return tmp end
x, y, z, t, a, b, c, i = num2cell(sort([x, y, z, t, a, b, c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
t_1 = (x * y) + (z * t);
t_2 = c * (a + (b * c));
tmp = 0.0;
if (t_2 <= 1e+261)
tmp = (t_1 - (t_2 * i)) * 2.0;
else
tmp = 2.0 * (t_1 - ((c * i) * (b * c)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(c * N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 1e+261], N[(N[(t$95$1 - N[(t$95$2 * i), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], N[(2.0 * N[(t$95$1 - N[(N[(c * i), $MachinePrecision] * N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
t_2 := c \cdot \left(a + b \cdot c\right)\\
\mathbf{if}\;t\_2 \leq 10^{+261}:\\
\;\;\;\;\left(t\_1 - t\_2 \cdot i\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t\_1 - \left(c \cdot i\right) \cdot \left(b \cdot c\right)\right)\\
\end{array}
\end{array}
if (*.f64 (+.f64 a (*.f64 b c)) c) < 9.9999999999999993e260Initial program 95.4%
if 9.9999999999999993e260 < (*.f64 (+.f64 a (*.f64 b c)) c) Initial program 58.6%
fma-define61.2%
associate-*l*94.8%
Simplified94.8%
fma-define92.2%
+-commutative92.2%
Applied egg-rr92.2%
Taylor expanded in a around 0 89.9%
*-commutative89.9%
Simplified89.9%
Final simplification94.5%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(if (<= c -1.12e+36)
(* (* c (* (+ a (* b c)) i)) -2.0)
(if (<= c 1.2e+15)
(* (+ (* x y) (* z t)) 2.0)
(* -2.0 (* c (* i (* a (+ 1.0 (/ (* b c) a)))))))))assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (c <= -1.12e+36) {
tmp = (c * ((a + (b * c)) * i)) * -2.0;
} else if (c <= 1.2e+15) {
tmp = ((x * y) + (z * t)) * 2.0;
} else {
tmp = -2.0 * (c * (i * (a * (1.0 + ((b * c) / a)))));
}
return tmp;
}
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
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 <= (-1.12d+36)) then
tmp = (c * ((a + (b * c)) * i)) * (-2.0d0)
else if (c <= 1.2d+15) then
tmp = ((x * y) + (z * t)) * 2.0d0
else
tmp = (-2.0d0) * (c * (i * (a * (1.0d0 + ((b * c) / a)))))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (c <= -1.12e+36) {
tmp = (c * ((a + (b * c)) * i)) * -2.0;
} else if (c <= 1.2e+15) {
tmp = ((x * y) + (z * t)) * 2.0;
} else {
tmp = -2.0 * (c * (i * (a * (1.0 + ((b * c) / a)))));
}
return tmp;
}
[x, y, z, t, a, b, c, i] = sort([x, y, z, t, a, b, c, i]) def code(x, y, z, t, a, b, c, i): tmp = 0 if c <= -1.12e+36: tmp = (c * ((a + (b * c)) * i)) * -2.0 elif c <= 1.2e+15: tmp = ((x * y) + (z * t)) * 2.0 else: tmp = -2.0 * (c * (i * (a * (1.0 + ((b * c) / a))))) return tmp
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (c <= -1.12e+36) tmp = Float64(Float64(c * Float64(Float64(a + Float64(b * c)) * i)) * -2.0); elseif (c <= 1.2e+15) tmp = Float64(Float64(Float64(x * y) + Float64(z * t)) * 2.0); else tmp = Float64(-2.0 * Float64(c * Float64(i * Float64(a * Float64(1.0 + Float64(Float64(b * c) / a)))))); end return tmp end
x, y, z, t, a, b, c, i = num2cell(sort([x, y, z, t, a, b, c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if (c <= -1.12e+36)
tmp = (c * ((a + (b * c)) * i)) * -2.0;
elseif (c <= 1.2e+15)
tmp = ((x * y) + (z * t)) * 2.0;
else
tmp = -2.0 * (c * (i * (a * (1.0 + ((b * c) / a)))));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[c, -1.12e+36], N[(N[(c * N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision], If[LessEqual[c, 1.2e+15], N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], N[(-2.0 * N[(c * N[(i * N[(a * N[(1.0 + N[(N[(b * c), $MachinePrecision] / a), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.12 \cdot 10^{+36}:\\
\;\;\;\;\left(c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right) \cdot -2\\
\mathbf{elif}\;c \leq 1.2 \cdot 10^{+15}:\\
\;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(c \cdot \left(i \cdot \left(a \cdot \left(1 + \frac{b \cdot c}{a}\right)\right)\right)\right)\\
\end{array}
\end{array}
if c < -1.11999999999999999e36Initial program 76.1%
associate--l+76.1%
*-commutative76.1%
associate--l+76.1%
associate--l+76.1%
*-commutative76.1%
associate--l+76.1%
fma-define76.1%
*-commutative76.1%
associate-*l*93.2%
+-commutative93.2%
fma-define93.2%
Simplified93.2%
Taylor expanded in i around inf 71.8%
if -1.11999999999999999e36 < c < 1.2e15Initial program 98.6%
associate--l+98.6%
*-commutative98.6%
associate--l+98.6%
associate--l+98.6%
*-commutative98.6%
associate--l+98.6%
fma-define98.6%
*-commutative98.6%
associate-*l*95.4%
+-commutative95.4%
fma-define95.4%
Simplified95.4%
Taylor expanded in c around 0 78.7%
if 1.2e15 < c Initial program 80.0%
associate--l+80.0%
*-commutative80.0%
associate--l+80.0%
associate--l+80.0%
*-commutative80.0%
associate--l+80.0%
fma-define82.1%
*-commutative82.1%
associate-*l*93.8%
+-commutative93.8%
fma-define93.8%
Simplified93.8%
Taylor expanded in i around inf 70.4%
Taylor expanded in a around inf 70.6%
Final simplification75.5%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (or (<= c -8.6e+39) (not (<= c 1.5e+15))) (* (* c (* (+ a (* b c)) i)) -2.0) (* (+ (* x y) (* z t)) 2.0)))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c <= -8.6e+39) || !(c <= 1.5e+15)) {
tmp = (c * ((a + (b * c)) * i)) * -2.0;
} else {
tmp = ((x * y) + (z * t)) * 2.0;
}
return tmp;
}
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
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 <= (-8.6d+39)) .or. (.not. (c <= 1.5d+15))) then
tmp = (c * ((a + (b * c)) * i)) * (-2.0d0)
else
tmp = ((x * y) + (z * t)) * 2.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c <= -8.6e+39) || !(c <= 1.5e+15)) {
tmp = (c * ((a + (b * c)) * i)) * -2.0;
} else {
tmp = ((x * y) + (z * t)) * 2.0;
}
return tmp;
}
[x, y, z, t, a, b, c, i] = sort([x, y, z, t, a, b, c, i]) def code(x, y, z, t, a, b, c, i): tmp = 0 if (c <= -8.6e+39) or not (c <= 1.5e+15): tmp = (c * ((a + (b * c)) * i)) * -2.0 else: tmp = ((x * y) + (z * t)) * 2.0 return tmp
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((c <= -8.6e+39) || !(c <= 1.5e+15)) tmp = Float64(Float64(c * Float64(Float64(a + Float64(b * c)) * i)) * -2.0); else tmp = Float64(Float64(Float64(x * y) + Float64(z * t)) * 2.0); end return tmp end
x, y, z, t, a, b, c, i = num2cell(sort([x, y, z, t, a, b, c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if ((c <= -8.6e+39) || ~((c <= 1.5e+15)))
tmp = (c * ((a + (b * c)) * i)) * -2.0;
else
tmp = ((x * y) + (z * t)) * 2.0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[c, -8.6e+39], N[Not[LessEqual[c, 1.5e+15]], $MachinePrecision]], N[(N[(c * N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;c \leq -8.6 \cdot 10^{+39} \lor \neg \left(c \leq 1.5 \cdot 10^{+15}\right):\\
\;\;\;\;\left(c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right) \cdot -2\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\
\end{array}
\end{array}
if c < -8.6e39 or 1.5e15 < c Initial program 77.9%
associate--l+77.9%
*-commutative77.9%
associate--l+77.9%
associate--l+77.9%
*-commutative77.9%
associate--l+77.9%
fma-define78.8%
*-commutative78.8%
associate-*l*93.4%
+-commutative93.4%
fma-define93.4%
Simplified93.4%
Taylor expanded in i around inf 71.2%
if -8.6e39 < c < 1.5e15Initial program 98.6%
associate--l+98.6%
*-commutative98.6%
associate--l+98.6%
associate--l+98.6%
*-commutative98.6%
associate--l+98.6%
fma-define98.6%
*-commutative98.6%
associate-*l*95.4%
+-commutative95.4%
fma-define95.4%
Simplified95.4%
Taylor expanded in c around 0 78.7%
Final simplification75.5%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* x (* y 2.0))))
(if (<= y -7.6e-47)
t_1
(if (<= y 1.6e-120)
(* -2.0 (* c (* i (* b c))))
(if (<= y 1.32e+72) (* t (* z 2.0)) t_1)))))assert(x < y && y < z && z < t && t < a && a < b && b < c && 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 * 2.0);
double tmp;
if (y <= -7.6e-47) {
tmp = t_1;
} else if (y <= 1.6e-120) {
tmp = -2.0 * (c * (i * (b * c)));
} else if (y <= 1.32e+72) {
tmp = t * (z * 2.0);
} else {
tmp = t_1;
}
return tmp;
}
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
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 * 2.0d0)
if (y <= (-7.6d-47)) then
tmp = t_1
else if (y <= 1.6d-120) then
tmp = (-2.0d0) * (c * (i * (b * c)))
else if (y <= 1.32d+72) then
tmp = t * (z * 2.0d0)
else
tmp = t_1
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i;
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 * 2.0);
double tmp;
if (y <= -7.6e-47) {
tmp = t_1;
} else if (y <= 1.6e-120) {
tmp = -2.0 * (c * (i * (b * c)));
} else if (y <= 1.32e+72) {
tmp = t * (z * 2.0);
} else {
tmp = t_1;
}
return tmp;
}
[x, y, z, t, a, b, c, i] = sort([x, y, z, t, a, b, c, i]) def code(x, y, z, t, a, b, c, i): t_1 = x * (y * 2.0) tmp = 0 if y <= -7.6e-47: tmp = t_1 elif y <= 1.6e-120: tmp = -2.0 * (c * (i * (b * c))) elif y <= 1.32e+72: tmp = t * (z * 2.0) else: tmp = t_1 return tmp
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) t_1 = Float64(x * Float64(y * 2.0)) tmp = 0.0 if (y <= -7.6e-47) tmp = t_1; elseif (y <= 1.6e-120) tmp = Float64(-2.0 * Float64(c * Float64(i * Float64(b * c)))); elseif (y <= 1.32e+72) tmp = Float64(t * Float64(z * 2.0)); else tmp = t_1; end return tmp end
x, y, z, t, a, b, c, i = num2cell(sort([x, y, z, t, a, b, c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
t_1 = x * (y * 2.0);
tmp = 0.0;
if (y <= -7.6e-47)
tmp = t_1;
elseif (y <= 1.6e-120)
tmp = -2.0 * (c * (i * (b * c)));
elseif (y <= 1.32e+72)
tmp = t * (z * 2.0);
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(x * N[(y * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -7.6e-47], t$95$1, If[LessEqual[y, 1.6e-120], N[(-2.0 * N[(c * N[(i * N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 1.32e+72], N[(t * N[(z * 2.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
t_1 := x \cdot \left(y \cdot 2\right)\\
\mathbf{if}\;y \leq -7.6 \cdot 10^{-47}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;y \leq 1.6 \cdot 10^{-120}:\\
\;\;\;\;-2 \cdot \left(c \cdot \left(i \cdot \left(b \cdot c\right)\right)\right)\\
\mathbf{elif}\;y \leq 1.32 \cdot 10^{+72}:\\
\;\;\;\;t \cdot \left(z \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if y < -7.60000000000000029e-47 or 1.3199999999999999e72 < y Initial program 88.0%
associate--l+88.0%
*-commutative88.0%
associate--l+88.0%
associate--l+88.0%
*-commutative88.0%
associate--l+88.0%
fma-define88.7%
*-commutative88.7%
associate-*l*92.1%
+-commutative92.1%
fma-define92.1%
Simplified92.1%
Taylor expanded in x around inf 52.7%
*-commutative52.7%
associate-*l*52.7%
Simplified52.7%
if -7.60000000000000029e-47 < y < 1.6e-120Initial program 93.9%
associate--l+93.9%
*-commutative93.9%
associate--l+93.9%
associate--l+93.9%
*-commutative93.9%
associate--l+93.9%
fma-define93.9%
*-commutative93.9%
associate-*l*97.4%
+-commutative97.4%
fma-define97.4%
Simplified97.4%
Taylor expanded in i around inf 59.0%
Taylor expanded in a around 0 40.5%
*-commutative78.4%
Simplified40.5%
if 1.6e-120 < y < 1.3199999999999999e72Initial program 87.7%
associate--l+87.7%
*-commutative87.7%
associate--l+87.7%
associate--l+87.7%
*-commutative87.7%
associate--l+87.7%
fma-define87.7%
*-commutative87.7%
associate-*l*97.5%
+-commutative97.5%
fma-define97.5%
Simplified97.5%
Taylor expanded in z around inf 55.1%
associate-*r*55.1%
*-commutative55.1%
associate-*l*55.1%
*-commutative55.1%
Simplified55.1%
Final simplification49.4%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (or (<= c -1e+131) (not (<= c 8.4e+89))) (* -2.0 (* c (* i (* b c)))) (* (+ (* x y) (* z t)) 2.0)))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c <= -1e+131) || !(c <= 8.4e+89)) {
tmp = -2.0 * (c * (i * (b * c)));
} else {
tmp = ((x * y) + (z * t)) * 2.0;
}
return tmp;
}
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
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 <= (-1d+131)) .or. (.not. (c <= 8.4d+89))) then
tmp = (-2.0d0) * (c * (i * (b * c)))
else
tmp = ((x * y) + (z * t)) * 2.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c <= -1e+131) || !(c <= 8.4e+89)) {
tmp = -2.0 * (c * (i * (b * c)));
} else {
tmp = ((x * y) + (z * t)) * 2.0;
}
return tmp;
}
[x, y, z, t, a, b, c, i] = sort([x, y, z, t, a, b, c, i]) def code(x, y, z, t, a, b, c, i): tmp = 0 if (c <= -1e+131) or not (c <= 8.4e+89): tmp = -2.0 * (c * (i * (b * c))) else: tmp = ((x * y) + (z * t)) * 2.0 return tmp
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((c <= -1e+131) || !(c <= 8.4e+89)) tmp = Float64(-2.0 * Float64(c * Float64(i * Float64(b * c)))); else tmp = Float64(Float64(Float64(x * y) + Float64(z * t)) * 2.0); end return tmp end
x, y, z, t, a, b, c, i = num2cell(sort([x, y, z, t, a, b, c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if ((c <= -1e+131) || ~((c <= 8.4e+89)))
tmp = -2.0 * (c * (i * (b * c)));
else
tmp = ((x * y) + (z * t)) * 2.0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[c, -1e+131], N[Not[LessEqual[c, 8.4e+89]], $MachinePrecision]], N[(-2.0 * N[(c * N[(i * N[(b * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1 \cdot 10^{+131} \lor \neg \left(c \leq 8.4 \cdot 10^{+89}\right):\\
\;\;\;\;-2 \cdot \left(c \cdot \left(i \cdot \left(b \cdot c\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\
\end{array}
\end{array}
if c < -9.9999999999999991e130 or 8.39999999999999945e89 < c Initial program 71.8%
associate--l+71.8%
*-commutative71.8%
associate--l+71.8%
associate--l+71.8%
*-commutative71.8%
associate--l+71.8%
fma-define73.2%
*-commutative73.2%
associate-*l*91.6%
+-commutative91.6%
fma-define91.6%
Simplified91.6%
Taylor expanded in i around inf 77.3%
Taylor expanded in a around 0 74.6%
*-commutative87.5%
Simplified74.6%
if -9.9999999999999991e130 < c < 8.39999999999999945e89Initial program 96.8%
associate--l+96.8%
*-commutative96.8%
associate--l+96.8%
associate--l+96.8%
*-commutative96.8%
associate--l+96.8%
fma-define96.8%
*-commutative96.8%
associate-*l*95.7%
+-commutative95.7%
fma-define95.7%
Simplified95.7%
Taylor expanded in c around 0 72.4%
Final simplification73.1%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (if (or (<= y -2.8e-53) (not (<= y 1.32e+72))) (* x (* y 2.0)) (* t (* z 2.0))))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((y <= -2.8e-53) || !(y <= 1.32e+72)) {
tmp = x * (y * 2.0);
} else {
tmp = t * (z * 2.0);
}
return tmp;
}
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
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 ((y <= (-2.8d-53)) .or. (.not. (y <= 1.32d+72))) then
tmp = x * (y * 2.0d0)
else
tmp = t * (z * 2.0d0)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((y <= -2.8e-53) || !(y <= 1.32e+72)) {
tmp = x * (y * 2.0);
} else {
tmp = t * (z * 2.0);
}
return tmp;
}
[x, y, z, t, a, b, c, i] = sort([x, y, z, t, a, b, c, i]) def code(x, y, z, t, a, b, c, i): tmp = 0 if (y <= -2.8e-53) or not (y <= 1.32e+72): tmp = x * (y * 2.0) else: tmp = t * (z * 2.0) return tmp
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((y <= -2.8e-53) || !(y <= 1.32e+72)) tmp = Float64(x * Float64(y * 2.0)); else tmp = Float64(t * Float64(z * 2.0)); end return tmp end
x, y, z, t, a, b, c, i = num2cell(sort([x, y, z, t, a, b, c, i])){:}
function tmp_2 = code(x, y, z, t, a, b, c, i)
tmp = 0.0;
if ((y <= -2.8e-53) || ~((y <= 1.32e+72)))
tmp = x * (y * 2.0);
else
tmp = t * (z * 2.0);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[y, -2.8e-53], N[Not[LessEqual[y, 1.32e+72]], $MachinePrecision]], N[(x * N[(y * 2.0), $MachinePrecision]), $MachinePrecision], N[(t * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.8 \cdot 10^{-53} \lor \neg \left(y \leq 1.32 \cdot 10^{+72}\right):\\
\;\;\;\;x \cdot \left(y \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(z \cdot 2\right)\\
\end{array}
\end{array}
if y < -2.79999999999999985e-53 or 1.3199999999999999e72 < y Initial program 88.1%
associate--l+88.1%
*-commutative88.1%
associate--l+88.1%
associate--l+88.1%
*-commutative88.1%
associate--l+88.1%
fma-define88.8%
*-commutative88.8%
associate-*l*92.2%
+-commutative92.2%
fma-define92.2%
Simplified92.2%
Taylor expanded in x around inf 52.4%
*-commutative52.4%
associate-*l*52.4%
Simplified52.4%
if -2.79999999999999985e-53 < y < 1.3199999999999999e72Initial program 91.8%
associate--l+91.8%
*-commutative91.8%
associate--l+91.8%
associate--l+91.8%
*-commutative91.8%
associate--l+91.8%
fma-define91.8%
*-commutative91.8%
associate-*l*97.4%
+-commutative97.4%
fma-define97.4%
Simplified97.4%
Taylor expanded in z around inf 38.9%
associate-*r*38.9%
*-commutative38.9%
associate-*l*38.9%
*-commutative38.9%
Simplified38.9%
Final simplification46.3%
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. (FPCore (x y z t a b c i) :precision binary64 (* t (* z 2.0)))
assert(x < y && y < z && z < t && t < a && a < b && b < c && c < i);
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return t * (z * 2.0);
}
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function.
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 = t * (z * 2.0d0)
end function
assert x < y && y < z && z < t && t < a && a < b && b < c && c < i;
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return t * (z * 2.0);
}
[x, y, z, t, a, b, c, i] = sort([x, y, z, t, a, b, c, i]) def code(x, y, z, t, a, b, c, i): return t * (z * 2.0)
x, y, z, t, a, b, c, i = sort([x, y, z, t, a, b, c, i]) function code(x, y, z, t, a, b, c, i) return Float64(t * Float64(z * 2.0)) end
x, y, z, t, a, b, c, i = num2cell(sort([x, y, z, t, a, b, c, i])){:}
function tmp = code(x, y, z, t, a, b, c, i)
tmp = t * (z * 2.0);
end
NOTE: x, y, z, t, a, b, c, and i should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(t * N[(z * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b, c, i] = \mathsf{sort}([x, y, z, t, a, b, c, i])\\
\\
t \cdot \left(z \cdot 2\right)
\end{array}
Initial program 89.8%
associate--l+89.8%
*-commutative89.8%
associate--l+89.8%
associate--l+89.8%
*-commutative89.8%
associate--l+89.8%
fma-define90.2%
*-commutative90.2%
associate-*l*94.6%
+-commutative94.6%
fma-define94.6%
Simplified94.6%
Taylor expanded in z around inf 29.4%
associate-*r*29.4%
*-commutative29.4%
associate-*l*29.4%
*-commutative29.4%
Simplified29.4%
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (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 = 2.0d0 * (((x * y) + (z * t)) - ((a + (b * c)) * (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 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)));
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i)))
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(a + Float64(b * c)) * Float64(c * i)))) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (((x * y) + (z * t)) - ((a + (b * c)) * (c * i))); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(\left(x \cdot y + z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right)
\end{array}
herbie shell --seed 2024135
(FPCore (x y z t a b c i)
:name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A"
:precision binary64
:alt
(! :herbie-platform default (* 2 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i)))))
(* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))