
(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 12 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 (if (<= z 7.8e-89) (fma a (* 27.0 b) (fma x 2.0 (* y (* z (* t -9.0))))) (* t (- (+ (* 2.0 (/ x t)) (* 27.0 (/ (* a b) t))) (* 9.0 (* z y))))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 7.8e-89) {
tmp = fma(a, (27.0 * b), fma(x, 2.0, (y * (z * (t * -9.0)))));
} else {
tmp = t * (((2.0 * (x / t)) + (27.0 * ((a * b) / t))) - (9.0 * (z * y)));
}
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 (z <= 7.8e-89) tmp = fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(y * Float64(z * Float64(t * -9.0))))); else tmp = Float64(t * Float64(Float64(Float64(2.0 * Float64(x / t)) + Float64(27.0 * Float64(Float64(a * b) / t))) - Float64(9.0 * Float64(z * y)))); end return 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[z, 7.8e-89], N[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0 + N[(y * N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(N[(N[(2.0 * N[(x / t), $MachinePrecision]), $MachinePrecision] + N[(27.0 * N[(N[(a * b), $MachinePrecision] / t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(9.0 * N[(z * y), $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}\;z \leq 7.8 \cdot 10^{-89}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, \mathsf{fma}\left(x, 2, y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(\left(2 \cdot \frac{x}{t} + 27 \cdot \frac{a \cdot b}{t}\right) - 9 \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if z < 7.79999999999999957e-89Initial program 95.5%
Simplified95.6%
if 7.79999999999999957e-89 < z Initial program 93.6%
associate-+l-93.6%
*-commutative93.6%
*-commutative93.6%
associate-*l*93.6%
associate-+l-93.6%
associate-*l*93.6%
*-commutative93.6%
*-commutative93.6%
associate-*l*93.3%
associate-*l*93.4%
Simplified93.4%
Taylor expanded in t around inf 76.0%
Final simplification89.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 (<= (* z (* y 9.0)) 1e+287) (fma a (* 27.0 b) (fma x 2.0 (* t (* y (* z -9.0))))) (* z (* y (* t -9.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 ((z * (y * 9.0)) <= 1e+287) {
tmp = fma(a, (27.0 * b), fma(x, 2.0, (t * (y * (z * -9.0)))));
} else {
tmp = z * (y * (t * -9.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 (Float64(z * Float64(y * 9.0)) <= 1e+287) tmp = fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(t * Float64(y * Float64(z * -9.0))))); else tmp = Float64(z * Float64(y * Float64(t * -9.0))); end return 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[N[(z * N[(y * 9.0), $MachinePrecision]), $MachinePrecision], 1e+287], N[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0 + N[(t * N[(y * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y * N[(t * -9.0), $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}\;z \cdot \left(y \cdot 9\right) \leq 10^{+287}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, \mathsf{fma}\left(x, 2, t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \left(t \cdot -9\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y #s(literal 9 binary64)) z) < 1.0000000000000001e287Initial program 96.6%
+-commutative96.6%
associate-+r-96.6%
*-commutative96.6%
cancel-sign-sub-inv96.6%
associate-*r*94.7%
distribute-lft-neg-in94.7%
*-commutative94.7%
cancel-sign-sub-inv94.7%
associate-+r-94.7%
associate-*l*94.7%
fma-define95.6%
cancel-sign-sub-inv95.6%
fma-define95.6%
*-commutative95.6%
distribute-rgt-neg-in95.6%
distribute-lft-neg-out95.6%
associate-*r*97.4%
associate-*l*97.4%
Simplified97.4%
if 1.0000000000000001e287 < (*.f64 (*.f64 y #s(literal 9 binary64)) z) Initial program 68.6%
+-commutative68.6%
associate-+r-68.6%
*-commutative68.6%
cancel-sign-sub-inv68.6%
associate-*r*93.1%
distribute-lft-neg-in93.1%
*-commutative93.1%
cancel-sign-sub-inv93.1%
associate-+r-93.1%
associate-*l*93.1%
fma-define99.8%
cancel-sign-sub-inv99.8%
fma-define99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
distribute-lft-neg-out99.8%
associate-*r*75.3%
associate-*l*75.3%
Simplified75.3%
Taylor expanded in t around inf 75.3%
*-commutative75.3%
associate-*r*75.3%
*-commutative75.3%
associate-*l*75.3%
Simplified75.3%
Taylor expanded in t around 0 75.3%
associate-*r*99.9%
associate-*r*99.8%
associate-*r*99.8%
Simplified99.8%
Final simplification97.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
(let* ((t_1 (* z (* y 9.0))))
(if (<= t_1 1e+287)
(+ (- (* x 2.0) (* t t_1)) (* b (* a 27.0)))
(* z (* y (* t -9.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 = z * (y * 9.0);
double tmp;
if (t_1 <= 1e+287) {
tmp = ((x * 2.0) - (t * t_1)) + (b * (a * 27.0));
} else {
tmp = z * (y * (t * -9.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 = z * (y * 9.0d0)
if (t_1 <= 1d+287) then
tmp = ((x * 2.0d0) - (t * t_1)) + (b * (a * 27.0d0))
else
tmp = z * (y * (t * (-9.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 = z * (y * 9.0);
double tmp;
if (t_1 <= 1e+287) {
tmp = ((x * 2.0) - (t * t_1)) + (b * (a * 27.0));
} else {
tmp = z * (y * (t * -9.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 = z * (y * 9.0) tmp = 0 if t_1 <= 1e+287: tmp = ((x * 2.0) - (t * t_1)) + (b * (a * 27.0)) else: tmp = z * (y * (t * -9.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(z * Float64(y * 9.0)) tmp = 0.0 if (t_1 <= 1e+287) tmp = Float64(Float64(Float64(x * 2.0) - Float64(t * t_1)) + Float64(b * Float64(a * 27.0))); else tmp = Float64(z * Float64(y * Float64(t * -9.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 = z * (y * 9.0);
tmp = 0.0;
if (t_1 <= 1e+287)
tmp = ((x * 2.0) - (t * t_1)) + (b * (a * 27.0));
else
tmp = z * (y * (t * -9.0));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(z * N[(y * 9.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, 1e+287], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t * t$95$1), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(z * N[(y * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := z \cdot \left(y \cdot 9\right)\\
\mathbf{if}\;t\_1 \leq 10^{+287}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot t\_1\right) + b \cdot \left(a \cdot 27\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \left(t \cdot -9\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y #s(literal 9 binary64)) z) < 1.0000000000000001e287Initial program 96.6%
if 1.0000000000000001e287 < (*.f64 (*.f64 y #s(literal 9 binary64)) z) Initial program 68.6%
+-commutative68.6%
associate-+r-68.6%
*-commutative68.6%
cancel-sign-sub-inv68.6%
associate-*r*93.1%
distribute-lft-neg-in93.1%
*-commutative93.1%
cancel-sign-sub-inv93.1%
associate-+r-93.1%
associate-*l*93.1%
fma-define99.8%
cancel-sign-sub-inv99.8%
fma-define99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
distribute-lft-neg-out99.8%
associate-*r*75.3%
associate-*l*75.3%
Simplified75.3%
Taylor expanded in t around inf 75.3%
*-commutative75.3%
associate-*r*75.3%
*-commutative75.3%
associate-*l*75.3%
Simplified75.3%
Taylor expanded in t around 0 75.3%
associate-*r*99.9%
associate-*r*99.8%
associate-*r*99.8%
Simplified99.8%
Final simplification96.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 (<= t 1.9e+39)
(+ (* 27.0 (* a b)) (* x 2.0))
(if (<= t 1.25e+258)
(+ (* t (* y (* z -9.0))) (* x 2.0))
(* a (+ (* 27.0 b) (* -9.0 (/ (* t (* z y)) a)))))))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 (t <= 1.9e+39) {
tmp = (27.0 * (a * b)) + (x * 2.0);
} else if (t <= 1.25e+258) {
tmp = (t * (y * (z * -9.0))) + (x * 2.0);
} else {
tmp = a * ((27.0 * b) + (-9.0 * ((t * (z * y)) / a)));
}
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 (t <= 1.9d+39) then
tmp = (27.0d0 * (a * b)) + (x * 2.0d0)
else if (t <= 1.25d+258) then
tmp = (t * (y * (z * (-9.0d0)))) + (x * 2.0d0)
else
tmp = a * ((27.0d0 * b) + ((-9.0d0) * ((t * (z * y)) / a)))
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 (t <= 1.9e+39) {
tmp = (27.0 * (a * b)) + (x * 2.0);
} else if (t <= 1.25e+258) {
tmp = (t * (y * (z * -9.0))) + (x * 2.0);
} else {
tmp = a * ((27.0 * b) + (-9.0 * ((t * (z * y)) / a)));
}
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 t <= 1.9e+39: tmp = (27.0 * (a * b)) + (x * 2.0) elif t <= 1.25e+258: tmp = (t * (y * (z * -9.0))) + (x * 2.0) else: tmp = a * ((27.0 * b) + (-9.0 * ((t * (z * y)) / a))) 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 (t <= 1.9e+39) tmp = Float64(Float64(27.0 * Float64(a * b)) + Float64(x * 2.0)); elseif (t <= 1.25e+258) tmp = Float64(Float64(t * Float64(y * Float64(z * -9.0))) + Float64(x * 2.0)); else tmp = Float64(a * Float64(Float64(27.0 * b) + Float64(-9.0 * Float64(Float64(t * Float64(z * y)) / a)))); 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 (t <= 1.9e+39)
tmp = (27.0 * (a * b)) + (x * 2.0);
elseif (t <= 1.25e+258)
tmp = (t * (y * (z * -9.0))) + (x * 2.0);
else
tmp = a * ((27.0 * b) + (-9.0 * ((t * (z * y)) / a)));
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[t, 1.9e+39], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 1.25e+258], N[(N[(t * N[(y * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], N[(a * N[(N[(27.0 * b), $MachinePrecision] + N[(-9.0 * N[(N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision] / a), $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}\;t \leq 1.9 \cdot 10^{+39}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) + x \cdot 2\\
\mathbf{elif}\;t \leq 1.25 \cdot 10^{+258}:\\
\;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right) + x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(27 \cdot b + -9 \cdot \frac{t \cdot \left(z \cdot y\right)}{a}\right)\\
\end{array}
\end{array}
if t < 1.8999999999999999e39Initial program 94.8%
+-commutative94.8%
associate-+r-94.8%
*-commutative94.8%
cancel-sign-sub-inv94.8%
associate-*r*96.2%
distribute-lft-neg-in96.2%
*-commutative96.2%
cancel-sign-sub-inv96.2%
associate-+r-96.2%
associate-*l*96.2%
fma-define97.1%
cancel-sign-sub-inv97.1%
fma-define97.1%
*-commutative97.1%
distribute-rgt-neg-in97.1%
distribute-lft-neg-out97.1%
associate-*r*95.8%
associate-*l*95.8%
Simplified95.8%
Taylor expanded in t around 0 73.4%
if 1.8999999999999999e39 < t < 1.25e258Initial program 96.9%
associate-+l-96.9%
*-commutative96.9%
*-commutative96.9%
associate-*l*97.0%
associate-+l-97.0%
associate-*l*96.9%
*-commutative96.9%
*-commutative96.9%
associate-*l*89.1%
associate-*l*89.0%
Simplified89.0%
Taylor expanded in a around 0 75.7%
sub-neg75.7%
*-commutative75.7%
*-commutative75.7%
distribute-rgt-neg-in75.7%
metadata-eval75.7%
associate-*r*75.9%
associate-*r*75.8%
*-commutative75.8%
Applied egg-rr75.8%
if 1.25e258 < t Initial program 92.1%
associate-+l-92.1%
*-commutative92.1%
*-commutative92.1%
associate-*l*92.1%
associate-+l-92.1%
associate-*l*92.1%
*-commutative92.1%
*-commutative92.1%
associate-*l*92.2%
associate-*l*92.1%
Simplified92.1%
Taylor expanded in x around 0 88.2%
Taylor expanded in a around inf 95.9%
Final simplification74.9%
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 (<= t 9.5e+39)
(+ t_1 (* x 2.0))
(if (<= t 4e+257)
(+ (* t (* y (* z -9.0))) (* x 2.0))
(- t_1 (* 9.0 (* t (* z y))))))))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 (t <= 9.5e+39) {
tmp = t_1 + (x * 2.0);
} else if (t <= 4e+257) {
tmp = (t * (y * (z * -9.0))) + (x * 2.0);
} else {
tmp = t_1 - (9.0 * (t * (z * y)));
}
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 (t <= 9.5d+39) then
tmp = t_1 + (x * 2.0d0)
else if (t <= 4d+257) then
tmp = (t * (y * (z * (-9.0d0)))) + (x * 2.0d0)
else
tmp = t_1 - (9.0d0 * (t * (z * y)))
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 (t <= 9.5e+39) {
tmp = t_1 + (x * 2.0);
} else if (t <= 4e+257) {
tmp = (t * (y * (z * -9.0))) + (x * 2.0);
} else {
tmp = t_1 - (9.0 * (t * (z * y)));
}
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 t <= 9.5e+39: tmp = t_1 + (x * 2.0) elif t <= 4e+257: tmp = (t * (y * (z * -9.0))) + (x * 2.0) else: tmp = t_1 - (9.0 * (t * (z * y))) 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 (t <= 9.5e+39) tmp = Float64(t_1 + Float64(x * 2.0)); elseif (t <= 4e+257) tmp = Float64(Float64(t * Float64(y * Float64(z * -9.0))) + Float64(x * 2.0)); else tmp = Float64(t_1 - Float64(9.0 * Float64(t * Float64(z * y)))); 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 (t <= 9.5e+39)
tmp = t_1 + (x * 2.0);
elseif (t <= 4e+257)
tmp = (t * (y * (z * -9.0))) + (x * 2.0);
else
tmp = t_1 - (9.0 * (t * (z * y)));
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[t, 9.5e+39], N[(t$95$1 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[t, 4e+257], N[(N[(t * N[(y * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], N[(t$95$1 - N[(9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $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}\;t \leq 9.5 \cdot 10^{+39}:\\
\;\;\;\;t\_1 + x \cdot 2\\
\mathbf{elif}\;t \leq 4 \cdot 10^{+257}:\\
\;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right) + x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t\_1 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if t < 9.50000000000000011e39Initial program 94.8%
+-commutative94.8%
associate-+r-94.8%
*-commutative94.8%
cancel-sign-sub-inv94.8%
associate-*r*96.2%
distribute-lft-neg-in96.2%
*-commutative96.2%
cancel-sign-sub-inv96.2%
associate-+r-96.2%
associate-*l*96.2%
fma-define97.1%
cancel-sign-sub-inv97.1%
fma-define97.1%
*-commutative97.1%
distribute-rgt-neg-in97.1%
distribute-lft-neg-out97.1%
associate-*r*95.8%
associate-*l*95.8%
Simplified95.8%
Taylor expanded in t around 0 73.4%
if 9.50000000000000011e39 < t < 4.00000000000000012e257Initial program 96.9%
associate-+l-96.9%
*-commutative96.9%
*-commutative96.9%
associate-*l*97.0%
associate-+l-97.0%
associate-*l*96.9%
*-commutative96.9%
*-commutative96.9%
associate-*l*89.1%
associate-*l*89.0%
Simplified89.0%
Taylor expanded in a around 0 75.7%
sub-neg75.7%
*-commutative75.7%
*-commutative75.7%
distribute-rgt-neg-in75.7%
metadata-eval75.7%
associate-*r*75.9%
associate-*r*75.8%
*-commutative75.8%
Applied egg-rr75.8%
if 4.00000000000000012e257 < t Initial program 92.1%
associate-+l-92.1%
*-commutative92.1%
*-commutative92.1%
associate-*l*92.1%
associate-+l-92.1%
associate-*l*92.1%
*-commutative92.1%
*-commutative92.1%
associate-*l*92.2%
associate-*l*92.1%
Simplified92.1%
Taylor expanded in x around 0 88.2%
Final simplification74.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 (<= z 5.2e+18) (+ (- (* x 2.0) (* (* y 9.0) (* z t))) (* a (* 27.0 b))) (- (* 27.0 (* a b)) (* 9.0 (* t (* z y))))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 5.2e+18) {
tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
} else {
tmp = (27.0 * (a * b)) - (9.0 * (t * (z * y)));
}
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 (z <= 5.2d+18) then
tmp = ((x * 2.0d0) - ((y * 9.0d0) * (z * t))) + (a * (27.0d0 * b))
else
tmp = (27.0d0 * (a * b)) - (9.0d0 * (t * (z * y)))
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 (z <= 5.2e+18) {
tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
} else {
tmp = (27.0 * (a * b)) - (9.0 * (t * (z * y)));
}
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 z <= 5.2e+18: tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b)) else: tmp = (27.0 * (a * b)) - (9.0 * (t * (z * y))) 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 (z <= 5.2e+18) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(y * 9.0) * Float64(z * t))) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(27.0 * Float64(a * b)) - Float64(9.0 * Float64(t * Float64(z * y)))); 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 (z <= 5.2e+18)
tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
else
tmp = (27.0 * (a * b)) - (9.0 * (t * (z * y)));
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[z, 5.2e+18], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] - N[(9.0 * N[(t * N[(z * y), $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}\;z \leq 5.2 \cdot 10^{+18}:\\
\;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if z < 5.2e18Initial program 96.0%
associate-+l-96.0%
*-commutative96.0%
*-commutative96.0%
associate-*l*96.0%
associate-+l-96.0%
associate-*l*96.0%
*-commutative96.0%
*-commutative96.0%
associate-*l*95.5%
associate-*l*95.5%
Simplified95.5%
if 5.2e18 < z Initial program 90.9%
associate-+l-90.9%
*-commutative90.9%
*-commutative90.9%
associate-*l*90.8%
associate-+l-90.8%
associate-*l*90.9%
*-commutative90.9%
*-commutative90.9%
associate-*l*90.4%
associate-*l*90.5%
Simplified90.5%
Taylor expanded in x around 0 72.3%
Final simplification90.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 (<= x -2.8e+55)
(* x 2.0)
(if (<= x -1.15e-60)
(* t (* y (* z -9.0)))
(if (<= x 1.8e+46) (* 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 (x <= -2.8e+55) {
tmp = x * 2.0;
} else if (x <= -1.15e-60) {
tmp = t * (y * (z * -9.0));
} else if (x <= 1.8e+46) {
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 (x <= (-2.8d+55)) then
tmp = x * 2.0d0
else if (x <= (-1.15d-60)) then
tmp = t * (y * (z * (-9.0d0)))
else if (x <= 1.8d+46) 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 (x <= -2.8e+55) {
tmp = x * 2.0;
} else if (x <= -1.15e-60) {
tmp = t * (y * (z * -9.0));
} else if (x <= 1.8e+46) {
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 x <= -2.8e+55: tmp = x * 2.0 elif x <= -1.15e-60: tmp = t * (y * (z * -9.0)) elif x <= 1.8e+46: 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 (x <= -2.8e+55) tmp = Float64(x * 2.0); elseif (x <= -1.15e-60) tmp = Float64(t * Float64(y * Float64(z * -9.0))); elseif (x <= 1.8e+46) 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 (x <= -2.8e+55)
tmp = x * 2.0;
elseif (x <= -1.15e-60)
tmp = t * (y * (z * -9.0));
elseif (x <= 1.8e+46)
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[LessEqual[x, -2.8e+55], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, -1.15e-60], N[(t * N[(y * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.8e+46], 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}\;x \leq -2.8 \cdot 10^{+55}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -1.15 \cdot 10^{-60}:\\
\;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
\mathbf{elif}\;x \leq 1.8 \cdot 10^{+46}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -2.8000000000000001e55 or 1.7999999999999999e46 < x Initial program 98.2%
+-commutative98.2%
associate-+r-98.2%
*-commutative98.2%
cancel-sign-sub-inv98.2%
associate-*r*94.0%
distribute-lft-neg-in94.0%
*-commutative94.0%
cancel-sign-sub-inv94.0%
associate-+r-94.0%
associate-*l*94.0%
fma-define94.0%
cancel-sign-sub-inv94.0%
fma-define94.0%
*-commutative94.0%
distribute-rgt-neg-in94.0%
distribute-lft-neg-out94.0%
associate-*r*98.2%
associate-*l*98.2%
Simplified98.2%
fma-undefine98.2%
fma-undefine98.2%
associate-+r+98.2%
*-commutative98.2%
associate-*l*97.2%
*-commutative97.2%
associate-*r*96.4%
*-commutative96.4%
*-commutative96.4%
associate-*r*97.2%
associate-*l*97.2%
metadata-eval97.2%
distribute-lft-neg-in97.2%
*-commutative97.2%
distribute-rgt-neg-in97.2%
*-commutative97.2%
associate-+r+97.2%
sub-neg97.2%
Applied egg-rr97.2%
Taylor expanded in x around inf 62.3%
if -2.8000000000000001e55 < x < -1.1500000000000001e-60Initial program 86.5%
+-commutative86.5%
associate-+r-86.5%
*-commutative86.5%
cancel-sign-sub-inv86.5%
associate-*r*89.9%
distribute-lft-neg-in89.9%
*-commutative89.9%
cancel-sign-sub-inv89.9%
associate-+r-89.9%
associate-*l*89.9%
fma-define93.4%
cancel-sign-sub-inv93.4%
fma-define93.4%
*-commutative93.4%
distribute-rgt-neg-in93.4%
distribute-lft-neg-out93.4%
associate-*r*90.0%
associate-*l*90.0%
Simplified90.0%
Taylor expanded in t around inf 42.8%
*-commutative42.8%
associate-*r*42.8%
associate-*l*42.8%
Simplified42.8%
if -1.1500000000000001e-60 < x < 1.7999999999999999e46Initial program 94.1%
+-commutative94.1%
associate-+r-94.1%
*-commutative94.1%
cancel-sign-sub-inv94.1%
associate-*r*96.4%
distribute-lft-neg-in96.4%
*-commutative96.4%
cancel-sign-sub-inv96.4%
associate-+r-96.4%
associate-*l*96.4%
fma-define98.1%
cancel-sign-sub-inv98.1%
fma-define98.1%
*-commutative98.1%
distribute-rgt-neg-in98.1%
distribute-lft-neg-out98.1%
associate-*r*95.8%
associate-*l*95.8%
Simplified95.8%
Taylor expanded in a around inf 51.7%
Final simplification55.2%
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 (<= x -1.15e+55)
(* x 2.0)
(if (<= x -9e-60)
(* -9.0 (* t (* z y)))
(if (<= x 1.25e+47) (* 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 (x <= -1.15e+55) {
tmp = x * 2.0;
} else if (x <= -9e-60) {
tmp = -9.0 * (t * (z * y));
} else if (x <= 1.25e+47) {
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 (x <= (-1.15d+55)) then
tmp = x * 2.0d0
else if (x <= (-9d-60)) then
tmp = (-9.0d0) * (t * (z * y))
else if (x <= 1.25d+47) 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 (x <= -1.15e+55) {
tmp = x * 2.0;
} else if (x <= -9e-60) {
tmp = -9.0 * (t * (z * y));
} else if (x <= 1.25e+47) {
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 x <= -1.15e+55: tmp = x * 2.0 elif x <= -9e-60: tmp = -9.0 * (t * (z * y)) elif x <= 1.25e+47: 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 (x <= -1.15e+55) tmp = Float64(x * 2.0); elseif (x <= -9e-60) tmp = Float64(-9.0 * Float64(t * Float64(z * y))); elseif (x <= 1.25e+47) 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 (x <= -1.15e+55)
tmp = x * 2.0;
elseif (x <= -9e-60)
tmp = -9.0 * (t * (z * y));
elseif (x <= 1.25e+47)
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[LessEqual[x, -1.15e+55], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, -9e-60], N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.25e+47], 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}\;x \leq -1.15 \cdot 10^{+55}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -9 \cdot 10^{-60}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\mathbf{elif}\;x \leq 1.25 \cdot 10^{+47}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -1.14999999999999994e55 or 1.25000000000000005e47 < x Initial program 98.2%
+-commutative98.2%
associate-+r-98.2%
*-commutative98.2%
cancel-sign-sub-inv98.2%
associate-*r*94.0%
distribute-lft-neg-in94.0%
*-commutative94.0%
cancel-sign-sub-inv94.0%
associate-+r-94.0%
associate-*l*94.0%
fma-define94.0%
cancel-sign-sub-inv94.0%
fma-define94.0%
*-commutative94.0%
distribute-rgt-neg-in94.0%
distribute-lft-neg-out94.0%
associate-*r*98.2%
associate-*l*98.2%
Simplified98.2%
fma-undefine98.2%
fma-undefine98.2%
associate-+r+98.2%
*-commutative98.2%
associate-*l*97.2%
*-commutative97.2%
associate-*r*96.4%
*-commutative96.4%
*-commutative96.4%
associate-*r*97.2%
associate-*l*97.2%
metadata-eval97.2%
distribute-lft-neg-in97.2%
*-commutative97.2%
distribute-rgt-neg-in97.2%
*-commutative97.2%
associate-+r+97.2%
sub-neg97.2%
Applied egg-rr97.2%
Taylor expanded in x around inf 62.3%
if -1.14999999999999994e55 < x < -9.00000000000000001e-60Initial program 86.5%
+-commutative86.5%
associate-+r-86.5%
*-commutative86.5%
cancel-sign-sub-inv86.5%
associate-*r*89.9%
distribute-lft-neg-in89.9%
*-commutative89.9%
cancel-sign-sub-inv89.9%
associate-+r-89.9%
associate-*l*89.9%
fma-define93.4%
cancel-sign-sub-inv93.4%
fma-define93.4%
*-commutative93.4%
distribute-rgt-neg-in93.4%
distribute-lft-neg-out93.4%
associate-*r*90.0%
associate-*l*90.0%
Simplified90.0%
Taylor expanded in t around inf 42.8%
if -9.00000000000000001e-60 < x < 1.25000000000000005e47Initial program 94.1%
+-commutative94.1%
associate-+r-94.1%
*-commutative94.1%
cancel-sign-sub-inv94.1%
associate-*r*96.4%
distribute-lft-neg-in96.4%
*-commutative96.4%
cancel-sign-sub-inv96.4%
associate-+r-96.4%
associate-*l*96.4%
fma-define98.1%
cancel-sign-sub-inv98.1%
fma-define98.1%
*-commutative98.1%
distribute-rgt-neg-in98.1%
distribute-lft-neg-out98.1%
associate-*r*95.8%
associate-*l*95.8%
Simplified95.8%
Taylor expanded in a around inf 51.7%
Final simplification55.2%
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 (<= z -122000000.0) (not (<= z 0.000118))) (* z (* y (* 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) {
double tmp;
if ((z <= -122000000.0) || !(z <= 0.000118)) {
tmp = z * (y * (t * -9.0));
} 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 ((z <= (-122000000.0d0)) .or. (.not. (z <= 0.000118d0))) then
tmp = z * (y * (t * (-9.0d0)))
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 ((z <= -122000000.0) || !(z <= 0.000118)) {
tmp = z * (y * (t * -9.0));
} 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 (z <= -122000000.0) or not (z <= 0.000118): tmp = z * (y * (t * -9.0)) 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 ((z <= -122000000.0) || !(z <= 0.000118)) tmp = Float64(z * Float64(y * Float64(t * -9.0))); 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 ((z <= -122000000.0) || ~((z <= 0.000118)))
tmp = z * (y * (t * -9.0));
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[Or[LessEqual[z, -122000000.0], N[Not[LessEqual[z, 0.000118]], $MachinePrecision]], N[(z * N[(y * N[(t * -9.0), $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}\;z \leq -122000000 \lor \neg \left(z \leq 0.000118\right):\\
\;\;\;\;z \cdot \left(y \cdot \left(t \cdot -9\right)\right)\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) + x \cdot 2\\
\end{array}
\end{array}
if z < -1.22e8 or 1.18e-4 < z Initial program 89.8%
+-commutative89.8%
associate-+r-89.8%
*-commutative89.8%
cancel-sign-sub-inv89.8%
associate-*r*95.7%
distribute-lft-neg-in95.7%
*-commutative95.7%
cancel-sign-sub-inv95.7%
associate-+r-95.7%
associate-*l*95.8%
fma-define98.2%
cancel-sign-sub-inv98.2%
fma-define98.2%
*-commutative98.2%
distribute-rgt-neg-in98.2%
distribute-lft-neg-out98.2%
associate-*r*92.2%
associate-*l*92.2%
Simplified92.2%
Taylor expanded in t around inf 44.3%
*-commutative44.3%
associate-*r*44.3%
*-commutative44.3%
associate-*l*44.3%
Simplified44.3%
Taylor expanded in t around 0 44.3%
associate-*r*49.6%
associate-*r*49.5%
associate-*r*49.5%
Simplified49.5%
if -1.22e8 < z < 1.18e-4Initial program 99.8%
+-commutative99.8%
associate-+r-99.8%
*-commutative99.8%
cancel-sign-sub-inv99.8%
associate-*r*93.6%
distribute-lft-neg-in93.6%
*-commutative93.6%
cancel-sign-sub-inv93.6%
associate-+r-93.6%
associate-*l*93.6%
fma-define93.6%
cancel-sign-sub-inv93.6%
fma-define93.6%
*-commutative93.6%
distribute-rgt-neg-in93.6%
distribute-lft-neg-out93.6%
associate-*r*99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in t around 0 83.1%
Final simplification67.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 (<= t 7.2e+40) (+ (* 27.0 (* a b)) (* x 2.0)) (+ (* t (* y (* z -9.0))) (* 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 (t <= 7.2e+40) {
tmp = (27.0 * (a * b)) + (x * 2.0);
} else {
tmp = (t * (y * (z * -9.0))) + (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 (t <= 7.2d+40) then
tmp = (27.0d0 * (a * b)) + (x * 2.0d0)
else
tmp = (t * (y * (z * (-9.0d0)))) + (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 (t <= 7.2e+40) {
tmp = (27.0 * (a * b)) + (x * 2.0);
} else {
tmp = (t * (y * (z * -9.0))) + (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 t <= 7.2e+40: tmp = (27.0 * (a * b)) + (x * 2.0) else: tmp = (t * (y * (z * -9.0))) + (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 (t <= 7.2e+40) tmp = Float64(Float64(27.0 * Float64(a * b)) + Float64(x * 2.0)); else tmp = Float64(Float64(t * Float64(y * Float64(z * -9.0))) + 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 (t <= 7.2e+40)
tmp = (27.0 * (a * b)) + (x * 2.0);
else
tmp = (t * (y * (z * -9.0))) + (x * 2.0);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 7.2e+40], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], N[(N[(t * N[(y * N[(z * -9.0), $MachinePrecision]), $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}\;t \leq 7.2 \cdot 10^{+40}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) + x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right) + x \cdot 2\\
\end{array}
\end{array}
if t < 7.19999999999999993e40Initial program 94.8%
+-commutative94.8%
associate-+r-94.8%
*-commutative94.8%
cancel-sign-sub-inv94.8%
associate-*r*96.2%
distribute-lft-neg-in96.2%
*-commutative96.2%
cancel-sign-sub-inv96.2%
associate-+r-96.2%
associate-*l*96.2%
fma-define97.1%
cancel-sign-sub-inv97.1%
fma-define97.1%
*-commutative97.1%
distribute-rgt-neg-in97.1%
distribute-lft-neg-out97.1%
associate-*r*95.8%
associate-*l*95.8%
Simplified95.8%
Taylor expanded in t around 0 73.4%
if 7.19999999999999993e40 < t Initial program 95.7%
associate-+l-95.6%
*-commutative95.6%
*-commutative95.6%
associate-*l*95.7%
associate-+l-95.7%
associate-*l*95.7%
*-commutative95.7%
*-commutative95.7%
associate-*l*89.9%
associate-*l*89.8%
Simplified89.8%
Taylor expanded in a around 0 74.4%
sub-neg74.4%
*-commutative74.4%
*-commutative74.4%
distribute-rgt-neg-in74.4%
metadata-eval74.4%
associate-*r*74.5%
associate-*r*74.5%
*-commutative74.5%
Applied egg-rr74.5%
Final simplification73.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 (or (<= x -4.1e+52) (not (<= x 6.8e+46))) (* x 2.0) (* 27.0 (* a b))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -4.1e+52) || !(x <= 6.8e+46)) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
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 <= (-4.1d+52)) .or. (.not. (x <= 6.8d+46))) then
tmp = x * 2.0d0
else
tmp = 27.0d0 * (a * b)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -4.1e+52) || !(x <= 6.8e+46)) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if (x <= -4.1e+52) or not (x <= 6.8e+46): tmp = x * 2.0 else: tmp = 27.0 * (a * b) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((x <= -4.1e+52) || !(x <= 6.8e+46)) tmp = Float64(x * 2.0); else tmp = Float64(27.0 * Float64(a * b)); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((x <= -4.1e+52) || ~((x <= 6.8e+46)))
tmp = x * 2.0;
else
tmp = 27.0 * (a * b);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[x, -4.1e+52], N[Not[LessEqual[x, 6.8e+46]], $MachinePrecision]], N[(x * 2.0), $MachinePrecision], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -4.1 \cdot 10^{+52} \lor \neg \left(x \leq 6.8 \cdot 10^{+46}\right):\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if x < -4.1e52 or 6.7999999999999996e46 < x Initial program 97.3%
+-commutative97.3%
associate-+r-97.3%
*-commutative97.3%
cancel-sign-sub-inv97.3%
associate-*r*93.2%
distribute-lft-neg-in93.2%
*-commutative93.2%
cancel-sign-sub-inv93.2%
associate-+r-93.2%
associate-*l*93.1%
fma-define94.0%
cancel-sign-sub-inv94.0%
fma-define94.0%
*-commutative94.0%
distribute-rgt-neg-in94.0%
distribute-lft-neg-out94.0%
associate-*r*98.2%
associate-*l*98.2%
Simplified98.2%
fma-undefine97.3%
fma-undefine97.3%
associate-+r+97.3%
*-commutative97.3%
associate-*l*96.3%
*-commutative96.3%
associate-*r*95.5%
*-commutative95.5%
*-commutative95.5%
associate-*r*96.3%
associate-*l*96.3%
metadata-eval96.3%
distribute-lft-neg-in96.3%
*-commutative96.3%
distribute-rgt-neg-in96.3%
*-commutative96.3%
associate-+r+96.3%
sub-neg96.3%
Applied egg-rr96.4%
Taylor expanded in x around inf 61.7%
if -4.1e52 < x < 6.7999999999999996e46Initial program 93.2%
+-commutative93.2%
associate-+r-93.2%
*-commutative93.2%
cancel-sign-sub-inv93.2%
associate-*r*95.8%
distribute-lft-neg-in95.8%
*-commutative95.8%
cancel-sign-sub-inv95.8%
associate-+r-95.8%
associate-*l*95.7%
fma-define97.1%
cancel-sign-sub-inv97.1%
fma-define97.1%
*-commutative97.1%
distribute-rgt-neg-in97.1%
distribute-lft-neg-out97.1%
associate-*r*94.6%
associate-*l*94.6%
Simplified94.6%
Taylor expanded in a around inf 48.0%
Final simplification53.9%
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.0%
+-commutative95.0%
associate-+r-95.0%
*-commutative95.0%
cancel-sign-sub-inv95.0%
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-define95.8%
cancel-sign-sub-inv95.8%
fma-define95.8%
*-commutative95.8%
distribute-rgt-neg-in95.8%
distribute-lft-neg-out95.8%
associate-*r*96.1%
associate-*l*96.1%
Simplified96.1%
fma-undefine95.0%
fma-undefine95.0%
associate-+r+95.0%
*-commutative95.0%
associate-*l*94.4%
*-commutative94.4%
associate-*r*93.8%
*-commutative93.8%
*-commutative93.8%
associate-*r*94.5%
associate-*l*94.5%
metadata-eval94.5%
distribute-lft-neg-in94.5%
*-commutative94.5%
distribute-rgt-neg-in94.5%
*-commutative94.5%
associate-+r+94.5%
sub-neg94.5%
Applied egg-rr94.5%
Taylor expanded in x around inf 35.5%
Final simplification35.5%
(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 2024170
(FPCore (x y z t a b)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, A"
:precision binary64
:alt
(! :herbie-platform default (if (< y 7590524218811189/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (- (* x 2) (* (* (* y 9) z) t)) (* a (* 27 b))) (+ (- (* x 2) (* 9 (* y (* t z)))) (* (* a 27) b))))
(+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))