
(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
(let* ((t_1 (+ a (* b c))))
(if (<= (- (+ (* x y) (* z t)) (* (* c t_1) i)) INFINITY)
(* 2.0 (- (fma x y (* z t)) (* t_1 (* c i))))
(* 2.0 (* y (- x (* c (/ (* i (fma c b a)) y))))))))
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 tmp;
if ((((x * y) + (z * t)) - ((c * t_1) * i)) <= ((double) INFINITY)) {
tmp = 2.0 * (fma(x, y, (z * t)) - (t_1 * (c * i)));
} else {
tmp = 2.0 * (y * (x - (c * ((i * fma(c, b, a)) / y))));
}
return tmp;
}
function code(x, y, z, t, a, b, c, i) t_1 = Float64(a + Float64(b * c)) tmp = 0.0 if (Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(Float64(c * t_1) * i)) <= Inf) tmp = Float64(2.0 * Float64(fma(x, y, Float64(z * t)) - Float64(t_1 * Float64(c * i)))); else tmp = Float64(2.0 * Float64(y * Float64(x - Float64(c * Float64(Float64(i * fma(c, b, a)) / y))))); end return tmp end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(a + N[(b * c), $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[(N[(x * y + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(t$95$1 * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(2.0 * N[(y * N[(x - N[(c * N[(N[(i * N[(c * b + a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a + b \cdot c\\
\mathbf{if}\;\left(x \cdot y + z \cdot t\right) - \left(c \cdot t\_1\right) \cdot i \leq \infty:\\
\;\;\;\;2 \cdot \left(\mathsf{fma}\left(x, y, z \cdot t\right) - t\_1 \cdot \left(c \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;2 \cdot \left(y \cdot \left(x - c \cdot \frac{i \cdot \mathsf{fma}\left(c, b, a\right)}{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 94.8%
fma-define94.8%
associate-*l*99.4%
Simplified99.4%
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 z around 0 41.2%
Taylor expanded in y around inf 70.6%
mul-1-neg70.6%
unsub-neg70.6%
associate-/l*70.6%
+-commutative70.6%
*-commutative70.6%
fma-undefine70.6%
Simplified70.6%
Final simplification97.5%
(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 (* c (/ (* i (fma c b a)) y))))))))
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 - (c * ((i * fma(c, b, a)) / y))));
}
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 * Float64(y * Float64(x - Float64(c * Float64(Float64(i * fma(c, b, a)) / y))))); 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[(y * N[(x - N[(c * N[(N[(i * N[(c * b + a), $MachinePrecision]), $MachinePrecision] / y), $MachinePrecision]), $MachinePrecision]), $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 \left(y \cdot \left(x - c \cdot \frac{i \cdot \mathsf{fma}\left(c, b, a\right)}{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 94.8%
fma-define94.8%
associate-*l*99.4%
Simplified99.4%
fma-define99.4%
+-commutative99.4%
Applied egg-rr99.4%
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 z around 0 41.2%
Taylor expanded in y around inf 70.6%
mul-1-neg70.6%
unsub-neg70.6%
associate-/l*70.6%
+-commutative70.6%
*-commutative70.6%
fma-undefine70.6%
Simplified70.6%
Final simplification97.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* c (* (+ a (* b c)) i))))
(if (<= (* x y) -1e+220)
(* 2.0 (- (* x y) (* c (* (* b c) i))))
(if (<= (* x y) -5e+104)
(* (+ (* x y) (* z t)) 2.0)
(if (<= (* x y) 1e-14)
(* 2.0 (- (* z t) t_1))
(if (<= (* x y) 1e+236)
(* 2.0 (- (* x y) t_1))
(* x (* 2.0 (+ y (* t (/ z x)))))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = c * ((a + (b * c)) * i);
double tmp;
if ((x * y) <= -1e+220) {
tmp = 2.0 * ((x * y) - (c * ((b * c) * i)));
} else if ((x * y) <= -5e+104) {
tmp = ((x * y) + (z * t)) * 2.0;
} else if ((x * y) <= 1e-14) {
tmp = 2.0 * ((z * t) - t_1);
} else if ((x * y) <= 1e+236) {
tmp = 2.0 * ((x * y) - t_1);
} else {
tmp = x * (2.0 * (y + (t * (z / x))));
}
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 = c * ((a + (b * c)) * i)
if ((x * y) <= (-1d+220)) then
tmp = 2.0d0 * ((x * y) - (c * ((b * c) * i)))
else if ((x * y) <= (-5d+104)) then
tmp = ((x * y) + (z * t)) * 2.0d0
else if ((x * y) <= 1d-14) then
tmp = 2.0d0 * ((z * t) - t_1)
else if ((x * y) <= 1d+236) then
tmp = 2.0d0 * ((x * y) - t_1)
else
tmp = x * (2.0d0 * (y + (t * (z / x))))
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 * ((a + (b * c)) * i);
double tmp;
if ((x * y) <= -1e+220) {
tmp = 2.0 * ((x * y) - (c * ((b * c) * i)));
} else if ((x * y) <= -5e+104) {
tmp = ((x * y) + (z * t)) * 2.0;
} else if ((x * y) <= 1e-14) {
tmp = 2.0 * ((z * t) - t_1);
} else if ((x * y) <= 1e+236) {
tmp = 2.0 * ((x * y) - t_1);
} else {
tmp = x * (2.0 * (y + (t * (z / x))));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = c * ((a + (b * c)) * i) tmp = 0 if (x * y) <= -1e+220: tmp = 2.0 * ((x * y) - (c * ((b * c) * i))) elif (x * y) <= -5e+104: tmp = ((x * y) + (z * t)) * 2.0 elif (x * y) <= 1e-14: tmp = 2.0 * ((z * t) - t_1) elif (x * y) <= 1e+236: tmp = 2.0 * ((x * y) - t_1) else: tmp = x * (2.0 * (y + (t * (z / x)))) return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(c * Float64(Float64(a + Float64(b * c)) * i)) tmp = 0.0 if (Float64(x * y) <= -1e+220) tmp = Float64(2.0 * Float64(Float64(x * y) - Float64(c * Float64(Float64(b * c) * i)))); elseif (Float64(x * y) <= -5e+104) tmp = Float64(Float64(Float64(x * y) + Float64(z * t)) * 2.0); elseif (Float64(x * y) <= 1e-14) tmp = Float64(2.0 * Float64(Float64(z * t) - t_1)); elseif (Float64(x * y) <= 1e+236) tmp = Float64(2.0 * Float64(Float64(x * y) - t_1)); else tmp = Float64(x * Float64(2.0 * Float64(y + Float64(t * Float64(z / x))))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = c * ((a + (b * c)) * i); tmp = 0.0; if ((x * y) <= -1e+220) tmp = 2.0 * ((x * y) - (c * ((b * c) * i))); elseif ((x * y) <= -5e+104) tmp = ((x * y) + (z * t)) * 2.0; elseif ((x * y) <= 1e-14) tmp = 2.0 * ((z * t) - t_1); elseif ((x * y) <= 1e+236) tmp = 2.0 * ((x * y) - t_1); else tmp = x * (2.0 * (y + (t * (z / x)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(c * N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(x * y), $MachinePrecision], -1e+220], N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(c * N[(N[(b * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -5e+104], N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e-14], N[(2.0 * N[(N[(z * t), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 1e+236], N[(2.0 * N[(N[(x * y), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision], N[(x * N[(2.0 * N[(y + N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\\
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+220}:\\
\;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(\left(b \cdot c\right) \cdot i\right)\right)\\
\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{+104}:\\
\;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\
\mathbf{elif}\;x \cdot y \leq 10^{-14}:\\
\;\;\;\;2 \cdot \left(z \cdot t - t\_1\right)\\
\mathbf{elif}\;x \cdot y \leq 10^{+236}:\\
\;\;\;\;2 \cdot \left(x \cdot y - t\_1\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + t \cdot \frac{z}{x}\right)\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1e220Initial program 85.7%
Taylor expanded in z around 0 85.7%
Taylor expanded in a around 0 89.3%
*-commutative89.3%
Simplified89.3%
if -1e220 < (*.f64 x y) < -4.9999999999999997e104Initial program 86.4%
Taylor expanded in c around 0 86.9%
if -4.9999999999999997e104 < (*.f64 x y) < 9.99999999999999999e-15Initial program 92.8%
Taylor expanded in x around 0 86.9%
if 9.99999999999999999e-15 < (*.f64 x y) < 1.00000000000000005e236Initial program 79.2%
Taylor expanded in z around 0 84.8%
if 1.00000000000000005e236 < (*.f64 x y) Initial program 84.2%
Taylor expanded in c around 0 89.5%
Taylor expanded in x around inf 92.1%
distribute-lft-out92.1%
associate-/l*94.7%
Simplified94.7%
Final simplification88.0%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ a (* b c))) (t_2 (* c (* t_1 i))) (t_3 (* c t_1)))
(if (<= t_3 (- INFINITY))
(* 2.0 (- (* z t) t_2))
(if (<= t_3 4e+306)
(* (- (+ (* x y) (* z t)) (* t_3 i)) 2.0)
(* -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 = c * (t_1 * i);
double t_3 = c * t_1;
double tmp;
if (t_3 <= -((double) INFINITY)) {
tmp = 2.0 * ((z * t) - t_2);
} else if (t_3 <= 4e+306) {
tmp = (((x * y) + (z * t)) - (t_3 * i)) * 2.0;
} else {
tmp = -2.0 * t_2;
}
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 t_3 = c * t_1;
double tmp;
if (t_3 <= -Double.POSITIVE_INFINITY) {
tmp = 2.0 * ((z * t) - t_2);
} else if (t_3 <= 4e+306) {
tmp = (((x * y) + (z * t)) - (t_3 * i)) * 2.0;
} else {
tmp = -2.0 * t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = a + (b * c) t_2 = c * (t_1 * i) t_3 = c * t_1 tmp = 0 if t_3 <= -math.inf: tmp = 2.0 * ((z * t) - t_2) elif t_3 <= 4e+306: tmp = (((x * y) + (z * t)) - (t_3 * i)) * 2.0 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 = Float64(c * Float64(t_1 * i)) t_3 = Float64(c * t_1) tmp = 0.0 if (t_3 <= Float64(-Inf)) tmp = Float64(2.0 * Float64(Float64(z * t) - t_2)); elseif (t_3 <= 4e+306) tmp = Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(t_3 * i)) * 2.0); else tmp = Float64(-2.0 * t_2); 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); t_3 = c * t_1; tmp = 0.0; if (t_3 <= -Inf) tmp = 2.0 * ((z * t) - t_2); elseif (t_3 <= 4e+306) tmp = (((x * y) + (z * t)) - (t_3 * i)) * 2.0; else tmp = -2.0 * t_2; 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[(c * N[(t$95$1 * i), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(c * t$95$1), $MachinePrecision]}, If[LessEqual[t$95$3, (-Infinity)], N[(2.0 * N[(N[(z * t), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$3, 4e+306], N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(t$95$3 * i), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], N[(-2.0 * t$95$2), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a + b \cdot c\\
t_2 := c \cdot \left(t\_1 \cdot i\right)\\
t_3 := c \cdot t\_1\\
\mathbf{if}\;t\_3 \leq -\infty:\\
\;\;\;\;2 \cdot \left(z \cdot t - t\_2\right)\\
\mathbf{elif}\;t\_3 \leq 4 \cdot 10^{+306}:\\
\;\;\;\;\left(\left(x \cdot y + z \cdot t\right) - t\_3 \cdot i\right) \cdot 2\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot t\_2\\
\end{array}
\end{array}
if (*.f64 (+.f64 a (*.f64 b c)) c) < -inf.0Initial program 80.9%
Taylor expanded in x around 0 97.1%
if -inf.0 < (*.f64 (+.f64 a (*.f64 b c)) c) < 4.00000000000000007e306Initial program 97.2%
if 4.00000000000000007e306 < (*.f64 (+.f64 a (*.f64 b c)) c) Initial program 52.6%
fma-define52.6%
associate-*l*78.3%
Simplified78.3%
Taylor expanded in i around inf 89.3%
Final simplification96.0%
(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 (* c (* t_1 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 * (c * (t_1 * i));
}
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 = -2.0 * (c * (t_1 * i));
}
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 = -2.0 * (c * (t_1 * i)) 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 * Float64(c * Float64(t_1 * i))); 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 = -2.0 * (c * (t_1 * i)); 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[(-2.0 * N[(c * N[(t$95$1 * i), $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 \left(c \cdot \left(t\_1 \cdot i\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 94.8%
fma-define94.8%
associate-*l*99.4%
Simplified99.4%
fma-define99.4%
+-commutative99.4%
Applied egg-rr99.4%
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-define5.9%
associate-*l*23.5%
Simplified23.5%
Taylor expanded in i around inf 53.0%
Final simplification96.3%
(FPCore (x y z t a b c i)
:precision binary64
(if (<= (* x y) -1e+220)
(* 2.0 (- (* x y) (* c (* (* b c) i))))
(if (<= (* x y) -5e+104)
(* (+ (* x y) (* z t)) 2.0)
(if (<= (* x y) 2e+178)
(* 2.0 (- (* z t) (* c (* (+ a (* b c)) i))))
(* x (* 2.0 (+ y (* t (/ z x)))))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((x * y) <= -1e+220) {
tmp = 2.0 * ((x * y) - (c * ((b * c) * i)));
} else if ((x * y) <= -5e+104) {
tmp = ((x * y) + (z * t)) * 2.0;
} else if ((x * y) <= 2e+178) {
tmp = 2.0 * ((z * t) - (c * ((a + (b * c)) * i)));
} else {
tmp = x * (2.0 * (y + (t * (z / x))));
}
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) <= (-1d+220)) then
tmp = 2.0d0 * ((x * y) - (c * ((b * c) * i)))
else if ((x * y) <= (-5d+104)) then
tmp = ((x * y) + (z * t)) * 2.0d0
else if ((x * y) <= 2d+178) then
tmp = 2.0d0 * ((z * t) - (c * ((a + (b * c)) * i)))
else
tmp = x * (2.0d0 * (y + (t * (z / x))))
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) <= -1e+220) {
tmp = 2.0 * ((x * y) - (c * ((b * c) * i)));
} else if ((x * y) <= -5e+104) {
tmp = ((x * y) + (z * t)) * 2.0;
} else if ((x * y) <= 2e+178) {
tmp = 2.0 * ((z * t) - (c * ((a + (b * c)) * i)));
} else {
tmp = x * (2.0 * (y + (t * (z / x))));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (x * y) <= -1e+220: tmp = 2.0 * ((x * y) - (c * ((b * c) * i))) elif (x * y) <= -5e+104: tmp = ((x * y) + (z * t)) * 2.0 elif (x * y) <= 2e+178: tmp = 2.0 * ((z * t) - (c * ((a + (b * c)) * i))) else: tmp = x * (2.0 * (y + (t * (z / x)))) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if (Float64(x * y) <= -1e+220) tmp = Float64(2.0 * Float64(Float64(x * y) - Float64(c * Float64(Float64(b * c) * i)))); elseif (Float64(x * y) <= -5e+104) tmp = Float64(Float64(Float64(x * y) + Float64(z * t)) * 2.0); elseif (Float64(x * y) <= 2e+178) tmp = Float64(2.0 * Float64(Float64(z * t) - Float64(c * Float64(Float64(a + Float64(b * c)) * i)))); else tmp = Float64(x * Float64(2.0 * Float64(y + Float64(t * Float64(z / x))))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((x * y) <= -1e+220) tmp = 2.0 * ((x * y) - (c * ((b * c) * i))); elseif ((x * y) <= -5e+104) tmp = ((x * y) + (z * t)) * 2.0; elseif ((x * y) <= 2e+178) tmp = 2.0 * ((z * t) - (c * ((a + (b * c)) * i))); else tmp = x * (2.0 * (y + (t * (z / x)))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[LessEqual[N[(x * y), $MachinePrecision], -1e+220], N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(c * N[(N[(b * c), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], -5e+104], N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[N[(x * y), $MachinePrecision], 2e+178], N[(2.0 * N[(N[(z * t), $MachinePrecision] - N[(c * N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * N[(2.0 * N[(y + N[(t * N[(z / x), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -1 \cdot 10^{+220}:\\
\;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(\left(b \cdot c\right) \cdot i\right)\right)\\
\mathbf{elif}\;x \cdot y \leq -5 \cdot 10^{+104}:\\
\;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\
\mathbf{elif}\;x \cdot y \leq 2 \cdot 10^{+178}:\\
\;\;\;\;2 \cdot \left(z \cdot t - c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot \left(2 \cdot \left(y + t \cdot \frac{z}{x}\right)\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -1e220Initial program 85.7%
Taylor expanded in z around 0 85.7%
Taylor expanded in a around 0 89.3%
*-commutative89.3%
Simplified89.3%
if -1e220 < (*.f64 x y) < -4.9999999999999997e104Initial program 86.4%
Taylor expanded in c around 0 86.9%
if -4.9999999999999997e104 < (*.f64 x y) < 2.0000000000000001e178Initial program 90.5%
Taylor expanded in x around 0 83.1%
if 2.0000000000000001e178 < (*.f64 x y) Initial program 83.9%
Taylor expanded in c around 0 86.1%
Taylor expanded in x around inf 88.4%
distribute-lft-out88.4%
associate-/l*90.7%
Simplified90.7%
Final simplification85.4%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= c -2.05e+52) (not (<= c 1.3e+84))) (* 2.0 (- (* x y) (* 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.05e+52) || !(c <= 1.3e+84)) {
tmp = 2.0 * ((x * y) - (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.05d+52)) .or. (.not. (c <= 1.3d+84))) then
tmp = 2.0d0 * ((x * y) - (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.05e+52) || !(c <= 1.3e+84)) {
tmp = 2.0 * ((x * y) - (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.05e+52) or not (c <= 1.3e+84): tmp = 2.0 * ((x * y) - (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.05e+52) || !(c <= 1.3e+84)) 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(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.05e+52) || ~((c <= 1.3e+84))) tmp = 2.0 * ((x * y) - (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.05e+52], N[Not[LessEqual[c, 1.3e+84]], $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[(i * N[(a * c), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;c \leq -2.05 \cdot 10^{+52} \lor \neg \left(c \leq 1.3 \cdot 10^{+84}\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) - i \cdot \left(a \cdot c\right)\right)\\
\end{array}
\end{array}
if c < -2.05e52 or 1.3000000000000001e84 < c Initial program 75.7%
Taylor expanded in z around 0 88.6%
if -2.05e52 < c < 1.3000000000000001e84Initial program 97.3%
Taylor expanded in a around inf 90.2%
*-commutative90.2%
Simplified90.2%
Final simplification89.6%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= c -8.2e+83) (not (<= c 5.8e+105))) (* -2.0 (* c (* (+ a (* b c)) i))) (* (+ (* 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 <= -8.2e+83) || !(c <= 5.8e+105)) {
tmp = -2.0 * (c * ((a + (b * c)) * i));
} 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 <= (-8.2d+83)) .or. (.not. (c <= 5.8d+105))) then
tmp = (-2.0d0) * (c * ((a + (b * c)) * i))
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 <= -8.2e+83) || !(c <= 5.8e+105)) {
tmp = -2.0 * (c * ((a + (b * c)) * i));
} else {
tmp = ((x * y) + (z * t)) * 2.0;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (c <= -8.2e+83) or not (c <= 5.8e+105): tmp = -2.0 * (c * ((a + (b * c)) * i)) 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 <= -8.2e+83) || !(c <= 5.8e+105)) tmp = Float64(-2.0 * Float64(c * Float64(Float64(a + Float64(b * c)) * i))); 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 <= -8.2e+83) || ~((c <= 5.8e+105))) tmp = -2.0 * (c * ((a + (b * c)) * i)); 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, -8.2e+83], N[Not[LessEqual[c, 5.8e+105]], $MachinePrecision]], N[(-2.0 * N[(c * N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $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 -8.2 \cdot 10^{+83} \lor \neg \left(c \leq 5.8 \cdot 10^{+105}\right):\\
\;\;\;\;-2 \cdot \left(c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\
\end{array}
\end{array}
if c < -8.2000000000000002e83 or 5.8000000000000002e105 < c Initial program 76.7%
fma-define76.7%
associate-*l*90.6%
Simplified90.6%
Taylor expanded in i around inf 81.6%
if -8.2000000000000002e83 < c < 5.8000000000000002e105Initial program 95.6%
Taylor expanded in c around 0 78.2%
Final simplification79.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* z (* t 2.0))))
(if (<= z -2.3e+83)
t_1
(if (<= z -6800000000.0)
(* (* c i) (* a -2.0))
(if (<= z 6.6e-74) (* y (* x 2.0)) t_1)))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double t_1 = z * (t * 2.0);
double tmp;
if (z <= -2.3e+83) {
tmp = t_1;
} else if (z <= -6800000000.0) {
tmp = (c * i) * (a * -2.0);
} else if (z <= 6.6e-74) {
tmp = y * (x * 2.0);
} 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 = z * (t * 2.0d0)
if (z <= (-2.3d+83)) then
tmp = t_1
else if (z <= (-6800000000.0d0)) then
tmp = (c * i) * (a * (-2.0d0))
else if (z <= 6.6d-74) then
tmp = y * (x * 2.0d0)
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 = z * (t * 2.0);
double tmp;
if (z <= -2.3e+83) {
tmp = t_1;
} else if (z <= -6800000000.0) {
tmp = (c * i) * (a * -2.0);
} else if (z <= 6.6e-74) {
tmp = y * (x * 2.0);
} else {
tmp = t_1;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = z * (t * 2.0) tmp = 0 if z <= -2.3e+83: tmp = t_1 elif z <= -6800000000.0: tmp = (c * i) * (a * -2.0) elif z <= 6.6e-74: tmp = y * (x * 2.0) else: tmp = t_1 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(z * Float64(t * 2.0)) tmp = 0.0 if (z <= -2.3e+83) tmp = t_1; elseif (z <= -6800000000.0) tmp = Float64(Float64(c * i) * Float64(a * -2.0)); elseif (z <= 6.6e-74) tmp = Float64(y * Float64(x * 2.0)); else tmp = t_1; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = z * (t * 2.0); tmp = 0.0; if (z <= -2.3e+83) tmp = t_1; elseif (z <= -6800000000.0) tmp = (c * i) * (a * -2.0); elseif (z <= 6.6e-74) tmp = y * (x * 2.0); else tmp = t_1; end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := Block[{t$95$1 = N[(z * N[(t * 2.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.3e+83], t$95$1, If[LessEqual[z, -6800000000.0], N[(N[(c * i), $MachinePrecision] * N[(a * -2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.6e-74], N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := z \cdot \left(t \cdot 2\right)\\
\mathbf{if}\;z \leq -2.3 \cdot 10^{+83}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;z \leq -6800000000:\\
\;\;\;\;\left(c \cdot i\right) \cdot \left(a \cdot -2\right)\\
\mathbf{elif}\;z \leq 6.6 \cdot 10^{-74}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if z < -2.29999999999999995e83 or 6.59999999999999992e-74 < z Initial program 87.5%
fma-define88.3%
associate-*l*92.1%
Simplified92.1%
Taylor expanded in z around inf 44.3%
associate-*r*44.3%
Simplified44.3%
if -2.29999999999999995e83 < z < -6.8e9Initial program 80.4%
fma-define80.4%
associate-*l*83.7%
Simplified83.7%
Taylor expanded in a around inf 38.8%
associate-*r*38.8%
Simplified38.8%
if -6.8e9 < z < 6.59999999999999992e-74Initial program 90.6%
fma-define90.6%
associate-*l*98.2%
Simplified98.2%
Taylor expanded in x around inf 41.6%
*-commutative41.6%
*-commutative41.6%
associate-*r*41.6%
*-commutative41.6%
Simplified41.6%
Final simplification42.8%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= c -7.6e+202) (not (<= c 8.2e+124))) (* (* c i) (* a -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 <= -7.6e+202) || !(c <= 8.2e+124)) {
tmp = (c * i) * (a * -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 <= (-7.6d+202)) .or. (.not. (c <= 8.2d+124))) then
tmp = (c * i) * (a * (-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 <= -7.6e+202) || !(c <= 8.2e+124)) {
tmp = (c * i) * (a * -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 <= -7.6e+202) or not (c <= 8.2e+124): tmp = (c * i) * (a * -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 <= -7.6e+202) || !(c <= 8.2e+124)) tmp = Float64(Float64(c * i) * Float64(a * -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 <= -7.6e+202) || ~((c <= 8.2e+124))) tmp = (c * i) * (a * -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, -7.6e+202], N[Not[LessEqual[c, 8.2e+124]], $MachinePrecision]], N[(N[(c * i), $MachinePrecision] * N[(a * -2.0), $MachinePrecision]), $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 -7.6 \cdot 10^{+202} \lor \neg \left(c \leq 8.2 \cdot 10^{+124}\right):\\
\;\;\;\;\left(c \cdot i\right) \cdot \left(a \cdot -2\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot y + z \cdot t\right) \cdot 2\\
\end{array}
\end{array}
if c < -7.6000000000000001e202 or 8.20000000000000002e124 < c Initial program 74.1%
fma-define74.1%
associate-*l*85.9%
Simplified85.9%
Taylor expanded in a around inf 45.9%
associate-*r*45.9%
Simplified45.9%
if -7.6000000000000001e202 < c < 8.20000000000000002e124Initial program 93.3%
Taylor expanded in c around 0 73.1%
Final simplification66.3%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= z -5e+64) (not (<= z 1.55e-76))) (* z (* t 2.0)) (* y (* x 2.0))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if ((z <= -5e+64) || !(z <= 1.55e-76)) {
tmp = z * (t * 2.0);
} else {
tmp = y * (x * 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 ((z <= (-5d+64)) .or. (.not. (z <= 1.55d-76))) then
tmp = z * (t * 2.0d0)
else
tmp = y * (x * 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 ((z <= -5e+64) || !(z <= 1.55e-76)) {
tmp = z * (t * 2.0);
} else {
tmp = y * (x * 2.0);
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if (z <= -5e+64) or not (z <= 1.55e-76): tmp = z * (t * 2.0) else: tmp = y * (x * 2.0) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((z <= -5e+64) || !(z <= 1.55e-76)) tmp = Float64(z * Float64(t * 2.0)); else tmp = Float64(y * Float64(x * 2.0)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if ((z <= -5e+64) || ~((z <= 1.55e-76))) tmp = z * (t * 2.0); else tmp = y * (x * 2.0); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[z, -5e+64], N[Not[LessEqual[z, 1.55e-76]], $MachinePrecision]], N[(z * N[(t * 2.0), $MachinePrecision]), $MachinePrecision], N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5 \cdot 10^{+64} \lor \neg \left(z \leq 1.55 \cdot 10^{-76}\right):\\
\;\;\;\;z \cdot \left(t \cdot 2\right)\\
\mathbf{else}:\\
\;\;\;\;y \cdot \left(x \cdot 2\right)\\
\end{array}
\end{array}
if z < -5e64 or 1.54999999999999985e-76 < z Initial program 87.1%
fma-define87.9%
associate-*l*92.3%
Simplified92.3%
Taylor expanded in z around inf 44.0%
associate-*r*44.0%
Simplified44.0%
if -5e64 < z < 1.54999999999999985e-76Initial program 89.9%
fma-define89.9%
associate-*l*96.4%
Simplified96.4%
Taylor expanded in x around inf 41.0%
*-commutative41.0%
*-commutative41.0%
associate-*r*41.0%
*-commutative41.0%
Simplified41.0%
Final simplification42.5%
(FPCore (x y z t a b c i) :precision binary64 (* y (* x 2.0)))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return y * (x * 2.0);
}
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 = y * (x * 2.0d0)
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
return y * (x * 2.0);
}
def code(x, y, z, t, a, b, c, i): return y * (x * 2.0)
function code(x, y, z, t, a, b, c, i) return Float64(y * Float64(x * 2.0)) end
function tmp = code(x, y, z, t, a, b, c, i) tmp = y * (x * 2.0); end
code[x_, y_, z_, t_, a_, b_, c_, i_] := N[(y * N[(x * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
y \cdot \left(x \cdot 2\right)
\end{array}
Initial program 88.5%
fma-define88.9%
associate-*l*94.3%
Simplified94.3%
Taylor expanded in x around inf 35.1%
*-commutative35.1%
*-commutative35.1%
associate-*r*35.1%
*-commutative35.1%
Simplified35.1%
Final simplification35.1%
(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 2024128
(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))))