
(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: 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 (<= (* (* y 9.0) z) 5e+195) (- (* x 2.0) (fma (* y (* 9.0 z)) t (* (- a) (* 27.0 b)))) (+ (* x 2.0) (- (* a (* 27.0 b)) (* (* y 9.0) (* z t))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((y * 9.0) * z) <= 5e+195) {
tmp = (x * 2.0) - fma((y * (9.0 * z)), t, (-a * (27.0 * b)));
} else {
tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (z * t)));
}
return tmp;
}
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(y * 9.0) * z) <= 5e+195) tmp = Float64(Float64(x * 2.0) - fma(Float64(y * Float64(9.0 * z)), t, Float64(Float64(-a) * Float64(27.0 * b)))); else tmp = Float64(Float64(x * 2.0) + Float64(Float64(a * Float64(27.0 * b)) - Float64(Float64(y * 9.0) * Float64(z * t)))); 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[N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision], 5e+195], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * N[(9.0 * z), $MachinePrecision]), $MachinePrecision] * t + N[((-a) * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $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}\;\left(y \cdot 9\right) \cdot z \leq 5 \cdot 10^{+195}:\\
\;\;\;\;x \cdot 2 - \mathsf{fma}\left(y \cdot \left(9 \cdot z\right), t, \left(-a\right) \cdot \left(27 \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + \left(a \cdot \left(27 \cdot b\right) - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y 9) z) < 4.9999999999999998e195Initial program 96.8%
associate-+l-96.8%
sub-neg96.8%
neg-mul-196.8%
metadata-eval96.8%
metadata-eval96.8%
cancel-sign-sub-inv96.8%
metadata-eval96.8%
*-lft-identity96.8%
associate-*l*94.6%
associate-*l*94.6%
Simplified94.6%
cancel-sign-sub-inv94.6%
associate-*r*96.8%
fma-def97.2%
associate-*l*97.2%
Applied egg-rr97.2%
if 4.9999999999999998e195 < (*.f64 (*.f64 y 9) z) Initial program 67.1%
associate-+l-67.1%
sub-neg67.1%
neg-mul-167.1%
metadata-eval67.1%
metadata-eval67.1%
cancel-sign-sub-inv67.1%
metadata-eval67.1%
*-lft-identity67.1%
associate-*l*99.7%
associate-*l*99.7%
Simplified99.7%
Final simplification97.6%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* y 9.0) z)))
(if (<= t_1 2e+74)
(+ (- (* x 2.0) (* t_1 t)) (* b (* a 27.0)))
(+ (* x 2.0) (- (* a (* 27.0 b)) (* (* y 9.0) (* z t)))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y * 9.0) * z;
double tmp;
if (t_1 <= 2e+74) {
tmp = ((x * 2.0) - (t_1 * t)) + (b * (a * 27.0));
} else {
tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (z * t)));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (y * 9.0d0) * z
if (t_1 <= 2d+74) then
tmp = ((x * 2.0d0) - (t_1 * t)) + (b * (a * 27.0d0))
else
tmp = (x * 2.0d0) + ((a * (27.0d0 * b)) - ((y * 9.0d0) * (z * t)))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y * 9.0) * z;
double tmp;
if (t_1 <= 2e+74) {
tmp = ((x * 2.0) - (t_1 * t)) + (b * (a * 27.0));
} else {
tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (z * t)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = (y * 9.0) * z tmp = 0 if t_1 <= 2e+74: tmp = ((x * 2.0) - (t_1 * t)) + (b * (a * 27.0)) else: tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (z * t))) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(y * 9.0) * z) tmp = 0.0 if (t_1 <= 2e+74) tmp = Float64(Float64(Float64(x * 2.0) - Float64(t_1 * t)) + Float64(b * Float64(a * 27.0))); else tmp = Float64(Float64(x * 2.0) + Float64(Float64(a * Float64(27.0 * b)) - Float64(Float64(y * 9.0) * Float64(z * t)))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = (y * 9.0) * z;
tmp = 0.0;
if (t_1 <= 2e+74)
tmp = ((x * 2.0) - (t_1 * t)) + (b * (a * 27.0));
else
tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (z * t)));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision]}, If[LessEqual[t$95$1, 2e+74], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t$95$1 * t), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := \left(y \cdot 9\right) \cdot z\\
\mathbf{if}\;t_1 \leq 2 \cdot 10^{+74}:\\
\;\;\;\;\left(x \cdot 2 - t_1 \cdot t\right) + b \cdot \left(a \cdot 27\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + \left(a \cdot \left(27 \cdot b\right) - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y 9) z) < 1.9999999999999999e74Initial program 96.9%
if 1.9999999999999999e74 < (*.f64 (*.f64 y 9) z) Initial program 78.0%
associate-+l-78.0%
sub-neg78.0%
neg-mul-178.0%
metadata-eval78.0%
metadata-eval78.0%
cancel-sign-sub-inv78.0%
metadata-eval78.0%
*-lft-identity78.0%
associate-*l*98.0%
associate-*l*98.0%
Simplified98.0%
Final simplification97.2%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* b (* a 27.0))))
(if (<= z -1.7e-83)
(+ t_1 (- (* x 2.0) (* z (* (* y 9.0) t))))
(+ (- (* x 2.0) (* (* (* y 9.0) z) t)) t_1))))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 = b * (a * 27.0);
double tmp;
if (z <= -1.7e-83) {
tmp = t_1 + ((x * 2.0) - (z * ((y * 9.0) * t)));
} else {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + t_1;
}
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 = b * (a * 27.0d0)
if (z <= (-1.7d-83)) then
tmp = t_1 + ((x * 2.0d0) - (z * ((y * 9.0d0) * t)))
else
tmp = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + t_1
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 = b * (a * 27.0);
double tmp;
if (z <= -1.7e-83) {
tmp = t_1 + ((x * 2.0) - (z * ((y * 9.0) * t)));
} else {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + t_1;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = b * (a * 27.0) tmp = 0 if z <= -1.7e-83: tmp = t_1 + ((x * 2.0) - (z * ((y * 9.0) * t))) else: tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + t_1 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(b * Float64(a * 27.0)) tmp = 0.0 if (z <= -1.7e-83) tmp = Float64(t_1 + Float64(Float64(x * 2.0) - Float64(z * Float64(Float64(y * 9.0) * t)))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + t_1); 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 = b * (a * 27.0);
tmp = 0.0;
if (z <= -1.7e-83)
tmp = t_1 + ((x * 2.0) - (z * ((y * 9.0) * t)));
else
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + t_1;
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[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.7e-83], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] - N[(z * N[(N[(y * 9.0), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a \cdot 27\right)\\
\mathbf{if}\;z \leq -1.7 \cdot 10^{-83}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - z \cdot \left(\left(y \cdot 9\right) \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + t_1\\
\end{array}
\end{array}
if z < -1.6999999999999999e-83Initial program 91.4%
Taylor expanded in y around 0 96.2%
associate-*r*96.2%
*-commutative96.2%
associate-*r*99.8%
Simplified99.8%
if -1.6999999999999999e-83 < z Initial program 93.3%
Final simplification95.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 -3.2e-122)
(- (* x 2.0) (* 9.0 (* y (* z t))))
(if (<= z 7.6e-103)
(- (* x 2.0) (* a (* b -27.0)))
(+ (* -9.0 (* z (* y t))) (* 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 (z <= -3.2e-122) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else if (z <= 7.6e-103) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = (-9.0 * (z * (y * t))) + (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 (z <= (-3.2d-122)) then
tmp = (x * 2.0d0) - (9.0d0 * (y * (z * t)))
else if (z <= 7.6d-103) then
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
else
tmp = ((-9.0d0) * (z * (y * t))) + (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 (z <= -3.2e-122) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else if (z <= 7.6e-103) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = (-9.0 * (z * (y * t))) + (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 z <= -3.2e-122: tmp = (x * 2.0) - (9.0 * (y * (z * t))) elif z <= 7.6e-103: tmp = (x * 2.0) - (a * (b * -27.0)) else: tmp = (-9.0 * (z * (y * t))) + (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 (z <= -3.2e-122) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))); elseif (z <= 7.6e-103) tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); else tmp = Float64(Float64(-9.0 * Float64(z * Float64(y * t))) + 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 (z <= -3.2e-122)
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
elseif (z <= 7.6e-103)
tmp = (x * 2.0) - (a * (b * -27.0));
else
tmp = (-9.0 * (z * (y * t))) + (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[LessEqual[z, -3.2e-122], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 7.6e-103], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(-9.0 * N[(z * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * 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.2 \cdot 10^{-122}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;z \leq 7.6 \cdot 10^{-103}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(z \cdot \left(y \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)\\
\end{array}
\end{array}
if z < -3.2000000000000002e-122Initial program 92.2%
Taylor expanded in a around 0 78.6%
if -3.2000000000000002e-122 < z < 7.6000000000000001e-103Initial program 99.7%
associate-+l-99.7%
sub-neg99.7%
neg-mul-199.7%
metadata-eval99.7%
metadata-eval99.7%
cancel-sign-sub-inv99.7%
metadata-eval99.7%
*-lft-identity99.7%
associate-*l*98.4%
associate-*l*98.5%
Simplified98.5%
Taylor expanded in y around 0 79.7%
*-commutative79.7%
Simplified79.7%
Taylor expanded in a around 0 79.7%
*-commutative79.7%
associate-*r*79.8%
Simplified79.8%
if 7.6000000000000001e-103 < z Initial program 87.5%
Taylor expanded in x around 0 74.9%
cancel-sign-sub-inv74.9%
associate-*r*74.9%
*-commutative74.9%
associate-*l*74.9%
metadata-eval74.9%
associate-*r*81.1%
Applied egg-rr81.1%
Final simplification79.8%
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) (* z (* (* y 9.0) t)))))
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) - (z * ((y * 9.0) * t)));
}
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) - (z * ((y * 9.0d0) * t)))
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) - (z * ((y * 9.0) * t)));
}
[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) - (z * ((y * 9.0) * t)))
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(z * Float64(Float64(y * 9.0) * t)))) 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) - (z * ((y * 9.0) * t)));
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[(z * N[(N[(y * 9.0), $MachinePrecision] * t), $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 - z \cdot \left(\left(y \cdot 9\right) \cdot t\right)\right)
\end{array}
Initial program 92.7%
Taylor expanded in y around 0 95.3%
associate-*r*95.3%
*-commutative95.3%
associate-*r*93.8%
Simplified93.8%
Final simplification93.8%
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 (<= y -2.6e+50) (not (<= y 2.8e-134))) (- (* x 2.0) (* 9.0 (* y (* z t)))) (- (* x 2.0) (* a (* b -27.0)))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.6e+50) || !(y <= 2.8e-134)) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else {
tmp = (x * 2.0) - (a * (b * -27.0));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-2.6d+50)) .or. (.not. (y <= 2.8d-134))) then
tmp = (x * 2.0d0) - (9.0d0 * (y * (z * t)))
else
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -2.6e+50) || !(y <= 2.8e-134)) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else {
tmp = (x * 2.0) - (a * (b * -27.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if (y <= -2.6e+50) or not (y <= 2.8e-134): tmp = (x * 2.0) - (9.0 * (y * (z * t))) else: tmp = (x * 2.0) - (a * (b * -27.0)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -2.6e+50) || !(y <= 2.8e-134)) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))); else tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((y <= -2.6e+50) || ~((y <= 2.8e-134)))
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
else
tmp = (x * 2.0) - (a * (b * -27.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -2.6e+50], N[Not[LessEqual[y, 2.8e-134]], $MachinePrecision]], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -2.6 \cdot 10^{+50} \lor \neg \left(y \leq 2.8 \cdot 10^{-134}\right):\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\end{array}
\end{array}
if y < -2.6000000000000002e50 or 2.7999999999999999e-134 < y Initial program 87.2%
Taylor expanded in a around 0 75.7%
if -2.6000000000000002e50 < y < 2.7999999999999999e-134Initial program 99.8%
associate-+l-99.8%
sub-neg99.8%
neg-mul-199.8%
metadata-eval99.8%
metadata-eval99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
*-lft-identity99.8%
associate-*l*92.1%
associate-*l*92.1%
Simplified92.1%
Taylor expanded in y around 0 78.0%
*-commutative78.0%
Simplified78.0%
Taylor expanded in a around 0 78.0%
*-commutative78.0%
associate-*r*78.1%
Simplified78.1%
Final simplification76.8%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* y (* z t)) -9.0)))
(if (<= y -6.2e+62)
t_1
(if (<= y -3.6e-41) (* x 2.0) (if (<= y 8.4e-94) (* a (* 27.0 b)) t_1)))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y * (z * t)) * -9.0;
double tmp;
if (y <= -6.2e+62) {
tmp = t_1;
} else if (y <= -3.6e-41) {
tmp = x * 2.0;
} else if (y <= 8.4e-94) {
tmp = a * (27.0 * b);
} else {
tmp = t_1;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (y * (z * t)) * (-9.0d0)
if (y <= (-6.2d+62)) then
tmp = t_1
else if (y <= (-3.6d-41)) then
tmp = x * 2.0d0
else if (y <= 8.4d-94) then
tmp = a * (27.0d0 * b)
else
tmp = t_1
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (y * (z * t)) * -9.0;
double tmp;
if (y <= -6.2e+62) {
tmp = t_1;
} else if (y <= -3.6e-41) {
tmp = x * 2.0;
} else if (y <= 8.4e-94) {
tmp = a * (27.0 * b);
} else {
tmp = t_1;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = (y * (z * t)) * -9.0 tmp = 0 if y <= -6.2e+62: tmp = t_1 elif y <= -3.6e-41: tmp = x * 2.0 elif y <= 8.4e-94: tmp = a * (27.0 * b) else: tmp = t_1 return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(y * Float64(z * t)) * -9.0) tmp = 0.0 if (y <= -6.2e+62) tmp = t_1; elseif (y <= -3.6e-41) tmp = Float64(x * 2.0); elseif (y <= 8.4e-94) tmp = Float64(a * Float64(27.0 * b)); else tmp = t_1; end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = (y * (z * t)) * -9.0;
tmp = 0.0;
if (y <= -6.2e+62)
tmp = t_1;
elseif (y <= -3.6e-41)
tmp = x * 2.0;
elseif (y <= 8.4e-94)
tmp = a * (27.0 * b);
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision] * -9.0), $MachinePrecision]}, If[LessEqual[y, -6.2e+62], t$95$1, If[LessEqual[y, -3.6e-41], N[(x * 2.0), $MachinePrecision], If[LessEqual[y, 8.4e-94], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := \left(y \cdot \left(z \cdot t\right)\right) \cdot -9\\
\mathbf{if}\;y \leq -6.2 \cdot 10^{+62}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;y \leq -3.6 \cdot 10^{-41}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;y \leq 8.4 \cdot 10^{-94}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if y < -6.20000000000000029e62 or 8.4000000000000004e-94 < y Initial program 87.1%
associate-+l-87.1%
sub-neg87.1%
neg-mul-187.1%
metadata-eval87.1%
metadata-eval87.1%
cancel-sign-sub-inv87.1%
metadata-eval87.1%
*-lft-identity87.1%
associate-*l*98.3%
associate-*l*98.3%
Simplified98.3%
cancel-sign-sub-inv98.3%
associate-*r*87.1%
fma-def87.1%
associate-*l*87.1%
Applied egg-rr87.1%
Taylor expanded in y around inf 64.5%
if -6.20000000000000029e62 < y < -3.6e-41Initial program 99.8%
associate-+l-99.8%
fma-neg99.8%
neg-sub099.8%
associate-+l-99.8%
neg-sub099.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-def99.8%
*-commutative99.8%
associate-*r*99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 45.0%
if -3.6e-41 < y < 8.4000000000000004e-94Initial program 98.8%
associate-+l-98.8%
sub-neg98.8%
neg-mul-198.8%
metadata-eval98.8%
metadata-eval98.8%
cancel-sign-sub-inv98.8%
metadata-eval98.8%
*-lft-identity98.8%
associate-*l*89.8%
associate-*l*89.8%
Simplified89.8%
cancel-sign-sub-inv89.8%
associate-*r*98.8%
fma-def99.8%
associate-*l*99.8%
Applied egg-rr99.8%
Taylor expanded in a around inf 40.0%
*-commutative40.0%
associate-*r*40.0%
Simplified40.0%
Final simplification53.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 (<= y -7.1e+62)
(* (* y (* z t)) -9.0)
(if (<= y -4.5e-43)
(* x 2.0)
(if (<= y 6.4e-94) (* a (* 27.0 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 (y <= -7.1e+62) {
tmp = (y * (z * t)) * -9.0;
} else if (y <= -4.5e-43) {
tmp = x * 2.0;
} else if (y <= 6.4e-94) {
tmp = a * (27.0 * 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 (y <= (-7.1d+62)) then
tmp = (y * (z * t)) * (-9.0d0)
else if (y <= (-4.5d-43)) then
tmp = x * 2.0d0
else if (y <= 6.4d-94) then
tmp = a * (27.0d0 * 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 (y <= -7.1e+62) {
tmp = (y * (z * t)) * -9.0;
} else if (y <= -4.5e-43) {
tmp = x * 2.0;
} else if (y <= 6.4e-94) {
tmp = a * (27.0 * 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 y <= -7.1e+62: tmp = (y * (z * t)) * -9.0 elif y <= -4.5e-43: tmp = x * 2.0 elif y <= 6.4e-94: tmp = a * (27.0 * 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 (y <= -7.1e+62) tmp = Float64(Float64(y * Float64(z * t)) * -9.0); elseif (y <= -4.5e-43) tmp = Float64(x * 2.0); elseif (y <= 6.4e-94) tmp = Float64(a * Float64(27.0 * 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 (y <= -7.1e+62)
tmp = (y * (z * t)) * -9.0;
elseif (y <= -4.5e-43)
tmp = x * 2.0;
elseif (y <= 6.4e-94)
tmp = a * (27.0 * 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[y, -7.1e+62], N[(N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision] * -9.0), $MachinePrecision], If[LessEqual[y, -4.5e-43], N[(x * 2.0), $MachinePrecision], If[LessEqual[y, 6.4e-94], N[(a * N[(27.0 * b), $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}\;y \leq -7.1 \cdot 10^{+62}:\\
\;\;\;\;\left(y \cdot \left(z \cdot t\right)\right) \cdot -9\\
\mathbf{elif}\;y \leq -4.5 \cdot 10^{-43}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;y \leq 6.4 \cdot 10^{-94}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
\end{array}
\end{array}
if y < -7.1000000000000003e62Initial program 80.1%
associate-+l-80.1%
sub-neg80.1%
neg-mul-180.1%
metadata-eval80.1%
metadata-eval80.1%
cancel-sign-sub-inv80.1%
metadata-eval80.1%
*-lft-identity80.1%
associate-*l*96.2%
associate-*l*96.1%
Simplified96.1%
cancel-sign-sub-inv96.1%
associate-*r*80.0%
fma-def80.0%
associate-*l*80.1%
Applied egg-rr80.1%
Taylor expanded in y around inf 70.4%
if -7.1000000000000003e62 < y < -4.50000000000000025e-43Initial program 99.8%
associate-+l-99.8%
fma-neg99.8%
neg-sub099.8%
associate-+l-99.8%
neg-sub099.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-def99.8%
*-commutative99.8%
associate-*r*99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 45.0%
if -4.50000000000000025e-43 < y < 6.39999999999999993e-94Initial program 98.8%
associate-+l-98.8%
sub-neg98.8%
neg-mul-198.8%
metadata-eval98.8%
metadata-eval98.8%
cancel-sign-sub-inv98.8%
metadata-eval98.8%
*-lft-identity98.8%
associate-*l*89.8%
associate-*l*89.8%
Simplified89.8%
cancel-sign-sub-inv89.8%
associate-*r*98.8%
fma-def99.8%
associate-*l*99.8%
Applied egg-rr99.8%
Taylor expanded in a around inf 40.0%
*-commutative40.0%
associate-*r*40.0%
Simplified40.0%
if 6.39999999999999993e-94 < y Initial program 91.6%
associate-+l-91.6%
sub-neg91.6%
neg-mul-191.6%
metadata-eval91.6%
metadata-eval91.6%
cancel-sign-sub-inv91.6%
metadata-eval91.6%
*-lft-identity91.6%
associate-*l*99.7%
associate-*l*99.7%
Simplified99.7%
cancel-sign-sub-inv99.7%
associate-*r*91.6%
fma-def91.6%
associate-*l*91.6%
Applied egg-rr91.6%
Taylor expanded in y around inf 60.6%
*-commutative60.6%
associate-*r*54.9%
associate-*r*54.8%
associate-*r*60.5%
*-commutative60.5%
associate-*l*54.6%
Simplified54.6%
Final simplification51.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 (<= y -2.45e+63)
(* y (* (* z t) -9.0))
(if (<= y -4e-41)
(* x 2.0)
(if (<= y 2.8e-112) (* a (* 27.0 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 (y <= -2.45e+63) {
tmp = y * ((z * t) * -9.0);
} else if (y <= -4e-41) {
tmp = x * 2.0;
} else if (y <= 2.8e-112) {
tmp = a * (27.0 * 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 (y <= (-2.45d+63)) then
tmp = y * ((z * t) * (-9.0d0))
else if (y <= (-4d-41)) then
tmp = x * 2.0d0
else if (y <= 2.8d-112) then
tmp = a * (27.0d0 * 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 (y <= -2.45e+63) {
tmp = y * ((z * t) * -9.0);
} else if (y <= -4e-41) {
tmp = x * 2.0;
} else if (y <= 2.8e-112) {
tmp = a * (27.0 * 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 y <= -2.45e+63: tmp = y * ((z * t) * -9.0) elif y <= -4e-41: tmp = x * 2.0 elif y <= 2.8e-112: tmp = a * (27.0 * 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 (y <= -2.45e+63) tmp = Float64(y * Float64(Float64(z * t) * -9.0)); elseif (y <= -4e-41) tmp = Float64(x * 2.0); elseif (y <= 2.8e-112) tmp = Float64(a * Float64(27.0 * 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 (y <= -2.45e+63)
tmp = y * ((z * t) * -9.0);
elseif (y <= -4e-41)
tmp = x * 2.0;
elseif (y <= 2.8e-112)
tmp = a * (27.0 * 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[y, -2.45e+63], N[(y * N[(N[(z * t), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, -4e-41], N[(x * 2.0), $MachinePrecision], If[LessEqual[y, 2.8e-112], N[(a * N[(27.0 * b), $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}\;y \leq -2.45 \cdot 10^{+63}:\\
\;\;\;\;y \cdot \left(\left(z \cdot t\right) \cdot -9\right)\\
\mathbf{elif}\;y \leq -4 \cdot 10^{-41}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;y \leq 2.8 \cdot 10^{-112}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
\end{array}
\end{array}
if y < -2.4499999999999998e63Initial program 80.1%
Taylor expanded in x around 0 81.6%
cancel-sign-sub-inv81.6%
associate-*r*81.6%
*-commutative81.6%
associate-*l*81.6%
metadata-eval81.6%
associate-*r*74.4%
Applied egg-rr74.4%
Taylor expanded in a around 0 70.4%
*-commutative70.4%
associate-*l*70.4%
Simplified70.4%
if -2.4499999999999998e63 < y < -4.00000000000000002e-41Initial program 99.8%
associate-+l-99.8%
fma-neg99.8%
neg-sub099.8%
associate-+l-99.8%
neg-sub099.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
fma-def99.8%
*-commutative99.8%
associate-*r*99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 45.0%
if -4.00000000000000002e-41 < y < 2.80000000000000023e-112Initial program 98.8%
associate-+l-98.8%
sub-neg98.8%
neg-mul-198.8%
metadata-eval98.8%
metadata-eval98.8%
cancel-sign-sub-inv98.8%
metadata-eval98.8%
*-lft-identity98.8%
associate-*l*89.7%
associate-*l*89.7%
Simplified89.7%
cancel-sign-sub-inv89.7%
associate-*r*98.8%
fma-def99.8%
associate-*l*99.8%
Applied egg-rr99.8%
Taylor expanded in a around inf 40.3%
*-commutative40.3%
associate-*r*40.4%
Simplified40.4%
if 2.80000000000000023e-112 < y Initial program 91.7%
associate-+l-91.7%
sub-neg91.7%
neg-mul-191.7%
metadata-eval91.7%
metadata-eval91.7%
cancel-sign-sub-inv91.7%
metadata-eval91.7%
*-lft-identity91.7%
associate-*l*99.7%
associate-*l*99.7%
Simplified99.7%
cancel-sign-sub-inv99.7%
associate-*r*91.7%
fma-def91.7%
associate-*l*91.7%
Applied egg-rr91.7%
Taylor expanded in y around inf 59.9%
*-commutative59.9%
associate-*r*54.2%
associate-*r*54.2%
associate-*r*59.8%
*-commutative59.8%
associate-*l*54.0%
Simplified54.0%
Final simplification51.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 -4000000.0) (* (* y (* z t)) -9.0) (if (<= z 5.8e+46) (- (* x 2.0) (* a (* b -27.0))) (* -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 (z <= -4000000.0) {
tmp = (y * (z * t)) * -9.0;
} else if (z <= 5.8e+46) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = -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 (z <= (-4000000.0d0)) then
tmp = (y * (z * t)) * (-9.0d0)
else if (z <= 5.8d+46) then
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
else
tmp = (-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 (z <= -4000000.0) {
tmp = (y * (z * t)) * -9.0;
} else if (z <= 5.8e+46) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = -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 z <= -4000000.0: tmp = (y * (z * t)) * -9.0 elif z <= 5.8e+46: tmp = (x * 2.0) - (a * (b * -27.0)) else: tmp = -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 (z <= -4000000.0) tmp = Float64(Float64(y * Float64(z * t)) * -9.0); elseif (z <= 5.8e+46) tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); else tmp = 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 (z <= -4000000.0)
tmp = (y * (z * t)) * -9.0;
elseif (z <= 5.8e+46)
tmp = (x * 2.0) - (a * (b * -27.0));
else
tmp = -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[LessEqual[z, -4000000.0], N[(N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision] * -9.0), $MachinePrecision], If[LessEqual[z, 5.8e+46], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-9.0 * N[(t * N[(y * z), $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 -4000000:\\
\;\;\;\;\left(y \cdot \left(z \cdot t\right)\right) \cdot -9\\
\mathbf{elif}\;z \leq 5.8 \cdot 10^{+46}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if z < -4e6Initial program 89.4%
associate-+l-89.4%
sub-neg89.4%
neg-mul-189.4%
metadata-eval89.4%
metadata-eval89.4%
cancel-sign-sub-inv89.4%
metadata-eval89.4%
*-lft-identity89.4%
associate-*l*95.3%
associate-*l*95.2%
Simplified95.2%
cancel-sign-sub-inv95.2%
associate-*r*89.3%
fma-def89.3%
associate-*l*89.4%
Applied egg-rr89.4%
Taylor expanded in y around inf 61.0%
if -4e6 < z < 5.8000000000000004e46Initial program 99.8%
associate-+l-99.8%
sub-neg99.8%
neg-mul-199.8%
metadata-eval99.8%
metadata-eval99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
*-lft-identity99.8%
associate-*l*99.1%
associate-*l*99.0%
Simplified99.0%
Taylor expanded in y around 0 74.8%
*-commutative74.8%
Simplified74.8%
Taylor expanded in a around 0 74.8%
*-commutative74.8%
associate-*r*74.9%
Simplified74.9%
if 5.8000000000000004e46 < z Initial program 81.4%
associate-+l-81.4%
sub-neg81.4%
neg-mul-181.4%
metadata-eval81.4%
metadata-eval81.4%
cancel-sign-sub-inv81.4%
metadata-eval81.4%
*-lft-identity81.4%
associate-*l*87.3%
associate-*l*87.3%
Simplified87.3%
cancel-sign-sub-inv87.3%
associate-*r*81.4%
fma-def83.0%
associate-*l*82.9%
Applied egg-rr82.9%
Taylor expanded in y around inf 58.4%
*-commutative58.4%
associate-*r*54.7%
Simplified54.7%
Final simplification66.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 (or (<= a -6e+89) (not (<= a 3.3e-64))) (* a (* 27.0 b)) (* x 2.0)))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -6e+89) || !(a <= 3.3e-64)) {
tmp = a * (27.0 * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-6d+89)) .or. (.not. (a <= 3.3d-64))) then
tmp = a * (27.0d0 * b)
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -6e+89) || !(a <= 3.3e-64)) {
tmp = a * (27.0 * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if (a <= -6e+89) or not (a <= 3.3e-64): tmp = a * (27.0 * b) else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -6e+89) || !(a <= 3.3e-64)) tmp = Float64(a * Float64(27.0 * b)); else tmp = Float64(x * 2.0); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((a <= -6e+89) || ~((a <= 3.3e-64)))
tmp = a * (27.0 * b);
else
tmp = x * 2.0;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -6e+89], N[Not[LessEqual[a, 3.3e-64]], $MachinePrecision]], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6 \cdot 10^{+89} \lor \neg \left(a \leq 3.3 \cdot 10^{-64}\right):\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if a < -6.00000000000000025e89 or 3.2999999999999999e-64 < a Initial program 94.5%
associate-+l-94.5%
sub-neg94.5%
neg-mul-194.5%
metadata-eval94.5%
metadata-eval94.5%
cancel-sign-sub-inv94.5%
metadata-eval94.5%
*-lft-identity94.5%
associate-*l*95.4%
associate-*l*95.4%
Simplified95.4%
cancel-sign-sub-inv95.4%
associate-*r*94.5%
fma-def95.4%
associate-*l*95.4%
Applied egg-rr95.4%
Taylor expanded in a around inf 48.6%
*-commutative48.6%
associate-*r*48.7%
Simplified48.7%
if -6.00000000000000025e89 < a < 3.2999999999999999e-64Initial program 91.3%
associate-+l-91.3%
fma-neg91.3%
neg-sub091.3%
associate-+l-91.3%
neg-sub091.3%
*-commutative91.3%
distribute-rgt-neg-in91.3%
fma-def91.3%
*-commutative91.3%
associate-*r*91.3%
distribute-rgt-neg-in91.3%
*-commutative91.3%
metadata-eval91.3%
Simplified91.3%
Taylor expanded in x around inf 34.1%
Final simplification40.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 92.7%
associate-+l-92.7%
fma-neg92.7%
neg-sub092.7%
associate-+l-92.7%
neg-sub092.7%
*-commutative92.7%
distribute-rgt-neg-in92.7%
fma-def93.1%
*-commutative93.1%
associate-*r*93.1%
distribute-rgt-neg-in93.1%
*-commutative93.1%
metadata-eval93.1%
Simplified93.1%
Taylor expanded in x around inf 26.9%
Final simplification26.9%
(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 2023213
(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)))