
(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 14 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
(let* ((t_1 (+ a (* b c))) (t_2 (fma x y (* z t))))
(if (<= (- (+ (* x y) (* z t)) (* (* c t_1) i)) INFINITY)
(* 2.0 (- t_2 (* t_1 (* c i))))
(* 2.0 t_2))))
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 = fma(x, y, (z * t));
double tmp;
if ((((x * y) + (z * t)) - ((c * t_1) * i)) <= ((double) INFINITY)) {
tmp = 2.0 * (t_2 - (t_1 * (c * i)));
} else {
tmp = 2.0 * t_2;
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(a + Float64(b * c)) t_2 = fma(x, y, Float64(z * t)) tmp = 0.0 if (Float64(Float64(Float64(x * y) + Float64(z * t)) - 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 * t_2); end return 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[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - 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 * t$95$2), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a + b \cdot c\\
t_2 := \mathsf{fma}\left(x, y, z \cdot t\right)\\
\mathbf{if}\;\left(x \cdot y + z \cdot t\right) - \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 t\_2\\
\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.5%
fma-define93.5%
associate-*l*98.8%
Simplified98.8%
if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)) Initial program 0.0%
fma-define0.0%
associate-*l*22.2%
Simplified22.2%
fma-define22.2%
+-commutative22.2%
Applied egg-rr22.2%
Taylor expanded in c around 0 66.7%
+-commutative66.7%
*-commutative66.7%
fma-undefine66.7%
*-commutative66.7%
Simplified66.7%
Final simplification97.7%
(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 (fma x y (* z t))))))
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 * fma(x, y, (z * t));
}
return tmp;
}
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 * fma(x, y, Float64(z * t))); end return 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[(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[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\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 \mathsf{fma}\left(x, y, z \cdot t\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.5%
fma-define93.5%
associate-*l*98.8%
Simplified98.8%
fma-define98.8%
+-commutative98.8%
Applied egg-rr98.8%
if +inf.0 < (-.f64 (+.f64 (*.f64 x y) (*.f64 z t)) (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i)) Initial program 0.0%
fma-define0.0%
associate-*l*22.2%
Simplified22.2%
fma-define22.2%
+-commutative22.2%
Applied egg-rr22.2%
Taylor expanded in c around 0 66.7%
+-commutative66.7%
*-commutative66.7%
fma-undefine66.7%
*-commutative66.7%
Simplified66.7%
Final simplification97.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* c i) (* a -2.0)))
(t_2 (* 2.0 (* z t)))
(t_3 (* (* x y) 2.0)))
(if (<= (* x y) -1.05e+53)
t_3
(if (<= (* x y) -1.46e-8)
t_1
(if (<= (* x y) -6.5e-65)
t_2
(if (<= (* x y) -5.8e-242)
t_1
(if (<= (* x y) 1.15e-77)
t_2
(if (<= (* x y) 5.6e+38) t_1 t_3))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (c * i) * (a * -2.0);
double t_2 = 2.0 * (z * t);
double t_3 = (x * y) * 2.0;
double tmp;
if ((x * y) <= -1.05e+53) {
tmp = t_3;
} else if ((x * y) <= -1.46e-8) {
tmp = t_1;
} else if ((x * y) <= -6.5e-65) {
tmp = t_2;
} else if ((x * y) <= -5.8e-242) {
tmp = t_1;
} else if ((x * y) <= 1.15e-77) {
tmp = t_2;
} else if ((x * y) <= 5.6e+38) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = (c * i) * (a * (-2.0d0))
t_2 = 2.0d0 * (z * t)
t_3 = (x * y) * 2.0d0
if ((x * y) <= (-1.05d+53)) then
tmp = t_3
else if ((x * y) <= (-1.46d-8)) then
tmp = t_1
else if ((x * y) <= (-6.5d-65)) then
tmp = t_2
else if ((x * y) <= (-5.8d-242)) then
tmp = t_1
else if ((x * y) <= 1.15d-77) then
tmp = t_2
else if ((x * y) <= 5.6d+38) then
tmp = t_1
else
tmp = t_3
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 = (c * i) * (a * -2.0);
double t_2 = 2.0 * (z * t);
double t_3 = (x * y) * 2.0;
double tmp;
if ((x * y) <= -1.05e+53) {
tmp = t_3;
} else if ((x * y) <= -1.46e-8) {
tmp = t_1;
} else if ((x * y) <= -6.5e-65) {
tmp = t_2;
} else if ((x * y) <= -5.8e-242) {
tmp = t_1;
} else if ((x * y) <= 1.15e-77) {
tmp = t_2;
} else if ((x * y) <= 5.6e+38) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (c * i) * (a * -2.0) t_2 = 2.0 * (z * t) t_3 = (x * y) * 2.0 tmp = 0 if (x * y) <= -1.05e+53: tmp = t_3 elif (x * y) <= -1.46e-8: tmp = t_1 elif (x * y) <= -6.5e-65: tmp = t_2 elif (x * y) <= -5.8e-242: tmp = t_1 elif (x * y) <= 1.15e-77: tmp = t_2 elif (x * y) <= 5.6e+38: tmp = t_1 else: tmp = t_3 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(c * i) * Float64(a * -2.0)) t_2 = Float64(2.0 * Float64(z * t)) t_3 = Float64(Float64(x * y) * 2.0) tmp = 0.0 if (Float64(x * y) <= -1.05e+53) tmp = t_3; elseif (Float64(x * y) <= -1.46e-8) tmp = t_1; elseif (Float64(x * y) <= -6.5e-65) tmp = t_2; elseif (Float64(x * y) <= -5.8e-242) tmp = t_1; elseif (Float64(x * y) <= 1.15e-77) tmp = t_2; elseif (Float64(x * y) <= 5.6e+38) tmp = t_1; else tmp = t_3; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (c * i) * (a * -2.0); t_2 = 2.0 * (z * t); t_3 = (x * y) * 2.0; tmp = 0.0; if ((x * y) <= -1.05e+53) tmp = t_3; elseif ((x * y) <= -1.46e-8) tmp = t_1; elseif ((x * y) <= -6.5e-65) tmp = t_2; elseif ((x * y) <= -5.8e-242) tmp = t_1; elseif ((x * y) <= 1.15e-77) tmp = t_2; elseif ((x * y) <= 5.6e+38) tmp = t_1; else tmp = t_3; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(c * i), $MachinePrecision] * N[(a * -2.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * y), $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1.05e+53], t$95$3, If[LessEqual[N[(x * y), $MachinePrecision], -1.46e-8], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], -6.5e-65], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], -5.8e-242], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 1.15e-77], t$95$2, If[LessEqual[N[(x * y), $MachinePrecision], 5.6e+38], t$95$1, t$95$3]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(c \cdot i\right) \cdot \left(a \cdot -2\right)\\
t_2 := 2 \cdot \left(z \cdot t\right)\\
t_3 := \left(x \cdot y\right) \cdot 2\\
\mathbf{if}\;x \cdot y \leq -1.05 \cdot 10^{+53}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;x \cdot y \leq -1.46 \cdot 10^{-8}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq -6.5 \cdot 10^{-65}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \cdot y \leq -5.8 \cdot 10^{-242}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 1.15 \cdot 10^{-77}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;x \cdot y \leq 5.6 \cdot 10^{+38}:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if (*.f64 x y) < -1.0500000000000001e53 or 5.6e38 < (*.f64 x y) Initial program 90.1%
Taylor expanded in x around inf 60.1%
if -1.0500000000000001e53 < (*.f64 x y) < -1.46e-8 or -6.5e-65 < (*.f64 x y) < -5.8000000000000002e-242 or 1.14999999999999999e-77 < (*.f64 x y) < 5.6e38Initial program 87.5%
Taylor expanded in i around inf 69.8%
Taylor expanded in c around 0 43.8%
*-commutative43.8%
*-commutative43.8%
associate-*l*43.8%
Simplified43.8%
if -1.46e-8 < (*.f64 x y) < -6.5e-65 or -5.8000000000000002e-242 < (*.f64 x y) < 1.14999999999999999e-77Initial program 91.9%
Taylor expanded in z around inf 48.7%
Final simplification51.9%
(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 (- INFINITY)) (not (<= t_2 1e+299)))
(* 2.0 (- (* z t) (* c (* t_1 i))))
(* (- (+ (* x y) (* z t)) t_2) 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 = (c * t_1) * i;
double tmp;
if ((t_2 <= -((double) INFINITY)) || !(t_2 <= 1e+299)) {
tmp = 2.0 * ((z * t) - (c * (t_1 * i)));
} else {
tmp = (((x * y) + (z * t)) - t_2) * 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 = (c * t_1) * i;
double tmp;
if ((t_2 <= -Double.POSITIVE_INFINITY) || !(t_2 <= 1e+299)) {
tmp = 2.0 * ((z * t) - (c * (t_1 * i)));
} else {
tmp = (((x * y) + (z * t)) - t_2) * 2.0;
}
return tmp;
}
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 <= -math.inf) or not (t_2 <= 1e+299): tmp = 2.0 * ((z * t) - (c * (t_1 * i))) else: tmp = (((x * y) + (z * t)) - t_2) * 2.0 return tmp
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 <= Float64(-Inf)) || !(t_2 <= 1e+299)) tmp = Float64(2.0 * Float64(Float64(z * t) - Float64(c * Float64(t_1 * i)))); else tmp = Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) - t_2) * 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 = (c * t_1) * i; tmp = 0.0; if ((t_2 <= -Inf) || ~((t_2 <= 1e+299))) tmp = 2.0 * ((z * t) - (c * (t_1 * i))); else tmp = (((x * y) + (z * t)) - t_2) * 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[(N[(c * t$95$1), $MachinePrecision] * i), $MachinePrecision]}, If[Or[LessEqual[t$95$2, (-Infinity)], N[Not[LessEqual[t$95$2, 1e+299]], $MachinePrecision]], N[(2.0 * N[(N[(z * t), $MachinePrecision] - N[(c * N[(t$95$1 * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision] * 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a + b \cdot c\\
t_2 := \left(c \cdot t\_1\right) \cdot i\\
\mathbf{if}\;t\_2 \leq -\infty \lor \neg \left(t\_2 \leq 10^{+299}\right):\\
\;\;\;\;2 \cdot \left(z \cdot t - c \cdot \left(t\_1 \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(x \cdot y + z \cdot t\right) - t\_2\right) \cdot 2\\
\end{array}
\end{array}
if (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < -inf.0 or 1.0000000000000001e299 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) Initial program 74.3%
Taylor expanded in x around 0 90.6%
if -inf.0 < (*.f64 (*.f64 (+.f64 a (*.f64 b c)) c) i) < 1.0000000000000001e299Initial program 99.2%
Final simplification96.1%
(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))))
(* t_2 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 = (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 = t_2 * 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 = (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 = t_2 * 2.0;
}
return tmp;
}
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 = t_2 * 2.0 return tmp
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(t_2 * 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 = (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 = t_2 * 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[(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[(t$95$2 * 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\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}:\\
\;\;\;\;t\_2 \cdot 2\\
\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.5%
fma-define93.5%
associate-*l*98.8%
Simplified98.8%
fma-define98.8%
+-commutative98.8%
Applied egg-rr98.8%
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 c around 0 66.7%
Final simplification97.7%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* 2.0 (- (* z t) (* c (* (+ a (* b c)) i))))))
(if (<= c -105000.0)
t_1
(if (<= c -5.8e-27)
(* 2.0 (- (* x y) (* a (* c i))))
(if (or (<= c -7.2e-42) (not (<= c 2.2e+37)))
t_1
(* (+ (* x y) (* z t)) 2.0))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = 2.0 * ((z * t) - (c * ((a + (b * c)) * i)));
double tmp;
if (c <= -105000.0) {
tmp = t_1;
} else if (c <= -5.8e-27) {
tmp = 2.0 * ((x * y) - (a * (c * i)));
} else if ((c <= -7.2e-42) || !(c <= 2.2e+37)) {
tmp = t_1;
} else {
tmp = ((x * y) + (z * t)) * 2.0;
}
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 * ((z * t) - (c * ((a + (b * c)) * i)))
if (c <= (-105000.0d0)) then
tmp = t_1
else if (c <= (-5.8d-27)) then
tmp = 2.0d0 * ((x * y) - (a * (c * i)))
else if ((c <= (-7.2d-42)) .or. (.not. (c <= 2.2d+37))) then
tmp = t_1
else
tmp = ((x * y) + (z * t)) * 2.0d0
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 * ((z * t) - (c * ((a + (b * c)) * i)));
double tmp;
if (c <= -105000.0) {
tmp = t_1;
} else if (c <= -5.8e-27) {
tmp = 2.0 * ((x * y) - (a * (c * i)));
} else if ((c <= -7.2e-42) || !(c <= 2.2e+37)) {
tmp = t_1;
} else {
tmp = ((x * y) + (z * t)) * 2.0;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = 2.0 * ((z * t) - (c * ((a + (b * c)) * i))) tmp = 0 if c <= -105000.0: tmp = t_1 elif c <= -5.8e-27: tmp = 2.0 * ((x * y) - (a * (c * i))) elif (c <= -7.2e-42) or not (c <= 2.2e+37): tmp = t_1 else: tmp = ((x * y) + (z * t)) * 2.0 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * Float64(Float64(z * t) - Float64(c * Float64(Float64(a + Float64(b * c)) * i)))) tmp = 0.0 if (c <= -105000.0) tmp = t_1; elseif (c <= -5.8e-27) tmp = Float64(2.0 * Float64(Float64(x * y) - Float64(a * Float64(c * i)))); elseif ((c <= -7.2e-42) || !(c <= 2.2e+37)) tmp = t_1; else tmp = Float64(Float64(Float64(x * y) + Float64(z * t)) * 2.0); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = 2.0 * ((z * t) - (c * ((a + (b * c)) * i))); tmp = 0.0; if (c <= -105000.0) tmp = t_1; elseif (c <= -5.8e-27) tmp = 2.0 * ((x * y) - (a * (c * i))); elseif ((c <= -7.2e-42) || ~((c <= 2.2e+37))) tmp = t_1; else tmp = ((x * y) + (z * t)) * 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(2.0 * N[(N[(z * t), $MachinePrecision] - N[(c * N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -105000.0], t$95$1, If[LessEqual[c, -5.8e-27], N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[c, -7.2e-42], N[Not[LessEqual[c, 2.2e+37]], $MachinePrecision]], t$95$1, N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(z \cdot t - c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\
\mathbf{if}\;c \leq -105000:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq -5.8 \cdot 10^{-27}:\\
\;\;\;\;2 \cdot \left(x \cdot y - a \cdot \left(c \cdot i\right)\right)\\
\mathbf{elif}\;c \leq -7.2 \cdot 10^{-42} \lor \neg \left(c \leq 2.2 \cdot 10^{+37}\right):\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\
\end{array}
\end{array}
if c < -105000 or -5.80000000000000008e-27 < c < -7.2000000000000004e-42 or 2.2000000000000001e37 < c Initial program 82.1%
Taylor expanded in x around 0 88.6%
if -105000 < c < -5.80000000000000008e-27Initial program 99.8%
Taylor expanded in a around inf 89.9%
*-commutative89.9%
Simplified89.9%
Taylor expanded in z around 0 84.8%
if -7.2000000000000004e-42 < c < 2.2000000000000001e37Initial program 98.2%
Taylor expanded in c around 0 85.0%
Final simplification86.8%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* x y) 2.0))
(t_2 (* (* c (* b (* c i))) -2.0))
(t_3 (* 2.0 (* z t))))
(if (<= c -5.2e+22)
t_2
(if (<= c -3.5e-136)
t_1
(if (<= c -1.9e-277)
t_3
(if (<= c 5.2e-61) t_1 (if (<= c 3.1e+33) t_3 t_2)))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) * 2.0;
double t_2 = (c * (b * (c * i))) * -2.0;
double t_3 = 2.0 * (z * t);
double tmp;
if (c <= -5.2e+22) {
tmp = t_2;
} else if (c <= -3.5e-136) {
tmp = t_1;
} else if (c <= -1.9e-277) {
tmp = t_3;
} else if (c <= 5.2e-61) {
tmp = t_1;
} else if (c <= 3.1e+33) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = (x * y) * 2.0d0
t_2 = (c * (b * (c * i))) * (-2.0d0)
t_3 = 2.0d0 * (z * t)
if (c <= (-5.2d+22)) then
tmp = t_2
else if (c <= (-3.5d-136)) then
tmp = t_1
else if (c <= (-1.9d-277)) then
tmp = t_3
else if (c <= 5.2d-61) then
tmp = t_1
else if (c <= 3.1d+33) then
tmp = t_3
else
tmp = t_2
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) * 2.0;
double t_2 = (c * (b * (c * i))) * -2.0;
double t_3 = 2.0 * (z * t);
double tmp;
if (c <= -5.2e+22) {
tmp = t_2;
} else if (c <= -3.5e-136) {
tmp = t_1;
} else if (c <= -1.9e-277) {
tmp = t_3;
} else if (c <= 5.2e-61) {
tmp = t_1;
} else if (c <= 3.1e+33) {
tmp = t_3;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (x * y) * 2.0 t_2 = (c * (b * (c * i))) * -2.0 t_3 = 2.0 * (z * t) tmp = 0 if c <= -5.2e+22: tmp = t_2 elif c <= -3.5e-136: tmp = t_1 elif c <= -1.9e-277: tmp = t_3 elif c <= 5.2e-61: tmp = t_1 elif c <= 3.1e+33: tmp = t_3 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) * 2.0) t_2 = Float64(Float64(c * Float64(b * Float64(c * i))) * -2.0) t_3 = Float64(2.0 * Float64(z * t)) tmp = 0.0 if (c <= -5.2e+22) tmp = t_2; elseif (c <= -3.5e-136) tmp = t_1; elseif (c <= -1.9e-277) tmp = t_3; elseif (c <= 5.2e-61) tmp = t_1; elseif (c <= 3.1e+33) tmp = t_3; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (x * y) * 2.0; t_2 = (c * (b * (c * i))) * -2.0; t_3 = 2.0 * (z * t); tmp = 0.0; if (c <= -5.2e+22) tmp = t_2; elseif (c <= -3.5e-136) tmp = t_1; elseif (c <= -1.9e-277) tmp = t_3; elseif (c <= 5.2e-61) tmp = t_1; elseif (c <= 3.1e+33) tmp = t_3; else tmp = t_2; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] * 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(c * N[(b * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision]}, Block[{t$95$3 = N[(2.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -5.2e+22], t$95$2, If[LessEqual[c, -3.5e-136], t$95$1, If[LessEqual[c, -1.9e-277], t$95$3, If[LessEqual[c, 5.2e-61], t$95$1, If[LessEqual[c, 3.1e+33], t$95$3, t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot y\right) \cdot 2\\
t_2 := \left(c \cdot \left(b \cdot \left(c \cdot i\right)\right)\right) \cdot -2\\
t_3 := 2 \cdot \left(z \cdot t\right)\\
\mathbf{if}\;c \leq -5.2 \cdot 10^{+22}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;c \leq -3.5 \cdot 10^{-136}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq -1.9 \cdot 10^{-277}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;c \leq 5.2 \cdot 10^{-61}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;c \leq 3.1 \cdot 10^{+33}:\\
\;\;\;\;t\_3\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if c < -5.2e22 or 3.1e33 < c Initial program 81.8%
Taylor expanded in i around inf 77.5%
Taylor expanded in i around 0 77.5%
Taylor expanded in a around 0 65.3%
if -5.2e22 < c < -3.50000000000000029e-136 or -1.89999999999999993e-277 < c < 5.20000000000000021e-61Initial program 99.8%
Taylor expanded in x around inf 49.7%
if -3.50000000000000029e-136 < c < -1.89999999999999993e-277 or 5.20000000000000021e-61 < c < 3.1e33Initial program 95.8%
Taylor expanded in z around inf 58.7%
Final simplification59.1%
(FPCore (x y z t a b c i)
:precision binary64
(if (or (<= c -2.6e+135)
(not
(or (<= c -8.2e+112) (and (not (<= c -2.6e+45)) (<= c 1.55e+37)))))
(* (* c (* (+ a (* b c)) i)) -2.0)
(* (+ (* x y) (* z t)) 2.0)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c <= -2.6e+135) || !((c <= -8.2e+112) || (!(c <= -2.6e+45) && (c <= 1.55e+37)))) {
tmp = (c * ((a + (b * c)) * i)) * -2.0;
} else {
tmp = ((x * y) + (z * t)) * 2.0;
}
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 <= (-2.6d+135)) .or. (.not. (c <= (-8.2d+112)) .or. (.not. (c <= (-2.6d+45))) .and. (c <= 1.55d+37))) then
tmp = (c * ((a + (b * c)) * i)) * (-2.0d0)
else
tmp = ((x * y) + (z * t)) * 2.0d0
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 <= -2.6e+135) || !((c <= -8.2e+112) || (!(c <= -2.6e+45) && (c <= 1.55e+37)))) {
tmp = (c * ((a + (b * c)) * i)) * -2.0;
} else {
tmp = ((x * y) + (z * t)) * 2.0;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c <= -2.6e+135) or not ((c <= -8.2e+112) or (not (c <= -2.6e+45) and (c <= 1.55e+37))): tmp = (c * ((a + (b * c)) * i)) * -2.0 else: tmp = ((x * y) + (z * t)) * 2.0 return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((c <= -2.6e+135) || !((c <= -8.2e+112) || (!(c <= -2.6e+45) && (c <= 1.55e+37)))) 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
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((c <= -2.6e+135) || ~(((c <= -8.2e+112) || (~((c <= -2.6e+45)) && (c <= 1.55e+37))))) tmp = (c * ((a + (b * c)) * i)) * -2.0; else tmp = ((x * y) + (z * t)) * 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[c, -2.6e+135], N[Not[Or[LessEqual[c, -8.2e+112], And[N[Not[LessEqual[c, -2.6e+45]], $MachinePrecision], LessEqual[c, 1.55e+37]]]], $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}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -2.6 \cdot 10^{+135} \lor \neg \left(c \leq -8.2 \cdot 10^{+112} \lor \neg \left(c \leq -2.6 \cdot 10^{+45}\right) \land c \leq 1.55 \cdot 10^{+37}\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 < -2.6e135 or -8.19999999999999951e112 < c < -2.60000000000000007e45 or 1.5500000000000001e37 < c Initial program 80.6%
Taylor expanded in i around inf 83.5%
Taylor expanded in i around 0 83.5%
if -2.6e135 < c < -8.19999999999999951e112 or -2.60000000000000007e45 < c < 1.5500000000000001e37Initial program 97.8%
Taylor expanded in c around 0 81.4%
Final simplification82.3%
(FPCore (x y z t a b c i)
:precision binary64
(if (or (<= c -2.75e+135)
(not
(or (<= c -3.2e+112) (and (not (<= c -1.75e+53)) (<= c 5.8e+36)))))
(* (* c (* b (* c i))) -2.0)
(* (+ (* x y) (* z t)) 2.0)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c <= -2.75e+135) || !((c <= -3.2e+112) || (!(c <= -1.75e+53) && (c <= 5.8e+36)))) {
tmp = (c * (b * (c * i))) * -2.0;
} else {
tmp = ((x * y) + (z * t)) * 2.0;
}
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 <= (-2.75d+135)) .or. (.not. (c <= (-3.2d+112)) .or. (.not. (c <= (-1.75d+53))) .and. (c <= 5.8d+36))) then
tmp = (c * (b * (c * i))) * (-2.0d0)
else
tmp = ((x * y) + (z * t)) * 2.0d0
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 <= -2.75e+135) || !((c <= -3.2e+112) || (!(c <= -1.75e+53) && (c <= 5.8e+36)))) {
tmp = (c * (b * (c * i))) * -2.0;
} else {
tmp = ((x * y) + (z * t)) * 2.0;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c <= -2.75e+135) or not ((c <= -3.2e+112) or (not (c <= -1.75e+53) and (c <= 5.8e+36))): tmp = (c * (b * (c * i))) * -2.0 else: tmp = ((x * y) + (z * t)) * 2.0 return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((c <= -2.75e+135) || !((c <= -3.2e+112) || (!(c <= -1.75e+53) && (c <= 5.8e+36)))) tmp = Float64(Float64(c * Float64(b * Float64(c * i))) * -2.0); else tmp = Float64(Float64(Float64(x * y) + Float64(z * t)) * 2.0); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((c <= -2.75e+135) || ~(((c <= -3.2e+112) || (~((c <= -1.75e+53)) && (c <= 5.8e+36))))) tmp = (c * (b * (c * i))) * -2.0; else tmp = ((x * y) + (z * t)) * 2.0; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[c, -2.75e+135], N[Not[Or[LessEqual[c, -3.2e+112], And[N[Not[LessEqual[c, -1.75e+53]], $MachinePrecision], LessEqual[c, 5.8e+36]]]], $MachinePrecision]], N[(N[(c * N[(b * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * -2.0), $MachinePrecision], N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -2.75 \cdot 10^{+135} \lor \neg \left(c \leq -3.2 \cdot 10^{+112} \lor \neg \left(c \leq -1.75 \cdot 10^{+53}\right) \land c \leq 5.8 \cdot 10^{+36}\right):\\
\;\;\;\;\left(c \cdot \left(b \cdot \left(c \cdot i\right)\right)\right) \cdot -2\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\
\end{array}
\end{array}
if c < -2.7499999999999999e135 or -3.19999999999999986e112 < c < -1.75000000000000009e53 or 5.8e36 < c Initial program 80.4%
Taylor expanded in i around inf 83.4%
Taylor expanded in i around 0 83.4%
Taylor expanded in a around 0 72.3%
if -2.7499999999999999e135 < c < -3.19999999999999986e112 or -1.75000000000000009e53 < c < 5.8e36Initial program 97.8%
Taylor expanded in c around 0 80.9%
Final simplification77.1%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* x y) 2.0)))
(if (<= (* x y) -400.0)
t_1
(if (<= (* x y) 3.5e-76)
(* 2.0 (* z t))
(if (<= (* x y) 9e+38) (* -2.0 (* c (* a i))) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) * 2.0;
double tmp;
if ((x * y) <= -400.0) {
tmp = t_1;
} else if ((x * y) <= 3.5e-76) {
tmp = 2.0 * (z * t);
} else if ((x * y) <= 9e+38) {
tmp = -2.0 * (c * (a * 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 = (x * y) * 2.0d0
if ((x * y) <= (-400.0d0)) then
tmp = t_1
else if ((x * y) <= 3.5d-76) then
tmp = 2.0d0 * (z * t)
else if ((x * y) <= 9d+38) then
tmp = (-2.0d0) * (c * (a * 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 = (x * y) * 2.0;
double tmp;
if ((x * y) <= -400.0) {
tmp = t_1;
} else if ((x * y) <= 3.5e-76) {
tmp = 2.0 * (z * t);
} else if ((x * y) <= 9e+38) {
tmp = -2.0 * (c * (a * i));
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (x * y) * 2.0 tmp = 0 if (x * y) <= -400.0: tmp = t_1 elif (x * y) <= 3.5e-76: tmp = 2.0 * (z * t) elif (x * y) <= 9e+38: tmp = -2.0 * (c * (a * i)) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) * 2.0) tmp = 0.0 if (Float64(x * y) <= -400.0) tmp = t_1; elseif (Float64(x * y) <= 3.5e-76) tmp = Float64(2.0 * Float64(z * t)); elseif (Float64(x * y) <= 9e+38) tmp = Float64(-2.0 * Float64(c * Float64(a * i))); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = (x * y) * 2.0; tmp = 0.0; if ((x * y) <= -400.0) tmp = t_1; elseif ((x * y) <= 3.5e-76) tmp = 2.0 * (z * t); elseif ((x * y) <= 9e+38) tmp = -2.0 * (c * (a * 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[(x * y), $MachinePrecision] * 2.0), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -400.0], t$95$1, If[LessEqual[N[(x * y), $MachinePrecision], 3.5e-76], N[(2.0 * N[(z * t), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 9e+38], N[(-2.0 * N[(c * N[(a * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot y\right) \cdot 2\\
\mathbf{if}\;x \cdot y \leq -400:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;x \cdot y \leq 3.5 \cdot 10^{-76}:\\
\;\;\;\;2 \cdot \left(z \cdot t\right)\\
\mathbf{elif}\;x \cdot y \leq 9 \cdot 10^{+38}:\\
\;\;\;\;-2 \cdot \left(c \cdot \left(a \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if (*.f64 x y) < -400 or 8.99999999999999961e38 < (*.f64 x y) Initial program 89.5%
Taylor expanded in x around inf 55.6%
if -400 < (*.f64 x y) < 3.49999999999999997e-76Initial program 92.1%
Taylor expanded in z around inf 40.6%
if 3.49999999999999997e-76 < (*.f64 x y) < 8.99999999999999961e38Initial program 82.5%
Taylor expanded in i around inf 64.8%
Taylor expanded in c around 0 51.2%
*-commutative51.2%
*-commutative51.2%
associate-*l*51.2%
Simplified51.2%
Taylor expanded in c around 0 51.2%
*-commutative51.2%
associate-*r*47.1%
Simplified47.1%
Final simplification47.6%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ (* x y) (* z t))))
(if (<= c -29000000000.0)
(* 2.0 (- (* z t) (* c (* (+ a (* b c)) i))))
(if (<= c 2.65e+67)
(* 2.0 (- t_1 (* i (* a c))))
(* 2.0 (- t_1 (* c (* b (* c i)))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) + (z * t);
double tmp;
if (c <= -29000000000.0) {
tmp = 2.0 * ((z * t) - (c * ((a + (b * c)) * i)));
} else if (c <= 2.65e+67) {
tmp = 2.0 * (t_1 - (i * (a * c)));
} else {
tmp = 2.0 * (t_1 - (c * (b * (c * i))));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: t_1
real(8) :: tmp
t_1 = (x * y) + (z * t)
if (c <= (-29000000000.0d0)) then
tmp = 2.0d0 * ((z * t) - (c * ((a + (b * c)) * i)))
else if (c <= 2.65d+67) then
tmp = 2.0d0 * (t_1 - (i * (a * c)))
else
tmp = 2.0d0 * (t_1 - (c * (b * (c * i))))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = (x * y) + (z * t);
double tmp;
if (c <= -29000000000.0) {
tmp = 2.0 * ((z * t) - (c * ((a + (b * c)) * i)));
} else if (c <= 2.65e+67) {
tmp = 2.0 * (t_1 - (i * (a * c)));
} else {
tmp = 2.0 * (t_1 - (c * (b * (c * i))));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (x * y) + (z * t) tmp = 0 if c <= -29000000000.0: tmp = 2.0 * ((z * t) - (c * ((a + (b * c)) * i))) elif c <= 2.65e+67: tmp = 2.0 * (t_1 - (i * (a * c))) else: tmp = 2.0 * (t_1 - (c * (b * (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 (c <= -29000000000.0) tmp = Float64(2.0 * Float64(Float64(z * t) - Float64(c * Float64(Float64(a + Float64(b * c)) * i)))); elseif (c <= 2.65e+67) tmp = Float64(2.0 * Float64(t_1 - Float64(i * Float64(a * c)))); else tmp = Float64(2.0 * Float64(t_1 - Float64(c * Float64(b * 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 (c <= -29000000000.0) tmp = 2.0 * ((z * t) - (c * ((a + (b * c)) * i))); elseif (c <= 2.65e+67) tmp = 2.0 * (t_1 - (i * (a * c))); else tmp = 2.0 * (t_1 - (c * (b * (c * i)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -29000000000.0], N[(2.0 * N[(N[(z * t), $MachinePrecision] - N[(c * N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, 2.65e+67], N[(2.0 * N[(t$95$1 - N[(i * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(t$95$1 - N[(c * N[(b * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := x \cdot y + z \cdot t\\
\mathbf{if}\;c \leq -29000000000:\\
\;\;\;\;2 \cdot \left(z \cdot t - c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\
\mathbf{elif}\;c \leq 2.65 \cdot 10^{+67}:\\
\;\;\;\;2 \cdot \left(t\_1 - i \cdot \left(a \cdot c\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(t\_1 - c \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)\\
\end{array}
\end{array}
if c < -2.9e10Initial program 83.1%
Taylor expanded in x around 0 88.8%
if -2.9e10 < c < 2.65e67Initial program 98.4%
Taylor expanded in a around inf 93.3%
*-commutative93.3%
Simplified93.3%
if 2.65e67 < c Initial program 78.8%
associate--l+78.8%
*-commutative78.8%
associate--l+78.8%
associate--l+78.8%
*-commutative78.8%
associate--l+78.8%
fma-define78.8%
*-commutative78.8%
associate-*l*96.2%
+-commutative96.2%
fma-define96.2%
Simplified96.2%
Taylor expanded in b around inf 94.5%
fma-define96.2%
+-commutative96.2%
Applied egg-rr94.5%
Final simplification92.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= c -2.6e+16) (not (<= c 1.22e+39))) (* 2.0 (- (* z t) (* c (* (+ a (* b c)) i)))) (* 2.0 (- (+ (* x y) (* z t)) (* i (* a c))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((c <= -2.6e+16) || !(c <= 1.22e+39)) {
tmp = 2.0 * ((z * t) - (c * ((a + (b * c)) * i)));
} else {
tmp = 2.0 * (((x * y) + (z * t)) - (i * (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) :: tmp
if ((c <= (-2.6d+16)) .or. (.not. (c <= 1.22d+39))) then
tmp = 2.0d0 * ((z * t) - (c * ((a + (b * c)) * i)))
else
tmp = 2.0d0 * (((x * y) + (z * t)) - (i * (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 tmp;
if ((c <= -2.6e+16) || !(c <= 1.22e+39)) {
tmp = 2.0 * ((z * t) - (c * ((a + (b * c)) * i)));
} else {
tmp = 2.0 * (((x * y) + (z * t)) - (i * (a * c)));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c <= -2.6e+16) or not (c <= 1.22e+39): tmp = 2.0 * ((z * t) - (c * ((a + (b * c)) * i))) else: tmp = 2.0 * (((x * y) + (z * t)) - (i * (a * c))) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((c <= -2.6e+16) || !(c <= 1.22e+39)) tmp = Float64(2.0 * Float64(Float64(z * t) - Float64(c * Float64(Float64(a + Float64(b * c)) * i)))); else tmp = Float64(2.0 * Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(i * Float64(a * c)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((c <= -2.6e+16) || ~((c <= 1.22e+39))) tmp = 2.0 * ((z * t) - (c * ((a + (b * c)) * i))); else tmp = 2.0 * (((x * y) + (z * t)) - (i * (a * c))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[c, -2.6e+16], N[Not[LessEqual[c, 1.22e+39]], $MachinePrecision]], N[(2.0 * N[(N[(z * t), $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[(i * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -2.6 \cdot 10^{+16} \lor \neg \left(c \leq 1.22 \cdot 10^{+39}\right):\\
\;\;\;\;2 \cdot \left(z \cdot t - 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) - i \cdot \left(a \cdot c\right)\right)\\
\end{array}
\end{array}
if c < -2.6e16 or 1.22e39 < c Initial program 81.6%
Taylor expanded in x around 0 88.4%
if -2.6e16 < c < 1.22e39Initial program 98.3%
Taylor expanded in a around inf 93.9%
*-commutative93.9%
Simplified93.9%
Final simplification91.2%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -200.0) (not (<= (* x y) 2.2e+113))) (* (* x y) 2.0) (* 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) <= -200.0) || !((x * y) <= 2.2e+113)) {
tmp = (x * y) * 2.0;
} 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) <= (-200.0d0)) .or. (.not. ((x * y) <= 2.2d+113))) then
tmp = (x * y) * 2.0d0
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) <= -200.0) || !((x * y) <= 2.2e+113)) {
tmp = (x * y) * 2.0;
} else {
tmp = 2.0 * (z * t);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -200.0) or not ((x * y) <= 2.2e+113): tmp = (x * y) * 2.0 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) <= -200.0) || !(Float64(x * y) <= 2.2e+113)) tmp = Float64(Float64(x * y) * 2.0); 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) <= -200.0) || ~(((x * y) <= 2.2e+113))) tmp = (x * y) * 2.0; 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], -200.0], N[Not[LessEqual[N[(x * y), $MachinePrecision], 2.2e+113]], $MachinePrecision]], N[(N[(x * y), $MachinePrecision] * 2.0), $MachinePrecision], N[(2.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -200 \lor \neg \left(x \cdot y \leq 2.2 \cdot 10^{+113}\right):\\
\;\;\;\;\left(x \cdot y\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -200 or 2.2000000000000001e113 < (*.f64 x y) Initial program 91.2%
Taylor expanded in x around inf 59.4%
if -200 < (*.f64 x y) < 2.2000000000000001e113Initial program 89.5%
Taylor expanded in z around inf 37.5%
Final simplification46.1%
(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 90.2%
Taylor expanded in z around inf 28.7%
Final simplification28.7%
(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 2024059
(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))))