
(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 11 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) -1e-198) (fma a (* 27.0 b) (fma x 2.0 (* y (* t (* -9.0 z))))) (fma x 2.0 (fma z (* y (* t -9.0)) (* b (* a 27.0))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y * 9.0) <= -1e-198) {
tmp = fma(a, (27.0 * b), fma(x, 2.0, (y * (t * (-9.0 * z)))));
} else {
tmp = fma(x, 2.0, fma(z, (y * (t * -9.0)), (b * (a * 27.0))));
}
return tmp;
}
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(y * 9.0) <= -1e-198) tmp = fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(y * Float64(t * Float64(-9.0 * z))))); else tmp = fma(x, 2.0, fma(z, Float64(y * Float64(t * -9.0)), Float64(b * Float64(a * 27.0)))); end return tmp end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(y * 9.0), $MachinePrecision], -1e-198], N[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0 + N[(y * N[(t * N[(-9.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * 2.0 + N[(z * N[(y * N[(t * -9.0), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot 9 \leq -1 \cdot 10^{-198}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, \mathsf{fma}\left(x, 2, y \cdot \left(t \cdot \left(-9 \cdot z\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, 2, \mathsf{fma}\left(z, y \cdot \left(t \cdot -9\right), b \cdot \left(a \cdot 27\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 y 9) < -9.9999999999999991e-199Initial program 93.2%
+-commutative93.2%
associate-+r-93.2%
cancel-sign-sub-inv93.2%
*-commutative93.2%
distribute-rgt-neg-out93.2%
associate-*r*95.9%
*-commutative95.9%
distribute-rgt-neg-in95.9%
associate-+r+95.9%
sub-neg95.9%
associate-*l*96.0%
fma-def97.9%
fma-neg97.9%
associate-*l*97.9%
*-commutative97.9%
associate-*r*95.2%
distribute-rgt-neg-in95.2%
Simplified95.2%
if -9.9999999999999991e-199 < (*.f64 y 9) Initial program 97.5%
+-commutative97.5%
associate-+r-97.5%
cancel-sign-sub-inv97.5%
*-commutative97.5%
distribute-rgt-neg-out97.5%
associate-*r*97.9%
*-commutative97.9%
distribute-rgt-neg-in97.9%
associate-+r+97.9%
sub-neg97.9%
+-commutative97.9%
associate-+l-97.9%
fma-neg97.9%
associate-*l*93.2%
fma-neg93.2%
*-commutative93.2%
fma-neg93.2%
Simplified97.9%
Final simplification96.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 (<= (* y 9.0) -1e-38) (fma a (* 27.0 b) (fma x 2.0 (* y (* t (* -9.0 z))))) (+ (* b (* a 27.0)) (- (* x 2.0) (* t (* (* y 9.0) 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 ((y * 9.0) <= -1e-38) {
tmp = fma(a, (27.0 * b), fma(x, 2.0, (y * (t * (-9.0 * z)))));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * ((y * 9.0) * 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 (Float64(y * 9.0) <= -1e-38) tmp = fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(y * Float64(t * Float64(-9.0 * z))))); else tmp = Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(t * Float64(Float64(y * 9.0) * z)))); 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[(y * 9.0), $MachinePrecision], -1e-38], N[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0 + N[(y * N[(t * N[(-9.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot 9 \leq -1 \cdot 10^{-38}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, \mathsf{fma}\left(x, 2, y \cdot \left(t \cdot \left(-9 \cdot z\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - t \cdot \left(\left(y \cdot 9\right) \cdot z\right)\right)\\
\end{array}
\end{array}
if (*.f64 y 9) < -9.9999999999999996e-39Initial program 90.1%
+-commutative90.1%
associate-+r-90.1%
cancel-sign-sub-inv90.1%
*-commutative90.1%
distribute-rgt-neg-out90.1%
associate-*r*94.1%
*-commutative94.1%
distribute-rgt-neg-in94.1%
associate-+r+94.1%
sub-neg94.1%
associate-*l*94.1%
fma-def97.0%
fma-neg97.0%
associate-*l*97.0%
*-commutative97.0%
associate-*r*98.4%
distribute-rgt-neg-in98.4%
Simplified98.4%
if -9.9999999999999996e-39 < (*.f64 y 9) Initial program 97.9%
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 3.2e+54) (+ (- (* x 2.0) (* (* y 9.0) (* t z))) (* a (* 27.0 b))) (+ (* t (* -9.0 (* y z))) (* 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 (z <= 3.2e+54) {
tmp = ((x * 2.0) - ((y * 9.0) * (t * z))) + (a * (27.0 * b));
} else {
tmp = (t * (-9.0 * (y * z))) + (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 (z <= 3.2d+54) then
tmp = ((x * 2.0d0) - ((y * 9.0d0) * (t * z))) + (a * (27.0d0 * b))
else
tmp = (t * ((-9.0d0) * (y * z))) + (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 (z <= 3.2e+54) {
tmp = ((x * 2.0) - ((y * 9.0) * (t * z))) + (a * (27.0 * b));
} else {
tmp = (t * (-9.0 * (y * z))) + (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 z <= 3.2e+54: tmp = ((x * 2.0) - ((y * 9.0) * (t * z))) + (a * (27.0 * b)) else: tmp = (t * (-9.0 * (y * z))) + (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 (z <= 3.2e+54) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(y * 9.0) * Float64(t * z))) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(t * Float64(-9.0 * Float64(y * z))) + 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 (z <= 3.2e+54)
tmp = ((x * 2.0) - ((y * 9.0) * (t * z))) + (a * (27.0 * b));
else
tmp = (t * (-9.0 * (y * z))) + (x * 2.0);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 3.2e+54], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(t * N[(-9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $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^{+54}:\\
\;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(t \cdot z\right)\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(-9 \cdot \left(y \cdot z\right)\right) + x \cdot 2\\
\end{array}
\end{array}
if z < 3.2e54Initial program 97.4%
sub-neg97.4%
distribute-lft-neg-in97.4%
associate-*l*97.4%
*-commutative97.4%
*-commutative97.4%
cancel-sign-sub-inv97.4%
*-commutative97.4%
*-commutative97.4%
associate-*l*97.4%
associate-*l*96.5%
associate-*l*96.6%
Simplified96.6%
if 3.2e54 < z Initial program 90.8%
sub-neg90.8%
distribute-lft-neg-in90.8%
associate-*l*90.8%
*-commutative90.8%
*-commutative90.8%
cancel-sign-sub-inv90.8%
*-commutative90.8%
*-commutative90.8%
associate-*l*90.8%
associate-*l*82.6%
associate-*l*82.7%
Simplified82.7%
Taylor expanded in a around 0 71.7%
cancel-sign-sub-inv71.7%
metadata-eval71.7%
+-commutative71.7%
*-commutative71.7%
associate-*l*71.7%
Applied egg-rr71.7%
Final simplification90.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 (<= z -1.7e+110)
(* y (* z (* t -9.0)))
(if (or (<= z -2.8e-42) (not (<= z 3.6e-65)))
(+ (* t (* -9.0 (* y z))) (* x 2.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 <= -1.7e+110) {
tmp = y * (z * (t * -9.0));
} else if ((z <= -2.8e-42) || !(z <= 3.6e-65)) {
tmp = (t * (-9.0 * (y * z))) + (x * 2.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 <= (-1.7d+110)) then
tmp = y * (z * (t * (-9.0d0)))
else if ((z <= (-2.8d-42)) .or. (.not. (z <= 3.6d-65))) then
tmp = (t * ((-9.0d0) * (y * z))) + (x * 2.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 <= -1.7e+110) {
tmp = y * (z * (t * -9.0));
} else if ((z <= -2.8e-42) || !(z <= 3.6e-65)) {
tmp = (t * (-9.0 * (y * z))) + (x * 2.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 <= -1.7e+110: tmp = y * (z * (t * -9.0)) elif (z <= -2.8e-42) or not (z <= 3.6e-65): tmp = (t * (-9.0 * (y * z))) + (x * 2.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 <= -1.7e+110) tmp = Float64(y * Float64(z * Float64(t * -9.0))); elseif ((z <= -2.8e-42) || !(z <= 3.6e-65)) tmp = Float64(Float64(t * Float64(-9.0 * Float64(y * z))) + Float64(x * 2.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 <= -1.7e+110)
tmp = y * (z * (t * -9.0));
elseif ((z <= -2.8e-42) || ~((z <= 3.6e-65)))
tmp = (t * (-9.0 * (y * z))) + (x * 2.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[LessEqual[z, -1.7e+110], N[(y * N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[z, -2.8e-42], N[Not[LessEqual[z, 3.6e-65]], $MachinePrecision]], N[(N[(t * N[(-9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $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 -1.7 \cdot 10^{+110}:\\
\;\;\;\;y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-42} \lor \neg \left(z \leq 3.6 \cdot 10^{-65}\right):\\
\;\;\;\;t \cdot \left(-9 \cdot \left(y \cdot z\right)\right) + x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if z < -1.7000000000000001e110Initial program 86.6%
sub-neg86.6%
distribute-lft-neg-in86.6%
associate-*l*86.5%
*-commutative86.5%
*-commutative86.5%
cancel-sign-sub-inv86.5%
*-commutative86.5%
*-commutative86.5%
associate-*l*86.6%
associate-*l*86.8%
associate-*l*86.8%
Simplified86.8%
Taylor expanded in y around inf 61.8%
*-commutative61.8%
associate-*r*72.2%
*-commutative72.2%
associate-*r*72.2%
associate-*l*59.4%
Simplified59.4%
Taylor expanded in t around 0 59.4%
associate-*r*59.4%
*-commutative59.4%
Simplified59.4%
if -1.7000000000000001e110 < z < -2.79999999999999998e-42 or 3.5999999999999998e-65 < z Initial program 95.2%
sub-neg95.2%
distribute-lft-neg-in95.2%
associate-*l*95.3%
*-commutative95.3%
*-commutative95.3%
cancel-sign-sub-inv95.3%
*-commutative95.3%
*-commutative95.3%
associate-*l*95.2%
associate-*l*90.4%
associate-*l*90.5%
Simplified90.5%
Taylor expanded in a around 0 69.0%
cancel-sign-sub-inv69.0%
metadata-eval69.0%
+-commutative69.0%
*-commutative69.0%
associate-*l*69.0%
Applied egg-rr69.0%
if -2.79999999999999998e-42 < z < 3.5999999999999998e-65Initial program 99.9%
sub-neg99.9%
distribute-lft-neg-in99.9%
associate-*l*99.9%
*-commutative99.9%
*-commutative99.9%
cancel-sign-sub-inv99.9%
*-commutative99.9%
*-commutative99.9%
associate-*l*99.9%
associate-*l*98.9%
associate-*l*98.9%
Simplified98.9%
Taylor expanded in y around 0 91.7%
Final simplification76.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 (<= z -1.4e+110)
(* y (* z (* t -9.0)))
(if (<= z -7.5e-46)
(+ (* t (* -9.0 (* y z))) (* x 2.0))
(if (<= z 5.2e-66)
(+ (* x 2.0) (* 27.0 (* a b)))
(- (* x 2.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 <= -1.4e+110) {
tmp = y * (z * (t * -9.0));
} else if (z <= -7.5e-46) {
tmp = (t * (-9.0 * (y * z))) + (x * 2.0);
} else if (z <= 5.2e-66) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) - (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 <= (-1.4d+110)) then
tmp = y * (z * (t * (-9.0d0)))
else if (z <= (-7.5d-46)) then
tmp = (t * ((-9.0d0) * (y * z))) + (x * 2.0d0)
else if (z <= 5.2d-66) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else
tmp = (x * 2.0d0) - (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 <= -1.4e+110) {
tmp = y * (z * (t * -9.0));
} else if (z <= -7.5e-46) {
tmp = (t * (-9.0 * (y * z))) + (x * 2.0);
} else if (z <= 5.2e-66) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) - (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 <= -1.4e+110: tmp = y * (z * (t * -9.0)) elif z <= -7.5e-46: tmp = (t * (-9.0 * (y * z))) + (x * 2.0) elif z <= 5.2e-66: tmp = (x * 2.0) + (27.0 * (a * b)) else: tmp = (x * 2.0) - (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 <= -1.4e+110) tmp = Float64(y * Float64(z * Float64(t * -9.0))); elseif (z <= -7.5e-46) tmp = Float64(Float64(t * Float64(-9.0 * Float64(y * z))) + Float64(x * 2.0)); elseif (z <= 5.2e-66) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); else tmp = Float64(Float64(x * 2.0) - 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 <= -1.4e+110)
tmp = y * (z * (t * -9.0));
elseif (z <= -7.5e-46)
tmp = (t * (-9.0 * (y * z))) + (x * 2.0);
elseif (z <= 5.2e-66)
tmp = (x * 2.0) + (27.0 * (a * b));
else
tmp = (x * 2.0) - (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, -1.4e+110], N[(y * N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -7.5e-46], N[(N[(t * N[(-9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.2e-66], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.4 \cdot 10^{+110}:\\
\;\;\;\;y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\
\mathbf{elif}\;z \leq -7.5 \cdot 10^{-46}:\\
\;\;\;\;t \cdot \left(-9 \cdot \left(y \cdot z\right)\right) + x \cdot 2\\
\mathbf{elif}\;z \leq 5.2 \cdot 10^{-66}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if z < -1.39999999999999993e110Initial program 86.6%
sub-neg86.6%
distribute-lft-neg-in86.6%
associate-*l*86.5%
*-commutative86.5%
*-commutative86.5%
cancel-sign-sub-inv86.5%
*-commutative86.5%
*-commutative86.5%
associate-*l*86.6%
associate-*l*86.8%
associate-*l*86.8%
Simplified86.8%
Taylor expanded in y around inf 61.8%
*-commutative61.8%
associate-*r*72.2%
*-commutative72.2%
associate-*r*72.2%
associate-*l*59.4%
Simplified59.4%
Taylor expanded in t around 0 59.4%
associate-*r*59.4%
*-commutative59.4%
Simplified59.4%
if -1.39999999999999993e110 < z < -7.50000000000000027e-46Initial program 99.8%
sub-neg99.8%
distribute-lft-neg-in99.8%
associate-*l*99.9%
*-commutative99.9%
*-commutative99.9%
cancel-sign-sub-inv99.9%
*-commutative99.9%
*-commutative99.9%
associate-*l*99.8%
associate-*l*99.8%
associate-*l*100.0%
Simplified100.0%
Taylor expanded in a around 0 63.1%
cancel-sign-sub-inv63.1%
metadata-eval63.1%
+-commutative63.1%
*-commutative63.1%
associate-*l*63.1%
Applied egg-rr63.1%
if -7.50000000000000027e-46 < z < 5.1999999999999998e-66Initial program 99.9%
sub-neg99.9%
distribute-lft-neg-in99.9%
associate-*l*99.9%
*-commutative99.9%
*-commutative99.9%
cancel-sign-sub-inv99.9%
*-commutative99.9%
*-commutative99.9%
associate-*l*99.9%
associate-*l*98.9%
associate-*l*98.9%
Simplified98.9%
Taylor expanded in y around 0 91.6%
if 5.1999999999999998e-66 < z Initial program 93.6%
sub-neg93.6%
distribute-lft-neg-in93.6%
associate-*l*93.7%
*-commutative93.7%
*-commutative93.7%
cancel-sign-sub-inv93.7%
*-commutative93.7%
*-commutative93.7%
associate-*l*93.6%
associate-*l*87.2%
associate-*l*87.3%
Simplified87.3%
Taylor expanded in a around 0 71.5%
Final simplification76.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 (* 27.0 (* a b))) (t_2 (* -9.0 (* t (* y z)))))
(if (<= z -1.3e-46)
t_2
(if (<= z -1.05e-293)
t_1
(if (<= z 2.7e-148) (* x 2.0) (if (<= z 1.55e-65) t_1 t_2))))))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 * (t * (y * z));
double tmp;
if (z <= -1.3e-46) {
tmp = t_2;
} else if (z <= -1.05e-293) {
tmp = t_1;
} else if (z <= 2.7e-148) {
tmp = x * 2.0;
} else if (z <= 1.55e-65) {
tmp = t_1;
} else {
tmp = t_2;
}
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) * (t * (y * z))
if (z <= (-1.3d-46)) then
tmp = t_2
else if (z <= (-1.05d-293)) then
tmp = t_1
else if (z <= 2.7d-148) then
tmp = x * 2.0d0
else if (z <= 1.55d-65) then
tmp = t_1
else
tmp = t_2
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 * (t * (y * z));
double tmp;
if (z <= -1.3e-46) {
tmp = t_2;
} else if (z <= -1.05e-293) {
tmp = t_1;
} else if (z <= 2.7e-148) {
tmp = x * 2.0;
} else if (z <= 1.55e-65) {
tmp = t_1;
} else {
tmp = t_2;
}
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 * (t * (y * z)) tmp = 0 if z <= -1.3e-46: tmp = t_2 elif z <= -1.05e-293: tmp = t_1 elif z <= 2.7e-148: tmp = x * 2.0 elif z <= 1.55e-65: tmp = t_1 else: tmp = t_2 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(t * Float64(y * z))) tmp = 0.0 if (z <= -1.3e-46) tmp = t_2; elseif (z <= -1.05e-293) tmp = t_1; elseif (z <= 2.7e-148) tmp = Float64(x * 2.0); elseif (z <= 1.55e-65) tmp = t_1; else tmp = t_2; 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 * (t * (y * z));
tmp = 0.0;
if (z <= -1.3e-46)
tmp = t_2;
elseif (z <= -1.05e-293)
tmp = t_1;
elseif (z <= 2.7e-148)
tmp = x * 2.0;
elseif (z <= 1.55e-65)
tmp = t_1;
else
tmp = t_2;
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[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.3e-46], t$95$2, If[LessEqual[z, -1.05e-293], t$95$1, If[LessEqual[z, 2.7e-148], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, 1.55e-65], t$95$1, t$95$2]]]]]]
\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(t \cdot \left(y \cdot z\right)\right)\\
\mathbf{if}\;z \leq -1.3 \cdot 10^{-46}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -1.05 \cdot 10^{-293}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{-148}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 1.55 \cdot 10^{-65}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -1.3000000000000001e-46 or 1.55000000000000008e-65 < z Initial program 93.3%
sub-neg93.3%
distribute-lft-neg-in93.3%
associate-*l*93.3%
*-commutative93.3%
*-commutative93.3%
cancel-sign-sub-inv93.3%
*-commutative93.3%
*-commutative93.3%
associate-*l*93.3%
associate-*l*89.7%
associate-*l*89.7%
Simplified89.7%
Taylor expanded in y around inf 50.6%
if -1.3000000000000001e-46 < z < -1.05000000000000003e-293 or 2.69999999999999988e-148 < z < 1.55000000000000008e-65Initial program 99.8%
sub-neg99.8%
distribute-lft-neg-in99.8%
associate-*l*99.8%
*-commutative99.8%
*-commutative99.8%
cancel-sign-sub-inv99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
associate-*l*98.3%
associate-*l*98.3%
Simplified98.3%
Taylor expanded in a around inf 42.0%
if -1.05000000000000003e-293 < z < 2.69999999999999988e-148Initial program 100.0%
sub-neg100.0%
distribute-lft-neg-in100.0%
associate-*l*100.0%
*-commutative100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
associate-*l*100.0%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in x around inf 49.3%
Final simplification48.3%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* 27.0 (* a b))))
(if (<= z -7.8e-42)
(* y (* t (* -9.0 z)))
(if (<= z -9e-294)
t_1
(if (<= z 7.2e-137)
(* x 2.0)
(if (<= z 3e-65) t_1 (* -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 t_1 = 27.0 * (a * b);
double tmp;
if (z <= -7.8e-42) {
tmp = y * (t * (-9.0 * z));
} else if (z <= -9e-294) {
tmp = t_1;
} else if (z <= 7.2e-137) {
tmp = x * 2.0;
} else if (z <= 3e-65) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = 27.0d0 * (a * b)
if (z <= (-7.8d-42)) then
tmp = y * (t * ((-9.0d0) * z))
else if (z <= (-9d-294)) then
tmp = t_1
else if (z <= 7.2d-137) then
tmp = x * 2.0d0
else if (z <= 3d-65) then
tmp = t_1
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 t_1 = 27.0 * (a * b);
double tmp;
if (z <= -7.8e-42) {
tmp = y * (t * (-9.0 * z));
} else if (z <= -9e-294) {
tmp = t_1;
} else if (z <= 7.2e-137) {
tmp = x * 2.0;
} else if (z <= 3e-65) {
tmp = t_1;
} 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): t_1 = 27.0 * (a * b) tmp = 0 if z <= -7.8e-42: tmp = y * (t * (-9.0 * z)) elif z <= -9e-294: tmp = t_1 elif z <= 7.2e-137: tmp = x * 2.0 elif z <= 3e-65: tmp = t_1 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) t_1 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (z <= -7.8e-42) tmp = Float64(y * Float64(t * Float64(-9.0 * z))); elseif (z <= -9e-294) tmp = t_1; elseif (z <= 7.2e-137) tmp = Float64(x * 2.0); elseif (z <= 3e-65) tmp = t_1; 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)
t_1 = 27.0 * (a * b);
tmp = 0.0;
if (z <= -7.8e-42)
tmp = y * (t * (-9.0 * z));
elseif (z <= -9e-294)
tmp = t_1;
elseif (z <= 7.2e-137)
tmp = x * 2.0;
elseif (z <= 3e-65)
tmp = t_1;
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_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -7.8e-42], N[(y * N[(t * N[(-9.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9e-294], t$95$1, If[LessEqual[z, 7.2e-137], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, 3e-65], t$95$1, 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}
t_1 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;z \leq -7.8 \cdot 10^{-42}:\\
\;\;\;\;y \cdot \left(t \cdot \left(-9 \cdot z\right)\right)\\
\mathbf{elif}\;z \leq -9 \cdot 10^{-294}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 7.2 \cdot 10^{-137}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 3 \cdot 10^{-65}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if z < -7.8000000000000003e-42Initial program 92.7%
sub-neg92.7%
distribute-lft-neg-in92.7%
associate-*l*92.7%
*-commutative92.7%
*-commutative92.7%
cancel-sign-sub-inv92.7%
*-commutative92.7%
*-commutative92.7%
associate-*l*92.7%
associate-*l*92.8%
associate-*l*92.9%
Simplified92.9%
Taylor expanded in y around inf 47.5%
*-commutative47.5%
associate-*r*53.1%
*-commutative53.1%
associate-*r*53.1%
associate-*l*46.2%
Simplified46.2%
if -7.8000000000000003e-42 < z < -8.99999999999999963e-294 or 7.20000000000000013e-137 < z < 2.99999999999999998e-65Initial program 99.8%
sub-neg99.8%
distribute-lft-neg-in99.8%
associate-*l*99.8%
*-commutative99.8%
*-commutative99.8%
cancel-sign-sub-inv99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
associate-*l*99.8%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in a around inf 42.4%
if -8.99999999999999963e-294 < z < 7.20000000000000013e-137Initial program 100.0%
sub-neg100.0%
distribute-lft-neg-in100.0%
associate-*l*100.0%
*-commutative100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
associate-*l*97.5%
associate-*l*97.5%
Simplified97.5%
Taylor expanded in x around inf 49.5%
if 2.99999999999999998e-65 < z Initial program 93.6%
sub-neg93.6%
distribute-lft-neg-in93.6%
associate-*l*93.7%
*-commutative93.7%
*-commutative93.7%
cancel-sign-sub-inv93.7%
*-commutative93.7%
*-commutative93.7%
associate-*l*93.6%
associate-*l*87.2%
associate-*l*87.3%
Simplified87.3%
Taylor expanded in y around inf 53.5%
Final simplification48.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 (* 27.0 (* a b))))
(if (<= z -2.8e-43)
(* y (* z (* t -9.0)))
(if (<= z -3.7e-294)
t_1
(if (<= z 8e-153)
(* x 2.0)
(if (<= z 2.4e-64) t_1 (* -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 t_1 = 27.0 * (a * b);
double tmp;
if (z <= -2.8e-43) {
tmp = y * (z * (t * -9.0));
} else if (z <= -3.7e-294) {
tmp = t_1;
} else if (z <= 8e-153) {
tmp = x * 2.0;
} else if (z <= 2.4e-64) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = 27.0d0 * (a * b)
if (z <= (-2.8d-43)) then
tmp = y * (z * (t * (-9.0d0)))
else if (z <= (-3.7d-294)) then
tmp = t_1
else if (z <= 8d-153) then
tmp = x * 2.0d0
else if (z <= 2.4d-64) then
tmp = t_1
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 t_1 = 27.0 * (a * b);
double tmp;
if (z <= -2.8e-43) {
tmp = y * (z * (t * -9.0));
} else if (z <= -3.7e-294) {
tmp = t_1;
} else if (z <= 8e-153) {
tmp = x * 2.0;
} else if (z <= 2.4e-64) {
tmp = t_1;
} 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): t_1 = 27.0 * (a * b) tmp = 0 if z <= -2.8e-43: tmp = y * (z * (t * -9.0)) elif z <= -3.7e-294: tmp = t_1 elif z <= 8e-153: tmp = x * 2.0 elif z <= 2.4e-64: tmp = t_1 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) t_1 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (z <= -2.8e-43) tmp = Float64(y * Float64(z * Float64(t * -9.0))); elseif (z <= -3.7e-294) tmp = t_1; elseif (z <= 8e-153) tmp = Float64(x * 2.0); elseif (z <= 2.4e-64) tmp = t_1; 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)
t_1 = 27.0 * (a * b);
tmp = 0.0;
if (z <= -2.8e-43)
tmp = y * (z * (t * -9.0));
elseif (z <= -3.7e-294)
tmp = t_1;
elseif (z <= 8e-153)
tmp = x * 2.0;
elseif (z <= 2.4e-64)
tmp = t_1;
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_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.8e-43], N[(y * N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -3.7e-294], t$95$1, If[LessEqual[z, 8e-153], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, 2.4e-64], t$95$1, 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}
t_1 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;z \leq -2.8 \cdot 10^{-43}:\\
\;\;\;\;y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\
\mathbf{elif}\;z \leq -3.7 \cdot 10^{-294}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-153}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 2.4 \cdot 10^{-64}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if z < -2.7999999999999998e-43Initial program 92.7%
sub-neg92.7%
distribute-lft-neg-in92.7%
associate-*l*92.7%
*-commutative92.7%
*-commutative92.7%
cancel-sign-sub-inv92.7%
*-commutative92.7%
*-commutative92.7%
associate-*l*92.7%
associate-*l*92.8%
associate-*l*92.9%
Simplified92.9%
Taylor expanded in y around inf 47.5%
*-commutative47.5%
associate-*r*53.1%
*-commutative53.1%
associate-*r*53.1%
associate-*l*46.2%
Simplified46.2%
Taylor expanded in t around 0 46.2%
associate-*r*46.2%
*-commutative46.2%
Simplified46.2%
if -2.7999999999999998e-43 < z < -3.69999999999999994e-294 or 8.00000000000000031e-153 < z < 2.39999999999999998e-64Initial program 99.8%
sub-neg99.8%
distribute-lft-neg-in99.8%
associate-*l*99.9%
*-commutative99.9%
*-commutative99.9%
cancel-sign-sub-inv99.9%
*-commutative99.9%
*-commutative99.9%
associate-*l*99.8%
associate-*l*98.3%
associate-*l*98.4%
Simplified98.4%
Taylor expanded in a around inf 40.8%
if -3.69999999999999994e-294 < z < 8.00000000000000031e-153Initial program 100.0%
sub-neg100.0%
distribute-lft-neg-in100.0%
associate-*l*100.0%
*-commutative100.0%
*-commutative100.0%
cancel-sign-sub-inv100.0%
*-commutative100.0%
*-commutative100.0%
associate-*l*100.0%
associate-*l*100.0%
associate-*l*99.9%
Simplified99.9%
Taylor expanded in x around inf 49.3%
if 2.39999999999999998e-64 < z Initial program 93.6%
sub-neg93.6%
distribute-lft-neg-in93.6%
associate-*l*93.6%
*-commutative93.6%
*-commutative93.6%
cancel-sign-sub-inv93.6%
*-commutative93.6%
*-commutative93.6%
associate-*l*93.6%
associate-*l*87.1%
associate-*l*87.2%
Simplified87.2%
Taylor expanded in y around inf 54.0%
Final simplification48.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 -2.2e-40) (* y (* z (* t -9.0))) (if (<= z 3e+54) (+ (* x 2.0) (* 27.0 (* a b))) (* -9.0 (* t (* y z))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.2e-40) {
tmp = y * (z * (t * -9.0));
} else if (z <= 3e+54) {
tmp = (x * 2.0) + (27.0 * (a * b));
} 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 <= (-2.2d-40)) then
tmp = y * (z * (t * (-9.0d0)))
else if (z <= 3d+54) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
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 <= -2.2e-40) {
tmp = y * (z * (t * -9.0));
} else if (z <= 3e+54) {
tmp = (x * 2.0) + (27.0 * (a * b));
} 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 <= -2.2e-40: tmp = y * (z * (t * -9.0)) elif z <= 3e+54: tmp = (x * 2.0) + (27.0 * (a * b)) 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 <= -2.2e-40) tmp = Float64(y * Float64(z * Float64(t * -9.0))); elseif (z <= 3e+54) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); 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 <= -2.2e-40)
tmp = y * (z * (t * -9.0));
elseif (z <= 3e+54)
tmp = (x * 2.0) + (27.0 * (a * b));
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, -2.2e-40], N[(y * N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3e+54], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $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 -2.2 \cdot 10^{-40}:\\
\;\;\;\;y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\
\mathbf{elif}\;z \leq 3 \cdot 10^{+54}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if z < -2.20000000000000009e-40Initial program 92.7%
sub-neg92.7%
distribute-lft-neg-in92.7%
associate-*l*92.7%
*-commutative92.7%
*-commutative92.7%
cancel-sign-sub-inv92.7%
*-commutative92.7%
*-commutative92.7%
associate-*l*92.7%
associate-*l*92.8%
associate-*l*92.9%
Simplified92.9%
Taylor expanded in y around inf 47.5%
*-commutative47.5%
associate-*r*53.1%
*-commutative53.1%
associate-*r*53.1%
associate-*l*46.2%
Simplified46.2%
Taylor expanded in t around 0 46.2%
associate-*r*46.2%
*-commutative46.2%
Simplified46.2%
if -2.20000000000000009e-40 < z < 2.9999999999999999e54Initial program 99.8%
sub-neg99.8%
distribute-lft-neg-in99.8%
associate-*l*99.9%
*-commutative99.9%
*-commutative99.9%
cancel-sign-sub-inv99.9%
*-commutative99.9%
*-commutative99.9%
associate-*l*99.8%
associate-*l*98.4%
associate-*l*98.5%
Simplified98.5%
Taylor expanded in y around 0 82.6%
if 2.9999999999999999e54 < z Initial program 90.8%
sub-neg90.8%
distribute-lft-neg-in90.8%
associate-*l*90.8%
*-commutative90.8%
*-commutative90.8%
cancel-sign-sub-inv90.8%
*-commutative90.8%
*-commutative90.8%
associate-*l*90.8%
associate-*l*82.6%
associate-*l*82.7%
Simplified82.7%
Taylor expanded in y around inf 57.4%
Final simplification67.1%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= b -9.2e-127) (not (<= b 3.6e+29))) (* 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 ((b <= -9.2e-127) || !(b <= 3.6e+29)) {
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 ((b <= (-9.2d-127)) .or. (.not. (b <= 3.6d+29))) 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 ((b <= -9.2e-127) || !(b <= 3.6e+29)) {
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 (b <= -9.2e-127) or not (b <= 3.6e+29): 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 ((b <= -9.2e-127) || !(b <= 3.6e+29)) 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 ((b <= -9.2e-127) || ~((b <= 3.6e+29)))
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[b, -9.2e-127], N[Not[LessEqual[b, 3.6e+29]], $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}\;b \leq -9.2 \cdot 10^{-127} \lor \neg \left(b \leq 3.6 \cdot 10^{+29}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if b < -9.20000000000000075e-127 or 3.59999999999999976e29 < b Initial program 95.7%
sub-neg95.7%
distribute-lft-neg-in95.7%
associate-*l*95.8%
*-commutative95.8%
*-commutative95.8%
cancel-sign-sub-inv95.8%
*-commutative95.8%
*-commutative95.8%
associate-*l*95.7%
associate-*l*94.4%
associate-*l*94.5%
Simplified94.5%
Taylor expanded in a around inf 50.7%
if -9.20000000000000075e-127 < b < 3.59999999999999976e29Initial program 95.9%
sub-neg95.9%
distribute-lft-neg-in95.9%
associate-*l*95.9%
*-commutative95.9%
*-commutative95.9%
cancel-sign-sub-inv95.9%
*-commutative95.9%
*-commutative95.9%
associate-*l*95.9%
associate-*l*91.7%
associate-*l*91.8%
Simplified91.8%
Taylor expanded in x around inf 46.6%
Final simplification48.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 (* 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 95.8%
sub-neg95.8%
distribute-lft-neg-in95.8%
associate-*l*95.8%
*-commutative95.8%
*-commutative95.8%
cancel-sign-sub-inv95.8%
*-commutative95.8%
*-commutative95.8%
associate-*l*95.8%
associate-*l*93.2%
associate-*l*93.2%
Simplified93.2%
Taylor expanded in x around inf 32.3%
Final simplification32.3%
(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 2023290
(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)))