
(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 17 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 (<= t 6e-54) (+ (- (* x 2.0) (* (* t (* 9.0 y)) z)) (* a (* 27.0 b))) (fma (* a 27.0) b (fma x 2.0 (* (* y z) (* t -9.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 (t <= 6e-54) {
tmp = ((x * 2.0) - ((t * (9.0 * y)) * z)) + (a * (27.0 * b));
} else {
tmp = fma((a * 27.0), b, fma(x, 2.0, ((y * z) * (t * -9.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 (t <= 6e-54) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(t * Float64(9.0 * y)) * z)) + Float64(a * Float64(27.0 * b))); else tmp = fma(Float64(a * 27.0), b, fma(x, 2.0, Float64(Float64(y * z) * Float64(t * -9.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[t, 6e-54], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(t * N[(9.0 * y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * 27.0), $MachinePrecision] * b + N[(x * 2.0 + N[(N[(y * z), $MachinePrecision] * N[(t * -9.0), $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}\;t \leq 6 \cdot 10^{-54}:\\
\;\;\;\;\left(x \cdot 2 - \left(t \cdot \left(9 \cdot y\right)\right) \cdot z\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot 27, b, \mathsf{fma}\left(x, 2, \left(y \cdot z\right) \cdot \left(t \cdot -9\right)\right)\right)\\
\end{array}
\end{array}
if t < 6.00000000000000018e-54Initial program 97.2%
sub-neg97.2%
sub-neg97.2%
associate-*l*97.0%
associate-*l*97.0%
Simplified97.0%
Taylor expanded in y around 0 97.2%
*-commutative97.2%
associate-*l*97.2%
*-commutative97.2%
associate-*r*97.2%
*-commutative97.2%
associate-*r*96.6%
*-commutative96.6%
Simplified96.6%
if 6.00000000000000018e-54 < t Initial program 96.9%
sub-neg96.9%
sub-neg96.9%
associate-*l*90.3%
associate-*l*91.6%
Simplified91.6%
+-commutative91.6%
associate-*r*90.3%
fma-def90.3%
associate-*r*97.0%
fma-neg97.0%
distribute-lft-neg-in97.0%
distribute-lft-neg-in97.0%
distribute-rgt-neg-in97.0%
metadata-eval97.0%
associate-*r*97.0%
*-commutative97.0%
associate-*l*97.0%
associate-*l*96.9%
Applied egg-rr96.9%
Final simplification96.7%
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 (<= t 3.8e-177) (+ (- (* x 2.0) (* (* t (* 9.0 y)) z)) (* a (* 27.0 b))) (+ (* b (* a 27.0)) (- (* x 2.0) (* t (* 9.0 (* y z)))))))
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 (t <= 3.8e-177) {
tmp = ((x * 2.0) - ((t * (9.0 * y)) * z)) + (a * (27.0 * b));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z))));
}
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 (t <= 3.8d-177) then
tmp = ((x * 2.0d0) - ((t * (9.0d0 * y)) * z)) + (a * (27.0d0 * b))
else
tmp = (b * (a * 27.0d0)) + ((x * 2.0d0) - (t * (9.0d0 * (y * z))))
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 (t <= 3.8e-177) {
tmp = ((x * 2.0) - ((t * (9.0 * y)) * z)) + (a * (27.0 * b));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z))));
}
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 t <= 3.8e-177: tmp = ((x * 2.0) - ((t * (9.0 * y)) * z)) + (a * (27.0 * b)) else: tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z)))) 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 (t <= 3.8e-177) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(t * Float64(9.0 * y)) * z)) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(t * Float64(9.0 * Float64(y * z))))); 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 (t <= 3.8e-177)
tmp = ((x * 2.0) - ((t * (9.0 * y)) * z)) + (a * (27.0 * b));
else
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z))));
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[t, 3.8e-177], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(t * N[(9.0 * y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(9.0 * N[(y * z), $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}\;t \leq 3.8 \cdot 10^{-177}:\\
\;\;\;\;\left(x \cdot 2 - \left(t \cdot \left(9 \cdot y\right)\right) \cdot z\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - t \cdot \left(9 \cdot \left(y \cdot z\right)\right)\right)\\
\end{array}
\end{array}
if t < 3.80000000000000004e-177Initial program 97.4%
sub-neg97.4%
sub-neg97.4%
associate-*l*96.6%
associate-*l*96.6%
Simplified96.6%
Taylor expanded in y around 0 97.4%
*-commutative97.4%
associate-*l*97.4%
*-commutative97.4%
associate-*r*97.4%
*-commutative97.4%
associate-*r*96.1%
*-commutative96.1%
Simplified96.1%
if 3.80000000000000004e-177 < t Initial program 96.7%
Taylor expanded in y around 0 96.7%
Final simplification96.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 -1e-124) (+ (* a (* 27.0 b)) (- (* x 2.0) (* (* t z) (* 9.0 y)))) (+ (* b (* a 27.0)) (- (* x 2.0) (* t (* 9.0 (* y z)))))))
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 <= -1e-124) {
tmp = (a * (27.0 * b)) + ((x * 2.0) - ((t * z) * (9.0 * y)));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z))));
}
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 <= (-1d-124)) then
tmp = (a * (27.0d0 * b)) + ((x * 2.0d0) - ((t * z) * (9.0d0 * y)))
else
tmp = (b * (a * 27.0d0)) + ((x * 2.0d0) - (t * (9.0d0 * (y * z))))
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 <= -1e-124) {
tmp = (a * (27.0 * b)) + ((x * 2.0) - ((t * z) * (9.0 * y)));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z))));
}
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 <= -1e-124: tmp = (a * (27.0 * b)) + ((x * 2.0) - ((t * z) * (9.0 * y))) else: tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z)))) 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 <= -1e-124) tmp = Float64(Float64(a * Float64(27.0 * b)) + Float64(Float64(x * 2.0) - Float64(Float64(t * z) * Float64(9.0 * y)))); else tmp = Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(t * Float64(9.0 * Float64(y * z))))); 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 <= -1e-124)
tmp = (a * (27.0 * b)) + ((x * 2.0) - ((t * z) * (9.0 * y)));
else
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z))));
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, -1e-124], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(N[(t * z), $MachinePrecision] * N[(9.0 * y), $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[(y * z), $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 \cdot 10^{-124}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + \left(x \cdot 2 - \left(t \cdot z\right) \cdot \left(9 \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - t \cdot \left(9 \cdot \left(y \cdot z\right)\right)\right)\\
\end{array}
\end{array}
if z < -9.99999999999999933e-125Initial program 96.8%
sub-neg96.8%
sub-neg96.8%
associate-*l*93.9%
associate-*l*93.9%
Simplified93.9%
if -9.99999999999999933e-125 < z Initial program 97.4%
Taylor expanded in y around 0 97.4%
Final simplification96.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 (if (<= z -2e-120) (- (+ (* a (* 27.0 b)) (* x 2.0)) (* y (* 9.0 (* t z)))) (+ (* b (* a 27.0)) (- (* x 2.0) (* t (* 9.0 (* y z)))))))
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 <= -2e-120) {
tmp = ((a * (27.0 * b)) + (x * 2.0)) - (y * (9.0 * (t * z)));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z))));
}
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 <= (-2d-120)) then
tmp = ((a * (27.0d0 * b)) + (x * 2.0d0)) - (y * (9.0d0 * (t * z)))
else
tmp = (b * (a * 27.0d0)) + ((x * 2.0d0) - (t * (9.0d0 * (y * z))))
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 <= -2e-120) {
tmp = ((a * (27.0 * b)) + (x * 2.0)) - (y * (9.0 * (t * z)));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z))));
}
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 <= -2e-120: tmp = ((a * (27.0 * b)) + (x * 2.0)) - (y * (9.0 * (t * z))) else: tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z)))) 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 <= -2e-120) tmp = Float64(Float64(Float64(a * Float64(27.0 * b)) + Float64(x * 2.0)) - Float64(y * Float64(9.0 * Float64(t * z)))); else tmp = Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(t * Float64(9.0 * Float64(y * z))))); 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 <= -2e-120)
tmp = ((a * (27.0 * b)) + (x * 2.0)) - (y * (9.0 * (t * z)));
else
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z))));
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, -2e-120], N[(N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision] - N[(y * N[(9.0 * N[(t * z), $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[(y * z), $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 -2 \cdot 10^{-120}:\\
\;\;\;\;\left(a \cdot \left(27 \cdot b\right) + x \cdot 2\right) - y \cdot \left(9 \cdot \left(t \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - t \cdot \left(9 \cdot \left(y \cdot z\right)\right)\right)\\
\end{array}
\end{array}
if z < -1.99999999999999996e-120Initial program 96.7%
sub-neg96.7%
sub-neg96.7%
associate-*l*93.7%
associate-*l*93.7%
Simplified93.7%
+-commutative93.7%
associate-+r-93.7%
associate-*l*93.7%
Applied egg-rr93.7%
if -1.99999999999999996e-120 < z Initial program 97.4%
Taylor expanded in y around 0 97.4%
Final simplification96.1%
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 (<= t 1e-181) (+ (- (* x 2.0) (* (* t (* 9.0 y)) z)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* t (* y (* 9.0 z)))) (* 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 (t <= 1e-181) {
tmp = ((x * 2.0) - ((t * (9.0 * y)) * z)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (t * (y * (9.0 * z)))) + (b * (a * 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) :: tmp
if (t <= 1d-181) then
tmp = ((x * 2.0d0) - ((t * (9.0d0 * y)) * z)) + (a * (27.0d0 * b))
else
tmp = ((x * 2.0d0) - (t * (y * (9.0d0 * z)))) + (b * (a * 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 tmp;
if (t <= 1e-181) {
tmp = ((x * 2.0) - ((t * (9.0 * y)) * z)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (t * (y * (9.0 * z)))) + (b * (a * 27.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 t <= 1e-181: tmp = ((x * 2.0) - ((t * (9.0 * y)) * z)) + (a * (27.0 * b)) else: tmp = ((x * 2.0) - (t * (y * (9.0 * z)))) + (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 (t <= 1e-181) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(t * Float64(9.0 * y)) * z)) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(y * Float64(9.0 * z)))) + Float64(b * Float64(a * 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)
tmp = 0.0;
if (t <= 1e-181)
tmp = ((x * 2.0) - ((t * (9.0 * y)) * z)) + (a * (27.0 * b));
else
tmp = ((x * 2.0) - (t * (y * (9.0 * z)))) + (b * (a * 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_] := If[LessEqual[t, 1e-181], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(t * N[(9.0 * y), $MachinePrecision]), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(y * N[(9.0 * z), $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}\;t \leq 10^{-181}:\\
\;\;\;\;\left(x \cdot 2 - \left(t \cdot \left(9 \cdot y\right)\right) \cdot z\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(y \cdot \left(9 \cdot z\right)\right)\right) + b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if t < 1.00000000000000005e-181Initial program 97.4%
sub-neg97.4%
sub-neg97.4%
associate-*l*96.6%
associate-*l*96.5%
Simplified96.5%
Taylor expanded in y around 0 97.4%
*-commutative97.4%
associate-*l*97.4%
*-commutative97.4%
associate-*r*97.4%
*-commutative97.4%
associate-*r*96.1%
*-commutative96.1%
Simplified96.1%
if 1.00000000000000005e-181 < t Initial program 96.7%
pow196.7%
associate-*l*96.7%
Applied egg-rr96.7%
Final simplification96.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
(let* ((t_1 (* a (* 27.0 b))))
(if (<= x -1.1e+73)
(* x 2.0)
(if (<= x -500000.0)
t_1
(if (<= x -2.1e-93)
(* -9.0 (* z (* t y)))
(if (<= x -1.5e-199)
t_1
(if (<= x -4e-268)
(* y (* z (* t -9.0)))
(if (<= x 7.8e+54) (* 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 t_1 = a * (27.0 * b);
double tmp;
if (x <= -1.1e+73) {
tmp = x * 2.0;
} else if (x <= -500000.0) {
tmp = t_1;
} else if (x <= -2.1e-93) {
tmp = -9.0 * (z * (t * y));
} else if (x <= -1.5e-199) {
tmp = t_1;
} else if (x <= -4e-268) {
tmp = y * (z * (t * -9.0));
} else if (x <= 7.8e+54) {
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) :: t_1
real(8) :: tmp
t_1 = a * (27.0d0 * b)
if (x <= (-1.1d+73)) then
tmp = x * 2.0d0
else if (x <= (-500000.0d0)) then
tmp = t_1
else if (x <= (-2.1d-93)) then
tmp = (-9.0d0) * (z * (t * y))
else if (x <= (-1.5d-199)) then
tmp = t_1
else if (x <= (-4d-268)) then
tmp = y * (z * (t * (-9.0d0)))
else if (x <= 7.8d+54) 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 t_1 = a * (27.0 * b);
double tmp;
if (x <= -1.1e+73) {
tmp = x * 2.0;
} else if (x <= -500000.0) {
tmp = t_1;
} else if (x <= -2.1e-93) {
tmp = -9.0 * (z * (t * y));
} else if (x <= -1.5e-199) {
tmp = t_1;
} else if (x <= -4e-268) {
tmp = y * (z * (t * -9.0));
} else if (x <= 7.8e+54) {
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): t_1 = a * (27.0 * b) tmp = 0 if x <= -1.1e+73: tmp = x * 2.0 elif x <= -500000.0: tmp = t_1 elif x <= -2.1e-93: tmp = -9.0 * (z * (t * y)) elif x <= -1.5e-199: tmp = t_1 elif x <= -4e-268: tmp = y * (z * (t * -9.0)) elif x <= 7.8e+54: 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) t_1 = Float64(a * Float64(27.0 * b)) tmp = 0.0 if (x <= -1.1e+73) tmp = Float64(x * 2.0); elseif (x <= -500000.0) tmp = t_1; elseif (x <= -2.1e-93) tmp = Float64(-9.0 * Float64(z * Float64(t * y))); elseif (x <= -1.5e-199) tmp = t_1; elseif (x <= -4e-268) tmp = Float64(y * Float64(z * Float64(t * -9.0))); elseif (x <= 7.8e+54) 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)
t_1 = a * (27.0 * b);
tmp = 0.0;
if (x <= -1.1e+73)
tmp = x * 2.0;
elseif (x <= -500000.0)
tmp = t_1;
elseif (x <= -2.1e-93)
tmp = -9.0 * (z * (t * y));
elseif (x <= -1.5e-199)
tmp = t_1;
elseif (x <= -4e-268)
tmp = y * (z * (t * -9.0));
elseif (x <= 7.8e+54)
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_] := Block[{t$95$1 = N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.1e+73], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, -500000.0], t$95$1, If[LessEqual[x, -2.1e-93], N[(-9.0 * N[(z * N[(t * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -1.5e-199], t$95$1, If[LessEqual[x, -4e-268], N[(y * N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.8e+54], 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}
t_1 := a \cdot \left(27 \cdot b\right)\\
\mathbf{if}\;x \leq -1.1 \cdot 10^{+73}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -500000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -2.1 \cdot 10^{-93}:\\
\;\;\;\;-9 \cdot \left(z \cdot \left(t \cdot y\right)\right)\\
\mathbf{elif}\;x \leq -1.5 \cdot 10^{-199}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -4 \cdot 10^{-268}:\\
\;\;\;\;y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\
\mathbf{elif}\;x \leq 7.8 \cdot 10^{+54}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -1.1e73 or 7.8000000000000005e54 < x Initial program 96.9%
sub-neg96.9%
sub-neg96.9%
associate-*l*93.2%
associate-*l*94.2%
Simplified94.2%
Taylor expanded in x around inf 65.4%
if -1.1e73 < x < -5e5 or -2.1000000000000001e-93 < x < -1.49999999999999992e-199Initial program 99.8%
sub-neg99.8%
sub-neg99.8%
associate-*l*97.5%
associate-*l*97.4%
Simplified97.4%
Taylor expanded in y around 0 71.5%
+-commutative71.5%
*-commutative71.5%
*-commutative71.5%
fma-def71.5%
Applied egg-rr71.5%
Taylor expanded in a around inf 63.8%
*-commutative63.8%
associate-*r*63.8%
*-commutative63.8%
Simplified63.8%
if -5e5 < x < -2.1000000000000001e-93Initial program 99.7%
sub-neg99.7%
sub-neg99.7%
associate-*l*93.5%
associate-*l*93.5%
Simplified93.5%
Taylor expanded in a around 0 93.5%
Taylor expanded in y around inf 67.6%
associate-*r*67.3%
metadata-eval67.3%
distribute-lft-neg-in67.3%
*-commutative67.3%
associate-*l*61.4%
*-commutative61.4%
distribute-rgt-neg-in61.4%
metadata-eval61.4%
Simplified61.4%
Taylor expanded in y around 0 67.6%
associate-*r*67.7%
Simplified67.7%
if -1.49999999999999992e-199 < x < -3.99999999999999983e-268Initial program 91.9%
sub-neg91.9%
sub-neg91.9%
associate-*l*99.9%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in a around 0 99.7%
Taylor expanded in y around inf 56.3%
associate-*r*56.2%
metadata-eval56.2%
distribute-lft-neg-in56.2%
*-commutative56.2%
associate-*l*64.2%
*-commutative64.2%
distribute-rgt-neg-in64.2%
metadata-eval64.2%
Simplified64.2%
if -3.99999999999999983e-268 < x < 7.8000000000000005e54Initial program 96.5%
sub-neg96.5%
sub-neg96.5%
associate-*l*96.0%
associate-*l*95.9%
Simplified95.9%
Taylor expanded in a around 0 96.0%
Taylor expanded in a around inf 57.3%
Final simplification62.4%
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 (or (<= x -1.5e+73) (not (<= x 4.8e+51))) (+ (* x 2.0) (* (* y z) (* t -9.0))) (- (* 27.0 (* a b)) (* 9.0 (* t (* y z))))))
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 <= -1.5e+73) || !(x <= 4.8e+51)) {
tmp = (x * 2.0) + ((y * z) * (t * -9.0));
} else {
tmp = (27.0 * (a * b)) - (9.0 * (t * (y * z)));
}
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 <= (-1.5d+73)) .or. (.not. (x <= 4.8d+51))) then
tmp = (x * 2.0d0) + ((y * z) * (t * (-9.0d0)))
else
tmp = (27.0d0 * (a * b)) - (9.0d0 * (t * (y * z)))
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 <= -1.5e+73) || !(x <= 4.8e+51)) {
tmp = (x * 2.0) + ((y * z) * (t * -9.0));
} else {
tmp = (27.0 * (a * b)) - (9.0 * (t * (y * z)));
}
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 <= -1.5e+73) or not (x <= 4.8e+51): tmp = (x * 2.0) + ((y * z) * (t * -9.0)) else: tmp = (27.0 * (a * b)) - (9.0 * (t * (y * z))) 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 <= -1.5e+73) || !(x <= 4.8e+51)) tmp = Float64(Float64(x * 2.0) + Float64(Float64(y * z) * Float64(t * -9.0))); else tmp = Float64(Float64(27.0 * Float64(a * b)) - Float64(9.0 * Float64(t * Float64(y * z)))); 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 <= -1.5e+73) || ~((x <= 4.8e+51)))
tmp = (x * 2.0) + ((y * z) * (t * -9.0));
else
tmp = (27.0 * (a * b)) - (9.0 * (t * (y * z)));
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[Or[LessEqual[x, -1.5e+73], N[Not[LessEqual[x, 4.8e+51]], $MachinePrecision]], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(y * z), $MachinePrecision] * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] - N[(9.0 * N[(t * N[(y * z), $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}\;x \leq -1.5 \cdot 10^{+73} \lor \neg \left(x \leq 4.8 \cdot 10^{+51}\right):\\
\;\;\;\;x \cdot 2 + \left(y \cdot z\right) \cdot \left(t \cdot -9\right)\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if x < -1.50000000000000005e73 or 4.7999999999999997e51 < x Initial program 96.9%
sub-neg96.9%
sub-neg96.9%
associate-*l*93.2%
associate-*l*94.2%
Simplified94.2%
+-commutative94.2%
associate-+r-94.2%
associate-*l*94.2%
Applied egg-rr94.2%
Taylor expanded in a around 0 87.7%
cancel-sign-sub-inv87.7%
metadata-eval87.7%
associate-*r*87.7%
*-commutative87.7%
Simplified87.7%
if -1.50000000000000005e73 < x < 4.7999999999999997e51Initial program 97.3%
sub-neg97.3%
sub-neg97.3%
associate-*l*96.4%
associate-*l*96.4%
Simplified96.4%
Taylor expanded in x around 0 88.8%
Final simplification88.4%
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 (+ (* a (* 27.0 b)) (- (* x 2.0) (* t (* 9.0 (* y z))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
return (a * (27.0 * b)) + ((x * 2.0) - (t * (9.0 * (y * z))));
}
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 = (a * (27.0d0 * b)) + ((x * 2.0d0) - (t * (9.0d0 * (y * z))))
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 (a * (27.0 * b)) + ((x * 2.0) - (t * (9.0 * (y * z))));
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): return (a * (27.0 * b)) + ((x * 2.0) - (t * (9.0 * (y * z))))
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) return Float64(Float64(a * Float64(27.0 * b)) + Float64(Float64(x * 2.0) - Float64(t * Float64(9.0 * Float64(y * z))))) 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 = (a * (27.0 * b)) + ((x * 2.0) - (t * (9.0 * (y * z))));
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[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
a \cdot \left(27 \cdot b\right) + \left(x \cdot 2 - t \cdot \left(9 \cdot \left(y \cdot z\right)\right)\right)
\end{array}
Initial program 97.2%
sub-neg97.2%
sub-neg97.2%
associate-*l*95.2%
associate-*l*95.5%
Simplified95.5%
Taylor expanded in y around 0 97.5%
*-commutative97.5%
associate-*l*97.5%
*-commutative97.5%
associate-*r*97.5%
*-commutative97.5%
associate-*r*94.4%
*-commutative94.4%
Simplified94.4%
Taylor expanded in t around 0 97.5%
associate-*r*97.5%
*-commutative97.5%
associate-*l*97.5%
Simplified97.5%
Final simplification97.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 (+ (* b (* a 27.0)) (- (* x 2.0) (* t (* 9.0 (* y z))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
return (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z))));
}
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 = (b * (a * 27.0d0)) + ((x * 2.0d0) - (t * (9.0d0 * (y * z))))
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 (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z))));
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): return (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z))))
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) return Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(t * Float64(9.0 * Float64(y * z))))) 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 = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z))));
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[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - t \cdot \left(9 \cdot \left(y \cdot z\right)\right)\right)
\end{array}
Initial program 97.2%
Taylor expanded in y around 0 97.1%
Final simplification97.1%
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 (or (<= z -3.8e-64) (not (<= z 8.2e+33))) (+ (* x 2.0) (* (* y z) (* t -9.0))) (+ (* x 2.0) (* 27.0 (* a b)))))
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.8e-64) || !(z <= 8.2e+33)) {
tmp = (x * 2.0) + ((y * z) * (t * -9.0));
} else {
tmp = (x * 2.0) + (27.0 * (a * b));
}
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 <= (-3.8d-64)) .or. (.not. (z <= 8.2d+33))) then
tmp = (x * 2.0d0) + ((y * z) * (t * (-9.0d0)))
else
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
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 <= -3.8e-64) || !(z <= 8.2e+33)) {
tmp = (x * 2.0) + ((y * z) * (t * -9.0));
} else {
tmp = (x * 2.0) + (27.0 * (a * b));
}
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 <= -3.8e-64) or not (z <= 8.2e+33): tmp = (x * 2.0) + ((y * z) * (t * -9.0)) else: tmp = (x * 2.0) + (27.0 * (a * b)) 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.8e-64) || !(z <= 8.2e+33)) tmp = Float64(Float64(x * 2.0) + Float64(Float64(y * z) * Float64(t * -9.0))); else tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); 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 <= -3.8e-64) || ~((z <= 8.2e+33)))
tmp = (x * 2.0) + ((y * z) * (t * -9.0));
else
tmp = (x * 2.0) + (27.0 * (a * b));
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[Or[LessEqual[z, -3.8e-64], N[Not[LessEqual[z, 8.2e+33]], $MachinePrecision]], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(y * z), $MachinePrecision] * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $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.8 \cdot 10^{-64} \lor \neg \left(z \leq 8.2 \cdot 10^{+33}\right):\\
\;\;\;\;x \cdot 2 + \left(y \cdot z\right) \cdot \left(t \cdot -9\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if z < -3.8000000000000002e-64 or 8.1999999999999999e33 < z Initial program 95.5%
sub-neg95.5%
sub-neg95.5%
associate-*l*92.1%
associate-*l*92.1%
Simplified92.1%
+-commutative92.1%
associate-+r-92.1%
associate-*l*92.1%
Applied egg-rr92.1%
Taylor expanded in a around 0 70.1%
cancel-sign-sub-inv70.1%
metadata-eval70.1%
associate-*r*70.1%
*-commutative70.1%
Simplified70.1%
if -3.8000000000000002e-64 < z < 8.1999999999999999e33Initial program 99.0%
sub-neg99.0%
sub-neg99.0%
associate-*l*98.5%
associate-*l*99.3%
Simplified99.3%
Taylor expanded in y around 0 87.8%
Final simplification78.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 -1.1e-60)
(- (* x 2.0) (* 9.0 (* t (* y z))))
(if (<= z 8.5e+33)
(+ (* x 2.0) (* 27.0 (* a b)))
(+ (* x 2.0) (* (* y z) (* t -9.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 <= -1.1e-60) {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
} else if (z <= 8.5e+33) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) + ((y * z) * (t * -9.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 (z <= (-1.1d-60)) then
tmp = (x * 2.0d0) - (9.0d0 * (t * (y * z)))
else if (z <= 8.5d+33) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else
tmp = (x * 2.0d0) + ((y * z) * (t * (-9.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 (z <= -1.1e-60) {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
} else if (z <= 8.5e+33) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) + ((y * z) * (t * -9.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 z <= -1.1e-60: tmp = (x * 2.0) - (9.0 * (t * (y * z))) elif z <= 8.5e+33: tmp = (x * 2.0) + (27.0 * (a * b)) else: tmp = (x * 2.0) + ((y * z) * (t * -9.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 <= -1.1e-60) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(y * z)))); elseif (z <= 8.5e+33) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); else tmp = Float64(Float64(x * 2.0) + Float64(Float64(y * z) * Float64(t * -9.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 (z <= -1.1e-60)
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
elseif (z <= 8.5e+33)
tmp = (x * 2.0) + (27.0 * (a * b));
else
tmp = (x * 2.0) + ((y * z) * (t * -9.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[z, -1.1e-60], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.5e+33], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(y * z), $MachinePrecision] * N[(t * -9.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 -1.1 \cdot 10^{-60}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{+33}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + \left(y \cdot z\right) \cdot \left(t \cdot -9\right)\\
\end{array}
\end{array}
if z < -1.0999999999999999e-60Initial program 96.1%
sub-neg96.1%
sub-neg96.1%
associate-*l*92.6%
associate-*l*92.6%
Simplified92.6%
Taylor expanded in a around 0 70.1%
if -1.0999999999999999e-60 < z < 8.4999999999999998e33Initial program 99.0%
sub-neg99.0%
sub-neg99.0%
associate-*l*98.5%
associate-*l*99.3%
Simplified99.3%
Taylor expanded in y around 0 87.8%
if 8.4999999999999998e33 < z Initial program 94.5%
sub-neg94.5%
sub-neg94.5%
associate-*l*91.4%
associate-*l*91.5%
Simplified91.5%
+-commutative91.5%
associate-+r-91.5%
associate-*l*91.4%
Applied egg-rr91.4%
Taylor expanded in a around 0 70.2%
cancel-sign-sub-inv70.2%
metadata-eval70.2%
associate-*r*70.2%
*-commutative70.2%
Simplified70.2%
Final simplification78.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 (* a (* 27.0 b))))
(if (<= x -1e+73)
(* x 2.0)
(if (<= x -430000.0)
t_1
(if (<= x -4.15e-94)
(* -9.0 (* t (* y z)))
(if (<= x 4.6e+54) 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 = a * (27.0 * b);
double tmp;
if (x <= -1e+73) {
tmp = x * 2.0;
} else if (x <= -430000.0) {
tmp = t_1;
} else if (x <= -4.15e-94) {
tmp = -9.0 * (t * (y * z));
} else if (x <= 4.6e+54) {
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 = a * (27.0d0 * b)
if (x <= (-1d+73)) then
tmp = x * 2.0d0
else if (x <= (-430000.0d0)) then
tmp = t_1
else if (x <= (-4.15d-94)) then
tmp = (-9.0d0) * (t * (y * z))
else if (x <= 4.6d+54) 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 = a * (27.0 * b);
double tmp;
if (x <= -1e+73) {
tmp = x * 2.0;
} else if (x <= -430000.0) {
tmp = t_1;
} else if (x <= -4.15e-94) {
tmp = -9.0 * (t * (y * z));
} else if (x <= 4.6e+54) {
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 = a * (27.0 * b) tmp = 0 if x <= -1e+73: tmp = x * 2.0 elif x <= -430000.0: tmp = t_1 elif x <= -4.15e-94: tmp = -9.0 * (t * (y * z)) elif x <= 4.6e+54: 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(a * Float64(27.0 * b)) tmp = 0.0 if (x <= -1e+73) tmp = Float64(x * 2.0); elseif (x <= -430000.0) tmp = t_1; elseif (x <= -4.15e-94) tmp = Float64(-9.0 * Float64(t * Float64(y * z))); elseif (x <= 4.6e+54) 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 = a * (27.0 * b);
tmp = 0.0;
if (x <= -1e+73)
tmp = x * 2.0;
elseif (x <= -430000.0)
tmp = t_1;
elseif (x <= -4.15e-94)
tmp = -9.0 * (t * (y * z));
elseif (x <= 4.6e+54)
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[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1e+73], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, -430000.0], t$95$1, If[LessEqual[x, -4.15e-94], N[(-9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.6e+54], 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 := a \cdot \left(27 \cdot b\right)\\
\mathbf{if}\;x \leq -1 \cdot 10^{+73}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -430000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -4.15 \cdot 10^{-94}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{+54}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -9.99999999999999983e72 or 4.59999999999999988e54 < x Initial program 96.9%
sub-neg96.9%
sub-neg96.9%
associate-*l*93.2%
associate-*l*94.2%
Simplified94.2%
Taylor expanded in x around inf 65.4%
if -9.99999999999999983e72 < x < -4.3e5 or -4.1499999999999998e-94 < x < 4.59999999999999988e54Initial program 97.1%
sub-neg97.1%
sub-neg97.1%
associate-*l*96.7%
associate-*l*96.7%
Simplified96.7%
Taylor expanded in y around 0 65.0%
+-commutative65.0%
*-commutative65.0%
*-commutative65.0%
fma-def65.0%
Applied egg-rr65.0%
Taylor expanded in a around inf 56.7%
*-commutative56.7%
associate-*r*56.7%
*-commutative56.7%
Simplified56.7%
if -4.3e5 < x < -4.1499999999999998e-94Initial program 99.7%
sub-neg99.7%
sub-neg99.7%
associate-*l*93.5%
associate-*l*93.5%
Simplified93.5%
Taylor expanded in y around inf 67.6%
Final simplification60.7%
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 (* a (* 27.0 b))))
(if (<= x -1.4e+73)
(* x 2.0)
(if (<= x -430000.0)
t_1
(if (<= x -7.6e-94)
(* -9.0 (* z (* t y)))
(if (<= x 2.45e+54) 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 = a * (27.0 * b);
double tmp;
if (x <= -1.4e+73) {
tmp = x * 2.0;
} else if (x <= -430000.0) {
tmp = t_1;
} else if (x <= -7.6e-94) {
tmp = -9.0 * (z * (t * y));
} else if (x <= 2.45e+54) {
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 = a * (27.0d0 * b)
if (x <= (-1.4d+73)) then
tmp = x * 2.0d0
else if (x <= (-430000.0d0)) then
tmp = t_1
else if (x <= (-7.6d-94)) then
tmp = (-9.0d0) * (z * (t * y))
else if (x <= 2.45d+54) 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 = a * (27.0 * b);
double tmp;
if (x <= -1.4e+73) {
tmp = x * 2.0;
} else if (x <= -430000.0) {
tmp = t_1;
} else if (x <= -7.6e-94) {
tmp = -9.0 * (z * (t * y));
} else if (x <= 2.45e+54) {
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 = a * (27.0 * b) tmp = 0 if x <= -1.4e+73: tmp = x * 2.0 elif x <= -430000.0: tmp = t_1 elif x <= -7.6e-94: tmp = -9.0 * (z * (t * y)) elif x <= 2.45e+54: 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(a * Float64(27.0 * b)) tmp = 0.0 if (x <= -1.4e+73) tmp = Float64(x * 2.0); elseif (x <= -430000.0) tmp = t_1; elseif (x <= -7.6e-94) tmp = Float64(-9.0 * Float64(z * Float64(t * y))); elseif (x <= 2.45e+54) 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 = a * (27.0 * b);
tmp = 0.0;
if (x <= -1.4e+73)
tmp = x * 2.0;
elseif (x <= -430000.0)
tmp = t_1;
elseif (x <= -7.6e-94)
tmp = -9.0 * (z * (t * y));
elseif (x <= 2.45e+54)
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[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.4e+73], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, -430000.0], t$95$1, If[LessEqual[x, -7.6e-94], N[(-9.0 * N[(z * N[(t * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.45e+54], 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 := a \cdot \left(27 \cdot b\right)\\
\mathbf{if}\;x \leq -1.4 \cdot 10^{+73}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -430000:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -7.6 \cdot 10^{-94}:\\
\;\;\;\;-9 \cdot \left(z \cdot \left(t \cdot y\right)\right)\\
\mathbf{elif}\;x \leq 2.45 \cdot 10^{+54}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -1.40000000000000004e73 or 2.45e54 < x Initial program 96.9%
sub-neg96.9%
sub-neg96.9%
associate-*l*93.2%
associate-*l*94.2%
Simplified94.2%
Taylor expanded in x around inf 65.4%
if -1.40000000000000004e73 < x < -4.3e5 or -7.59999999999999999e-94 < x < 2.45e54Initial program 97.1%
sub-neg97.1%
sub-neg97.1%
associate-*l*96.7%
associate-*l*96.7%
Simplified96.7%
Taylor expanded in y around 0 65.0%
+-commutative65.0%
*-commutative65.0%
*-commutative65.0%
fma-def65.0%
Applied egg-rr65.0%
Taylor expanded in a around inf 56.7%
*-commutative56.7%
associate-*r*56.7%
*-commutative56.7%
Simplified56.7%
if -4.3e5 < x < -7.59999999999999999e-94Initial program 99.7%
sub-neg99.7%
sub-neg99.7%
associate-*l*93.5%
associate-*l*93.5%
Simplified93.5%
Taylor expanded in a around 0 93.5%
Taylor expanded in y around inf 67.6%
associate-*r*67.3%
metadata-eval67.3%
distribute-lft-neg-in67.3%
*-commutative67.3%
associate-*l*61.4%
*-commutative61.4%
distribute-rgt-neg-in61.4%
metadata-eval61.4%
Simplified61.4%
Taylor expanded in y around 0 67.6%
associate-*r*67.7%
Simplified67.7%
Final simplification60.7%
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.85e-6) (* -9.0 (* z (* t y))) (if (<= z 4.2e+34) (+ (* x 2.0) (* 27.0 (* a b))) (* t (* y (* z -9.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 <= -1.85e-6) {
tmp = -9.0 * (z * (t * y));
} else if (z <= 4.2e+34) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = t * (y * (z * -9.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 (z <= (-1.85d-6)) then
tmp = (-9.0d0) * (z * (t * y))
else if (z <= 4.2d+34) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else
tmp = t * (y * (z * (-9.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 (z <= -1.85e-6) {
tmp = -9.0 * (z * (t * y));
} else if (z <= 4.2e+34) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = t * (y * (z * -9.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 z <= -1.85e-6: tmp = -9.0 * (z * (t * y)) elif z <= 4.2e+34: tmp = (x * 2.0) + (27.0 * (a * b)) else: tmp = t * (y * (z * -9.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 <= -1.85e-6) tmp = Float64(-9.0 * Float64(z * Float64(t * y))); elseif (z <= 4.2e+34) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); else tmp = Float64(t * Float64(y * Float64(z * -9.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 (z <= -1.85e-6)
tmp = -9.0 * (z * (t * y));
elseif (z <= 4.2e+34)
tmp = (x * 2.0) + (27.0 * (a * b));
else
tmp = t * (y * (z * -9.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[z, -1.85e-6], N[(-9.0 * N[(z * N[(t * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.2e+34], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(y * N[(z * -9.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 -1.85 \cdot 10^{-6}:\\
\;\;\;\;-9 \cdot \left(z \cdot \left(t \cdot y\right)\right)\\
\mathbf{elif}\;z \leq 4.2 \cdot 10^{+34}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
\end{array}
\end{array}
if z < -1.8500000000000001e-6Initial program 95.4%
sub-neg95.4%
sub-neg95.4%
associate-*l*91.1%
associate-*l*91.1%
Simplified91.1%
Taylor expanded in a around 0 91.1%
Taylor expanded in y around inf 52.1%
associate-*r*52.1%
metadata-eval52.1%
distribute-lft-neg-in52.1%
*-commutative52.1%
associate-*l*53.7%
*-commutative53.7%
distribute-rgt-neg-in53.7%
metadata-eval53.7%
Simplified53.7%
Taylor expanded in y around 0 52.1%
associate-*r*55.1%
Simplified55.1%
if -1.8500000000000001e-6 < z < 4.20000000000000035e34Initial program 99.1%
sub-neg99.1%
sub-neg99.1%
associate-*l*98.7%
associate-*l*99.3%
Simplified99.3%
Taylor expanded in y around 0 84.6%
if 4.20000000000000035e34 < z Initial program 94.5%
sub-neg94.5%
sub-neg94.5%
associate-*l*91.4%
associate-*l*91.5%
Simplified91.5%
+-commutative91.5%
associate-+r-91.5%
associate-*l*91.4%
Applied egg-rr91.4%
Taylor expanded in y around inf 46.6%
*-commutative46.6%
associate-*l*46.6%
associate-*r*46.6%
Simplified46.6%
Final simplification68.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 (or (<= x -1.6e+73) (not (<= x 4.8e+54))) (* x 2.0) (* 27.0 (* a b))))
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 <= -1.6e+73) || !(x <= 4.8e+54)) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
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 <= (-1.6d+73)) .or. (.not. (x <= 4.8d+54))) then
tmp = x * 2.0d0
else
tmp = 27.0d0 * (a * b)
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 <= -1.6e+73) || !(x <= 4.8e+54)) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
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 <= -1.6e+73) or not (x <= 4.8e+54): tmp = x * 2.0 else: tmp = 27.0 * (a * b) 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 <= -1.6e+73) || !(x <= 4.8e+54)) tmp = Float64(x * 2.0); else tmp = Float64(27.0 * Float64(a * b)); 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 <= -1.6e+73) || ~((x <= 4.8e+54)))
tmp = x * 2.0;
else
tmp = 27.0 * (a * b);
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[Or[LessEqual[x, -1.6e+73], N[Not[LessEqual[x, 4.8e+54]], $MachinePrecision]], N[(x * 2.0), $MachinePrecision], N[(27.0 * N[(a * b), $MachinePrecision]), $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.6 \cdot 10^{+73} \lor \neg \left(x \leq 4.8 \cdot 10^{+54}\right):\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if x < -1.59999999999999991e73 or 4.79999999999999997e54 < x Initial program 96.9%
sub-neg96.9%
sub-neg96.9%
associate-*l*93.2%
associate-*l*94.2%
Simplified94.2%
Taylor expanded in x around inf 65.4%
if -1.59999999999999991e73 < x < 4.79999999999999997e54Initial program 97.3%
sub-neg97.3%
sub-neg97.3%
associate-*l*96.4%
associate-*l*96.4%
Simplified96.4%
Taylor expanded in a around 0 96.4%
Taylor expanded in a around inf 54.0%
Final simplification58.4%
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 (or (<= x -1.45e+73) (not (<= x 9.2e+54))) (* x 2.0) (* a (* 27.0 b))))
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 <= -1.45e+73) || !(x <= 9.2e+54)) {
tmp = x * 2.0;
} else {
tmp = a * (27.0 * b);
}
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 <= (-1.45d+73)) .or. (.not. (x <= 9.2d+54))) then
tmp = x * 2.0d0
else
tmp = a * (27.0d0 * b)
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 <= -1.45e+73) || !(x <= 9.2e+54)) {
tmp = x * 2.0;
} else {
tmp = a * (27.0 * b);
}
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 <= -1.45e+73) or not (x <= 9.2e+54): tmp = x * 2.0 else: tmp = a * (27.0 * b) 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 <= -1.45e+73) || !(x <= 9.2e+54)) tmp = Float64(x * 2.0); else tmp = Float64(a * Float64(27.0 * b)); 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 <= -1.45e+73) || ~((x <= 9.2e+54)))
tmp = x * 2.0;
else
tmp = a * (27.0 * b);
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[Or[LessEqual[x, -1.45e+73], N[Not[LessEqual[x, 9.2e+54]], $MachinePrecision]], N[(x * 2.0), $MachinePrecision], N[(a * N[(27.0 * b), $MachinePrecision]), $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.45 \cdot 10^{+73} \lor \neg \left(x \leq 9.2 \cdot 10^{+54}\right):\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\end{array}
\end{array}
if x < -1.4500000000000001e73 or 9.19999999999999977e54 < x Initial program 96.9%
sub-neg96.9%
sub-neg96.9%
associate-*l*93.2%
associate-*l*94.2%
Simplified94.2%
Taylor expanded in x around inf 65.4%
if -1.4500000000000001e73 < x < 9.19999999999999977e54Initial program 97.3%
sub-neg97.3%
sub-neg97.3%
associate-*l*96.4%
associate-*l*96.4%
Simplified96.4%
Taylor expanded in y around 0 62.1%
+-commutative62.1%
*-commutative62.1%
*-commutative62.1%
fma-def62.1%
Applied egg-rr62.1%
Taylor expanded in a around inf 54.0%
*-commutative54.0%
associate-*r*53.9%
*-commutative53.9%
Simplified53.9%
Final simplification58.4%
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 97.2%
sub-neg97.2%
sub-neg97.2%
associate-*l*95.2%
associate-*l*95.5%
Simplified95.5%
Taylor expanded in x around inf 31.8%
Final simplification31.8%
(FPCore (x y z t a b) :precision binary64 (if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (y < 7.590524218811189d-161) then
tmp = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + (a * (27.0d0 * b))
else
tmp = ((x * 2.0d0) - (9.0d0 * (y * (t * z)))) + ((a * 27.0d0) * b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y < 7.590524218811189e-161: tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)) else: tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y < 7.590524218811189e-161) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(t * z)))) + Float64(Float64(a * 27.0) * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y < 7.590524218811189e-161) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)); else tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Less[y, 7.590524218811189e-161], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y < 7.590524218811189 \cdot 10^{-161}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\
\end{array}
\end{array}
herbie shell --seed 2023318
(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)))