
(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. (FPCore (x y z t a b) :precision binary64 (fma a (* 27.0 b) (fma x 2.0 (* t (* y (* -9.0 z))))))
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 fma(a, (27.0 * b), fma(x, 2.0, (t * (y * (-9.0 * z)))));
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(t * Float64(y * Float64(-9.0 * z))))) end
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[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0 + N[(t * N[(y * N[(-9.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\mathsf{fma}\left(a, 27 \cdot b, \mathsf{fma}\left(x, 2, t \cdot \left(y \cdot \left(-9 \cdot z\right)\right)\right)\right)
\end{array}
Initial program 95.7%
+-commutative95.7%
associate-+r-95.7%
*-commutative95.7%
cancel-sign-sub-inv95.7%
associate-*r*94.6%
distribute-lft-neg-in94.6%
*-commutative94.6%
cancel-sign-sub-inv94.6%
associate-+r-94.6%
associate-*l*94.6%
fma-def95.0%
cancel-sign-sub-inv95.0%
fma-def95.0%
*-commutative95.0%
distribute-rgt-neg-in95.0%
distribute-lft-neg-out95.0%
associate-*r*96.1%
associate-*l*96.1%
Simplified96.1%
Final simplification96.1%
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 (* 27.0 (* a b))))
(if (<= z -5e+88)
(* -9.0 (* y (* t z)))
(if (<= z -4.5e+64)
t_1
(if (or (<= z -78000000000000.0) (not (<= z 1.15e+93)))
(* -9.0 (* z (* t y)))
(+ t_1 (* x 2.0)))))))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 = 27.0 * (a * b);
double tmp;
if (z <= -5e+88) {
tmp = -9.0 * (y * (t * z));
} else if (z <= -4.5e+64) {
tmp = t_1;
} else if ((z <= -78000000000000.0) || !(z <= 1.15e+93)) {
tmp = -9.0 * (z * (t * y));
} else {
tmp = t_1 + (x * 2.0);
}
return tmp;
}
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 = 27.0d0 * (a * b)
if (z <= (-5d+88)) then
tmp = (-9.0d0) * (y * (t * z))
else if (z <= (-4.5d+64)) then
tmp = t_1
else if ((z <= (-78000000000000.0d0)) .or. (.not. (z <= 1.15d+93))) then
tmp = (-9.0d0) * (z * (t * y))
else
tmp = t_1 + (x * 2.0d0)
end if
code = tmp
end function
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 = 27.0 * (a * b);
double tmp;
if (z <= -5e+88) {
tmp = -9.0 * (y * (t * z));
} else if (z <= -4.5e+64) {
tmp = t_1;
} else if ((z <= -78000000000000.0) || !(z <= 1.15e+93)) {
tmp = -9.0 * (z * (t * y));
} else {
tmp = t_1 + (x * 2.0);
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): t_1 = 27.0 * (a * b) tmp = 0 if z <= -5e+88: tmp = -9.0 * (y * (t * z)) elif z <= -4.5e+64: tmp = t_1 elif (z <= -78000000000000.0) or not (z <= 1.15e+93): tmp = -9.0 * (z * (t * y)) else: tmp = t_1 + (x * 2.0) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (z <= -5e+88) tmp = Float64(-9.0 * Float64(y * Float64(t * z))); elseif (z <= -4.5e+64) tmp = t_1; elseif ((z <= -78000000000000.0) || !(z <= 1.15e+93)) tmp = Float64(-9.0 * Float64(z * Float64(t * y))); else tmp = Float64(t_1 + Float64(x * 2.0)); end return tmp end
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 = 27.0 * (a * b);
tmp = 0.0;
if (z <= -5e+88)
tmp = -9.0 * (y * (t * z));
elseif (z <= -4.5e+64)
tmp = t_1;
elseif ((z <= -78000000000000.0) || ~((z <= 1.15e+93)))
tmp = -9.0 * (z * (t * y));
else
tmp = t_1 + (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.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5e+88], N[(-9.0 * N[(y * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -4.5e+64], t$95$1, If[Or[LessEqual[z, -78000000000000.0], N[Not[LessEqual[z, 1.15e+93]], $MachinePrecision]], N[(-9.0 * N[(z * N[(t * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;z \leq -5 \cdot 10^{+88}:\\
\;\;\;\;-9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\\
\mathbf{elif}\;z \leq -4.5 \cdot 10^{+64}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq -78000000000000 \lor \neg \left(z \leq 1.15 \cdot 10^{+93}\right):\\
\;\;\;\;-9 \cdot \left(z \cdot \left(t \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + x \cdot 2\\
\end{array}
\end{array}
if z < -4.99999999999999997e88Initial program 95.6%
sub-neg95.6%
sub-neg95.6%
associate-*l*91.2%
associate-*l*91.1%
Simplified91.1%
Taylor expanded in y around inf 49.6%
expm1-log1p-u27.8%
expm1-udef27.6%
*-commutative27.6%
associate-*l*27.6%
Applied egg-rr27.6%
expm1-def27.8%
expm1-log1p46.9%
*-commutative46.9%
associate-*l*53.5%
Simplified53.5%
Taylor expanded in z around 0 49.6%
*-commutative49.6%
associate-*l*46.9%
*-commutative46.9%
Simplified46.9%
if -4.99999999999999997e88 < z < -4.49999999999999973e64Initial program 100.0%
sub-neg100.0%
sub-neg100.0%
associate-*l*100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in a around inf 67.3%
if -4.49999999999999973e64 < z < -7.8e13 or 1.1500000000000001e93 < z Initial program 86.6%
sub-neg86.6%
sub-neg86.6%
associate-*l*89.6%
associate-*l*89.7%
Simplified89.7%
Taylor expanded in y around inf 59.7%
expm1-log1p-u31.2%
expm1-udef29.5%
*-commutative29.5%
associate-*l*30.8%
Applied egg-rr30.8%
expm1-def32.5%
expm1-log1p62.3%
*-commutative62.3%
associate-*l*63.9%
Simplified63.9%
if -7.8e13 < z < 1.1500000000000001e93Initial program 99.2%
sub-neg99.2%
sub-neg99.2%
associate-*l*98.6%
associate-*l*98.5%
Simplified98.5%
Taylor expanded in y around 0 72.3%
Final simplification66.0%
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 (+ (* y (* z (* t -9.0))) (+ (* 27.0 (* a b)) (* x 2.0))))
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 (y * (z * (t * -9.0))) + ((27.0 * (a * b)) + (x * 2.0));
}
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 = (y * (z * (t * (-9.0d0)))) + ((27.0d0 * (a * b)) + (x * 2.0d0))
end function
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 (y * (z * (t * -9.0))) + ((27.0 * (a * b)) + (x * 2.0));
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): return (y * (z * (t * -9.0))) + ((27.0 * (a * b)) + (x * 2.0))
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(Float64(y * Float64(z * Float64(t * -9.0))) + Float64(Float64(27.0 * Float64(a * b)) + Float64(x * 2.0))) end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = (y * (z * (t * -9.0))) + ((27.0 * (a * b)) + (x * 2.0));
end
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[(y * N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
y \cdot \left(z \cdot \left(t \cdot -9\right)\right) + \left(27 \cdot \left(a \cdot b\right) + x \cdot 2\right)
\end{array}
Initial program 95.7%
+-commutative95.7%
associate-+r-95.7%
*-commutative95.7%
cancel-sign-sub-inv95.7%
associate-*r*94.6%
distribute-lft-neg-in94.6%
*-commutative94.6%
cancel-sign-sub-inv94.6%
associate-+r-94.6%
associate-*l*94.6%
fma-def95.0%
cancel-sign-sub-inv95.0%
fma-def95.0%
*-commutative95.0%
distribute-rgt-neg-in95.0%
distribute-lft-neg-out95.0%
associate-*r*96.1%
associate-*l*96.1%
Simplified96.1%
fma-udef95.7%
fma-udef95.7%
associate-+r+95.7%
associate-*r*95.7%
*-commutative95.7%
associate-*l*95.7%
*-commutative95.7%
associate-*l*94.8%
*-commutative94.8%
associate-*r*94.8%
*-commutative94.8%
Applied egg-rr94.8%
Final simplification94.8%
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) (* (* y 9.0) (* t z))) (* a (* 27.0 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) - ((y * 9.0) * (t * z))) + (a * (27.0 * b));
}
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) - ((y * 9.0d0) * (t * z))) + (a * (27.0d0 * b))
end function
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) - ((y * 9.0) * (t * z))) + (a * (27.0 * 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) - ((y * 9.0) * (t * z))) + (a * (27.0 * 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(Float64(x * 2.0) - Float64(Float64(y * 9.0) * Float64(t * z))) + Float64(a * Float64(27.0 * b))) end
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) - ((y * 9.0) * (t * z))) + (a * (27.0 * b));
end
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[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(t \cdot z\right)\right) + a \cdot \left(27 \cdot b\right)
\end{array}
Initial program 95.7%
sub-neg95.7%
sub-neg95.7%
associate-*l*95.3%
associate-*l*95.3%
Simplified95.3%
Final simplification95.3%
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) (* t (* z (* y 9.0)))) (* b (* a 27.0))))
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) - (t * (z * (y * 9.0)))) + (b * (a * 27.0));
}
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) - (t * (z * (y * 9.0d0)))) + (b * (a * 27.0d0))
end function
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) - (t * (z * (y * 9.0)))) + (b * (a * 27.0));
}
[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) - (t * (z * (y * 9.0)))) + (b * (a * 27.0))
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(z * Float64(y * 9.0)))) + Float64(b * Float64(a * 27.0))) end
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) - (t * (z * (y * 9.0)))) + (b * (a * 27.0));
end
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[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(z * N[(y * 9.0), $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])\\
\\
\left(x \cdot 2 - t \cdot \left(z \cdot \left(y \cdot 9\right)\right)\right) + b \cdot \left(a \cdot 27\right)
\end{array}
Initial program 95.7%
Final simplification95.7%
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 (* -9.0 (* t (* y z)))))
(if (<= x -9.5e+19)
(* x 2.0)
(if (<= x -1.55e-124)
t_1
(if (<= x 5e-226)
(* 27.0 (* a b))
(if (<= x 1.75e-39) t_1 (* x 2.0)))))))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 = -9.0 * (t * (y * z));
double tmp;
if (x <= -9.5e+19) {
tmp = x * 2.0;
} else if (x <= -1.55e-124) {
tmp = t_1;
} else if (x <= 5e-226) {
tmp = 27.0 * (a * b);
} else if (x <= 1.75e-39) {
tmp = t_1;
} 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.
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 = (-9.0d0) * (t * (y * z))
if (x <= (-9.5d+19)) then
tmp = x * 2.0d0
else if (x <= (-1.55d-124)) then
tmp = t_1
else if (x <= 5d-226) then
tmp = 27.0d0 * (a * b)
else if (x <= 1.75d-39) then
tmp = t_1
else
tmp = x * 2.0d0
end if
code = tmp
end function
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 = -9.0 * (t * (y * z));
double tmp;
if (x <= -9.5e+19) {
tmp = x * 2.0;
} else if (x <= -1.55e-124) {
tmp = t_1;
} else if (x <= 5e-226) {
tmp = 27.0 * (a * b);
} else if (x <= 1.75e-39) {
tmp = t_1;
} else {
tmp = x * 2.0;
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): t_1 = -9.0 * (t * (y * z)) tmp = 0 if x <= -9.5e+19: tmp = x * 2.0 elif x <= -1.55e-124: tmp = t_1 elif x <= 5e-226: tmp = 27.0 * (a * b) elif x <= 1.75e-39: tmp = t_1 else: tmp = x * 2.0 return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(-9.0 * Float64(t * Float64(y * z))) tmp = 0.0 if (x <= -9.5e+19) tmp = Float64(x * 2.0); elseif (x <= -1.55e-124) tmp = t_1; elseif (x <= 5e-226) tmp = Float64(27.0 * Float64(a * b)); elseif (x <= 1.75e-39) tmp = t_1; else tmp = Float64(x * 2.0); end return tmp end
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 = -9.0 * (t * (y * z));
tmp = 0.0;
if (x <= -9.5e+19)
tmp = x * 2.0;
elseif (x <= -1.55e-124)
tmp = t_1;
elseif (x <= 5e-226)
tmp = 27.0 * (a * b);
elseif (x <= 1.75e-39)
tmp = t_1;
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.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(-9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.5e+19], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, -1.55e-124], t$95$1, If[LessEqual[x, 5e-226], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.75e-39], t$95$1, N[(x * 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := -9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{+19}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -1.55 \cdot 10^{-124}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5 \cdot 10^{-226}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;x \leq 1.75 \cdot 10^{-39}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -9.5e19 or 1.75e-39 < x Initial program 95.6%
sub-neg95.6%
sub-neg95.6%
associate-*l*95.5%
associate-*l*95.5%
Simplified95.5%
Taylor expanded in x around inf 53.3%
if -9.5e19 < x < -1.5499999999999999e-124 or 4.9999999999999998e-226 < x < 1.75e-39Initial program 94.2%
sub-neg94.2%
sub-neg94.2%
associate-*l*95.6%
associate-*l*95.6%
Simplified95.6%
Taylor expanded in y around inf 66.8%
if -1.5499999999999999e-124 < x < 4.9999999999999998e-226Initial program 98.0%
sub-neg98.0%
sub-neg98.0%
associate-*l*94.3%
associate-*l*94.1%
Simplified94.1%
Taylor expanded in a around inf 66.4%
Final simplification59.7%
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 (* -9.0 (* y (* t z)))))
(if (<= x -9.5e+19)
(* x 2.0)
(if (<= x -7.8e-126)
t_1
(if (<= x 2.4e-225)
(* 27.0 (* a b))
(if (<= x 1.8e-33) t_1 (* x 2.0)))))))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 = -9.0 * (y * (t * z));
double tmp;
if (x <= -9.5e+19) {
tmp = x * 2.0;
} else if (x <= -7.8e-126) {
tmp = t_1;
} else if (x <= 2.4e-225) {
tmp = 27.0 * (a * b);
} else if (x <= 1.8e-33) {
tmp = t_1;
} 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.
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 = (-9.0d0) * (y * (t * z))
if (x <= (-9.5d+19)) then
tmp = x * 2.0d0
else if (x <= (-7.8d-126)) then
tmp = t_1
else if (x <= 2.4d-225) then
tmp = 27.0d0 * (a * b)
else if (x <= 1.8d-33) then
tmp = t_1
else
tmp = x * 2.0d0
end if
code = tmp
end function
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 = -9.0 * (y * (t * z));
double tmp;
if (x <= -9.5e+19) {
tmp = x * 2.0;
} else if (x <= -7.8e-126) {
tmp = t_1;
} else if (x <= 2.4e-225) {
tmp = 27.0 * (a * b);
} else if (x <= 1.8e-33) {
tmp = t_1;
} else {
tmp = x * 2.0;
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): t_1 = -9.0 * (y * (t * z)) tmp = 0 if x <= -9.5e+19: tmp = x * 2.0 elif x <= -7.8e-126: tmp = t_1 elif x <= 2.4e-225: tmp = 27.0 * (a * b) elif x <= 1.8e-33: tmp = t_1 else: tmp = x * 2.0 return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(-9.0 * Float64(y * Float64(t * z))) tmp = 0.0 if (x <= -9.5e+19) tmp = Float64(x * 2.0); elseif (x <= -7.8e-126) tmp = t_1; elseif (x <= 2.4e-225) tmp = Float64(27.0 * Float64(a * b)); elseif (x <= 1.8e-33) tmp = t_1; else tmp = Float64(x * 2.0); end return tmp end
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 = -9.0 * (y * (t * z));
tmp = 0.0;
if (x <= -9.5e+19)
tmp = x * 2.0;
elseif (x <= -7.8e-126)
tmp = t_1;
elseif (x <= 2.4e-225)
tmp = 27.0 * (a * b);
elseif (x <= 1.8e-33)
tmp = t_1;
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.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(-9.0 * N[(y * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -9.5e+19], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, -7.8e-126], t$95$1, If[LessEqual[x, 2.4e-225], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.8e-33], t$95$1, N[(x * 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := -9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\\
\mathbf{if}\;x \leq -9.5 \cdot 10^{+19}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -7.8 \cdot 10^{-126}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-225}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{-33}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -9.5e19 or 1.80000000000000017e-33 < x Initial program 96.3%
sub-neg96.3%
sub-neg96.3%
associate-*l*97.0%
associate-*l*96.9%
Simplified96.9%
Taylor expanded in x around inf 54.1%
if -9.5e19 < x < -7.7999999999999996e-126 or 2.39999999999999996e-225 < x < 1.80000000000000017e-33Initial program 93.0%
sub-neg93.0%
sub-neg93.0%
associate-*l*93.0%
associate-*l*93.0%
Simplified93.0%
Taylor expanded in y around inf 66.3%
expm1-log1p-u37.2%
expm1-udef32.3%
*-commutative32.3%
associate-*l*34.7%
Applied egg-rr34.7%
expm1-def39.6%
expm1-log1p66.2%
*-commutative66.2%
associate-*l*61.0%
Simplified61.0%
Taylor expanded in z around 0 66.3%
*-commutative66.3%
associate-*l*66.2%
*-commutative66.2%
Simplified66.2%
if -7.7999999999999996e-126 < x < 2.39999999999999996e-225Initial program 98.0%
sub-neg98.0%
sub-neg98.0%
associate-*l*94.3%
associate-*l*94.1%
Simplified94.1%
Taylor expanded in a around inf 66.4%
Final simplification60.0%
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 (<= a -1.35e+144) (not (<= a 3.4e-41))) (+ (* 27.0 (* a b)) (* x 2.0)) (- (* x 2.0) (* 9.0 (* t (* y z))))))
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 ((a <= -1.35e+144) || !(a <= 3.4e-41)) {
tmp = (27.0 * (a * b)) + (x * 2.0);
} 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.
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 ((a <= (-1.35d+144)) .or. (.not. (a <= 3.4d-41))) then
tmp = (27.0d0 * (a * b)) + (x * 2.0d0)
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;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1.35e+144) || !(a <= 3.4e-41)) {
tmp = (27.0 * (a * b)) + (x * 2.0);
} 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]) def code(x, y, z, t, a, b): tmp = 0 if (a <= -1.35e+144) or not (a <= 3.4e-41): tmp = (27.0 * (a * b)) + (x * 2.0) 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]) function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1.35e+144) || !(a <= 3.4e-41)) tmp = Float64(Float64(27.0 * Float64(a * b)) + Float64(x * 2.0)); 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])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((a <= -1.35e+144) || ~((a <= 3.4e-41)))
tmp = (27.0 * (a * b)) + (x * 2.0);
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. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1.35e+144], N[Not[LessEqual[a, 3.4e-41]], $MachinePrecision]], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $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])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.35 \cdot 10^{+144} \lor \neg \left(a \leq 3.4 \cdot 10^{-41}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right) + x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if a < -1.35000000000000008e144 or 3.3999999999999998e-41 < a Initial program 96.0%
sub-neg96.0%
sub-neg96.0%
associate-*l*95.9%
associate-*l*95.9%
Simplified95.9%
Taylor expanded in y around 0 66.2%
if -1.35000000000000008e144 < a < 3.3999999999999998e-41Initial program 95.5%
sub-neg95.5%
sub-neg95.5%
associate-*l*94.9%
associate-*l*94.9%
Simplified94.9%
Taylor expanded in a around 0 76.8%
Final simplification72.6%
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 (<= a -1.55e+38)
(+ (* a (* 27.0 b)) (* -9.0 (* y (* t z))))
(if (<= a 2.7e-41)
(- (* x 2.0) (* 9.0 (* t (* y z))))
(+ (* 27.0 (* a b)) (* x 2.0)))))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 (a <= -1.55e+38) {
tmp = (a * (27.0 * b)) + (-9.0 * (y * (t * z)));
} else if (a <= 2.7e-41) {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
} else {
tmp = (27.0 * (a * b)) + (x * 2.0);
}
return tmp;
}
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 (a <= (-1.55d+38)) then
tmp = (a * (27.0d0 * b)) + ((-9.0d0) * (y * (t * z)))
else if (a <= 2.7d-41) then
tmp = (x * 2.0d0) - (9.0d0 * (t * (y * z)))
else
tmp = (27.0d0 * (a * b)) + (x * 2.0d0)
end if
code = tmp
end function
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 (a <= -1.55e+38) {
tmp = (a * (27.0 * b)) + (-9.0 * (y * (t * z)));
} else if (a <= 2.7e-41) {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
} else {
tmp = (27.0 * (a * b)) + (x * 2.0);
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if a <= -1.55e+38: tmp = (a * (27.0 * b)) + (-9.0 * (y * (t * z))) elif a <= 2.7e-41: tmp = (x * 2.0) - (9.0 * (t * (y * z))) else: tmp = (27.0 * (a * b)) + (x * 2.0) return tmp
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 (a <= -1.55e+38) tmp = Float64(Float64(a * Float64(27.0 * b)) + Float64(-9.0 * Float64(y * Float64(t * z)))); elseif (a <= 2.7e-41) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(y * z)))); else tmp = Float64(Float64(27.0 * Float64(a * b)) + Float64(x * 2.0)); end return tmp end
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 (a <= -1.55e+38)
tmp = (a * (27.0 * b)) + (-9.0 * (y * (t * z)));
elseif (a <= 2.7e-41)
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
else
tmp = (27.0 * (a * b)) + (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. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -1.55e+38], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(-9.0 * N[(y * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.7e-41], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(27.0 * N[(a * b), $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])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.55 \cdot 10^{+38}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + -9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\\
\mathbf{elif}\;a \leq 2.7 \cdot 10^{-41}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) + x \cdot 2\\
\end{array}
\end{array}
if a < -1.55000000000000009e38Initial program 94.6%
sub-neg94.6%
sub-neg94.6%
associate-*l*92.2%
associate-*l*92.1%
Simplified92.1%
Taylor expanded in x around 0 87.4%
sub-neg87.4%
*-commutative87.4%
associate-*r*87.4%
*-commutative87.4%
distribute-rgt-neg-in87.4%
*-commutative87.4%
metadata-eval87.4%
associate-*r*87.4%
*-commutative87.4%
associate-*l*82.5%
Applied egg-rr82.5%
Taylor expanded in z around 0 87.4%
*-commutative87.4%
associate-*r*84.9%
*-commutative84.9%
Simplified84.9%
if -1.55000000000000009e38 < a < 2.7e-41Initial program 95.8%
sub-neg95.8%
sub-neg95.8%
associate-*l*95.0%
associate-*l*95.0%
Simplified95.0%
Taylor expanded in a around 0 77.6%
if 2.7e-41 < a Initial program 96.2%
sub-neg96.2%
sub-neg96.2%
associate-*l*97.3%
associate-*l*97.2%
Simplified97.2%
Taylor expanded in y around 0 70.1%
Final simplification76.5%
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 (<= a -2.4e+38)
(+ (* a (* 27.0 b)) (* t (* -9.0 (* y z))))
(if (<= a 3.4e-41)
(- (* x 2.0) (* 9.0 (* t (* y z))))
(+ (* 27.0 (* a b)) (* x 2.0)))))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 (a <= -2.4e+38) {
tmp = (a * (27.0 * b)) + (t * (-9.0 * (y * z)));
} else if (a <= 3.4e-41) {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
} else {
tmp = (27.0 * (a * b)) + (x * 2.0);
}
return tmp;
}
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 (a <= (-2.4d+38)) then
tmp = (a * (27.0d0 * b)) + (t * ((-9.0d0) * (y * z)))
else if (a <= 3.4d-41) then
tmp = (x * 2.0d0) - (9.0d0 * (t * (y * z)))
else
tmp = (27.0d0 * (a * b)) + (x * 2.0d0)
end if
code = tmp
end function
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 (a <= -2.4e+38) {
tmp = (a * (27.0 * b)) + (t * (-9.0 * (y * z)));
} else if (a <= 3.4e-41) {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
} else {
tmp = (27.0 * (a * b)) + (x * 2.0);
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if a <= -2.4e+38: tmp = (a * (27.0 * b)) + (t * (-9.0 * (y * z))) elif a <= 3.4e-41: tmp = (x * 2.0) - (9.0 * (t * (y * z))) else: tmp = (27.0 * (a * b)) + (x * 2.0) return tmp
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 (a <= -2.4e+38) tmp = Float64(Float64(a * Float64(27.0 * b)) + Float64(t * Float64(-9.0 * Float64(y * z)))); elseif (a <= 3.4e-41) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(y * z)))); else tmp = Float64(Float64(27.0 * Float64(a * b)) + Float64(x * 2.0)); end return tmp end
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 (a <= -2.4e+38)
tmp = (a * (27.0 * b)) + (t * (-9.0 * (y * z)));
elseif (a <= 3.4e-41)
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
else
tmp = (27.0 * (a * b)) + (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. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2.4e+38], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(t * N[(-9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.4e-41], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(27.0 * N[(a * b), $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])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.4 \cdot 10^{+38}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + t \cdot \left(-9 \cdot \left(y \cdot z\right)\right)\\
\mathbf{elif}\;a \leq 3.4 \cdot 10^{-41}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) + x \cdot 2\\
\end{array}
\end{array}
if a < -2.40000000000000017e38Initial program 94.6%
sub-neg94.6%
sub-neg94.6%
associate-*l*92.2%
associate-*l*92.1%
Simplified92.1%
Taylor expanded in x around 0 87.4%
sub-neg87.4%
*-commutative87.4%
associate-*r*87.4%
*-commutative87.4%
distribute-rgt-neg-in87.4%
*-commutative87.4%
metadata-eval87.4%
associate-*r*87.4%
*-commutative87.4%
associate-*l*82.5%
Applied egg-rr82.5%
Taylor expanded in z around 0 87.4%
associate-*r*87.4%
associate-*r*82.5%
*-commutative82.5%
associate-*r*82.5%
associate-*l*87.4%
Simplified87.4%
Taylor expanded in y around 0 87.4%
if -2.40000000000000017e38 < a < 3.3999999999999998e-41Initial program 95.8%
sub-neg95.8%
sub-neg95.8%
associate-*l*95.0%
associate-*l*95.0%
Simplified95.0%
Taylor expanded in a around 0 77.6%
if 3.3999999999999998e-41 < a Initial program 96.2%
sub-neg96.2%
sub-neg96.2%
associate-*l*97.3%
associate-*l*97.2%
Simplified97.2%
Taylor expanded in y around 0 70.1%
Final simplification76.8%
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 (<= a -2.7e+38) (not (<= a 1.6e-58))) (* 27.0 (* a b)) (* x 2.0)))
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 ((a <= -2.7e+38) || !(a <= 1.6e-58)) {
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.
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 ((a <= (-2.7d+38)) .or. (.not. (a <= 1.6d-58))) 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;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -2.7e+38) || !(a <= 1.6e-58)) {
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]) def code(x, y, z, t, a, b): tmp = 0 if (a <= -2.7e+38) or not (a <= 1.6e-58): 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]) function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -2.7e+38) || !(a <= 1.6e-58)) 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])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((a <= -2.7e+38) || ~((a <= 1.6e-58)))
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. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -2.7e+38], N[Not[LessEqual[a, 1.6e-58]], $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])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.7 \cdot 10^{+38} \lor \neg \left(a \leq 1.6 \cdot 10^{-58}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if a < -2.69999999999999996e38 or 1.6e-58 < a Initial program 95.1%
sub-neg95.1%
sub-neg95.1%
associate-*l*95.8%
associate-*l*95.7%
Simplified95.7%
Taylor expanded in a around inf 47.0%
if -2.69999999999999996e38 < a < 1.6e-58Initial program 96.3%
sub-neg96.3%
sub-neg96.3%
associate-*l*94.8%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in x around inf 42.0%
Final simplification44.4%
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 (<= a -3.8e+38) (* 27.0 (* a b)) (if (<= a 1.6e-58) (* x 2.0) (* b (* a 27.0)))))
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 (a <= -3.8e+38) {
tmp = 27.0 * (a * b);
} else if (a <= 1.6e-58) {
tmp = x * 2.0;
} else {
tmp = b * (a * 27.0);
}
return tmp;
}
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 (a <= (-3.8d+38)) then
tmp = 27.0d0 * (a * b)
else if (a <= 1.6d-58) then
tmp = x * 2.0d0
else
tmp = b * (a * 27.0d0)
end if
code = tmp
end function
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 (a <= -3.8e+38) {
tmp = 27.0 * (a * b);
} else if (a <= 1.6e-58) {
tmp = x * 2.0;
} else {
tmp = b * (a * 27.0);
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if a <= -3.8e+38: tmp = 27.0 * (a * b) elif a <= 1.6e-58: tmp = x * 2.0 else: tmp = b * (a * 27.0) return tmp
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 (a <= -3.8e+38) tmp = Float64(27.0 * Float64(a * b)); elseif (a <= 1.6e-58) tmp = Float64(x * 2.0); else tmp = Float64(b * Float64(a * 27.0)); end return tmp end
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 (a <= -3.8e+38)
tmp = 27.0 * (a * b);
elseif (a <= 1.6e-58)
tmp = x * 2.0;
else
tmp = 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. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -3.8e+38], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 1.6e-58], N[(x * 2.0), $MachinePrecision], N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -3.8 \cdot 10^{+38}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;a \leq 1.6 \cdot 10^{-58}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if a < -3.7999999999999998e38Initial program 94.6%
sub-neg94.6%
sub-neg94.6%
associate-*l*92.2%
associate-*l*92.1%
Simplified92.1%
Taylor expanded in a around inf 45.1%
if -3.7999999999999998e38 < a < 1.6e-58Initial program 96.3%
sub-neg96.3%
sub-neg96.3%
associate-*l*94.8%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in x around inf 42.0%
if 1.6e-58 < a Initial program 95.3%
+-commutative95.3%
associate-+r-95.3%
*-commutative95.3%
cancel-sign-sub-inv95.3%
associate-*r*92.9%
distribute-lft-neg-in92.9%
*-commutative92.9%
cancel-sign-sub-inv92.9%
associate-+r-92.9%
associate-*l*92.9%
fma-def94.1%
cancel-sign-sub-inv94.1%
fma-def94.1%
*-commutative94.1%
distribute-rgt-neg-in94.1%
distribute-lft-neg-out94.1%
associate-*r*96.4%
associate-*l*96.4%
Simplified96.4%
fma-udef95.2%
fma-udef95.2%
associate-+r+95.2%
associate-*r*95.2%
*-commutative95.2%
associate-*l*95.3%
*-commutative95.3%
associate-*l*97.5%
*-commutative97.5%
associate-*r*97.5%
*-commutative97.5%
Applied egg-rr97.5%
Taylor expanded in a around inf 47.8%
associate-*r*47.8%
*-commutative47.8%
Simplified47.8%
Final simplification44.4%
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);
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.
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;
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]) 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]) 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])){:}
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. 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 \cdot 2
\end{array}
Initial program 95.7%
sub-neg95.7%
sub-neg95.7%
associate-*l*95.3%
associate-*l*95.3%
Simplified95.3%
Taylor expanded in x around inf 31.8%
Final simplification31.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 2024010
(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)))