
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
real(8) function code(x, y, z, t, a, b)
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
code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
real(8) function code(x, y, z, t, a, b)
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
code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\end{array}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= (* y 9.0) -2e-22) (fma a (* 27.0 b) (fma x 2.0 (* y (* (* -9.0 z) t)))) (- (+ (* x 2.0) (* 27.0 (* a b))) (* (* y t) (* 9.0 z)))))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y * 9.0) <= -2e-22) {
tmp = fma(a, (27.0 * b), fma(x, 2.0, (y * ((-9.0 * z) * t))));
} else {
tmp = ((x * 2.0) + (27.0 * (a * b))) - ((y * t) * (9.0 * z));
}
return tmp;
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(y * 9.0) <= -2e-22) tmp = fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(y * Float64(Float64(-9.0 * z) * t)))); else tmp = Float64(Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))) - Float64(Float64(y * t) * Float64(9.0 * z))); end return tmp end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(y * 9.0), $MachinePrecision], -2e-22], N[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0 + N[(y * N[(N[(-9.0 * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(y * t), $MachinePrecision] * N[(9.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot 9 \leq -2 \cdot 10^{-22}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, \mathsf{fma}\left(x, 2, y \cdot \left(\left(-9 \cdot z\right) \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 + 27 \cdot \left(a \cdot b\right)\right) - \left(y \cdot t\right) \cdot \left(9 \cdot z\right)\\
\end{array}
\end{array}
if (*.f64 y 9) < -2.0000000000000001e-22Initial program 92.6%
+-commutative92.6%
sub-neg92.6%
associate-+r+92.6%
associate-*l*98.4%
distribute-rgt-neg-in98.4%
*-commutative98.4%
distribute-rgt-neg-in98.4%
associate-*l*89.1%
associate-+r+89.1%
sub-neg89.1%
associate-*l*89.1%
fma-define89.1%
fma-neg89.1%
*-commutative89.1%
distribute-lft-neg-in89.1%
associate-*l*92.5%
Simplified99.7%
if -2.0000000000000001e-22 < (*.f64 y 9) Initial program 93.9%
associate-*l*93.5%
associate-*l*93.5%
Simplified93.5%
+-commutative93.5%
associate-+r-93.5%
*-commutative93.5%
associate-*l*93.4%
associate-*r*93.9%
*-commutative93.9%
associate-*l*93.9%
associate-*r*96.2%
Applied egg-rr96.2%
Final simplification97.1%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* b (* a 27.0))))
(if (or (<= t_1 -1e-11) (not (<= t_1 2e-60)))
(+ (* t (* z (* y -9.0))) (* a (* 27.0 b)))
(- (* x 2.0) (* 9.0 (* t (* y z)))))))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a * 27.0);
double tmp;
if ((t_1 <= -1e-11) || !(t_1 <= 2e-60)) {
tmp = (t * (z * (y * -9.0))) + (a * (27.0 * b));
} else {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: t_1
real(8) :: tmp
t_1 = b * (a * 27.0d0)
if ((t_1 <= (-1d-11)) .or. (.not. (t_1 <= 2d-60))) then
tmp = (t * (z * (y * (-9.0d0)))) + (a * (27.0d0 * b))
else
tmp = (x * 2.0d0) - (9.0d0 * (t * (y * z)))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a * 27.0);
double tmp;
if ((t_1 <= -1e-11) || !(t_1 <= 2e-60)) {
tmp = (t * (z * (y * -9.0))) + (a * (27.0 * b));
} else {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) [x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): t_1 = b * (a * 27.0) tmp = 0 if (t_1 <= -1e-11) or not (t_1 <= 2e-60): tmp = (t * (z * (y * -9.0))) + (a * (27.0 * b)) else: tmp = (x * 2.0) - (9.0 * (t * (y * z))) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a * 27.0)) tmp = 0.0 if ((t_1 <= -1e-11) || !(t_1 <= 2e-60)) tmp = Float64(Float64(t * Float64(z * Float64(y * -9.0))) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(y * z)))); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = b * (a * 27.0);
tmp = 0.0;
if ((t_1 <= -1e-11) || ~((t_1 <= 2e-60)))
tmp = (t * (z * (y * -9.0))) + (a * (27.0 * b));
else
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -1e-11], N[Not[LessEqual[t$95$1, 2e-60]], $MachinePrecision]], N[(N[(t * N[(z * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a \cdot 27\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-11} \lor \neg \left(t\_1 \leq 2 \cdot 10^{-60}\right):\\
\;\;\;\;t \cdot \left(z \cdot \left(y \cdot -9\right)\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 a 27) b) < -9.99999999999999939e-12 or 1.9999999999999999e-60 < (*.f64 (*.f64 a 27) b) Initial program 95.5%
associate-*l*95.3%
associate-*l*95.3%
Simplified95.3%
Taylor expanded in x around 0 85.5%
*-commutative85.5%
associate-*r*85.6%
*-commutative85.6%
associate-*l*85.6%
Simplified85.6%
if -9.99999999999999939e-12 < (*.f64 (*.f64 a 27) b) < 1.9999999999999999e-60Initial program 91.0%
associate-*l*93.7%
associate-*l*93.7%
Simplified93.7%
Taylor expanded in a around 0 87.6%
Final simplification86.4%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* b (* a 27.0))))
(if (<= t_1 -1e-11)
(+ (* t (* z (* y -9.0))) (* a (* 27.0 b)))
(if (<= t_1 2e-60)
(- (* x 2.0) (* 9.0 (* t (* y z))))
(+ t_1 (* z (* -9.0 (* y t))))))))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a * 27.0);
double tmp;
if (t_1 <= -1e-11) {
tmp = (t * (z * (y * -9.0))) + (a * (27.0 * b));
} else if (t_1 <= 2e-60) {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
} else {
tmp = t_1 + (z * (-9.0 * (y * t)));
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: t_1
real(8) :: tmp
t_1 = b * (a * 27.0d0)
if (t_1 <= (-1d-11)) then
tmp = (t * (z * (y * (-9.0d0)))) + (a * (27.0d0 * b))
else if (t_1 <= 2d-60) then
tmp = (x * 2.0d0) - (9.0d0 * (t * (y * z)))
else
tmp = t_1 + (z * ((-9.0d0) * (y * t)))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a * 27.0);
double tmp;
if (t_1 <= -1e-11) {
tmp = (t * (z * (y * -9.0))) + (a * (27.0 * b));
} else if (t_1 <= 2e-60) {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
} else {
tmp = t_1 + (z * (-9.0 * (y * t)));
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) [x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): t_1 = b * (a * 27.0) tmp = 0 if t_1 <= -1e-11: tmp = (t * (z * (y * -9.0))) + (a * (27.0 * b)) elif t_1 <= 2e-60: tmp = (x * 2.0) - (9.0 * (t * (y * z))) else: tmp = t_1 + (z * (-9.0 * (y * t))) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a * 27.0)) tmp = 0.0 if (t_1 <= -1e-11) tmp = Float64(Float64(t * Float64(z * Float64(y * -9.0))) + Float64(a * Float64(27.0 * b))); elseif (t_1 <= 2e-60) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(y * z)))); else tmp = Float64(t_1 + Float64(z * Float64(-9.0 * Float64(y * t)))); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = b * (a * 27.0);
tmp = 0.0;
if (t_1 <= -1e-11)
tmp = (t * (z * (y * -9.0))) + (a * (27.0 * b));
elseif (t_1 <= 2e-60)
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
else
tmp = t_1 + (z * (-9.0 * (y * t)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-11], N[(N[(t * N[(z * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-60], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(z * N[(-9.0 * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a \cdot 27\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-11}:\\
\;\;\;\;t \cdot \left(z \cdot \left(y \cdot -9\right)\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-60}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + z \cdot \left(-9 \cdot \left(y \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 a 27) b) < -9.99999999999999939e-12Initial program 97.0%
associate-*l*95.5%
associate-*l*95.6%
Simplified95.6%
Taylor expanded in x around 0 90.8%
*-commutative90.8%
associate-*r*90.8%
*-commutative90.8%
associate-*l*90.9%
Simplified90.9%
if -9.99999999999999939e-12 < (*.f64 (*.f64 a 27) b) < 1.9999999999999999e-60Initial program 91.0%
associate-*l*93.7%
associate-*l*93.7%
Simplified93.7%
Taylor expanded in a around 0 87.6%
if 1.9999999999999999e-60 < (*.f64 (*.f64 a 27) b) Initial program 94.1%
Taylor expanded in y around 0 94.1%
Taylor expanded in x around 0 82.2%
*-commutative82.2%
*-commutative82.2%
*-commutative82.2%
associate-*r*79.7%
metadata-eval79.7%
distribute-rgt-neg-in79.7%
associate-*r*79.6%
distribute-rgt-neg-in79.6%
associate-*l*79.7%
*-commutative79.7%
distribute-rgt-neg-in79.7%
*-commutative79.7%
distribute-rgt-neg-in79.7%
metadata-eval79.7%
Simplified79.7%
Taylor expanded in y around 0 79.6%
Final simplification86.0%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* b (* a 27.0))))
(if (<= t_1 -1e-11)
(+ (* t (* z (* y -9.0))) (* a (* 27.0 b)))
(if (<= t_1 2e-60)
(- (* x 2.0) (* 9.0 (* t (* y z))))
(+ t_1 (* z (* t (* y -9.0))))))))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a * 27.0);
double tmp;
if (t_1 <= -1e-11) {
tmp = (t * (z * (y * -9.0))) + (a * (27.0 * b));
} else if (t_1 <= 2e-60) {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
} else {
tmp = t_1 + (z * (t * (y * -9.0)));
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: t_1
real(8) :: tmp
t_1 = b * (a * 27.0d0)
if (t_1 <= (-1d-11)) then
tmp = (t * (z * (y * (-9.0d0)))) + (a * (27.0d0 * b))
else if (t_1 <= 2d-60) then
tmp = (x * 2.0d0) - (9.0d0 * (t * (y * z)))
else
tmp = t_1 + (z * (t * (y * (-9.0d0))))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a * 27.0);
double tmp;
if (t_1 <= -1e-11) {
tmp = (t * (z * (y * -9.0))) + (a * (27.0 * b));
} else if (t_1 <= 2e-60) {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
} else {
tmp = t_1 + (z * (t * (y * -9.0)));
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) [x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): t_1 = b * (a * 27.0) tmp = 0 if t_1 <= -1e-11: tmp = (t * (z * (y * -9.0))) + (a * (27.0 * b)) elif t_1 <= 2e-60: tmp = (x * 2.0) - (9.0 * (t * (y * z))) else: tmp = t_1 + (z * (t * (y * -9.0))) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a * 27.0)) tmp = 0.0 if (t_1 <= -1e-11) tmp = Float64(Float64(t * Float64(z * Float64(y * -9.0))) + Float64(a * Float64(27.0 * b))); elseif (t_1 <= 2e-60) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(y * z)))); else tmp = Float64(t_1 + Float64(z * Float64(t * Float64(y * -9.0)))); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = b * (a * 27.0);
tmp = 0.0;
if (t_1 <= -1e-11)
tmp = (t * (z * (y * -9.0))) + (a * (27.0 * b));
elseif (t_1 <= 2e-60)
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
else
tmp = t_1 + (z * (t * (y * -9.0)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -1e-11], N[(N[(t * N[(z * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 2e-60], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(z * N[(t * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a \cdot 27\right)\\
\mathbf{if}\;t\_1 \leq -1 \cdot 10^{-11}:\\
\;\;\;\;t \cdot \left(z \cdot \left(y \cdot -9\right)\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;t\_1 \leq 2 \cdot 10^{-60}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + z \cdot \left(t \cdot \left(y \cdot -9\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 a 27) b) < -9.99999999999999939e-12Initial program 97.0%
associate-*l*95.5%
associate-*l*95.6%
Simplified95.6%
Taylor expanded in x around 0 90.8%
*-commutative90.8%
associate-*r*90.8%
*-commutative90.8%
associate-*l*90.9%
Simplified90.9%
if -9.99999999999999939e-12 < (*.f64 (*.f64 a 27) b) < 1.9999999999999999e-60Initial program 91.0%
associate-*l*93.7%
associate-*l*93.7%
Simplified93.7%
Taylor expanded in a around 0 87.6%
if 1.9999999999999999e-60 < (*.f64 (*.f64 a 27) b) Initial program 94.1%
Taylor expanded in y around 0 94.1%
Taylor expanded in x around 0 82.2%
*-commutative82.2%
*-commutative82.2%
*-commutative82.2%
associate-*r*79.7%
metadata-eval79.7%
distribute-rgt-neg-in79.7%
associate-*r*79.6%
distribute-rgt-neg-in79.6%
associate-*l*79.7%
*-commutative79.7%
distribute-rgt-neg-in79.7%
*-commutative79.7%
distribute-rgt-neg-in79.7%
metadata-eval79.7%
Simplified79.7%
Taylor expanded in y around 0 79.6%
associate-*r*79.7%
*-commutative79.7%
associate-*l*79.7%
Simplified79.7%
Final simplification86.0%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (or (<= b -1.95e-48)
(and (not (<= b 2.6e-31)) (or (<= b 3.3e+25) (not (<= b 9.2e+64)))))
(* 27.0 (* a b))
(* x 2.0)))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.95e-48) || (!(b <= 2.6e-31) && ((b <= 3.3e+25) || !(b <= 9.2e+64)))) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if ((b <= (-1.95d-48)) .or. (.not. (b <= 2.6d-31)) .and. (b <= 3.3d+25) .or. (.not. (b <= 9.2d+64))) then
tmp = 27.0d0 * (a * b)
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -1.95e-48) || (!(b <= 2.6e-31) && ((b <= 3.3e+25) || !(b <= 9.2e+64)))) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) [x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if (b <= -1.95e-48) or (not (b <= 2.6e-31) and ((b <= 3.3e+25) or not (b <= 9.2e+64))): tmp = 27.0 * (a * b) else: tmp = x * 2.0 return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -1.95e-48) || (!(b <= 2.6e-31) && ((b <= 3.3e+25) || !(b <= 9.2e+64)))) tmp = Float64(27.0 * Float64(a * b)); else tmp = Float64(x * 2.0); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((b <= -1.95e-48) || (~((b <= 2.6e-31)) && ((b <= 3.3e+25) || ~((b <= 9.2e+64)))))
tmp = 27.0 * (a * b);
else
tmp = x * 2.0;
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -1.95e-48], And[N[Not[LessEqual[b, 2.6e-31]], $MachinePrecision], Or[LessEqual[b, 3.3e+25], N[Not[LessEqual[b, 9.2e+64]], $MachinePrecision]]]], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.95 \cdot 10^{-48} \lor \neg \left(b \leq 2.6 \cdot 10^{-31}\right) \land \left(b \leq 3.3 \cdot 10^{+25} \lor \neg \left(b \leq 9.2 \cdot 10^{+64}\right)\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if b < -1.95e-48 or 2.59999999999999995e-31 < b < 3.3000000000000001e25 or 9.2e64 < b Initial program 94.9%
Taylor expanded in y around 0 94.9%
Taylor expanded in x around 0 83.6%
*-commutative83.6%
*-commutative83.6%
*-commutative83.6%
associate-*r*82.8%
metadata-eval82.8%
distribute-rgt-neg-in82.8%
associate-*r*82.1%
distribute-rgt-neg-in82.1%
associate-*l*82.1%
*-commutative82.1%
distribute-rgt-neg-in82.1%
*-commutative82.1%
distribute-rgt-neg-in82.1%
metadata-eval82.1%
Simplified82.1%
Taylor expanded in y around 0 82.1%
Taylor expanded in z around 0 59.5%
if -1.95e-48 < b < 2.59999999999999995e-31 or 3.3000000000000001e25 < b < 9.2e64Initial program 91.8%
+-commutative91.8%
sub-neg91.8%
associate-+r+91.8%
associate-*l*93.6%
distribute-rgt-neg-in93.6%
*-commutative93.6%
distribute-rgt-neg-in93.6%
associate-*l*93.4%
associate-+r+93.4%
sub-neg93.4%
associate-*l*93.4%
fma-define93.4%
fma-neg93.4%
distribute-rgt-neg-in93.4%
*-commutative93.4%
associate-*r*91.8%
Simplified92.6%
fma-undefine92.6%
fma-undefine92.6%
associate-+r+92.6%
*-commutative92.6%
associate-*l*92.6%
*-commutative92.6%
associate-*r*94.5%
*-commutative94.5%
*-commutative94.5%
associate-*r*94.5%
Applied egg-rr94.5%
Taylor expanded in x around inf 45.0%
Final simplification53.5%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= b -1.8e-51)
(* a (* 27.0 b))
(if (or (<= b 7.5e-30) (and (not (<= b 8.5e+26)) (<= b 1.05e+65)))
(* x 2.0)
(* 27.0 (* a b)))))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.8e-51) {
tmp = a * (27.0 * b);
} else if ((b <= 7.5e-30) || (!(b <= 8.5e+26) && (b <= 1.05e+65))) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (b <= (-1.8d-51)) then
tmp = a * (27.0d0 * b)
else if ((b <= 7.5d-30) .or. (.not. (b <= 8.5d+26)) .and. (b <= 1.05d+65)) then
tmp = x * 2.0d0
else
tmp = 27.0d0 * (a * b)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.8e-51) {
tmp = a * (27.0 * b);
} else if ((b <= 7.5e-30) || (!(b <= 8.5e+26) && (b <= 1.05e+65))) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) [x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if b <= -1.8e-51: tmp = a * (27.0 * b) elif (b <= 7.5e-30) or (not (b <= 8.5e+26) and (b <= 1.05e+65)): tmp = x * 2.0 else: tmp = 27.0 * (a * b) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.8e-51) tmp = Float64(a * Float64(27.0 * b)); elseif ((b <= 7.5e-30) || (!(b <= 8.5e+26) && (b <= 1.05e+65))) tmp = Float64(x * 2.0); else tmp = Float64(27.0 * Float64(a * b)); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (b <= -1.8e-51)
tmp = a * (27.0 * b);
elseif ((b <= 7.5e-30) || (~((b <= 8.5e+26)) && (b <= 1.05e+65)))
tmp = x * 2.0;
else
tmp = 27.0 * (a * b);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.8e-51], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[b, 7.5e-30], And[N[Not[LessEqual[b, 8.5e+26]], $MachinePrecision], LessEqual[b, 1.05e+65]]], N[(x * 2.0), $MachinePrecision], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.8 \cdot 10^{-51}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;b \leq 7.5 \cdot 10^{-30} \lor \neg \left(b \leq 8.5 \cdot 10^{+26}\right) \land b \leq 1.05 \cdot 10^{+65}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if b < -1.8e-51Initial program 96.4%
Taylor expanded in y around 0 96.4%
Taylor expanded in x around 0 86.6%
*-commutative86.6%
*-commutative86.6%
*-commutative86.6%
associate-*r*86.4%
metadata-eval86.4%
distribute-rgt-neg-in86.4%
associate-*r*86.4%
distribute-rgt-neg-in86.4%
associate-*l*86.4%
*-commutative86.4%
distribute-rgt-neg-in86.4%
*-commutative86.4%
distribute-rgt-neg-in86.4%
metadata-eval86.4%
Simplified86.4%
Taylor expanded in y around 0 86.4%
Taylor expanded in z around 0 55.7%
associate-*r*55.7%
*-commutative55.7%
associate-*r*55.7%
Simplified55.7%
if -1.8e-51 < b < 7.5000000000000006e-30 or 8.5e26 < b < 1.04999999999999996e65Initial program 91.8%
+-commutative91.8%
sub-neg91.8%
associate-+r+91.8%
associate-*l*93.6%
distribute-rgt-neg-in93.6%
*-commutative93.6%
distribute-rgt-neg-in93.6%
associate-*l*93.4%
associate-+r+93.4%
sub-neg93.4%
associate-*l*93.4%
fma-define93.4%
fma-neg93.4%
distribute-rgt-neg-in93.4%
*-commutative93.4%
associate-*r*91.8%
Simplified92.6%
fma-undefine92.6%
fma-undefine92.6%
associate-+r+92.6%
*-commutative92.6%
associate-*l*92.6%
*-commutative92.6%
associate-*r*94.5%
*-commutative94.5%
*-commutative94.5%
associate-*r*94.5%
Applied egg-rr94.5%
Taylor expanded in x around inf 45.0%
if 7.5000000000000006e-30 < b < 8.5e26 or 1.04999999999999996e65 < b Initial program 93.1%
Taylor expanded in y around 0 93.1%
Taylor expanded in x around 0 80.1%
*-commutative80.1%
*-commutative80.1%
*-commutative80.1%
associate-*r*78.6%
metadata-eval78.6%
distribute-rgt-neg-in78.6%
associate-*r*77.3%
distribute-rgt-neg-in77.3%
associate-*l*77.2%
*-commutative77.2%
distribute-rgt-neg-in77.2%
*-commutative77.2%
distribute-rgt-neg-in77.2%
metadata-eval77.2%
Simplified77.2%
Taylor expanded in y around 0 77.3%
Taylor expanded in z around 0 63.7%
Final simplification53.5%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 6.8e+70) (+ (+ (* x 2.0) (* 27.0 (* a b))) (* y (* z (* -9.0 t)))) (- (* x 2.0) (* 9.0 (* t (* y z))))))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 6.8e+70) {
tmp = ((x * 2.0) + (27.0 * (a * b))) + (y * (z * (-9.0 * t)));
} else {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (z <= 6.8d+70) then
tmp = ((x * 2.0d0) + (27.0d0 * (a * b))) + (y * (z * ((-9.0d0) * t)))
else
tmp = (x * 2.0d0) - (9.0d0 * (t * (y * z)))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 6.8e+70) {
tmp = ((x * 2.0) + (27.0 * (a * b))) + (y * (z * (-9.0 * t)));
} else {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) [x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= 6.8e+70: tmp = ((x * 2.0) + (27.0 * (a * b))) + (y * (z * (-9.0 * t))) else: tmp = (x * 2.0) - (9.0 * (t * (y * z))) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 6.8e+70) tmp = Float64(Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))) + Float64(y * Float64(z * Float64(-9.0 * t)))); else tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(y * z)))); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= 6.8e+70)
tmp = ((x * 2.0) + (27.0 * (a * b))) + (y * (z * (-9.0 * t)));
else
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 6.8e+70], N[(N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(z * N[(-9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 6.8 \cdot 10^{+70}:\\
\;\;\;\;\left(x \cdot 2 + 27 \cdot \left(a \cdot b\right)\right) + y \cdot \left(z \cdot \left(-9 \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if z < 6.8000000000000002e70Initial program 96.6%
+-commutative96.6%
sub-neg96.6%
associate-+r+96.6%
associate-*l*96.5%
distribute-rgt-neg-in96.5%
*-commutative96.5%
distribute-rgt-neg-in96.5%
associate-*l*93.7%
associate-+r+93.7%
sub-neg93.7%
associate-*l*93.7%
fma-define93.7%
fma-neg93.7%
distribute-rgt-neg-in93.7%
*-commutative93.7%
associate-*r*96.6%
Simplified97.0%
fma-undefine97.0%
fma-undefine97.0%
associate-+r+97.0%
*-commutative97.0%
associate-*l*97.0%
*-commutative97.0%
associate-*r*97.0%
*-commutative97.0%
*-commutative97.0%
associate-*r*97.0%
Applied egg-rr97.0%
if 6.8000000000000002e70 < z Initial program 82.7%
associate-*l*87.7%
associate-*l*87.7%
Simplified87.7%
Taylor expanded in a around 0 63.5%
Final simplification89.8%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 9.5e+54) (+ (+ (* x 2.0) (* 27.0 (* a b))) (* y (* z (* -9.0 t)))) (+ (- (* x 2.0) (* t (* 9.0 (* y z)))) (* b (* a 27.0)))))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 9.5e+54) {
tmp = ((x * 2.0) + (27.0 * (a * b))) + (y * (z * (-9.0 * t)));
} else {
tmp = ((x * 2.0) - (t * (9.0 * (y * z)))) + (b * (a * 27.0));
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (z <= 9.5d+54) then
tmp = ((x * 2.0d0) + (27.0d0 * (a * b))) + (y * (z * ((-9.0d0) * t)))
else
tmp = ((x * 2.0d0) - (t * (9.0d0 * (y * z)))) + (b * (a * 27.0d0))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 9.5e+54) {
tmp = ((x * 2.0) + (27.0 * (a * b))) + (y * (z * (-9.0 * t)));
} else {
tmp = ((x * 2.0) - (t * (9.0 * (y * z)))) + (b * (a * 27.0));
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) [x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= 9.5e+54: tmp = ((x * 2.0) + (27.0 * (a * b))) + (y * (z * (-9.0 * t))) else: tmp = ((x * 2.0) - (t * (9.0 * (y * z)))) + (b * (a * 27.0)) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 9.5e+54) tmp = Float64(Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))) + Float64(y * Float64(z * Float64(-9.0 * t)))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(9.0 * Float64(y * z)))) + Float64(b * Float64(a * 27.0))); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= 9.5e+54)
tmp = ((x * 2.0) + (27.0 * (a * b))) + (y * (z * (-9.0 * t)));
else
tmp = ((x * 2.0) - (t * (9.0 * (y * z)))) + (b * (a * 27.0));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 9.5e+54], N[(N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(y * N[(z * N[(-9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 9.5 \cdot 10^{+54}:\\
\;\;\;\;\left(x \cdot 2 + 27 \cdot \left(a \cdot b\right)\right) + y \cdot \left(z \cdot \left(-9 \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(9 \cdot \left(y \cdot z\right)\right)\right) + b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if z < 9.4999999999999999e54Initial program 96.5%
+-commutative96.5%
sub-neg96.5%
associate-+r+96.5%
associate-*l*96.5%
distribute-rgt-neg-in96.5%
*-commutative96.5%
distribute-rgt-neg-in96.5%
associate-*l*93.7%
associate-+r+93.7%
sub-neg93.7%
associate-*l*93.7%
fma-define93.7%
fma-neg93.7%
distribute-rgt-neg-in93.7%
*-commutative93.7%
associate-*r*96.5%
Simplified97.0%
fma-undefine97.0%
fma-undefine97.0%
associate-+r+97.0%
*-commutative97.0%
associate-*l*97.0%
*-commutative97.0%
associate-*r*96.9%
*-commutative96.9%
*-commutative96.9%
associate-*r*96.9%
Applied egg-rr96.9%
if 9.4999999999999999e54 < z Initial program 83.3%
Taylor expanded in y around 0 83.3%
Final simplification93.9%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* x 2.0) (* 27.0 (* a b)))))
(if (<= z 1.05e+55)
(+ t_1 (* y (* z (* -9.0 t))))
(- t_1 (* (* y t) (* 9.0 z))))))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * 2.0) + (27.0 * (a * b));
double tmp;
if (z <= 1.05e+55) {
tmp = t_1 + (y * (z * (-9.0 * t)));
} else {
tmp = t_1 - ((y * t) * (9.0 * z));
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: t_1
real(8) :: tmp
t_1 = (x * 2.0d0) + (27.0d0 * (a * b))
if (z <= 1.05d+55) then
tmp = t_1 + (y * (z * ((-9.0d0) * t)))
else
tmp = t_1 - ((y * t) * (9.0d0 * z))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * 2.0) + (27.0 * (a * b));
double tmp;
if (z <= 1.05e+55) {
tmp = t_1 + (y * (z * (-9.0 * t)));
} else {
tmp = t_1 - ((y * t) * (9.0 * z));
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) [x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): t_1 = (x * 2.0) + (27.0 * (a * b)) tmp = 0 if z <= 1.05e+55: tmp = t_1 + (y * (z * (-9.0 * t))) else: tmp = t_1 - ((y * t) * (9.0 * z)) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))) tmp = 0.0 if (z <= 1.05e+55) tmp = Float64(t_1 + Float64(y * Float64(z * Float64(-9.0 * t)))); else tmp = Float64(t_1 - Float64(Float64(y * t) * Float64(9.0 * z))); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = (x * 2.0) + (27.0 * (a * b));
tmp = 0.0;
if (z <= 1.05e+55)
tmp = t_1 + (y * (z * (-9.0 * t)));
else
tmp = t_1 - ((y * t) * (9.0 * z));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 1.05e+55], N[(t$95$1 + N[(y * N[(z * N[(-9.0 * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 - N[(N[(y * t), $MachinePrecision] * N[(9.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;z \leq 1.05 \cdot 10^{+55}:\\
\;\;\;\;t\_1 + y \cdot \left(z \cdot \left(-9 \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 - \left(y \cdot t\right) \cdot \left(9 \cdot z\right)\\
\end{array}
\end{array}
if z < 1.05e55Initial program 96.5%
+-commutative96.5%
sub-neg96.5%
associate-+r+96.5%
associate-*l*96.5%
distribute-rgt-neg-in96.5%
*-commutative96.5%
distribute-rgt-neg-in96.5%
associate-*l*93.7%
associate-+r+93.7%
sub-neg93.7%
associate-*l*93.7%
fma-define93.7%
fma-neg93.7%
distribute-rgt-neg-in93.7%
*-commutative93.7%
associate-*r*96.5%
Simplified97.0%
fma-undefine97.0%
fma-undefine97.0%
associate-+r+97.0%
*-commutative97.0%
associate-*l*97.0%
*-commutative97.0%
associate-*r*96.9%
*-commutative96.9%
*-commutative96.9%
associate-*r*96.9%
Applied egg-rr96.9%
if 1.05e55 < z Initial program 83.3%
associate-*l*88.2%
associate-*l*88.2%
Simplified88.2%
+-commutative88.2%
associate-+r-88.2%
*-commutative88.2%
associate-*l*88.2%
associate-*r*83.4%
*-commutative83.4%
associate-*l*83.3%
associate-*r*97.5%
Applied egg-rr97.5%
Final simplification97.0%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= b -1.3e-47)
(+ (* x 2.0) (* a (* 27.0 b)))
(if (<= b 3.9e+66)
(- (* x 2.0) (* 9.0 (* t (* y z))))
(+ (* b (* a 27.0)) (* x 2.0)))))assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.3e-47) {
tmp = (x * 2.0) + (a * (27.0 * b));
} else if (b <= 3.9e+66) {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
} else {
tmp = (b * (a * 27.0)) + (x * 2.0);
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (b <= (-1.3d-47)) then
tmp = (x * 2.0d0) + (a * (27.0d0 * b))
else if (b <= 3.9d+66) then
tmp = (x * 2.0d0) - (9.0d0 * (t * (y * z)))
else
tmp = (b * (a * 27.0d0)) + (x * 2.0d0)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.3e-47) {
tmp = (x * 2.0) + (a * (27.0 * b));
} else if (b <= 3.9e+66) {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
} else {
tmp = (b * (a * 27.0)) + (x * 2.0);
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) [x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if b <= -1.3e-47: tmp = (x * 2.0) + (a * (27.0 * b)) elif b <= 3.9e+66: tmp = (x * 2.0) - (9.0 * (t * (y * z))) else: tmp = (b * (a * 27.0)) + (x * 2.0) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.3e-47) tmp = Float64(Float64(x * 2.0) + Float64(a * Float64(27.0 * b))); elseif (b <= 3.9e+66) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(y * z)))); else tmp = Float64(Float64(b * Float64(a * 27.0)) + Float64(x * 2.0)); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (b <= -1.3e-47)
tmp = (x * 2.0) + (a * (27.0 * b));
elseif (b <= 3.9e+66)
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
else
tmp = (b * (a * 27.0)) + (x * 2.0);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.3e-47], N[(N[(x * 2.0), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.9e+66], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.3 \cdot 10^{-47}:\\
\;\;\;\;x \cdot 2 + a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;b \leq 3.9 \cdot 10^{+66}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + x \cdot 2\\
\end{array}
\end{array}
if b < -1.3e-47Initial program 96.4%
associate-*l*93.9%
associate-*l*93.9%
Simplified93.9%
Taylor expanded in x around inf 67.1%
if -1.3e-47 < b < 3.9000000000000004e66Initial program 91.1%
associate-*l*94.3%
associate-*l*94.3%
Simplified94.3%
Taylor expanded in a around 0 79.8%
if 3.9000000000000004e66 < b Initial program 94.9%
Taylor expanded in y around 0 94.9%
Taylor expanded in x around inf 83.4%
Final simplification76.6%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (+ (* x 2.0) (* 27.0 (* a b))))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return (x * 2.0) + (27.0 * (a * b));
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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
code = (x * 2.0d0) + (27.0d0 * (a * b))
end function
assert x < y && y < z && z < t && t < a && a < b;
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return (x * 2.0) + (27.0 * (a * b));
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) [x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): return (x * 2.0) + (27.0 * (a * b))
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))) end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = (x * 2.0) + (27.0 * (a * b));
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
x \cdot 2 + 27 \cdot \left(a \cdot b\right)
\end{array}
Initial program 93.6%
associate-*l*94.7%
associate-*l*94.7%
Simplified94.7%
Taylor expanded in y around 0 65.0%
Final simplification65.0%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (+ (* b (* a 27.0)) (* x 2.0)))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return (b * (a * 27.0)) + (x * 2.0);
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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
code = (b * (a * 27.0d0)) + (x * 2.0d0)
end function
assert x < y && y < z && z < t && t < a && a < b;
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return (b * (a * 27.0)) + (x * 2.0);
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) [x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): return (b * (a * 27.0)) + (x * 2.0)
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(Float64(b * Float64(a * 27.0)) + Float64(x * 2.0)) end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = (b * (a * 27.0)) + (x * 2.0);
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
b \cdot \left(a \cdot 27\right) + x \cdot 2
\end{array}
Initial program 93.6%
Taylor expanded in y around 0 93.9%
Taylor expanded in x around inf 65.0%
Final simplification65.0%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (* x 2.0))
assert(x < y && y < z && z < t && t < a && a < b);
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
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
code = x * 2.0d0
end function
assert x < y && y < z && z < t && t < a && a < b;
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) [x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): return x * 2.0
x, y, z, t, a, b = sort([x, y, z, t, a, b]) x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(x * 2.0) end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = x * 2.0;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(x * 2.0), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\\\
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
x \cdot 2
\end{array}
Initial program 93.6%
+-commutative93.6%
sub-neg93.6%
associate-+r+93.6%
associate-*l*94.7%
distribute-rgt-neg-in94.7%
*-commutative94.7%
distribute-rgt-neg-in94.7%
associate-*l*94.5%
associate-+r+94.5%
sub-neg94.5%
associate-*l*94.2%
fma-define94.2%
fma-neg94.2%
distribute-rgt-neg-in94.2%
*-commutative94.2%
associate-*r*93.2%
Simplified93.6%
fma-undefine93.6%
fma-undefine93.6%
associate-+r+93.6%
*-commutative93.6%
associate-*l*93.9%
*-commutative93.9%
associate-*r*95.0%
*-commutative95.0%
*-commutative95.0%
associate-*r*95.0%
Applied egg-rr95.0%
Taylor expanded in x around inf 27.8%
Final simplification27.8%
(FPCore (x y z t a b) :precision binary64 (if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
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) :: tmp
if (y < 7.590524218811189d-161) then
tmp = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + (a * (27.0d0 * b))
else
tmp = ((x * 2.0d0) - (9.0d0 * (y * (t * z)))) + ((a * 27.0d0) * b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y < 7.590524218811189e-161: tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)) else: tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y < 7.590524218811189e-161) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(t * z)))) + Float64(Float64(a * 27.0) * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y < 7.590524218811189e-161) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)); else tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Less[y, 7.590524218811189e-161], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y < 7.590524218811189 \cdot 10^{-161}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\
\end{array}
\end{array}
herbie shell --seed 2024034
(FPCore (x y z t a b)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, A"
:precision binary64
:herbie-target
(if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b)))
(+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))