
(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 10 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 (+ (* x y) (* z t))))
(if (<= (- t_2 (* (* c t_1) i)) INFINITY)
(* 2.0 (- t_2 (* t_1 (* c i))))
(* 2.0 (* 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 = 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 * (b * (c * -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 * (b * (c * -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 * (b * (c * -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(b * Float64(c * Float64(-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 * (b * (c * -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[(b * N[(c * (-i)), $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(c \cdot \left(b \cdot \left(c \cdot \left(-i\right)\right)\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.5%
fma-def94.5%
associate-*l*99.1%
Simplified99.1%
fma-def99.1%
+-commutative99.1%
Applied egg-rr99.1%
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 i around inf 66.8%
Taylor expanded in a around 0 67.0%
Final simplification97.2%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (+ a (* b c))) (t_2 (* c t_1)))
(if (or (<= t_2 (- INFINITY)) (not (<= t_2 2e+203)))
(* -2.0 (* c (* t_1 i)))
(* (- (+ (* x y) (* z t)) (* t_2 i)) 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;
double tmp;
if ((t_2 <= -((double) INFINITY)) || !(t_2 <= 2e+203)) {
tmp = -2.0 * (c * (t_1 * i));
} else {
tmp = (((x * y) + (z * t)) - (t_2 * i)) * 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;
double tmp;
if ((t_2 <= -Double.POSITIVE_INFINITY) || !(t_2 <= 2e+203)) {
tmp = -2.0 * (c * (t_1 * i));
} else {
tmp = (((x * y) + (z * t)) - (t_2 * i)) * 2.0;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = a + (b * c) t_2 = c * t_1 tmp = 0 if (t_2 <= -math.inf) or not (t_2 <= 2e+203): tmp = -2.0 * (c * (t_1 * i)) else: tmp = (((x * y) + (z * t)) - (t_2 * i)) * 2.0 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(a + Float64(b * c)) t_2 = Float64(c * t_1) tmp = 0.0 if ((t_2 <= Float64(-Inf)) || !(t_2 <= 2e+203)) tmp = Float64(-2.0 * Float64(c * Float64(t_1 * i))); else tmp = Float64(Float64(Float64(Float64(x * y) + Float64(z * t)) - Float64(t_2 * i)) * 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; tmp = 0.0; if ((t_2 <= -Inf) || ~((t_2 <= 2e+203))) tmp = -2.0 * (c * (t_1 * i)); else tmp = (((x * y) + (z * t)) - (t_2 * i)) * 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[(c * t$95$1), $MachinePrecision]}, If[Or[LessEqual[t$95$2, (-Infinity)], N[Not[LessEqual[t$95$2, 2e+203]], $MachinePrecision]], N[(-2.0 * N[(c * N[(t$95$1 * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(N[(x * y), $MachinePrecision] + N[(z * t), $MachinePrecision]), $MachinePrecision] - N[(t$95$2 * i), $MachinePrecision]), $MachinePrecision] * 2.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := a + b \cdot c\\
t_2 := c \cdot t_1\\
\mathbf{if}\;t_2 \leq -\infty \lor \neg \left(t_2 \leq 2 \cdot 10^{+203}\right):\\
\;\;\;\;-2 \cdot \left(c \cdot \left(t_1 \cdot i\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(\left(x \cdot y + z \cdot t\right) - t_2 \cdot i\right) \cdot 2\\
\end{array}
\end{array}
if (*.f64 (+.f64 a (*.f64 b c)) c) < -inf.0 or 2e203 < (*.f64 (+.f64 a (*.f64 b c)) c) Initial program 74.2%
Taylor expanded in i around inf 94.0%
Taylor expanded in i around 0 94.0%
if -inf.0 < (*.f64 (+.f64 a (*.f64 b c)) c) < 2e203Initial program 98.0%
Final simplification96.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* 2.0 (- (* z t) (* a (* c i)))))
(t_2 (* 2.0 (- (* x y) (* c (* b (* c i)))))))
(if (<= c -1.15e+27)
t_2
(if (<= c -1.75e-105)
t_1
(if (<= c -2.3e-129)
t_2
(if (<= c -2.6e-273)
t_1
(if (<= c 6.5e-242)
t_2
(if (<= c 5.2e-7)
t_1
(if (<= c 2e+97) t_2 (* -2.0 (* c (* (+ a (* b c)) i))))))))))))
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) - (a * (c * i)));
double t_2 = 2.0 * ((x * y) - (c * (b * (c * i))));
double tmp;
if (c <= -1.15e+27) {
tmp = t_2;
} else if (c <= -1.75e-105) {
tmp = t_1;
} else if (c <= -2.3e-129) {
tmp = t_2;
} else if (c <= -2.6e-273) {
tmp = t_1;
} else if (c <= 6.5e-242) {
tmp = t_2;
} else if (c <= 5.2e-7) {
tmp = t_1;
} else if (c <= 2e+97) {
tmp = t_2;
} else {
tmp = -2.0 * (c * ((a + (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) :: t_2
real(8) :: tmp
t_1 = 2.0d0 * ((z * t) - (a * (c * i)))
t_2 = 2.0d0 * ((x * y) - (c * (b * (c * i))))
if (c <= (-1.15d+27)) then
tmp = t_2
else if (c <= (-1.75d-105)) then
tmp = t_1
else if (c <= (-2.3d-129)) then
tmp = t_2
else if (c <= (-2.6d-273)) then
tmp = t_1
else if (c <= 6.5d-242) then
tmp = t_2
else if (c <= 5.2d-7) then
tmp = t_1
else if (c <= 2d+97) then
tmp = t_2
else
tmp = (-2.0d0) * (c * ((a + (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 = 2.0 * ((z * t) - (a * (c * i)));
double t_2 = 2.0 * ((x * y) - (c * (b * (c * i))));
double tmp;
if (c <= -1.15e+27) {
tmp = t_2;
} else if (c <= -1.75e-105) {
tmp = t_1;
} else if (c <= -2.3e-129) {
tmp = t_2;
} else if (c <= -2.6e-273) {
tmp = t_1;
} else if (c <= 6.5e-242) {
tmp = t_2;
} else if (c <= 5.2e-7) {
tmp = t_1;
} else if (c <= 2e+97) {
tmp = t_2;
} else {
tmp = -2.0 * (c * ((a + (b * c)) * i));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = 2.0 * ((z * t) - (a * (c * i))) t_2 = 2.0 * ((x * y) - (c * (b * (c * i)))) tmp = 0 if c <= -1.15e+27: tmp = t_2 elif c <= -1.75e-105: tmp = t_1 elif c <= -2.3e-129: tmp = t_2 elif c <= -2.6e-273: tmp = t_1 elif c <= 6.5e-242: tmp = t_2 elif c <= 5.2e-7: tmp = t_1 elif c <= 2e+97: tmp = t_2 else: tmp = -2.0 * (c * ((a + (b * c)) * i)) return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * Float64(Float64(z * t) - Float64(a * Float64(c * i)))) t_2 = Float64(2.0 * Float64(Float64(x * y) - Float64(c * Float64(b * Float64(c * i))))) tmp = 0.0 if (c <= -1.15e+27) tmp = t_2; elseif (c <= -1.75e-105) tmp = t_1; elseif (c <= -2.3e-129) tmp = t_2; elseif (c <= -2.6e-273) tmp = t_1; elseif (c <= 6.5e-242) tmp = t_2; elseif (c <= 5.2e-7) tmp = t_1; elseif (c <= 2e+97) tmp = t_2; else tmp = Float64(-2.0 * Float64(c * Float64(Float64(a + Float64(b * c)) * i))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = 2.0 * ((z * t) - (a * (c * i))); t_2 = 2.0 * ((x * y) - (c * (b * (c * i)))); tmp = 0.0; if (c <= -1.15e+27) tmp = t_2; elseif (c <= -1.75e-105) tmp = t_1; elseif (c <= -2.3e-129) tmp = t_2; elseif (c <= -2.6e-273) tmp = t_1; elseif (c <= 6.5e-242) tmp = t_2; elseif (c <= 5.2e-7) tmp = t_1; elseif (c <= 2e+97) tmp = t_2; else tmp = -2.0 * (c * ((a + (b * c)) * i)); 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[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(c * N[(b * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -1.15e+27], t$95$2, If[LessEqual[c, -1.75e-105], t$95$1, If[LessEqual[c, -2.3e-129], t$95$2, If[LessEqual[c, -2.6e-273], t$95$1, If[LessEqual[c, 6.5e-242], t$95$2, If[LessEqual[c, 5.2e-7], t$95$1, If[LessEqual[c, 2e+97], t$95$2, N[(-2.0 * N[(c * N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(z \cdot t - a \cdot \left(c \cdot i\right)\right)\\
t_2 := 2 \cdot \left(x \cdot y - c \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)\\
\mathbf{if}\;c \leq -1.15 \cdot 10^{+27}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq -1.75 \cdot 10^{-105}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -2.3 \cdot 10^{-129}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq -2.6 \cdot 10^{-273}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 6.5 \cdot 10^{-242}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq 5.2 \cdot 10^{-7}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 2 \cdot 10^{+97}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\
\end{array}
\end{array}
if c < -1.15e27 or -1.75e-105 < c < -2.3e-129 or -2.59999999999999983e-273 < c < 6.4999999999999998e-242 or 5.19999999999999998e-7 < c < 2.0000000000000001e97Initial program 86.8%
Taylor expanded in z around 0 83.3%
Taylor expanded in a around 0 78.5%
if -1.15e27 < c < -1.75e-105 or -2.3e-129 < c < -2.59999999999999983e-273 or 6.4999999999999998e-242 < c < 5.19999999999999998e-7Initial program 97.9%
fma-def97.9%
associate-*l*97.8%
Simplified97.8%
fma-def97.8%
+-commutative97.8%
Applied egg-rr97.8%
Taylor expanded in a around inf 94.7%
Taylor expanded in x around 0 70.4%
if 2.0000000000000001e97 < c Initial program 75.2%
Taylor expanded in i around inf 90.9%
Taylor expanded in i around 0 90.9%
Final simplification77.5%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* 2.0 (- (* z t) (* a (* c i)))))
(t_2 (* 2.0 (- (* x y) (* c (* c (* b i)))))))
(if (<= c -1.9e+27)
t_2
(if (<= c -1.75e-105)
t_1
(if (<= c -1.1e-132)
(* 2.0 (- (* x y) (* c (* b (* c i)))))
(if (<= c -3e-274)
t_1
(if (<= c 1.8e-237)
t_2
(if (<= c 7.4e-7)
t_1
(if (<= c 2.5e+95)
t_2
(* -2.0 (* c (* (+ a (* b c)) i))))))))))))
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) - (a * (c * i)));
double t_2 = 2.0 * ((x * y) - (c * (c * (b * i))));
double tmp;
if (c <= -1.9e+27) {
tmp = t_2;
} else if (c <= -1.75e-105) {
tmp = t_1;
} else if (c <= -1.1e-132) {
tmp = 2.0 * ((x * y) - (c * (b * (c * i))));
} else if (c <= -3e-274) {
tmp = t_1;
} else if (c <= 1.8e-237) {
tmp = t_2;
} else if (c <= 7.4e-7) {
tmp = t_1;
} else if (c <= 2.5e+95) {
tmp = t_2;
} else {
tmp = -2.0 * (c * ((a + (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) :: t_2
real(8) :: tmp
t_1 = 2.0d0 * ((z * t) - (a * (c * i)))
t_2 = 2.0d0 * ((x * y) - (c * (c * (b * i))))
if (c <= (-1.9d+27)) then
tmp = t_2
else if (c <= (-1.75d-105)) then
tmp = t_1
else if (c <= (-1.1d-132)) then
tmp = 2.0d0 * ((x * y) - (c * (b * (c * i))))
else if (c <= (-3d-274)) then
tmp = t_1
else if (c <= 1.8d-237) then
tmp = t_2
else if (c <= 7.4d-7) then
tmp = t_1
else if (c <= 2.5d+95) then
tmp = t_2
else
tmp = (-2.0d0) * (c * ((a + (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 = 2.0 * ((z * t) - (a * (c * i)));
double t_2 = 2.0 * ((x * y) - (c * (c * (b * i))));
double tmp;
if (c <= -1.9e+27) {
tmp = t_2;
} else if (c <= -1.75e-105) {
tmp = t_1;
} else if (c <= -1.1e-132) {
tmp = 2.0 * ((x * y) - (c * (b * (c * i))));
} else if (c <= -3e-274) {
tmp = t_1;
} else if (c <= 1.8e-237) {
tmp = t_2;
} else if (c <= 7.4e-7) {
tmp = t_1;
} else if (c <= 2.5e+95) {
tmp = t_2;
} else {
tmp = -2.0 * (c * ((a + (b * c)) * i));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = 2.0 * ((z * t) - (a * (c * i))) t_2 = 2.0 * ((x * y) - (c * (c * (b * i)))) tmp = 0 if c <= -1.9e+27: tmp = t_2 elif c <= -1.75e-105: tmp = t_1 elif c <= -1.1e-132: tmp = 2.0 * ((x * y) - (c * (b * (c * i)))) elif c <= -3e-274: tmp = t_1 elif c <= 1.8e-237: tmp = t_2 elif c <= 7.4e-7: tmp = t_1 elif c <= 2.5e+95: tmp = t_2 else: tmp = -2.0 * (c * ((a + (b * c)) * i)) return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * Float64(Float64(z * t) - Float64(a * Float64(c * i)))) t_2 = Float64(2.0 * Float64(Float64(x * y) - Float64(c * Float64(c * Float64(b * i))))) tmp = 0.0 if (c <= -1.9e+27) tmp = t_2; elseif (c <= -1.75e-105) tmp = t_1; elseif (c <= -1.1e-132) tmp = Float64(2.0 * Float64(Float64(x * y) - Float64(c * Float64(b * Float64(c * i))))); elseif (c <= -3e-274) tmp = t_1; elseif (c <= 1.8e-237) tmp = t_2; elseif (c <= 7.4e-7) tmp = t_1; elseif (c <= 2.5e+95) tmp = t_2; else tmp = Float64(-2.0 * Float64(c * Float64(Float64(a + Float64(b * c)) * i))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = 2.0 * ((z * t) - (a * (c * i))); t_2 = 2.0 * ((x * y) - (c * (c * (b * i)))); tmp = 0.0; if (c <= -1.9e+27) tmp = t_2; elseif (c <= -1.75e-105) tmp = t_1; elseif (c <= -1.1e-132) tmp = 2.0 * ((x * y) - (c * (b * (c * i)))); elseif (c <= -3e-274) tmp = t_1; elseif (c <= 1.8e-237) tmp = t_2; elseif (c <= 7.4e-7) tmp = t_1; elseif (c <= 2.5e+95) tmp = t_2; else tmp = -2.0 * (c * ((a + (b * c)) * i)); 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[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(c * N[(c * N[(b * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -1.9e+27], t$95$2, If[LessEqual[c, -1.75e-105], t$95$1, If[LessEqual[c, -1.1e-132], N[(2.0 * N[(N[(x * y), $MachinePrecision] - N[(c * N[(b * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[c, -3e-274], t$95$1, If[LessEqual[c, 1.8e-237], t$95$2, If[LessEqual[c, 7.4e-7], t$95$1, If[LessEqual[c, 2.5e+95], t$95$2, N[(-2.0 * N[(c * N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(z \cdot t - a \cdot \left(c \cdot i\right)\right)\\
t_2 := 2 \cdot \left(x \cdot y - c \cdot \left(c \cdot \left(b \cdot i\right)\right)\right)\\
\mathbf{if}\;c \leq -1.9 \cdot 10^{+27}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq -1.75 \cdot 10^{-105}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq -1.1 \cdot 10^{-132}:\\
\;\;\;\;2 \cdot \left(x \cdot y - c \cdot \left(b \cdot \left(c \cdot i\right)\right)\right)\\
\mathbf{elif}\;c \leq -3 \cdot 10^{-274}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 1.8 \cdot 10^{-237}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq 7.4 \cdot 10^{-7}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 2.5 \cdot 10^{+95}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \left(c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\
\end{array}
\end{array}
if c < -1.90000000000000011e27 or -2.99999999999999977e-274 < c < 1.79999999999999998e-237 or 7.40000000000000009e-7 < c < 2.50000000000000012e95Initial program 85.5%
Taylor expanded in z around 0 84.4%
Taylor expanded in a around 0 79.1%
*-commutative79.1%
associate-*l*80.0%
Simplified80.0%
if -1.90000000000000011e27 < c < -1.75e-105 or -1.09999999999999995e-132 < c < -2.99999999999999977e-274 or 1.79999999999999998e-237 < c < 7.40000000000000009e-7Initial program 97.9%
fma-def97.9%
associate-*l*97.8%
Simplified97.8%
fma-def97.8%
+-commutative97.8%
Applied egg-rr97.8%
Taylor expanded in a around inf 94.7%
Taylor expanded in x around 0 70.4%
if -1.75e-105 < c < -1.09999999999999995e-132Initial program 99.7%
Taylor expanded in z around 0 73.2%
Taylor expanded in a around 0 71.9%
if 2.50000000000000012e95 < c Initial program 75.2%
Taylor expanded in i around inf 90.9%
Taylor expanded in i around 0 90.9%
Final simplification77.9%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -7e-284) (not (<= (* x y) 1.35e-39))) (* 2.0 (- (* x y) (* c (* (+ a (* b c)) i)))) (* 2.0 (- (* z t) (* a (* c i))))))
double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -7e-284) || !((x * y) <= 1.35e-39)) {
tmp = 2.0 * ((x * y) - (c * ((a + (b * c)) * i)));
} else {
tmp = 2.0 * ((z * t) - (a * (c * i)));
}
return tmp;
}
real(8) function code(x, y, z, t, a, b, c, i)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8), intent (in) :: c
real(8), intent (in) :: i
real(8) :: tmp
if (((x * y) <= (-7d-284)) .or. (.not. ((x * y) <= 1.35d-39))) then
tmp = 2.0d0 * ((x * y) - (c * ((a + (b * c)) * i)))
else
tmp = 2.0d0 * ((z * t) - (a * (c * i)))
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b, double c, double i) {
double tmp;
if (((x * y) <= -7e-284) || !((x * y) <= 1.35e-39)) {
tmp = 2.0 * ((x * y) - (c * ((a + (b * c)) * i)));
} else {
tmp = 2.0 * ((z * t) - (a * (c * i)));
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): tmp = 0 if ((x * y) <= -7e-284) or not ((x * y) <= 1.35e-39): tmp = 2.0 * ((x * y) - (c * ((a + (b * c)) * i))) else: tmp = 2.0 * ((z * t) - (a * (c * i))) return tmp
function code(x, y, z, t, a, b, c, i) tmp = 0.0 if ((Float64(x * y) <= -7e-284) || !(Float64(x * y) <= 1.35e-39)) tmp = Float64(2.0 * Float64(Float64(x * y) - Float64(c * Float64(Float64(a + Float64(b * c)) * i)))); else tmp = Float64(2.0 * Float64(Float64(z * t) - Float64(a * Float64(c * i)))); end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) tmp = 0.0; if (((x * y) <= -7e-284) || ~(((x * y) <= 1.35e-39))) tmp = 2.0 * ((x * y) - (c * ((a + (b * c)) * i))); else tmp = 2.0 * ((z * t) - (a * (c * i))); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_, c_, i_] := If[Or[LessEqual[N[(x * y), $MachinePrecision], -7e-284], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.35e-39]], $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[(z * t), $MachinePrecision] - N[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;x \cdot y \leq -7 \cdot 10^{-284} \lor \neg \left(x \cdot y \leq 1.35 \cdot 10^{-39}\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(z \cdot t - a \cdot \left(c \cdot i\right)\right)\\
\end{array}
\end{array}
if (*.f64 x y) < -6.99999999999999951e-284 or 1.35e-39 < (*.f64 x y) Initial program 89.3%
Taylor expanded in z around 0 76.5%
if -6.99999999999999951e-284 < (*.f64 x y) < 1.35e-39Initial program 88.3%
fma-def88.3%
associate-*l*94.4%
Simplified94.4%
fma-def94.4%
+-commutative94.4%
Applied egg-rr94.4%
Taylor expanded in a around inf 77.4%
Taylor expanded in x around 0 75.1%
Final simplification76.1%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* (* x y) 2.0))
(t_2 (* 2.0 (* z t)))
(t_3 (* -2.0 (* c (* (+ a (* b c)) i)))))
(if (<= c -1.16e+24)
t_3
(if (<= c -4.6e-271)
t_2
(if (<= c 7.2e-180)
t_1
(if (<= c 1.22e-144) t_2 (if (<= c 7e-58) 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 = (x * y) * 2.0;
double t_2 = 2.0 * (z * t);
double t_3 = -2.0 * (c * ((a + (b * c)) * i));
double tmp;
if (c <= -1.16e+24) {
tmp = t_3;
} else if (c <= -4.6e-271) {
tmp = t_2;
} else if (c <= 7.2e-180) {
tmp = t_1;
} else if (c <= 1.22e-144) {
tmp = t_2;
} else if (c <= 7e-58) {
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 = (x * y) * 2.0d0
t_2 = 2.0d0 * (z * t)
t_3 = (-2.0d0) * (c * ((a + (b * c)) * i))
if (c <= (-1.16d+24)) then
tmp = t_3
else if (c <= (-4.6d-271)) then
tmp = t_2
else if (c <= 7.2d-180) then
tmp = t_1
else if (c <= 1.22d-144) then
tmp = t_2
else if (c <= 7d-58) 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 = (x * y) * 2.0;
double t_2 = 2.0 * (z * t);
double t_3 = -2.0 * (c * ((a + (b * c)) * i));
double tmp;
if (c <= -1.16e+24) {
tmp = t_3;
} else if (c <= -4.6e-271) {
tmp = t_2;
} else if (c <= 7.2e-180) {
tmp = t_1;
} else if (c <= 1.22e-144) {
tmp = t_2;
} else if (c <= 7e-58) {
tmp = t_1;
} else {
tmp = t_3;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = (x * y) * 2.0 t_2 = 2.0 * (z * t) t_3 = -2.0 * (c * ((a + (b * c)) * i)) tmp = 0 if c <= -1.16e+24: tmp = t_3 elif c <= -4.6e-271: tmp = t_2 elif c <= 7.2e-180: tmp = t_1 elif c <= 1.22e-144: tmp = t_2 elif c <= 7e-58: tmp = t_1 else: tmp = t_3 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(Float64(x * y) * 2.0) t_2 = Float64(2.0 * Float64(z * t)) t_3 = Float64(-2.0 * Float64(c * Float64(Float64(a + Float64(b * c)) * i))) tmp = 0.0 if (c <= -1.16e+24) tmp = t_3; elseif (c <= -4.6e-271) tmp = t_2; elseif (c <= 7.2e-180) tmp = t_1; elseif (c <= 1.22e-144) tmp = t_2; elseif (c <= 7e-58) 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 = (x * y) * 2.0; t_2 = 2.0 * (z * t); t_3 = -2.0 * (c * ((a + (b * c)) * i)); tmp = 0.0; if (c <= -1.16e+24) tmp = t_3; elseif (c <= -4.6e-271) tmp = t_2; elseif (c <= 7.2e-180) tmp = t_1; elseif (c <= 1.22e-144) tmp = t_2; elseif (c <= 7e-58) 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[(x * y), $MachinePrecision] * 2.0), $MachinePrecision]}, Block[{t$95$2 = N[(2.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(-2.0 * N[(c * N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -1.16e+24], t$95$3, If[LessEqual[c, -4.6e-271], t$95$2, If[LessEqual[c, 7.2e-180], t$95$1, If[LessEqual[c, 1.22e-144], t$95$2, If[LessEqual[c, 7e-58], t$95$1, t$95$3]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := \left(x \cdot y\right) \cdot 2\\
t_2 := 2 \cdot \left(z \cdot t\right)\\
t_3 := -2 \cdot \left(c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\
\mathbf{if}\;c \leq -1.16 \cdot 10^{+24}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;c \leq -4.6 \cdot 10^{-271}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq 7.2 \cdot 10^{-180}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 1.22 \cdot 10^{-144}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq 7 \cdot 10^{-58}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if c < -1.16000000000000005e24 or 6.9999999999999998e-58 < c Initial program 82.0%
Taylor expanded in i around inf 73.3%
Taylor expanded in i around 0 73.3%
if -1.16000000000000005e24 < c < -4.60000000000000017e-271 or 7.1999999999999998e-180 < c < 1.22e-144Initial program 97.0%
Taylor expanded in z around inf 51.4%
if -4.60000000000000017e-271 < c < 7.1999999999999998e-180 or 1.22e-144 < c < 6.9999999999999998e-58Initial program 100.0%
Taylor expanded in x around inf 62.2%
Final simplification65.6%
(FPCore (x y z t a b c i)
:precision binary64
(let* ((t_1 (* 2.0 (- (* z t) (* a (* c i)))))
(t_2 (* -2.0 (* c (* (+ a (* b c)) i)))))
(if (<= c -1.62e+102)
t_2
(if (<= c -6e-271)
t_1
(if (<= c 2.9e-237)
(* (* x y) 2.0)
(if (<= c 200000000000.0) t_1 t_2))))))
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) - (a * (c * i)));
double t_2 = -2.0 * (c * ((a + (b * c)) * i));
double tmp;
if (c <= -1.62e+102) {
tmp = t_2;
} else if (c <= -6e-271) {
tmp = t_1;
} else if (c <= 2.9e-237) {
tmp = (x * y) * 2.0;
} else if (c <= 200000000000.0) {
tmp = t_1;
} 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) :: tmp
t_1 = 2.0d0 * ((z * t) - (a * (c * i)))
t_2 = (-2.0d0) * (c * ((a + (b * c)) * i))
if (c <= (-1.62d+102)) then
tmp = t_2
else if (c <= (-6d-271)) then
tmp = t_1
else if (c <= 2.9d-237) then
tmp = (x * y) * 2.0d0
else if (c <= 200000000000.0d0) then
tmp = t_1
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 = 2.0 * ((z * t) - (a * (c * i)));
double t_2 = -2.0 * (c * ((a + (b * c)) * i));
double tmp;
if (c <= -1.62e+102) {
tmp = t_2;
} else if (c <= -6e-271) {
tmp = t_1;
} else if (c <= 2.9e-237) {
tmp = (x * y) * 2.0;
} else if (c <= 200000000000.0) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
def code(x, y, z, t, a, b, c, i): t_1 = 2.0 * ((z * t) - (a * (c * i))) t_2 = -2.0 * (c * ((a + (b * c)) * i)) tmp = 0 if c <= -1.62e+102: tmp = t_2 elif c <= -6e-271: tmp = t_1 elif c <= 2.9e-237: tmp = (x * y) * 2.0 elif c <= 200000000000.0: tmp = t_1 else: tmp = t_2 return tmp
function code(x, y, z, t, a, b, c, i) t_1 = Float64(2.0 * Float64(Float64(z * t) - Float64(a * Float64(c * i)))) t_2 = Float64(-2.0 * Float64(c * Float64(Float64(a + Float64(b * c)) * i))) tmp = 0.0 if (c <= -1.62e+102) tmp = t_2; elseif (c <= -6e-271) tmp = t_1; elseif (c <= 2.9e-237) tmp = Float64(Float64(x * y) * 2.0); elseif (c <= 200000000000.0) tmp = t_1; else tmp = t_2; end return tmp end
function tmp_2 = code(x, y, z, t, a, b, c, i) t_1 = 2.0 * ((z * t) - (a * (c * i))); t_2 = -2.0 * (c * ((a + (b * c)) * i)); tmp = 0.0; if (c <= -1.62e+102) tmp = t_2; elseif (c <= -6e-271) tmp = t_1; elseif (c <= 2.9e-237) tmp = (x * y) * 2.0; elseif (c <= 200000000000.0) tmp = t_1; else tmp = t_2; 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[(a * N[(c * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-2.0 * N[(c * N[(N[(a + N[(b * c), $MachinePrecision]), $MachinePrecision] * i), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[c, -1.62e+102], t$95$2, If[LessEqual[c, -6e-271], t$95$1, If[LessEqual[c, 2.9e-237], N[(N[(x * y), $MachinePrecision] * 2.0), $MachinePrecision], If[LessEqual[c, 200000000000.0], t$95$1, t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_1 := 2 \cdot \left(z \cdot t - a \cdot \left(c \cdot i\right)\right)\\
t_2 := -2 \cdot \left(c \cdot \left(\left(a + b \cdot c\right) \cdot i\right)\right)\\
\mathbf{if}\;c \leq -1.62 \cdot 10^{+102}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;c \leq -6 \cdot 10^{-271}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;c \leq 2.9 \cdot 10^{-237}:\\
\;\;\;\;\left(x \cdot y\right) \cdot 2\\
\mathbf{elif}\;c \leq 200000000000:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if c < -1.62e102 or 2e11 < c Initial program 76.5%
Taylor expanded in i around inf 81.9%
Taylor expanded in i around 0 81.9%
if -1.62e102 < c < -6.00000000000000004e-271 or 2.90000000000000011e-237 < c < 2e11Initial program 98.4%
fma-def98.4%
associate-*l*98.2%
Simplified98.2%
fma-def98.2%
+-commutative98.2%
Applied egg-rr98.2%
Taylor expanded in a around inf 91.5%
Taylor expanded in x around 0 62.3%
if -6.00000000000000004e-271 < c < 2.90000000000000011e-237Initial program 100.0%
Taylor expanded in x around inf 76.0%
Final simplification71.7%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= c -7.8e+59) (not (<= c 7.2e-7))) (* 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 <= -7.8e+59) || !(c <= 7.2e-7)) {
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 <= (-7.8d+59)) .or. (.not. (c <= 7.2d-7))) 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 <= -7.8e+59) || !(c <= 7.2e-7)) {
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 <= -7.8e+59) or not (c <= 7.2e-7): 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 <= -7.8e+59) || !(c <= 7.2e-7)) 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 <= -7.8e+59) || ~((c <= 7.2e-7))) 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, -7.8e+59], N[Not[LessEqual[c, 7.2e-7]], $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 -7.8 \cdot 10^{+59} \lor \neg \left(c \leq 7.2 \cdot 10^{-7}\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 < -7.80000000000000043e59 or 7.19999999999999989e-7 < c Initial program 79.6%
Taylor expanded in z around 0 89.3%
if -7.80000000000000043e59 < c < 7.19999999999999989e-7Initial program 98.4%
Taylor expanded in a around inf 93.9%
*-commutative93.9%
Simplified93.9%
Final simplification91.6%
(FPCore (x y z t a b c i) :precision binary64 (if (or (<= (* x y) -1.22e+61) (not (<= (* x y) 1.75e-26))) (* (* 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) <= -1.22e+61) || !((x * y) <= 1.75e-26)) {
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) <= (-1.22d+61)) .or. (.not. ((x * y) <= 1.75d-26))) 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) <= -1.22e+61) || !((x * y) <= 1.75e-26)) {
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) <= -1.22e+61) or not ((x * y) <= 1.75e-26): 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) <= -1.22e+61) || !(Float64(x * y) <= 1.75e-26)) 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) <= -1.22e+61) || ~(((x * y) <= 1.75e-26))) 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], -1.22e+61], N[Not[LessEqual[N[(x * y), $MachinePrecision], 1.75e-26]], $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 -1.22 \cdot 10^{+61} \lor \neg \left(x \cdot y \leq 1.75 \cdot 10^{-26}\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) < -1.22e61 or 1.74999999999999992e-26 < (*.f64 x y) Initial program 90.3%
Taylor expanded in x around inf 54.4%
if -1.22e61 < (*.f64 x y) < 1.74999999999999992e-26Initial program 87.8%
Taylor expanded in z around inf 40.2%
Final simplification47.0%
(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 89.0%
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 2023301
(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))))