
(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 10 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: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 3.4e+26) (fma a (* 27.0 b) (- (* x 2.0) (* 9.0 (* y (* z t))))) (+ (- (* x 2.0) (* t (* z (* 9.0 y)))) (* b (* a 27.0)))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 3.4e+26) {
tmp = fma(a, (27.0 * b), ((x * 2.0) - (9.0 * (y * (z * t)))));
} else {
tmp = ((x * 2.0) - (t * (z * (9.0 * y)))) + (b * (a * 27.0));
}
return tmp;
}
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 3.4e+26) tmp = fma(a, Float64(27.0 * b), Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t))))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(z * Float64(9.0 * y)))) + Float64(b * Float64(a * 27.0))); end return tmp end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 3.4e+26], N[(a * N[(27.0 * b), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(z * N[(9.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 3.4 \cdot 10^{+26}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(z \cdot \left(9 \cdot y\right)\right)\right) + b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if z < 3.4000000000000003e26Initial program 94.3%
+-commutative94.3%
associate-*l*94.3%
fma-def94.8%
associate-*l*94.4%
*-commutative94.4%
associate-*l*94.4%
Simplified94.4%
if 3.4000000000000003e26 < z Initial program 89.7%
Final simplification93.5%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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.4e+48)
(* y (* (* z t) -9.0))
(if (or (<= z -3.2e-108)
(and (not (<= z -1.15e-124))
(or (<= z 5.2e-17) (and (not (<= z 1.3e+48)) (<= z 3e+87)))))
(- (* x 2.0) (* a (* b -27.0)))
(* -9.0 (* y (* z t))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -6.4e+48) {
tmp = y * ((z * t) * -9.0);
} else if ((z <= -3.2e-108) || (!(z <= -1.15e-124) && ((z <= 5.2e-17) || (!(z <= 1.3e+48) && (z <= 3e+87))))) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = -9.0 * (y * (z * t));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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.4d+48)) then
tmp = y * ((z * t) * (-9.0d0))
else if ((z <= (-3.2d-108)) .or. (.not. (z <= (-1.15d-124))) .and. (z <= 5.2d-17) .or. (.not. (z <= 1.3d+48)) .and. (z <= 3d+87)) then
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
else
tmp = (-9.0d0) * (y * (z * t))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -6.4e+48) {
tmp = y * ((z * t) * -9.0);
} else if ((z <= -3.2e-108) || (!(z <= -1.15e-124) && ((z <= 5.2e-17) || (!(z <= 1.3e+48) && (z <= 3e+87))))) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = -9.0 * (y * (z * t));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -6.4e+48: tmp = y * ((z * t) * -9.0) elif (z <= -3.2e-108) or (not (z <= -1.15e-124) and ((z <= 5.2e-17) or (not (z <= 1.3e+48) and (z <= 3e+87)))): tmp = (x * 2.0) - (a * (b * -27.0)) else: tmp = -9.0 * (y * (z * t)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -6.4e+48) tmp = Float64(y * Float64(Float64(z * t) * -9.0)); elseif ((z <= -3.2e-108) || (!(z <= -1.15e-124) && ((z <= 5.2e-17) || (!(z <= 1.3e+48) && (z <= 3e+87))))) tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); else tmp = Float64(-9.0 * Float64(y * Float64(z * t))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -6.4e+48)
tmp = y * ((z * t) * -9.0);
elseif ((z <= -3.2e-108) || (~((z <= -1.15e-124)) && ((z <= 5.2e-17) || (~((z <= 1.3e+48)) && (z <= 3e+87)))))
tmp = (x * 2.0) - (a * (b * -27.0));
else
tmp = -9.0 * (y * (z * t));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -6.4e+48], N[(y * N[(N[(z * t), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -3.2e-108], And[N[Not[LessEqual[z, -1.15e-124]], $MachinePrecision], Or[LessEqual[z, 5.2e-17], And[N[Not[LessEqual[z, 1.3e+48]], $MachinePrecision], LessEqual[z, 3e+87]]]]], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.4 \cdot 10^{+48}:\\
\;\;\;\;y \cdot \left(\left(z \cdot t\right) \cdot -9\right)\\
\mathbf{elif}\;z \leq -3.2 \cdot 10^{-108} \lor \neg \left(z \leq -1.15 \cdot 10^{-124}\right) \land \left(z \leq 5.2 \cdot 10^{-17} \lor \neg \left(z \leq 1.3 \cdot 10^{+48}\right) \land z \leq 3 \cdot 10^{+87}\right):\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if z < -6.4000000000000003e48Initial program 81.7%
+-commutative81.7%
associate-*l*81.8%
fma-def81.8%
associate-*l*82.1%
*-commutative82.1%
associate-*l*82.1%
Simplified82.1%
Taylor expanded in y around inf 47.4%
*-commutative47.4%
*-commutative47.4%
associate-*r*47.4%
associate-*r*47.3%
*-commutative47.3%
associate-*l*47.4%
*-commutative47.4%
Simplified47.4%
Taylor expanded in t around 0 47.4%
if -6.4000000000000003e48 < z < -3.2e-108 or -1.15000000000000006e-124 < z < 5.20000000000000006e-17 or 1.29999999999999998e48 < z < 2.9999999999999999e87Initial program 98.0%
associate-+l-98.0%
sub-neg98.0%
neg-mul-198.0%
metadata-eval98.0%
metadata-eval98.0%
cancel-sign-sub-inv98.0%
metadata-eval98.0%
*-lft-identity98.0%
associate-*l*98.0%
associate-*l*98.6%
Simplified98.6%
Taylor expanded in y around 0 81.3%
*-commutative81.3%
associate-*l*81.3%
Simplified81.3%
if -3.2e-108 < z < -1.15000000000000006e-124 or 5.20000000000000006e-17 < z < 1.29999999999999998e48 or 2.9999999999999999e87 < z Initial program 91.3%
+-commutative91.3%
associate-*l*89.2%
fma-def89.2%
associate-*l*95.6%
*-commutative95.6%
associate-*l*95.6%
Simplified95.6%
Taylor expanded in y around inf 48.6%
Final simplification68.5%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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 (+ (* y (* (* z t) -9.0)) (* 27.0 (* a b)))))
(if (<= y -2.6e+253)
t_1
(if (<= y -9.5e+178)
(- (* x 2.0) (* 9.0 (* y (* z t))))
(if (<= y -4.9e+95) t_1 (- (* x 2.0) (* a (* b -27.0))))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y * ((z * t) * -9.0)) + (27.0 * (a * b));
double tmp;
if (y <= -2.6e+253) {
tmp = t_1;
} else if (y <= -9.5e+178) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else if (y <= -4.9e+95) {
tmp = t_1;
} else {
tmp = (x * 2.0) - (a * (b * -27.0));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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 = (y * ((z * t) * (-9.0d0))) + (27.0d0 * (a * b))
if (y <= (-2.6d+253)) then
tmp = t_1
else if (y <= (-9.5d+178)) then
tmp = (x * 2.0d0) - (9.0d0 * (y * (z * t)))
else if (y <= (-4.9d+95)) then
tmp = t_1
else
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y * ((z * t) * -9.0)) + (27.0 * (a * b));
double tmp;
if (y <= -2.6e+253) {
tmp = t_1;
} else if (y <= -9.5e+178) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else if (y <= -4.9e+95) {
tmp = t_1;
} else {
tmp = (x * 2.0) - (a * (b * -27.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = (y * ((z * t) * -9.0)) + (27.0 * (a * b)) tmp = 0 if y <= -2.6e+253: tmp = t_1 elif y <= -9.5e+178: tmp = (x * 2.0) - (9.0 * (y * (z * t))) elif y <= -4.9e+95: tmp = t_1 else: tmp = (x * 2.0) - (a * (b * -27.0)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(y * Float64(Float64(z * t) * -9.0)) + Float64(27.0 * Float64(a * b))) tmp = 0.0 if (y <= -2.6e+253) tmp = t_1; elseif (y <= -9.5e+178) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))); elseif (y <= -4.9e+95) tmp = t_1; else tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = (y * ((z * t) * -9.0)) + (27.0 * (a * b));
tmp = 0.0;
if (y <= -2.6e+253)
tmp = t_1;
elseif (y <= -9.5e+178)
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
elseif (y <= -4.9e+95)
tmp = t_1;
else
tmp = (x * 2.0) - (a * (b * -27.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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[(y * N[(N[(z * t), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.6e+253], t$95$1, If[LessEqual[y, -9.5e+178], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -4.9e+95], t$95$1, N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := y \cdot \left(\left(z \cdot t\right) \cdot -9\right) + 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;y \leq -2.6 \cdot 10^{+253}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -9.5 \cdot 10^{+178}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;y \leq -4.9 \cdot 10^{+95}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\end{array}
\end{array}
if y < -2.6e253 or -9.5e178 < y < -4.8999999999999999e95Initial program 79.3%
+-commutative79.3%
associate-*l*82.6%
fma-def86.2%
associate-*l*96.1%
*-commutative96.1%
associate-*l*96.1%
Simplified96.1%
Taylor expanded in x around 0 78.7%
cancel-sign-sub-inv78.7%
metadata-eval78.7%
+-commutative78.7%
*-commutative78.7%
associate-*l*78.7%
Applied egg-rr78.7%
if -2.6e253 < y < -9.5e178Initial program 94.8%
+-commutative94.8%
associate-*l*94.8%
fma-def94.8%
associate-*l*99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in a around 0 99.8%
if -4.8999999999999999e95 < y Initial program 95.2%
associate-+l-95.2%
sub-neg95.2%
neg-mul-195.2%
metadata-eval95.2%
metadata-eval95.2%
cancel-sign-sub-inv95.2%
metadata-eval95.2%
*-lft-identity95.2%
associate-*l*94.9%
associate-*l*94.5%
Simplified94.5%
Taylor expanded in y around 0 74.2%
*-commutative74.2%
associate-*l*73.7%
Simplified73.7%
Final simplification76.2%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z -1.4e+65) (* y (* (* z t) -9.0)) (+ (* b (* a 27.0)) (- (* x 2.0) (* t (* 9.0 (* z y)))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.4e+65) {
tmp = y * ((z * t) * -9.0);
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (z * y))));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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 <= (-1.4d+65)) then
tmp = y * ((z * t) * (-9.0d0))
else
tmp = (b * (a * 27.0d0)) + ((x * 2.0d0) - (t * (9.0d0 * (z * y))))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.4e+65) {
tmp = y * ((z * t) * -9.0);
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (z * y))));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -1.4e+65: tmp = y * ((z * t) * -9.0) else: tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (z * y)))) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.4e+65) tmp = Float64(y * Float64(Float64(z * t) * -9.0)); else tmp = Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(t * Float64(9.0 * Float64(z * y))))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -1.4e+65)
tmp = y * ((z * t) * -9.0);
else
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (z * y))));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.4e+65], N[(y * N[(N[(z * t), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(9.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+65}:\\
\;\;\;\;y \cdot \left(\left(z \cdot t\right) \cdot -9\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - t \cdot \left(9 \cdot \left(z \cdot y\right)\right)\right)\\
\end{array}
\end{array}
if z < -1.3999999999999999e65Initial program 83.3%
+-commutative83.3%
associate-*l*83.4%
fma-def83.4%
associate-*l*81.8%
*-commutative81.8%
associate-*l*81.8%
Simplified81.8%
Taylor expanded in y around inf 48.3%
*-commutative48.3%
*-commutative48.3%
associate-*r*48.3%
associate-*r*48.2%
*-commutative48.2%
associate-*l*48.3%
*-commutative48.3%
Simplified48.3%
Taylor expanded in t around 0 48.3%
if -1.3999999999999999e65 < z Initial program 96.0%
Taylor expanded in y around 0 96.0%
Final simplification86.3%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 8e-98) (+ (* x 2.0) (- (* a (* 27.0 b)) (* y (* 9.0 (* z t))))) (+ (* b (* a 27.0)) (- (* x 2.0) (* t (* 9.0 (* z y)))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 8e-98) {
tmp = (x * 2.0) + ((a * (27.0 * b)) - (y * (9.0 * (z * t))));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (z * y))));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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 <= 8d-98) then
tmp = (x * 2.0d0) + ((a * (27.0d0 * b)) - (y * (9.0d0 * (z * t))))
else
tmp = (b * (a * 27.0d0)) + ((x * 2.0d0) - (t * (9.0d0 * (z * y))))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 8e-98) {
tmp = (x * 2.0) + ((a * (27.0 * b)) - (y * (9.0 * (z * t))));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (z * y))));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= 8e-98: tmp = (x * 2.0) + ((a * (27.0 * b)) - (y * (9.0 * (z * t)))) else: tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (z * y)))) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 8e-98) tmp = Float64(Float64(x * 2.0) + Float64(Float64(a * Float64(27.0 * b)) - Float64(y * Float64(9.0 * Float64(z * t))))); else tmp = Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(t * Float64(9.0 * Float64(z * y))))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= 8e-98)
tmp = (x * 2.0) + ((a * (27.0 * b)) - (y * (9.0 * (z * t))));
else
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (z * y))));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 8e-98], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] - N[(y * N[(9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(9.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 8 \cdot 10^{-98}:\\
\;\;\;\;x \cdot 2 + \left(a \cdot \left(27 \cdot b\right) - y \cdot \left(9 \cdot \left(z \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - t \cdot \left(9 \cdot \left(z \cdot y\right)\right)\right)\\
\end{array}
\end{array}
if z < 7.99999999999999951e-98Initial program 93.5%
+-commutative93.5%
associate-*l*93.5%
fma-def94.0%
associate-*l*93.6%
*-commutative93.6%
associate-*l*93.6%
Simplified93.6%
fma-udef93.0%
associate-*r*93.1%
associate-*r*93.1%
*-commutative93.1%
associate-*r*93.5%
+-commutative93.5%
associate-+l-93.5%
associate-*r*93.1%
associate-*l*93.1%
associate-*r*93.1%
Applied egg-rr93.1%
if 7.99999999999999951e-98 < z Initial program 93.3%
Taylor expanded in y around 0 93.4%
Final simplification93.2%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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) (* 9.0 (* y (* z t))))))
(if (<= y -2.7e+175)
t_1
(if (<= y -2e+169)
(- (* x 2.0) (* (* a b) -27.0))
(if (<= y -4.6e+95) t_1 (- (* x 2.0) (* a (* b -27.0))))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * 2.0) - (9.0 * (y * (z * t)));
double tmp;
if (y <= -2.7e+175) {
tmp = t_1;
} else if (y <= -2e+169) {
tmp = (x * 2.0) - ((a * b) * -27.0);
} else if (y <= -4.6e+95) {
tmp = t_1;
} else {
tmp = (x * 2.0) - (a * (b * -27.0));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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) - (9.0d0 * (y * (z * t)))
if (y <= (-2.7d+175)) then
tmp = t_1
else if (y <= (-2d+169)) then
tmp = (x * 2.0d0) - ((a * b) * (-27.0d0))
else if (y <= (-4.6d+95)) then
tmp = t_1
else
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * 2.0) - (9.0 * (y * (z * t)));
double tmp;
if (y <= -2.7e+175) {
tmp = t_1;
} else if (y <= -2e+169) {
tmp = (x * 2.0) - ((a * b) * -27.0);
} else if (y <= -4.6e+95) {
tmp = t_1;
} else {
tmp = (x * 2.0) - (a * (b * -27.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = (x * 2.0) - (9.0 * (y * (z * t))) tmp = 0 if y <= -2.7e+175: tmp = t_1 elif y <= -2e+169: tmp = (x * 2.0) - ((a * b) * -27.0) elif y <= -4.6e+95: tmp = t_1 else: tmp = (x * 2.0) - (a * (b * -27.0)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))) tmp = 0.0 if (y <= -2.7e+175) tmp = t_1; elseif (y <= -2e+169) tmp = Float64(Float64(x * 2.0) - Float64(Float64(a * b) * -27.0)); elseif (y <= -4.6e+95) tmp = t_1; else tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = (x * 2.0) - (9.0 * (y * (z * t)));
tmp = 0.0;
if (y <= -2.7e+175)
tmp = t_1;
elseif (y <= -2e+169)
tmp = (x * 2.0) - ((a * b) * -27.0);
elseif (y <= -4.6e+95)
tmp = t_1;
else
tmp = (x * 2.0) - (a * (b * -27.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.7e+175], t$95$1, If[LessEqual[y, -2e+169], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * -27.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -4.6e+95], t$95$1, N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{if}\;y \leq -2.7 \cdot 10^{+175}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -2 \cdot 10^{+169}:\\
\;\;\;\;x \cdot 2 - \left(a \cdot b\right) \cdot -27\\
\mathbf{elif}\;y \leq -4.6 \cdot 10^{+95}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\end{array}
\end{array}
if y < -2.7000000000000001e175 or -1.99999999999999987e169 < y < -4.59999999999999994e95Initial program 84.9%
+-commutative84.9%
associate-*l*87.0%
fma-def89.2%
associate-*l*97.5%
*-commutative97.5%
associate-*l*97.5%
Simplified97.5%
Taylor expanded in a around 0 86.7%
if -2.7000000000000001e175 < y < -1.99999999999999987e169Initial program 100.0%
associate-+l-100.0%
sub-neg100.0%
neg-mul-1100.0%
metadata-eval100.0%
metadata-eval100.0%
cancel-sign-sub-inv100.0%
metadata-eval100.0%
*-lft-identity100.0%
associate-*l*100.0%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in y around 0 100.0%
*-commutative100.0%
Simplified100.0%
if -4.59999999999999994e95 < y Initial program 95.2%
associate-+l-95.2%
sub-neg95.2%
neg-mul-195.2%
metadata-eval95.2%
metadata-eval95.2%
cancel-sign-sub-inv95.2%
metadata-eval95.2%
*-lft-identity95.2%
associate-*l*94.9%
associate-*l*94.5%
Simplified94.5%
Taylor expanded in y around 0 74.2%
*-commutative74.2%
associate-*l*73.7%
Simplified73.7%
Final simplification76.2%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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))) (t_2 (* -9.0 (* y (* z t)))))
(if (<= y -2.4e+175)
t_2
(if (<= y -2.35e+169)
t_1
(if (<= y -3.8e+95)
t_2
(if (or (<= y -1.12e-260) (not (<= y 1.25e-300))) t_1 (* x 2.0)))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double t_2 = -9.0 * (y * (z * t));
double tmp;
if (y <= -2.4e+175) {
tmp = t_2;
} else if (y <= -2.35e+169) {
tmp = t_1;
} else if (y <= -3.8e+95) {
tmp = t_2;
} else if ((y <= -1.12e-260) || !(y <= 1.25e-300)) {
tmp = t_1;
} else {
tmp = x * 2.0;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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) :: t_2
real(8) :: tmp
t_1 = 27.0d0 * (a * b)
t_2 = (-9.0d0) * (y * (z * t))
if (y <= (-2.4d+175)) then
tmp = t_2
else if (y <= (-2.35d+169)) then
tmp = t_1
else if (y <= (-3.8d+95)) then
tmp = t_2
else if ((y <= (-1.12d-260)) .or. (.not. (y <= 1.25d-300))) then
tmp = t_1
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
assert 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 t_2 = -9.0 * (y * (z * t));
double tmp;
if (y <= -2.4e+175) {
tmp = t_2;
} else if (y <= -2.35e+169) {
tmp = t_1;
} else if (y <= -3.8e+95) {
tmp = t_2;
} else if ((y <= -1.12e-260) || !(y <= 1.25e-300)) {
tmp = t_1;
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = 27.0 * (a * b) t_2 = -9.0 * (y * (z * t)) tmp = 0 if y <= -2.4e+175: tmp = t_2 elif y <= -2.35e+169: tmp = t_1 elif y <= -3.8e+95: tmp = t_2 elif (y <= -1.12e-260) or not (y <= 1.25e-300): tmp = t_1 else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(27.0 * Float64(a * b)) t_2 = Float64(-9.0 * Float64(y * Float64(z * t))) tmp = 0.0 if (y <= -2.4e+175) tmp = t_2; elseif (y <= -2.35e+169) tmp = t_1; elseif (y <= -3.8e+95) tmp = t_2; elseif ((y <= -1.12e-260) || !(y <= 1.25e-300)) tmp = t_1; else tmp = Float64(x * 2.0); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = 27.0 * (a * b);
t_2 = -9.0 * (y * (z * t));
tmp = 0.0;
if (y <= -2.4e+175)
tmp = t_2;
elseif (y <= -2.35e+169)
tmp = t_1;
elseif (y <= -3.8e+95)
tmp = t_2;
elseif ((y <= -1.12e-260) || ~((y <= 1.25e-300)))
tmp = t_1;
else
tmp = x * 2.0;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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]}, Block[{t$95$2 = N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -2.4e+175], t$95$2, If[LessEqual[y, -2.35e+169], t$95$1, If[LessEqual[y, -3.8e+95], t$95$2, If[Or[LessEqual[y, -1.12e-260], N[Not[LessEqual[y, 1.25e-300]], $MachinePrecision]], t$95$1, N[(x * 2.0), $MachinePrecision]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right)\\
t_2 := -9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{if}\;y \leq -2.4 \cdot 10^{+175}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -2.35 \cdot 10^{+169}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -3.8 \cdot 10^{+95}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;y \leq -1.12 \cdot 10^{-260} \lor \neg \left(y \leq 1.25 \cdot 10^{-300}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if y < -2.4e175 or -2.3499999999999999e169 < y < -3.7999999999999999e95Initial program 84.9%
+-commutative84.9%
associate-*l*87.0%
fma-def89.2%
associate-*l*97.5%
*-commutative97.5%
associate-*l*97.5%
Simplified97.5%
Taylor expanded in y around inf 69.2%
if -2.4e175 < y < -2.3499999999999999e169 or -3.7999999999999999e95 < y < -1.12000000000000004e-260 or 1.24999999999999999e-300 < y Initial program 95.1%
+-commutative95.1%
associate-*l*94.6%
fma-def94.6%
associate-*l*94.3%
*-commutative94.3%
associate-*l*94.3%
Simplified94.3%
Taylor expanded in a around inf 42.8%
if -1.12000000000000004e-260 < y < 1.24999999999999999e-300Initial program 99.8%
+-commutative99.8%
associate-*l*99.6%
fma-def99.6%
associate-*l*99.6%
*-commutative99.6%
associate-*l*99.6%
Simplified99.6%
Taylor expanded in x around inf 26.9%
Final simplification46.9%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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 (<= y -2.85e+175)
(* y (* (* z t) -9.0))
(if (<= y -1.9e+169)
t_1
(if (<= y -6.2e+95)
(* -9.0 (* y (* z t)))
(if (or (<= y -6e-262) (not (<= y 1.1e-300))) t_1 (* x 2.0)))))))assert(y < z && z < t);
assert(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 (y <= -2.85e+175) {
tmp = y * ((z * t) * -9.0);
} else if (y <= -1.9e+169) {
tmp = t_1;
} else if (y <= -6.2e+95) {
tmp = -9.0 * (y * (z * t));
} else if ((y <= -6e-262) || !(y <= 1.1e-300)) {
tmp = t_1;
} else {
tmp = x * 2.0;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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 (y <= (-2.85d+175)) then
tmp = y * ((z * t) * (-9.0d0))
else if (y <= (-1.9d+169)) then
tmp = t_1
else if (y <= (-6.2d+95)) then
tmp = (-9.0d0) * (y * (z * t))
else if ((y <= (-6d-262)) .or. (.not. (y <= 1.1d-300))) then
tmp = t_1
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
assert 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 (y <= -2.85e+175) {
tmp = y * ((z * t) * -9.0);
} else if (y <= -1.9e+169) {
tmp = t_1;
} else if (y <= -6.2e+95) {
tmp = -9.0 * (y * (z * t));
} else if ((y <= -6e-262) || !(y <= 1.1e-300)) {
tmp = t_1;
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = 27.0 * (a * b) tmp = 0 if y <= -2.85e+175: tmp = y * ((z * t) * -9.0) elif y <= -1.9e+169: tmp = t_1 elif y <= -6.2e+95: tmp = -9.0 * (y * (z * t)) elif (y <= -6e-262) or not (y <= 1.1e-300): tmp = t_1 else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (y <= -2.85e+175) tmp = Float64(y * Float64(Float64(z * t) * -9.0)); elseif (y <= -1.9e+169) tmp = t_1; elseif (y <= -6.2e+95) tmp = Float64(-9.0 * Float64(y * Float64(z * t))); elseif ((y <= -6e-262) || !(y <= 1.1e-300)) tmp = t_1; else tmp = Float64(x * 2.0); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = 27.0 * (a * b);
tmp = 0.0;
if (y <= -2.85e+175)
tmp = y * ((z * t) * -9.0);
elseif (y <= -1.9e+169)
tmp = t_1;
elseif (y <= -6.2e+95)
tmp = -9.0 * (y * (z * t));
elseif ((y <= -6e-262) || ~((y <= 1.1e-300)))
tmp = t_1;
else
tmp = x * 2.0;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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[y, -2.85e+175], N[(y * N[(N[(z * t), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -1.9e+169], t$95$1, If[LessEqual[y, -6.2e+95], N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -6e-262], N[Not[LessEqual[y, 1.1e-300]], $MachinePrecision]], t$95$1, N[(x * 2.0), $MachinePrecision]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;y \leq -2.85 \cdot 10^{+175}:\\
\;\;\;\;y \cdot \left(\left(z \cdot t\right) \cdot -9\right)\\
\mathbf{elif}\;y \leq -1.9 \cdot 10^{+169}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -6.2 \cdot 10^{+95}:\\
\;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;y \leq -6 \cdot 10^{-262} \lor \neg \left(y \leq 1.1 \cdot 10^{-300}\right):\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if y < -2.85000000000000012e175Initial program 84.8%
+-commutative84.8%
associate-*l*87.7%
fma-def90.8%
associate-*l*99.8%
*-commutative99.8%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in y around inf 78.2%
*-commutative78.2%
*-commutative78.2%
associate-*r*78.4%
associate-*r*78.3%
*-commutative78.3%
associate-*l*78.4%
*-commutative78.4%
Simplified78.4%
Taylor expanded in t around 0 78.4%
if -2.85000000000000012e175 < y < -1.89999999999999996e169 or -6.2000000000000006e95 < y < -6.00000000000000036e-262 or 1.10000000000000001e-300 < y Initial program 95.1%
+-commutative95.1%
associate-*l*94.6%
fma-def94.6%
associate-*l*94.3%
*-commutative94.3%
associate-*l*94.3%
Simplified94.3%
Taylor expanded in a around inf 42.8%
if -1.89999999999999996e169 < y < -6.2000000000000006e95Initial program 85.4%
+-commutative85.4%
associate-*l*85.4%
fma-def85.4%
associate-*l*91.9%
*-commutative91.9%
associate-*l*92.1%
Simplified92.1%
Taylor expanded in y around inf 46.9%
if -6.00000000000000036e-262 < y < 1.10000000000000001e-300Initial program 99.8%
+-commutative99.8%
associate-*l*99.6%
fma-def99.6%
associate-*l*99.6%
*-commutative99.6%
associate-*l*99.6%
Simplified99.6%
Taylor expanded in x around inf 26.9%
Final simplification46.9%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= x -1e+30) (* x 2.0) (if (<= x 8.8e+70) (* 27.0 (* a b)) (* x 2.0))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1e+30) {
tmp = x * 2.0;
} else if (x <= 8.8e+70) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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 (x <= (-1d+30)) then
tmp = x * 2.0d0
else if (x <= 8.8d+70) then
tmp = 27.0d0 * (a * b)
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (x <= -1e+30) {
tmp = x * 2.0;
} else if (x <= 8.8e+70) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if x <= -1e+30: tmp = x * 2.0 elif x <= 8.8e+70: tmp = 27.0 * (a * b) else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (x <= -1e+30) tmp = Float64(x * 2.0); elseif (x <= 8.8e+70) tmp = Float64(27.0 * Float64(a * b)); else tmp = Float64(x * 2.0); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (x <= -1e+30)
tmp = x * 2.0;
elseif (x <= 8.8e+70)
tmp = 27.0 * (a * b);
else
tmp = x * 2.0;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[x, -1e+30], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, 8.8e+70], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1 \cdot 10^{+30}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq 8.8 \cdot 10^{+70}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -1e30 or 8.80000000000000003e70 < x Initial program 92.3%
+-commutative92.3%
associate-*l*92.3%
fma-def92.3%
associate-*l*95.2%
*-commutative95.2%
associate-*l*95.2%
Simplified95.2%
Taylor expanded in x around inf 53.1%
if -1e30 < x < 8.80000000000000003e70Initial program 94.2%
+-commutative94.2%
associate-*l*94.2%
fma-def94.8%
associate-*l*94.9%
*-commutative94.9%
associate-*l*94.9%
Simplified94.9%
Taylor expanded in a around inf 51.4%
Final simplification52.0%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: 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(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: 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 y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): return x * 2.0
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) return Float64(x * 2.0) end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = x * 2.0;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: 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}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
x \cdot 2
\end{array}
Initial program 93.5%
+-commutative93.5%
associate-*l*93.4%
fma-def93.8%
associate-*l*95.0%
*-commutative95.0%
associate-*l*95.0%
Simplified95.0%
Taylor expanded in x around inf 30.0%
Final simplification30.0%
(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 2023200
(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)))