
(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 12 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}
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (- (fma 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 * (fma(x, y, (z * t)) - ((a + (b * c)) * (c * i)));
}
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(fma(x, y, Float64(z * t)) - Float64(Float64(a + Float64(b * c)) * Float64(c * i)))) end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(N[(x * y + 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(\mathsf{fma}\left(x, y, z \cdot t\right) - \left(a + b \cdot c\right) \cdot \left(c \cdot i\right)\right)
\end{array}
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-def88.0%
associate-*l*96.1%
Simplified96.1%
Final simplification96.1%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ a (* b c))) (t_2 (* i (* c t_1))) (t_3 (* c (* t_1 i))))
(if (<= t_2 (- INFINITY))
(* 2.0 (- (* x y) t_3))
(if (<= t_2 2e+294) (* 2.0 (- (+ (* x y) (* z t)) t_2)) (* t_3 -2.0)))))
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 = i * (c * t_1);
double t_3 = c * (t_1 * i);
double tmp;
if (t_2 <= -((double) INFINITY)) {
tmp = 2.0 * ((x * y) - t_3);
} else if (t_2 <= 2e+294) {
tmp = 2.0 * (((x * y) + (z * t)) - t_2);
} else {
tmp = t_3 * -2.0;
}
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 = a + (b * c);
double t_2 = i * (c * t_1);
double t_3 = c * (t_1 * i);
double tmp;
if (t_2 <= -Double.POSITIVE_INFINITY) {
tmp = 2.0 * ((x * y) - t_3);
} else if (t_2 <= 2e+294) {
tmp = 2.0 * (((x * y) + (z * t)) - t_2);
} else {
tmp = t_3 * -2.0;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = a + (b * c) t_2 = i * (c * t_1) t_3 = c * (t_1 * i) tmp = 0 if t_2 <= -math.inf: tmp = 2.0 * ((x * y) - t_3) elif t_2 <= 2e+294: tmp = 2.0 * (((x * y) + (z * t)) - t_2) else: tmp = t_3 * -2.0 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(a + Float64(b * c)) t_2 = Float64(i * Float64(c * t_1)) t_3 = Float64(c * Float64(t_1 * i)) tmp = 0.0 if (t_2 <= Float64(-Inf)) tmp = Float64(2.0 * Float64(Float64(x * y) - t_3)); elseif (t_2 <= 2e+294) tmp = Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - t_2)); else tmp = Float64(t_3 * -2.0); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = a + (b * c); t_2 = i * (c * t_1); t_3 = c * (t_1 * i); tmp = 0.0; if (t_2 <= -Inf) tmp = 2.0 * ((x * y) - t_3); elseif (t_2 <= 2e+294) tmp = 2.0 * (((x * y) + (z * t)) - t_2); else tmp = t_3 * -2.0; end tmp_2 = tmp; end
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[(i * N[(c * t$95$1), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(c * N[(t$95$1 * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, (-Infinity)], N[(2.0 * N[(N[(x * y), $MachinePrecision] - t$95$3), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 2e+294], N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision], N[(t$95$3 * -2.0), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a + b \cdot c\\
t_2 := i \cdot \left(c \cdot t_1\right)\\
t_3 := c \cdot \left(t_1 \cdot i\right)\\
\mathbf{if}\;t_2 \leq -\infty:\\
\;\;\;\;2 \cdot \left(x \cdot y - t_3\right)\\
\mathbf{elif}\;t_2 \leq 2 \cdot 10^{+294}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - t_2\right)\\
\mathbf{else}:\\
\;\;\;\;t_3 \cdot -2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0Initial program 76.1%
Taylor expanded in z around 0 90.6%
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 2.00000000000000013e294Initial program 98.6%
if 2.00000000000000013e294 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 70.3%
Taylor expanded in i around inf 89.3%
Taylor expanded in i around 0 89.3%
Final simplification95.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* 2.0 (* x y))))
(if (<= (* x y) -950000000000.0)
t_1
(if (<= (* x y) 1.9e-271)
(* 2.0 (* z t))
(if (<= (* x y) 3.6e-29)
(* -2.0 (* a (* c i)))
(if (or (<= (* x y) 1.2e+20) (not (<= (* x y) 4e+73)))
t_1
(* 2.0 (* (* a i) (- c)))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = 2.0 * (x * y);
double tmp;
if ((x * y) <= -950000000000.0) {
tmp = t_1;
} else if ((x * y) <= 1.9e-271) {
tmp = 2.0 * (z * t);
} else if ((x * y) <= 3.6e-29) {
tmp = -2.0 * (a * (c * i));
} else if (((x * y) <= 1.2e+20) || !((x * y) <= 4e+73)) {
tmp = t_1;
} else {
tmp = 2.0 * ((a * i) * -c);
}
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 = 2.0d0 * (x * y)
if ((x * y) <= (-950000000000.0d0)) then
tmp = t_1
else if ((x * y) <= 1.9d-271) then
tmp = 2.0d0 * (z * t)
else if ((x * y) <= 3.6d-29) then
tmp = (-2.0d0) * (a * (c * i))
else if (((x * y) <= 1.2d+20) .or. (.not. ((x * y) <= 4d+73))) then
tmp = t_1
else
tmp = 2.0d0 * ((a * i) * -c)
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 = 2.0 * (x * y);
double tmp;
if ((x * y) <= -950000000000.0) {
tmp = t_1;
} else if ((x * y) <= 1.9e-271) {
tmp = 2.0 * (z * t);
} else if ((x * y) <= 3.6e-29) {
tmp = -2.0 * (a * (c * i));
} else if (((x * y) <= 1.2e+20) || !((x * y) <= 4e+73)) {
tmp = t_1;
} else {
tmp = 2.0 * ((a * i) * -c);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = 2.0 * (x * y) tmp = 0 if (x * y) <= -950000000000.0: tmp = t_1 elif (x * y) <= 1.9e-271: tmp = 2.0 * (z * t) elif (x * y) <= 3.6e-29: tmp = -2.0 * (a * (c * i)) elif ((x * y) <= 1.2e+20) or not ((x * y) <= 4e+73): tmp = t_1 else: tmp = 2.0 * ((a * i) * -c) return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * Float64(x * y)) tmp = 0.0 if (Float64(x * y) <= -950000000000.0) tmp = t_1; elseif (Float64(x * y) <= 1.9e-271) tmp = Float64(2.0 * Float64(z * t)); elseif (Float64(x * y) <= 3.6e-29) tmp = Float64(-2.0 * Float64(a * Float64(c * i))); elseif ((Float64(x * y) <= 1.2e+20) || !(Float64(x * y) <= 4e+73)) tmp = t_1; else tmp = Float64(2.0 * Float64(Float64(a * i) * Float64(-c))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = 2.0 * (x * y); tmp = 0.0; if ((x * y) <= -950000000000.0) tmp = t_1; elseif ((x * y) <= 1.9e-271) tmp = 2.0 * (z * t); elseif ((x * y) <= 3.6e-29) tmp = -2.0 * (a * (c * i)); elseif (((x * y) <= 1.2e+20) || ~(((x * y) <= 4e+73))) tmp = t_1; else tmp = 2.0 * ((a * i) * -c); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -950000000000.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1.9e-271], N[(2.0 * N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 3.6e-29], N[(-2.0 * N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[N[(x * y), $MachinePrecision], 1.2e+20], N[Not[LessEqual[N[(x * y), $MachinePrecision], 4e+73]], $MachinePrecision]], t$95$1, N[(2.0 * N[(N[(a * i), $MachinePrecision] * (-c)), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot y\right)\\
\mathbf{if}\;x \cdot y \leq -950000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 1.9 \cdot 10^{-271}:\\
\;\;\;\;2 \cdot \left(z \cdot t\right)\\
\mathbf{elif}\;x \cdot y \leq 3.6 \cdot 10^{-29}:\\
\;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\
\mathbf{elif}\;x \cdot y \leq 1.2 \cdot 10^{+20} \lor \neg \left(x \cdot y \leq 4 \cdot 10^{+73}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(a \cdot i\right) \cdot \left(-c\right)\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -9.5e11 or 3.59999999999999974e-29 < (*.f64 x y) < 1.2e20 or 3.99999999999999993e73 < (*.f64 x y) Initial program 89.8%
Taylor expanded in x around inf 60.8%
if -9.5e11 < (*.f64 x y) < 1.90000000000000005e-271Initial program 88.9%
Taylor expanded in z around inf 44.5%
if 1.90000000000000005e-271 < (*.f64 x y) < 3.59999999999999974e-29Initial program 81.7%
Taylor expanded in a around inf 46.2%
mul-1-neg46.2%
*-commutative46.2%
distribute-rgt-neg-in46.2%
Simplified46.2%
Taylor expanded in c around 0 46.2%
if 1.2e20 < (*.f64 x y) < 3.99999999999999993e73Initial program 80.4%
Taylor expanded in a around inf 50.6%
mul-1-neg50.6%
*-commutative50.6%
associate-*l*60.3%
Simplified60.3%
Final simplification53.3%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))))
(if (or (<= a -2e+77) (not (<= a 3.05e+29)))
(* 2.0 (- t_1 (* a (* c i))))
(* 2.0 (- t_1 (* (* 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 tmp;
if ((a <= -2e+77) || !(a <= 3.05e+29)) {
tmp = 2.0 * (t_1 - (a * (c * i)));
} else {
tmp = 2.0 * (t_1 - ((b * c) * (c * i)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) + (z * t)
if ((a <= (-2d+77)) .or. (.not. (a <= 3.05d+29))) then
tmp = 2.0d0 * (t_1 - (a * (c * i)))
else
tmp = 2.0d0 * (t_1 - ((b * c) * (c * i)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) + (z * t);
double tmp;
if ((a <= -2e+77) || !(a <= 3.05e+29)) {
tmp = 2.0 * (t_1 - (a * (c * i)));
} else {
tmp = 2.0 * (t_1 - ((b * c) * (c * i)));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (x * y) + (z * t) tmp = 0 if (a <= -2e+77) or not (a <= 3.05e+29): tmp = 2.0 * (t_1 - (a * (c * i))) else: tmp = 2.0 * (t_1 - ((b * c) * (c * i))) 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 ((a <= -2e+77) || !(a <= 3.05e+29)) tmp = Float64(2.0 * Float64(t_1 - Float64(a * Float64(c * i)))); else tmp = Float64(2.0 * Float64(t_1 - Float64(Float64(b * c) * Float64(c * i)))); 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 ((a <= -2e+77) || ~((a <= 3.05e+29))) tmp = 2.0 * (t_1 - (a * (c * i))); else tmp = 2.0 * (t_1 - ((b * c) * (c * i))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[a, -2e+77], N[Not[LessEqual[a, 3.05e+29]], $MachinePrecision]], N[(2.0 * N[(t$95$1 - N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$1 - N[(N[(b * c), $MachinePrecision] * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;a \leq -2 \cdot 10^{+77} \lor \neg \left(a \leq 3.05 \cdot 10^{+29}\right):\\
\;\;\;\;2 \cdot \left(t_1 - a \cdot \left(c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t_1 - \left(b \cdot c\right) \cdot \left(c \cdot i\right)\right)\\
\end{array}
\end{array}
if a < -1.99999999999999997e77 or 3.0499999999999999e29 < a Initial program 84.4%
Taylor expanded in a around inf 87.9%
if -1.99999999999999997e77 < a < 3.0499999999999999e29Initial program 90.7%
associate--l+90.7%
*-commutative90.7%
associate--l+90.7%
associate--l+90.7%
*-commutative90.7%
associate--l+90.7%
fma-def90.7%
associate-*l*96.5%
Simplified96.5%
fma-def96.5%
+-commutative96.5%
Applied egg-rr96.5%
Taylor expanded in a around 0 94.4%
Final simplification91.6%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* 2.0 (* x y))))
(if (<= (* x y) -29000000000.0)
t_1
(if (<= (* x y) 1.35e-273)
(* 2.0 (* z t))
(if (<= (* x y) 2.25e-29) (* -2.0 (* a (* 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 = 2.0 * (x * y);
double tmp;
if ((x * y) <= -29000000000.0) {
tmp = t_1;
} else if ((x * y) <= 1.35e-273) {
tmp = 2.0 * (z * t);
} else if ((x * y) <= 2.25e-29) {
tmp = -2.0 * (a * (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 = 2.0d0 * (x * y)
if ((x * y) <= (-29000000000.0d0)) then
tmp = t_1
else if ((x * y) <= 1.35d-273) then
tmp = 2.0d0 * (z * t)
else if ((x * y) <= 2.25d-29) then
tmp = (-2.0d0) * (a * (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 = 2.0 * (x * y);
double tmp;
if ((x * y) <= -29000000000.0) {
tmp = t_1;
} else if ((x * y) <= 1.35e-273) {
tmp = 2.0 * (z * t);
} else if ((x * y) <= 2.25e-29) {
tmp = -2.0 * (a * (c * i));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = 2.0 * (x * y) tmp = 0 if (x * y) <= -29000000000.0: tmp = t_1 elif (x * y) <= 1.35e-273: tmp = 2.0 * (z * t) elif (x * y) <= 2.25e-29: tmp = -2.0 * (a * (c * i)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * Float64(x * y)) tmp = 0.0 if (Float64(x * y) <= -29000000000.0) tmp = t_1; elseif (Float64(x * y) <= 1.35e-273) tmp = Float64(2.0 * Float64(z * t)); elseif (Float64(x * y) <= 2.25e-29) tmp = Float64(-2.0 * Float64(a * 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 = 2.0 * (x * y); tmp = 0.0; if ((x * y) <= -29000000000.0) tmp = t_1; elseif ((x * y) <= 1.35e-273) tmp = 2.0 * (z * t); elseif ((x * y) <= 2.25e-29) tmp = -2.0 * (a * (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[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -29000000000.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1.35e-273], N[(2.0 * N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2.25e-29], N[(-2.0 * N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(x \cdot y\right)\\
\mathbf{if}\;x \cdot y \leq -29000000000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \cdot y \leq 1.35 \cdot 10^{-273}:\\
\;\;\;\;2 \cdot \left(z \cdot t\right)\\
\mathbf{elif}\;x \cdot y \leq 2.25 \cdot 10^{-29}:\\
\;\;\;\;-2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if (*.f64 x y) < -2.9e10 or 2.2499999999999999e-29 < (*.f64 x y) Initial program 89.1%
Taylor expanded in x around inf 57.2%
if -2.9e10 < (*.f64 x y) < 1.34999999999999992e-273Initial program 88.9%
Taylor expanded in z around inf 44.5%
if 1.34999999999999992e-273 < (*.f64 x y) < 2.2499999999999999e-29Initial program 81.7%
Taylor expanded in a around inf 46.2%
mul-1-neg46.2%
*-commutative46.2%
distribute-rgt-neg-in46.2%
Simplified46.2%
Taylor expanded in c around 0 46.2%
Final simplification51.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= c -1.9e-78) (not (<= c 1.25e-23))) (* 2.0 (- (* x y) (* c (* (+ a (* b c)) i)))) (* 2.0 (+ (* 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 <= -1.9e-78) || !(c <= 1.25e-23)) {
tmp = 2.0 * ((x * y) - (c * ((a + (b * c)) * i)));
} else {
tmp = 2.0 * ((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 <= (-1.9d-78)) .or. (.not. (c <= 1.25d-23))) then
tmp = 2.0d0 * ((x * y) - (c * ((a + (b * c)) * i)))
else
tmp = 2.0d0 * ((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 <= -1.9e-78) || !(c <= 1.25e-23)) {
tmp = 2.0 * ((x * y) - (c * ((a + (b * c)) * i)));
} else {
tmp = 2.0 * ((x * y) + (z * t));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c <= -1.9e-78) or not (c <= 1.25e-23): tmp = 2.0 * ((x * y) - (c * ((a + (b * c)) * i))) else: tmp = 2.0 * ((x * y) + (z * t)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((c <= -1.9e-78) || !(c <= 1.25e-23)) tmp = Float64(2.0 * Float64(Float64(x * y) - Float64(c * Float64(Float64(a + Float64(b * c)) * i)))); else tmp = Float64(2.0 * 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 <= -1.9e-78) || ~((c <= 1.25e-23))) tmp = 2.0 * ((x * y) - (c * ((a + (b * c)) * i))); else tmp = 2.0 * ((x * y) + (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[c, -1.9e-78], N[Not[LessEqual[c, 1.25e-23]], $MachinePrecision]], N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(c * N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -1.9 \cdot 10^{-78} \lor \neg \left(c \leq 1.25 \cdot 10^{-23}\right):\\
\;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot y + z \cdot t\right)\\
\end{array}
\end{array}
if c < -1.8999999999999999e-78 or 1.2500000000000001e-23 < c Initial program 82.4%
Taylor expanded in z around 0 83.4%
if -1.8999999999999999e-78 < c < 1.2500000000000001e-23Initial program 97.9%
Taylor expanded in c around 0 86.5%
Final simplification84.5%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= c -5.8e+56) (not (<= c 5.1e+16))) (* 2.0 (- (* x y) (* c (* (+ a (* b c)) i)))) (* 2.0 (- (+ (* x y) (* z t)) (* a (* c i))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c <= -5.8e+56) || !(c <= 5.1e+16)) {
tmp = 2.0 * ((x * y) - (c * ((a + (b * c)) * i)));
} else {
tmp = 2.0 * (((x * y) + (z * t)) - (a * (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 <= (-5.8d+56)) .or. (.not. (c <= 5.1d+16))) then
tmp = 2.0d0 * ((x * y) - (c * ((a + (b * c)) * i)))
else
tmp = 2.0d0 * (((x * y) + (z * t)) - (a * (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 <= -5.8e+56) || !(c <= 5.1e+16)) {
tmp = 2.0 * ((x * y) - (c * ((a + (b * c)) * i)));
} else {
tmp = 2.0 * (((x * y) + (z * t)) - (a * (c * i)));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c <= -5.8e+56) or not (c <= 5.1e+16): tmp = 2.0 * ((x * y) - (c * ((a + (b * c)) * i))) else: tmp = 2.0 * (((x * y) + (z * t)) - (a * (c * i))) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((c <= -5.8e+56) || !(c <= 5.1e+16)) tmp = Float64(2.0 * Float64(Float64(x * y) - Float64(c * Float64(Float64(a + Float64(b * c)) * i)))); else tmp = Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(a * Float64(c * i)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((c <= -5.8e+56) || ~((c <= 5.1e+16))) tmp = 2.0 * ((x * y) - (c * ((a + (b * c)) * i))); else tmp = 2.0 * (((x * y) + (z * t)) - (a * (c * i))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[c, -5.8e+56], N[Not[LessEqual[c, 5.1e+16]], $MachinePrecision]], N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(c * N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -5.8 \cdot 10^{+56} \lor \neg \left(c \leq 5.1 \cdot 10^{+16}\right):\\
\;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(\left(x \cdot y + z \cdot t\right) - a \cdot \left(c \cdot i\right)\right)\\
\end{array}
\end{array}
if c < -5.80000000000000014e56 or 5.1e16 < c Initial program 79.0%
Taylor expanded in z around 0 86.3%
if -5.80000000000000014e56 < c < 5.1e16Initial program 96.9%
Taylor expanded in a around inf 94.2%
Final simplification90.2%
(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}
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-def88.0%
associate-*l*96.1%
Simplified96.1%
fma-def96.1%
+-commutative96.1%
Applied egg-rr96.1%
Final simplification96.1%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= c -4.3e+64) (not (<= c 1.12e+60))) (* (* c (* (+ a (* b c)) i)) -2.0) (* 2.0 (+ (* 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 <= -4.3e+64) || !(c <= 1.12e+60)) {
tmp = (c * ((a + (b * c)) * i)) * -2.0;
} else {
tmp = 2.0 * ((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 <= (-4.3d+64)) .or. (.not. (c <= 1.12d+60))) then
tmp = (c * ((a + (b * c)) * i)) * (-2.0d0)
else
tmp = 2.0d0 * ((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 <= -4.3e+64) || !(c <= 1.12e+60)) {
tmp = (c * ((a + (b * c)) * i)) * -2.0;
} else {
tmp = 2.0 * ((x * y) + (z * t));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c <= -4.3e+64) or not (c <= 1.12e+60): tmp = (c * ((a + (b * c)) * i)) * -2.0 else: tmp = 2.0 * ((x * y) + (z * t)) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((c <= -4.3e+64) || !(c <= 1.12e+60)) tmp = Float64(Float64(c * Float64(Float64(a + Float64(b * c)) * i)) * -2.0); else tmp = Float64(2.0 * 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 <= -4.3e+64) || ~((c <= 1.12e+60))) tmp = (c * ((a + (b * c)) * i)) * -2.0; else tmp = 2.0 * ((x * y) + (z * t)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[c, -4.3e+64], N[Not[LessEqual[c, 1.12e+60]], $MachinePrecision]], N[(N[(c * N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision], N[(2.0 * N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -4.3 \cdot 10^{+64} \lor \neg \left(c \leq 1.12 \cdot 10^{+60}\right):\\
\;\;\;\;\left(c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right) \cdot -2\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(x \cdot y + z \cdot t\right)\\
\end{array}
\end{array}
if c < -4.2999999999999998e64 or 1.1199999999999999e60 < c Initial program 77.8%
Taylor expanded in i around inf 77.1%
Taylor expanded in i around 0 77.1%
if -4.2999999999999998e64 < c < 1.1199999999999999e60Initial program 95.9%
Taylor expanded in c around 0 77.4%
Final simplification77.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* -2.0 (* a (* c i)))))
(if (<= c -5.2e+224)
t_1
(if (<= c 2.3e+163)
(* 2.0 (+ (* x y) (* z t)))
(if (<= c 1.75e+254) t_1 (* i (* 2.0 (* a c))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = -2.0 * (a * (c * i));
double tmp;
if (c <= -5.2e+224) {
tmp = t_1;
} else if (c <= 2.3e+163) {
tmp = 2.0 * ((x * y) + (z * t));
} else if (c <= 1.75e+254) {
tmp = t_1;
} else {
tmp = i * (2.0 * (a * c));
}
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 = (-2.0d0) * (a * (c * i))
if (c <= (-5.2d+224)) then
tmp = t_1
else if (c <= 2.3d+163) then
tmp = 2.0d0 * ((x * y) + (z * t))
else if (c <= 1.75d+254) then
tmp = t_1
else
tmp = i * (2.0d0 * (a * c))
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 = -2.0 * (a * (c * i));
double tmp;
if (c <= -5.2e+224) {
tmp = t_1;
} else if (c <= 2.3e+163) {
tmp = 2.0 * ((x * y) + (z * t));
} else if (c <= 1.75e+254) {
tmp = t_1;
} else {
tmp = i * (2.0 * (a * c));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = -2.0 * (a * (c * i)) tmp = 0 if c <= -5.2e+224: tmp = t_1 elif c <= 2.3e+163: tmp = 2.0 * ((x * y) + (z * t)) elif c <= 1.75e+254: tmp = t_1 else: tmp = i * (2.0 * (a * c)) return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(-2.0 * Float64(a * Float64(c * i))) tmp = 0.0 if (c <= -5.2e+224) tmp = t_1; elseif (c <= 2.3e+163) tmp = Float64(2.0 * Float64(Float64(x * y) + Float64(z * t))); elseif (c <= 1.75e+254) tmp = t_1; else tmp = Float64(i * Float64(2.0 * Float64(a * c))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = -2.0 * (a * (c * i)); tmp = 0.0; if (c <= -5.2e+224) tmp = t_1; elseif (c <= 2.3e+163) tmp = 2.0 * ((x * y) + (z * t)); elseif (c <= 1.75e+254) tmp = t_1; else tmp = i * (2.0 * (a * c)); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(-2.0 * N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -5.2e+224], t$95$1, If[LessEqual[c, 2.3e+163], N[(2.0 * N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 1.75e+254], t$95$1, N[(i * N[(2.0 * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := -2 \cdot \left(a \cdot \left(c \cdot i\right)\right)\\
\mathbf{if}\;c \leq -5.2 \cdot 10^{+224}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 2.3 \cdot 10^{+163}:\\
\;\;\;\;2 \cdot \left(x \cdot y + z \cdot t\right)\\
\mathbf{elif}\;c \leq 1.75 \cdot 10^{+254}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;i \cdot \left(2 \cdot \left(a \cdot c\right)\right)\\
\end{array}
\end{array}
if c < -5.2000000000000001e224 or 2.30000000000000002e163 < c < 1.75000000000000008e254Initial program 77.6%
Taylor expanded in a around inf 66.7%
mul-1-neg66.7%
*-commutative66.7%
distribute-rgt-neg-in66.7%
Simplified66.7%
Taylor expanded in c around 0 66.7%
if -5.2000000000000001e224 < c < 2.30000000000000002e163Initial program 90.7%
Taylor expanded in c around 0 66.8%
if 1.75000000000000008e254 < c Initial program 67.4%
Taylor expanded in a around inf 22.4%
mul-1-neg22.4%
*-commutative22.4%
distribute-rgt-neg-in22.4%
Simplified22.4%
Taylor expanded in c around 0 22.4%
Applied egg-rr67.0%
distribute-lft-neg-in67.0%
metadata-eval67.0%
count-267.0%
distribute-lft-out67.0%
count-267.0%
*-commutative67.0%
Simplified67.0%
Final simplification66.8%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -9000000000000.0) (not (<= (* x y) 4.2e-29))) (* 2.0 (* x y)) (* 2.0 (* z t))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -9000000000000.0) || !((x * y) <= 4.2e-29)) {
tmp = 2.0 * (x * y);
} else {
tmp = 2.0 * (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 (((x * y) <= (-9000000000000.0d0)) .or. (.not. ((x * y) <= 4.2d-29))) then
tmp = 2.0d0 * (x * y)
else
tmp = 2.0d0 * (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 (((x * y) <= -9000000000000.0) || !((x * y) <= 4.2e-29)) {
tmp = 2.0 * (x * y);
} else {
tmp = 2.0 * (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -9000000000000.0) or not ((x * y) <= 4.2e-29): tmp = 2.0 * (x * y) else: tmp = 2.0 * (z * t) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -9000000000000.0) || !(Float64(x * y) <= 4.2e-29)) tmp = Float64(2.0 * Float64(x * y)); else tmp = Float64(2.0 * Float64(z * t)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((x * y) <= -9000000000000.0) || ~(((x * y) <= 4.2e-29))) tmp = 2.0 * (x * y); else tmp = 2.0 * (z * t); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -9000000000000.0], N[Not[LessEqual[N[(x * y), $MachinePrecision], 4.2e-29]], $MachinePrecision]], N[(2.0 * N[(x * y), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -9000000000000 \lor \neg \left(x \cdot y \leq 4.2 \cdot 10^{-29}\right):\\
\;\;\;\;2 \cdot \left(x \cdot y\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -9e12 or 4.19999999999999979e-29 < (*.f64 x y) Initial program 89.1%
Taylor expanded in x around inf 57.2%
if -9e12 < (*.f64 x y) < 4.19999999999999979e-29Initial program 86.8%
Taylor expanded in z around inf 38.9%
Final simplification48.5%
(FPCore (x y z t a b c i) :precision binary64 (* 2.0 (* z t)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return 2.0 * (z * t);
}
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 * (z * t)
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 * (z * t);
}
def code(x, y, z, t, a, b, c, i): return 2.0 * (z * t)
function code(x, y, z, t, a, b, c, i) return Float64(2.0 * Float64(z * t)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = 2.0 * (z * t); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(2.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
2 \cdot \left(z \cdot t\right)
\end{array}
Initial program 88.0%
Taylor expanded in z around inf 27.4%
Final simplification27.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 2023335
(FPCore (x y z t a b c i)
:name "Diagrams.ThreeD.Shapes:frustum from diagrams-lib-1.3.0.3, A"
:precision binary64
:herbie-target
(* 2.0 (- (+ (* x y) (* z t)) (* (+ a (* b c)) (* c i))))
(* 2.0 (- (+ (* x y) (* z t)) (* (* (+ a (* b c)) c) i))))