
(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
(let* ((t_1 (* (* a 27.0) b)))
(if (<= (* (* y 9.0) z) 5e+34)
(+ (- (* x 2.0) (* (* 9.0 (* y z)) t)) t_1)
(fma x 2.0 (fma 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 = (a * 27.0) * b;
double tmp;
if (((y * 9.0) * z) <= 5e+34) {
tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + t_1;
} else {
tmp = fma(x, 2.0, fma(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(Float64(a * 27.0) * b) tmp = 0.0 if (Float64(Float64(y * 9.0) * z) <= 5e+34) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(9.0 * Float64(y * z)) * t)) + t_1); else tmp = fma(x, 2.0, fma(y, Float64(-9.0 * Float64(z * t)), t_1)); 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_] := Block[{t$95$1 = N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision], 5e+34], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(x * 2.0 + N[(y * N[(-9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision] + t$95$1), $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(a \cdot 27\right) \cdot b\\
\mathbf{if}\;\left(y \cdot 9\right) \cdot z \leq 5 \cdot 10^{+34}:\\
\;\;\;\;\left(x \cdot 2 - \left(9 \cdot \left(y \cdot z\right)\right) \cdot t\right) + t_1\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, 2, \mathsf{fma}\left(y, -9 \cdot \left(z \cdot t\right), t_1\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y 9) z) < 4.9999999999999998e34Initial program 97.9%
Taylor expanded in y around 0 97.9%
*-commutative97.9%
Simplified97.9%
if 4.9999999999999998e34 < (*.f64 (*.f64 y 9) z) Initial program 90.3%
associate-+l-90.3%
fma-neg90.3%
neg-sub090.3%
associate-+l-90.3%
neg-sub090.3%
associate-*l*98.3%
associate-*l*98.3%
distribute-rgt-neg-in98.3%
fma-def98.3%
*-commutative98.3%
distribute-rgt-neg-in98.3%
metadata-eval98.3%
Simplified98.3%
Final simplification98.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 (<= (* (* y 9.0) z) 5e+226) (+ (- (* x 2.0) (* (* 9.0 (* y z)) t)) (* (* a 27.0) b)) (- (* 27.0 (* a b)) (* 9.0 (* y (* z t))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((y * 9.0) * z) <= 5e+226) {
tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b);
} else {
tmp = (27.0 * (a * b)) - (9.0 * (y * (z * t)));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (((y * 9.0d0) * z) <= 5d+226) then
tmp = ((x * 2.0d0) - ((9.0d0 * (y * z)) * t)) + ((a * 27.0d0) * b)
else
tmp = (27.0d0 * (a * b)) - (9.0d0 * (y * (z * t)))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((y * 9.0) * z) <= 5e+226) {
tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b);
} else {
tmp = (27.0 * (a * b)) - (9.0 * (y * (z * t)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if ((y * 9.0) * z) <= 5e+226: tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b) else: tmp = (27.0 * (a * b)) - (9.0 * (y * (z * t))) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(y * 9.0) * z) <= 5e+226) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(9.0 * Float64(y * z)) * t)) + Float64(Float64(a * 27.0) * b)); else tmp = Float64(Float64(27.0 * Float64(a * b)) - Float64(9.0 * Float64(y * Float64(z * t)))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (((y * 9.0) * z) <= 5e+226)
tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b);
else
tmp = (27.0 * (a * b)) - (9.0 * (y * (z * t)));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision], 5e+226], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] - N[(9.0 * N[(y * 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^{+226}:\\
\;\;\;\;\left(x \cdot 2 - \left(9 \cdot \left(y \cdot z\right)\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y 9) z) < 5.0000000000000005e226Initial program 98.1%
Taylor expanded in y around 0 98.2%
*-commutative98.2%
Simplified98.2%
if 5.0000000000000005e226 < (*.f64 (*.f64 y 9) z) Initial program 79.8%
associate-+l-79.8%
sub-neg79.8%
neg-mul-179.8%
metadata-eval79.8%
metadata-eval79.8%
cancel-sign-sub-inv79.8%
metadata-eval79.8%
*-lft-identity79.8%
associate-*l*99.8%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in x around 0 96.5%
Final simplification98.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 8.2e+27) (+ (* y (* t (* z -9.0))) (+ (* x 2.0) (* 27.0 (* a b)))) (+ (* x 2.0) (* 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 <= 8.2e+27) {
tmp = (y * (t * (z * -9.0))) + ((x * 2.0) + (27.0 * (a * b)));
} else {
tmp = (x * 2.0) + (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 <= 8.2d+27) then
tmp = (y * (t * (z * (-9.0d0)))) + ((x * 2.0d0) + (27.0d0 * (a * b)))
else
tmp = (x * 2.0d0) + (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 <= 8.2e+27) {
tmp = (y * (t * (z * -9.0))) + ((x * 2.0) + (27.0 * (a * b)));
} else {
tmp = (x * 2.0) + (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 <= 8.2e+27: tmp = (y * (t * (z * -9.0))) + ((x * 2.0) + (27.0 * (a * b))) else: tmp = (x * 2.0) + (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 <= 8.2e+27) tmp = Float64(Float64(y * Float64(t * Float64(z * -9.0))) + Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b)))); else tmp = Float64(Float64(x * 2.0) + Float64(t * Float64(Float64(y * 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 <= 8.2e+27)
tmp = (y * (t * (z * -9.0))) + ((x * 2.0) + (27.0 * (a * b)));
else
tmp = (x * 2.0) + (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, 8.2e+27], N[(N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(t * N[(N[(y * z), $MachinePrecision] * -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 8.2 \cdot 10^{+27}:\\
\;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right) + \left(x \cdot 2 + 27 \cdot \left(a \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + t \cdot \left(\left(y \cdot z\right) \cdot -9\right)\\
\end{array}
\end{array}
if z < 8.2000000000000005e27Initial program 97.6%
associate-+l-97.6%
fma-neg97.6%
neg-sub097.6%
associate-+l-97.6%
neg-sub097.6%
*-commutative97.6%
distribute-rgt-neg-in97.6%
fma-def97.6%
*-commutative97.6%
associate-*r*97.6%
distribute-rgt-neg-in97.6%
*-commutative97.6%
metadata-eval97.6%
Simplified97.6%
Taylor expanded in t around 0 96.7%
+-commutative96.7%
fma-def96.7%
*-commutative96.7%
associate-*r*97.7%
associate-*l*97.7%
*-commutative97.7%
associate-*r*97.7%
Simplified97.7%
fma-udef97.7%
fma-udef97.7%
associate-*r*97.7%
*-commutative97.7%
associate-+r+97.7%
*-commutative97.7%
associate-*l*97.7%
associate-*l*96.6%
Applied egg-rr96.6%
if 8.2000000000000005e27 < z Initial program 92.5%
associate-+l-92.5%
sub-neg92.5%
neg-mul-192.5%
metadata-eval92.5%
metadata-eval92.5%
cancel-sign-sub-inv92.5%
metadata-eval92.5%
*-lft-identity92.5%
associate-*l*90.4%
associate-*l*90.4%
Simplified90.4%
Taylor expanded in a around 0 71.1%
*-commutative71.1%
associate-*r*76.0%
associate-*l*76.1%
*-commutative76.1%
sub-neg76.1%
*-commutative76.1%
*-commutative76.1%
distribute-rgt-neg-in76.1%
distribute-rgt-neg-in76.1%
metadata-eval76.1%
Applied egg-rr76.1%
Final simplification90.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
(let* ((t_1 (+ (* x 2.0) (* 27.0 (* a b)))))
(if (<= y -5e+31)
(+ (* y (* t (* z -9.0))) t_1)
(+ (* z (* y (* t -9.0))) 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 = (x * 2.0) + (27.0 * (a * b));
double tmp;
if (y <= -5e+31) {
tmp = (y * (t * (z * -9.0))) + t_1;
} else {
tmp = (z * (y * (t * -9.0))) + 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 = (x * 2.0d0) + (27.0d0 * (a * b))
if (y <= (-5d+31)) then
tmp = (y * (t * (z * (-9.0d0)))) + t_1
else
tmp = (z * (y * (t * (-9.0d0)))) + 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 = (x * 2.0) + (27.0 * (a * b));
double tmp;
if (y <= -5e+31) {
tmp = (y * (t * (z * -9.0))) + t_1;
} else {
tmp = (z * (y * (t * -9.0))) + 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 = (x * 2.0) + (27.0 * (a * b)) tmp = 0 if y <= -5e+31: tmp = (y * (t * (z * -9.0))) + t_1 else: tmp = (z * (y * (t * -9.0))) + 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(x * 2.0) + Float64(27.0 * Float64(a * b))) tmp = 0.0 if (y <= -5e+31) tmp = Float64(Float64(y * Float64(t * Float64(z * -9.0))) + t_1); else tmp = Float64(Float64(z * Float64(y * Float64(t * -9.0))) + 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 = (x * 2.0) + (27.0 * (a * b));
tmp = 0.0;
if (y <= -5e+31)
tmp = (y * (t * (z * -9.0))) + t_1;
else
tmp = (z * (y * (t * -9.0))) + 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[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[y, -5e+31], N[(N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(N[(z * N[(y * N[(t * -9.0), $MachinePrecision]), $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 := x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;y \leq -5 \cdot 10^{+31}:\\
\;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right) + t_1\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + t_1\\
\end{array}
\end{array}
if y < -5.00000000000000027e31Initial program 91.4%
associate-+l-91.4%
fma-neg91.4%
neg-sub091.4%
associate-+l-91.4%
neg-sub091.4%
*-commutative91.4%
distribute-rgt-neg-in91.4%
fma-def91.4%
*-commutative91.4%
associate-*r*91.4%
distribute-rgt-neg-in91.4%
*-commutative91.4%
metadata-eval91.4%
Simplified91.4%
Taylor expanded in t around 0 99.9%
+-commutative99.9%
fma-def99.9%
*-commutative99.9%
associate-*r*91.4%
associate-*l*91.5%
*-commutative91.5%
associate-*r*91.4%
Simplified91.4%
fma-udef91.4%
fma-udef91.4%
associate-*r*91.5%
*-commutative91.5%
associate-+r+91.5%
*-commutative91.5%
associate-*l*91.4%
associate-*l*99.9%
Applied egg-rr99.9%
if -5.00000000000000027e31 < y Initial program 97.7%
associate-+l-97.7%
fma-neg97.7%
neg-sub097.7%
associate-+l-97.7%
neg-sub097.7%
*-commutative97.7%
distribute-rgt-neg-in97.7%
fma-def97.7%
*-commutative97.7%
associate-*r*97.7%
distribute-rgt-neg-in97.7%
*-commutative97.7%
metadata-eval97.7%
Simplified97.7%
Taylor expanded in t around 0 92.9%
+-commutative92.9%
fma-def92.9%
*-commutative92.9%
associate-*r*97.7%
associate-*l*97.8%
*-commutative97.8%
associate-*r*97.7%
Simplified97.7%
fma-udef97.7%
fma-udef97.7%
associate-*r*97.8%
*-commutative97.8%
associate-+r+97.8%
*-commutative97.8%
associate-*l*97.8%
associate-*l*92.9%
Applied egg-rr92.9%
Taylor expanded in y around 0 92.9%
associate-*r*97.3%
*-commutative97.3%
associate-*r*96.8%
associate-*l*96.8%
*-commutative96.8%
*-commutative96.8%
Simplified96.8%
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 (if (<= t 1e+64) (+ (* y (* t (* z -9.0))) (+ (* x 2.0) (* 27.0 (* a b)))) (+ (* (* a 27.0) b) (- (* x 2.0) (* (* (* 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 (t <= 1e+64) {
tmp = (y * (t * (z * -9.0))) + ((x * 2.0) + (27.0 * (a * b)));
} else {
tmp = ((a * 27.0) * b) + ((x * 2.0) - (((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) :: tmp
if (t <= 1d+64) then
tmp = (y * (t * (z * (-9.0d0)))) + ((x * 2.0d0) + (27.0d0 * (a * b)))
else
tmp = ((a * 27.0d0) * b) + ((x * 2.0d0) - (((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 tmp;
if (t <= 1e+64) {
tmp = (y * (t * (z * -9.0))) + ((x * 2.0) + (27.0 * (a * b)));
} else {
tmp = ((a * 27.0) * b) + ((x * 2.0) - (((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): tmp = 0 if t <= 1e+64: tmp = (y * (t * (z * -9.0))) + ((x * 2.0) + (27.0 * (a * b))) else: tmp = ((a * 27.0) * b) + ((x * 2.0) - (((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 (t <= 1e+64) tmp = Float64(Float64(y * Float64(t * Float64(z * -9.0))) + Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b)))); else tmp = Float64(Float64(Float64(a * 27.0) * b) + Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (t <= 1e+64)
tmp = (y * (t * (z * -9.0))) + ((x * 2.0) + (27.0 * (a * b)));
else
tmp = ((a * 27.0) * b) + ((x * 2.0) - (((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_] := If[LessEqual[t, 1e+64], N[(N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 10^{+64}:\\
\;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right) + \left(x \cdot 2 + 27 \cdot \left(a \cdot b\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\\
\end{array}
\end{array}
if t < 1.00000000000000002e64Initial program 95.1%
associate-+l-95.1%
fma-neg95.1%
neg-sub095.1%
associate-+l-95.1%
neg-sub095.1%
*-commutative95.1%
distribute-rgt-neg-in95.1%
fma-def95.1%
*-commutative95.1%
associate-*r*95.1%
distribute-rgt-neg-in95.1%
*-commutative95.1%
metadata-eval95.1%
Simplified95.1%
Taylor expanded in t around 0 97.6%
+-commutative97.6%
fma-def97.6%
*-commutative97.6%
associate-*r*95.1%
associate-*l*95.2%
*-commutative95.2%
associate-*r*95.1%
Simplified95.1%
fma-udef95.1%
fma-udef95.1%
associate-*r*95.2%
*-commutative95.2%
associate-+r+95.2%
*-commutative95.2%
associate-*l*95.2%
associate-*l*97.6%
Applied egg-rr97.6%
if 1.00000000000000002e64 < t Initial program 99.8%
Final simplification98.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
(let* ((t_1 (* -9.0 (* y (* z t)))))
(if (<= t -1.15e-95)
t_1
(if (<= t 5.8e-199)
(* x 2.0)
(if (or (<= t 2.2e+38) (and (not (<= t 1.06e+67)) (<= t 1.2e+119)))
(* 27.0 (* a 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 = -9.0 * (y * (z * t));
double tmp;
if (t <= -1.15e-95) {
tmp = t_1;
} else if (t <= 5.8e-199) {
tmp = x * 2.0;
} else if ((t <= 2.2e+38) || (!(t <= 1.06e+67) && (t <= 1.2e+119))) {
tmp = 27.0 * (a * 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 = (-9.0d0) * (y * (z * t))
if (t <= (-1.15d-95)) then
tmp = t_1
else if (t <= 5.8d-199) then
tmp = x * 2.0d0
else if ((t <= 2.2d+38) .or. (.not. (t <= 1.06d+67)) .and. (t <= 1.2d+119)) then
tmp = 27.0d0 * (a * 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 = -9.0 * (y * (z * t));
double tmp;
if (t <= -1.15e-95) {
tmp = t_1;
} else if (t <= 5.8e-199) {
tmp = x * 2.0;
} else if ((t <= 2.2e+38) || (!(t <= 1.06e+67) && (t <= 1.2e+119))) {
tmp = 27.0 * (a * 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 = -9.0 * (y * (z * t)) tmp = 0 if t <= -1.15e-95: tmp = t_1 elif t <= 5.8e-199: tmp = x * 2.0 elif (t <= 2.2e+38) or (not (t <= 1.06e+67) and (t <= 1.2e+119)): tmp = 27.0 * (a * 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(-9.0 * Float64(y * Float64(z * t))) tmp = 0.0 if (t <= -1.15e-95) tmp = t_1; elseif (t <= 5.8e-199) tmp = Float64(x * 2.0); elseif ((t <= 2.2e+38) || (!(t <= 1.06e+67) && (t <= 1.2e+119))) tmp = Float64(27.0 * Float64(a * 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 = -9.0 * (y * (z * t));
tmp = 0.0;
if (t <= -1.15e-95)
tmp = t_1;
elseif (t <= 5.8e-199)
tmp = x * 2.0;
elseif ((t <= 2.2e+38) || (~((t <= 1.06e+67)) && (t <= 1.2e+119)))
tmp = 27.0 * (a * 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[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -1.15e-95], t$95$1, If[LessEqual[t, 5.8e-199], N[(x * 2.0), $MachinePrecision], If[Or[LessEqual[t, 2.2e+38], And[N[Not[LessEqual[t, 1.06e+67]], $MachinePrecision], LessEqual[t, 1.2e+119]]], N[(27.0 * N[(a * 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 := -9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{if}\;t \leq -1.15 \cdot 10^{-95}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 5.8 \cdot 10^{-199}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;t \leq 2.2 \cdot 10^{+38} \lor \neg \left(t \leq 1.06 \cdot 10^{+67}\right) \land t \leq 1.2 \cdot 10^{+119}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if t < -1.15e-95 or 2.20000000000000006e38 < t < 1.0599999999999999e67 or 1.2e119 < t Initial program 99.1%
Taylor expanded in y around 0 99.1%
*-commutative99.1%
Simplified99.1%
Taylor expanded in y around inf 54.0%
if -1.15e-95 < t < 5.8e-199Initial program 89.8%
associate-+l-89.8%
fma-neg89.8%
neg-sub089.8%
associate-+l-89.8%
neg-sub089.8%
*-commutative89.8%
distribute-rgt-neg-in89.8%
fma-def89.8%
*-commutative89.8%
associate-*r*89.9%
distribute-rgt-neg-in89.9%
*-commutative89.9%
metadata-eval89.9%
Simplified89.9%
Taylor expanded in x around inf 55.7%
if 5.8e-199 < t < 2.20000000000000006e38 or 1.0599999999999999e67 < t < 1.2e119Initial program 96.6%
Taylor expanded in y around 0 96.7%
*-commutative96.7%
Simplified96.7%
Taylor expanded in a around inf 44.0%
Final simplification52.2%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* 27.0 (* a b))) (t_2 (* -9.0 (* y (* z t)))))
(if (<= t -2.6e-91)
t_2
(if (<= t 3.45e-205)
(* x 2.0)
(if (<= t 2.8e+38)
t_1
(if (<= t 3.6e+65)
t_2
(if (<= t 2e+116) t_1 (* (* z t) (* y -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 t_1 = 27.0 * (a * b);
double t_2 = -9.0 * (y * (z * t));
double tmp;
if (t <= -2.6e-91) {
tmp = t_2;
} else if (t <= 3.45e-205) {
tmp = x * 2.0;
} else if (t <= 2.8e+38) {
tmp = t_1;
} else if (t <= 3.6e+65) {
tmp = t_2;
} else if (t <= 2e+116) {
tmp = t_1;
} else {
tmp = (z * t) * (y * -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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 27.0d0 * (a * b)
t_2 = (-9.0d0) * (y * (z * t))
if (t <= (-2.6d-91)) then
tmp = t_2
else if (t <= 3.45d-205) then
tmp = x * 2.0d0
else if (t <= 2.8d+38) then
tmp = t_1
else if (t <= 3.6d+65) then
tmp = t_2
else if (t <= 2d+116) then
tmp = t_1
else
tmp = (z * t) * (y * (-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 t_1 = 27.0 * (a * b);
double t_2 = -9.0 * (y * (z * t));
double tmp;
if (t <= -2.6e-91) {
tmp = t_2;
} else if (t <= 3.45e-205) {
tmp = x * 2.0;
} else if (t <= 2.8e+38) {
tmp = t_1;
} else if (t <= 3.6e+65) {
tmp = t_2;
} else if (t <= 2e+116) {
tmp = t_1;
} else {
tmp = (z * t) * (y * -9.0);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = 27.0 * (a * b) t_2 = -9.0 * (y * (z * t)) tmp = 0 if t <= -2.6e-91: tmp = t_2 elif t <= 3.45e-205: tmp = x * 2.0 elif t <= 2.8e+38: tmp = t_1 elif t <= 3.6e+65: tmp = t_2 elif t <= 2e+116: tmp = t_1 else: tmp = (z * t) * (y * -9.0) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(27.0 * Float64(a * b)) t_2 = Float64(-9.0 * Float64(y * Float64(z * t))) tmp = 0.0 if (t <= -2.6e-91) tmp = t_2; elseif (t <= 3.45e-205) tmp = Float64(x * 2.0); elseif (t <= 2.8e+38) tmp = t_1; elseif (t <= 3.6e+65) tmp = t_2; elseif (t <= 2e+116) tmp = t_1; else tmp = Float64(Float64(z * t) * Float64(y * -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)
t_1 = 27.0 * (a * b);
t_2 = -9.0 * (y * (z * t));
tmp = 0.0;
if (t <= -2.6e-91)
tmp = t_2;
elseif (t <= 3.45e-205)
tmp = x * 2.0;
elseif (t <= 2.8e+38)
tmp = t_1;
elseif (t <= 3.6e+65)
tmp = t_2;
elseif (t <= 2e+116)
tmp = t_1;
else
tmp = (z * t) * (y * -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_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t, -2.6e-91], t$95$2, If[LessEqual[t, 3.45e-205], N[(x * 2.0), $MachinePrecision], If[LessEqual[t, 2.8e+38], t$95$1, If[LessEqual[t, 3.6e+65], t$95$2, If[LessEqual[t, 2e+116], t$95$1, N[(N[(z * t), $MachinePrecision] * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right)\\
t_2 := -9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{if}\;t \leq -2.6 \cdot 10^{-91}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 3.45 \cdot 10^{-205}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;t \leq 2.8 \cdot 10^{+38}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;t \leq 3.6 \cdot 10^{+65}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;t \leq 2 \cdot 10^{+116}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot t\right) \cdot \left(y \cdot -9\right)\\
\end{array}
\end{array}
if t < -2.60000000000000014e-91 or 2.8e38 < t < 3.59999999999999978e65Initial program 98.7%
Taylor expanded in y around 0 98.7%
*-commutative98.7%
Simplified98.7%
Taylor expanded in y around inf 48.9%
if -2.60000000000000014e-91 < t < 3.4499999999999999e-205Initial program 91.2%
associate-+l-91.2%
fma-neg91.2%
neg-sub091.2%
associate-+l-91.2%
neg-sub091.2%
*-commutative91.2%
distribute-rgt-neg-in91.2%
fma-def91.2%
*-commutative91.2%
associate-*r*91.2%
distribute-rgt-neg-in91.2%
*-commutative91.2%
metadata-eval91.2%
Simplified91.2%
Taylor expanded in x around inf 53.6%
if 3.4499999999999999e-205 < t < 2.8e38 or 3.59999999999999978e65 < t < 2.00000000000000003e116Initial program 95.2%
Taylor expanded in y around 0 95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in a around inf 42.0%
if 2.00000000000000003e116 < t Initial program 99.9%
Taylor expanded in y around 0 99.9%
*-commutative99.9%
Simplified99.9%
Taylor expanded in y around inf 65.8%
associate-*r*65.8%
Simplified65.8%
Final simplification51.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 (or (<= z -5.2e-97) (not (<= z 1.5e-78))) (+ (* x 2.0) (* t (* (* y z) -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 <= -5.2e-97) || !(z <= 1.5e-78)) {
tmp = (x * 2.0) + (t * ((y * z) * -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 <= (-5.2d-97)) .or. (.not. (z <= 1.5d-78))) then
tmp = (x * 2.0d0) + (t * ((y * z) * (-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 <= -5.2e-97) || !(z <= 1.5e-78)) {
tmp = (x * 2.0) + (t * ((y * z) * -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 <= -5.2e-97) or not (z <= 1.5e-78): tmp = (x * 2.0) + (t * ((y * z) * -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 <= -5.2e-97) || !(z <= 1.5e-78)) tmp = Float64(Float64(x * 2.0) + Float64(t * Float64(Float64(y * z) * -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 <= -5.2e-97) || ~((z <= 1.5e-78)))
tmp = (x * 2.0) + (t * ((y * z) * -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, -5.2e-97], N[Not[LessEqual[z, 1.5e-78]], $MachinePrecision]], N[(N[(x * 2.0), $MachinePrecision] + N[(t * N[(N[(y * z), $MachinePrecision] * -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 -5.2 \cdot 10^{-97} \lor \neg \left(z \leq 1.5 \cdot 10^{-78}\right):\\
\;\;\;\;x \cdot 2 + t \cdot \left(\left(y \cdot z\right) \cdot -9\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if z < -5.20000000000000014e-97 or 1.49999999999999994e-78 < z Initial program 94.1%
associate-+l-94.1%
sub-neg94.1%
neg-mul-194.1%
metadata-eval94.1%
metadata-eval94.1%
cancel-sign-sub-inv94.1%
metadata-eval94.1%
*-lft-identity94.1%
associate-*l*92.0%
associate-*l*92.0%
Simplified92.0%
Taylor expanded in a around 0 71.2%
*-commutative71.2%
associate-*r*73.9%
associate-*l*74.0%
*-commutative74.0%
sub-neg74.0%
*-commutative74.0%
*-commutative74.0%
distribute-rgt-neg-in74.0%
distribute-rgt-neg-in74.0%
metadata-eval74.0%
Applied egg-rr74.0%
if -5.20000000000000014e-97 < z < 1.49999999999999994e-78Initial 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.8%
distribute-rgt-neg-in99.8%
*-commutative99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t around 0 92.1%
Final simplification80.2%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= z -5e-97)
(- (* x 2.0) (* 9.0 (* y (* z t))))
(if (<= z 8e-82)
(+ (* x 2.0) (* 27.0 (* a b)))
(+ (* x 2.0) (* 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 <= -5e-97) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else if (z <= 8e-82) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) + (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 <= (-5d-97)) then
tmp = (x * 2.0d0) - (9.0d0 * (y * (z * t)))
else if (z <= 8d-82) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else
tmp = (x * 2.0d0) + (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 <= -5e-97) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else if (z <= 8e-82) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) + (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 <= -5e-97: tmp = (x * 2.0) - (9.0 * (y * (z * t))) elif z <= 8e-82: tmp = (x * 2.0) + (27.0 * (a * b)) else: tmp = (x * 2.0) + (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 <= -5e-97) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))); elseif (z <= 8e-82) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); else tmp = Float64(Float64(x * 2.0) + Float64(t * Float64(Float64(y * 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 <= -5e-97)
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
elseif (z <= 8e-82)
tmp = (x * 2.0) + (27.0 * (a * b));
else
tmp = (x * 2.0) + (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, -5e-97], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8e-82], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(t * N[(N[(y * z), $MachinePrecision] * -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 -5 \cdot 10^{-97}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-82}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + t \cdot \left(\left(y \cdot z\right) \cdot -9\right)\\
\end{array}
\end{array}
if z < -4.9999999999999995e-97Initial program 94.8%
associate-+l-94.8%
sub-neg94.8%
neg-mul-194.8%
metadata-eval94.8%
metadata-eval94.8%
cancel-sign-sub-inv94.8%
metadata-eval94.8%
*-lft-identity94.8%
associate-*l*92.4%
associate-*l*92.4%
Simplified92.4%
Taylor expanded in a around 0 71.5%
if -4.9999999999999995e-97 < z < 8e-82Initial 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.8%
distribute-rgt-neg-in99.8%
*-commutative99.8%
metadata-eval99.8%
Simplified99.8%
Taylor expanded in t around 0 92.1%
if 8e-82 < z Initial program 93.5%
associate-+l-93.5%
sub-neg93.5%
neg-mul-193.5%
metadata-eval93.5%
metadata-eval93.5%
cancel-sign-sub-inv93.5%
metadata-eval93.5%
*-lft-identity93.5%
associate-*l*91.8%
associate-*l*91.8%
Simplified91.8%
Taylor expanded in a around 0 70.9%
*-commutative70.9%
associate-*r*75.1%
associate-*l*75.2%
*-commutative75.2%
sub-neg75.2%
*-commutative75.2%
*-commutative75.2%
distribute-rgt-neg-in75.2%
distribute-rgt-neg-in75.2%
metadata-eval75.2%
Applied egg-rr75.2%
Final simplification79.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 (<= a -6e+162)
(not (or (<= a -7.6e+142) (and (not (<= a -3e+44)) (<= a 1.5e-127)))))
(* 27.0 (* a b))
(* x 2.0)))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -6e+162) || !((a <= -7.6e+142) || (!(a <= -3e+44) && (a <= 1.5e-127)))) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-6d+162)) .or. (.not. (a <= (-7.6d+142)) .or. (.not. (a <= (-3d+44))) .and. (a <= 1.5d-127))) then
tmp = 27.0d0 * (a * b)
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -6e+162) || !((a <= -7.6e+142) || (!(a <= -3e+44) && (a <= 1.5e-127)))) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if (a <= -6e+162) or not ((a <= -7.6e+142) or (not (a <= -3e+44) and (a <= 1.5e-127))): tmp = 27.0 * (a * b) else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -6e+162) || !((a <= -7.6e+142) || (!(a <= -3e+44) && (a <= 1.5e-127)))) tmp = Float64(27.0 * Float64(a * b)); else tmp = Float64(x * 2.0); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((a <= -6e+162) || ~(((a <= -7.6e+142) || (~((a <= -3e+44)) && (a <= 1.5e-127)))))
tmp = 27.0 * (a * b);
else
tmp = x * 2.0;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -6e+162], N[Not[Or[LessEqual[a, -7.6e+142], And[N[Not[LessEqual[a, -3e+44]], $MachinePrecision], LessEqual[a, 1.5e-127]]]], $MachinePrecision]], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -6 \cdot 10^{+162} \lor \neg \left(a \leq -7.6 \cdot 10^{+142} \lor \neg \left(a \leq -3 \cdot 10^{+44}\right) \land a \leq 1.5 \cdot 10^{-127}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if a < -5.9999999999999996e162 or -7.59999999999999979e142 < a < -2.99999999999999987e44 or 1.50000000000000004e-127 < a Initial program 94.2%
Taylor expanded in y around 0 94.1%
*-commutative94.1%
Simplified94.1%
Taylor expanded in a around inf 49.7%
if -5.9999999999999996e162 < a < -7.59999999999999979e142 or -2.99999999999999987e44 < a < 1.50000000000000004e-127Initial program 98.3%
associate-+l-98.3%
fma-neg98.3%
neg-sub098.3%
associate-+l-98.3%
neg-sub098.3%
*-commutative98.3%
distribute-rgt-neg-in98.3%
fma-def98.3%
*-commutative98.3%
associate-*r*98.3%
distribute-rgt-neg-in98.3%
*-commutative98.3%
metadata-eval98.3%
Simplified98.3%
Taylor expanded in x around inf 44.8%
Final simplification47.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 (<= y -3.4e+196) (not (<= y 2.4e-111))) (* -9.0 (* y (* z t))) (+ (* 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 ((y <= -3.4e+196) || !(y <= 2.4e-111)) {
tmp = -9.0 * (y * (z * t));
} 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 ((y <= (-3.4d+196)) .or. (.not. (y <= 2.4d-111))) then
tmp = (-9.0d0) * (y * (z * t))
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 ((y <= -3.4e+196) || !(y <= 2.4e-111)) {
tmp = -9.0 * (y * (z * t));
} 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 (y <= -3.4e+196) or not (y <= 2.4e-111): tmp = -9.0 * (y * (z * t)) 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 ((y <= -3.4e+196) || !(y <= 2.4e-111)) tmp = Float64(-9.0 * Float64(y * Float64(z * t))); 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 ((y <= -3.4e+196) || ~((y <= 2.4e-111)))
tmp = -9.0 * (y * (z * t));
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[y, -3.4e+196], N[Not[LessEqual[y, 2.4e-111]], $MachinePrecision]], N[(-9.0 * N[(y * N[(z * t), $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}\;y \leq -3.4 \cdot 10^{+196} \lor \neg \left(y \leq 2.4 \cdot 10^{-111}\right):\\
\;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if y < -3.4e196 or 2.4000000000000001e-111 < y Initial program 95.1%
Taylor expanded in y around 0 95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in y around inf 52.5%
if -3.4e196 < y < 2.4000000000000001e-111Initial program 96.7%
associate-+l-96.7%
fma-neg96.7%
neg-sub096.7%
associate-+l-96.7%
neg-sub096.7%
*-commutative96.7%
distribute-rgt-neg-in96.7%
fma-def96.7%
*-commutative96.7%
associate-*r*96.7%
distribute-rgt-neg-in96.7%
*-commutative96.7%
metadata-eval96.7%
Simplified96.7%
Taylor expanded in t around 0 72.8%
Final simplification64.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 (* 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 96.1%
associate-+l-96.1%
fma-neg96.1%
neg-sub096.1%
associate-+l-96.1%
neg-sub096.1%
*-commutative96.1%
distribute-rgt-neg-in96.1%
fma-def96.1%
*-commutative96.1%
associate-*r*96.1%
distribute-rgt-neg-in96.1%
*-commutative96.1%
metadata-eval96.1%
Simplified96.1%
Taylor expanded in x around inf 33.5%
Final simplification33.5%
(FPCore (x y z t a b) :precision binary64 (if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (y < 7.590524218811189d-161) then
tmp = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + (a * (27.0d0 * b))
else
tmp = ((x * 2.0d0) - (9.0d0 * (y * (t * z)))) + ((a * 27.0d0) * b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y < 7.590524218811189e-161: tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)) else: tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y < 7.590524218811189e-161) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(t * z)))) + Float64(Float64(a * 27.0) * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y < 7.590524218811189e-161) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)); else tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Less[y, 7.590524218811189e-161], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y < 7.590524218811189 \cdot 10^{-161}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\
\end{array}
\end{array}
herbie shell --seed 2023228
(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)))