
(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 16 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 (<= z 5e-122) (fma a (* 27.0 b) (fma x 2.0 (* y (* t (* z -9.0))))) (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 (z <= 5e-122) {
tmp = fma(a, (27.0 * b), fma(x, 2.0, (y * (t * (z * -9.0)))));
} 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 (z <= 5e-122) tmp = fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(y * Float64(t * Float64(z * -9.0))))); 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[z, 5e-122], N[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0 + N[(y * N[(t * N[(z * -9.0), $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}\;z \leq 5 \cdot 10^{-122}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, \mathsf{fma}\left(x, 2, y \cdot \left(t \cdot \left(z \cdot -9\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 z < 4.9999999999999999e-122Initial program 95.0%
+-commutative95.0%
associate-+r-95.0%
cancel-sign-sub-inv95.0%
*-commutative95.0%
distribute-rgt-neg-out95.0%
associate-*r*92.0%
*-commutative92.0%
distribute-rgt-neg-in92.0%
associate-+r+92.0%
sub-neg92.0%
associate-*l*92.0%
fma-def92.0%
fma-neg92.0%
associate-*l*92.6%
*-commutative92.6%
associate-*r*93.2%
distribute-rgt-neg-in93.2%
Simplified93.2%
if 4.9999999999999999e-122 < z Initial program 91.8%
+-commutative91.8%
associate-+r-91.8%
cancel-sign-sub-inv91.8%
*-commutative91.8%
distribute-rgt-neg-out91.8%
associate-*r*98.8%
*-commutative98.8%
distribute-rgt-neg-in98.8%
associate-+r+98.8%
sub-neg98.8%
+-commutative98.8%
associate-+l-98.8%
fma-neg98.8%
associate-*l*92.8%
fma-neg92.8%
*-commutative92.8%
fma-neg92.8%
Simplified98.8%
Final simplification95.3%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 2.8e-43) (fma a (* 27.0 b) (fma x 2.0 (* y (* t (* z -9.0))))) (- (* x 2.0) (fma (* z y) (* t 9.0) (* a (* 27.0 (- b)))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 2.8e-43) {
tmp = fma(a, (27.0 * b), fma(x, 2.0, (y * (t * (z * -9.0)))));
} else {
tmp = (x * 2.0) - fma((z * y), (t * 9.0), (a * (27.0 * -b)));
}
return tmp;
}
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 2.8e-43) tmp = fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(y * Float64(t * Float64(z * -9.0))))); else tmp = Float64(Float64(x * 2.0) - fma(Float64(z * y), Float64(t * 9.0), Float64(a * Float64(27.0 * Float64(-b))))); 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[z, 2.8e-43], N[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0 + N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(z * y), $MachinePrecision] * N[(t * 9.0), $MachinePrecision] + N[(a * N[(27.0 * (-b)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2.8 \cdot 10^{-43}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, \mathsf{fma}\left(x, 2, y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - \mathsf{fma}\left(z \cdot y, t \cdot 9, a \cdot \left(27 \cdot \left(-b\right)\right)\right)\\
\end{array}
\end{array}
if z < 2.7999999999999998e-43Initial program 95.3%
+-commutative95.3%
associate-+r-95.3%
cancel-sign-sub-inv95.3%
*-commutative95.3%
distribute-rgt-neg-out95.3%
associate-*r*92.6%
*-commutative92.6%
distribute-rgt-neg-in92.6%
associate-+r+92.6%
sub-neg92.6%
associate-*l*92.6%
fma-def92.6%
fma-neg92.6%
associate-*l*93.2%
*-commutative93.2%
associate-*r*93.2%
distribute-rgt-neg-in93.2%
Simplified93.2%
if 2.7999999999999998e-43 < z Initial program 90.4%
sub-neg90.4%
distribute-lft-neg-in90.4%
associate-*l*90.5%
*-commutative90.5%
*-commutative90.5%
cancel-sign-sub-inv90.5%
*-commutative90.5%
*-commutative90.5%
associate-*l*90.4%
associate-*l*92.8%
associate-*l*92.8%
Simplified92.8%
associate-+l-92.8%
associate-*r*90.4%
associate-*r*90.4%
associate-*r*92.8%
associate-*l*92.8%
associate-*r*92.8%
Applied egg-rr92.8%
cancel-sign-sub-inv92.8%
*-commutative92.8%
associate-*r*92.8%
associate-*r*90.5%
fma-def90.5%
*-commutative90.5%
Applied egg-rr90.5%
Final simplification92.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 (* a (* 27.0 b))))
(if (<= (* y 9.0) -4000.0)
(+ t_1 (- (* x 2.0) (* y (* z (* t 9.0)))))
(+ t_1 (fma x 2.0 (* (* y t) (* 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 t_1 = a * (27.0 * b);
double tmp;
if ((y * 9.0) <= -4000.0) {
tmp = t_1 + ((x * 2.0) - (y * (z * (t * 9.0))));
} else {
tmp = t_1 + fma(x, 2.0, ((y * t) * (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) t_1 = Float64(a * Float64(27.0 * b)) tmp = 0.0 if (Float64(y * 9.0) <= -4000.0) tmp = Float64(t_1 + Float64(Float64(x * 2.0) - Float64(y * Float64(z * Float64(t * 9.0))))); else tmp = Float64(t_1 + fma(x, 2.0, Float64(Float64(y * t) * Float64(z * -9.0)))); end return tmp end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y * 9.0), $MachinePrecision], -4000.0], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] - N[(y * N[(z * N[(t * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(x * 2.0 + N[(N[(y * t), $MachinePrecision] * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := a \cdot \left(27 \cdot b\right)\\
\mathbf{if}\;y \cdot 9 \leq -4000:\\
\;\;\;\;t_1 + \left(x \cdot 2 - y \cdot \left(z \cdot \left(t \cdot 9\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \mathsf{fma}\left(x, 2, \left(y \cdot t\right) \cdot \left(z \cdot -9\right)\right)\\
\end{array}
\end{array}
if (*.f64 y 9) < -4e3Initial program 89.1%
sub-neg89.1%
distribute-lft-neg-in89.1%
associate-*l*89.2%
*-commutative89.2%
*-commutative89.2%
cancel-sign-sub-inv89.2%
*-commutative89.2%
*-commutative89.2%
associate-*l*89.1%
associate-*l*98.4%
associate-*l*98.3%
Simplified98.3%
Taylor expanded in y around 0 98.4%
*-commutative98.4%
associate-*r*98.4%
*-commutative98.4%
associate-*l*98.4%
Simplified98.4%
if -4e3 < (*.f64 y 9) Initial program 95.6%
+-commutative95.6%
associate-+r-95.6%
cancel-sign-sub-inv95.6%
*-commutative95.6%
distribute-rgt-neg-out95.6%
associate-*r*95.1%
*-commutative95.1%
distribute-rgt-neg-in95.1%
associate-+r+95.1%
sub-neg95.1%
associate-*l*95.1%
fma-def95.1%
fma-neg95.1%
associate-*l*95.6%
*-commutative95.6%
associate-*r*91.1%
distribute-rgt-neg-in91.1%
Simplified91.0%
fma-udef91.0%
associate-*r*95.6%
*-commutative95.6%
Applied egg-rr95.6%
Final simplification96.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 2e-47) (+ (* x 2.0) (- (* a (* 27.0 b)) (* y (* 9.0 (* z t))))) (- (* x 2.0) (fma (* z y) (* t 9.0) (* (* 27.0 b) (- a))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 2e-47) {
tmp = (x * 2.0) + ((a * (27.0 * b)) - (y * (9.0 * (z * t))));
} else {
tmp = (x * 2.0) - fma((z * y), (t * 9.0), ((27.0 * b) * -a));
}
return tmp;
}
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 2e-47) tmp = Float64(Float64(x * 2.0) + Float64(Float64(a * Float64(27.0 * b)) - Float64(y * Float64(9.0 * Float64(z * t))))); else tmp = Float64(Float64(x * 2.0) - fma(Float64(z * y), Float64(t * 9.0), Float64(Float64(27.0 * b) * Float64(-a)))); 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[z, 2e-47], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] - N[(y * N[(9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(z * y), $MachinePrecision] * N[(t * 9.0), $MachinePrecision] + N[(N[(27.0 * b), $MachinePrecision] * (-a)), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2 \cdot 10^{-47}:\\
\;\;\;\;x \cdot 2 + \left(a \cdot \left(27 \cdot b\right) - y \cdot \left(9 \cdot \left(z \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - \mathsf{fma}\left(z \cdot y, t \cdot 9, \left(27 \cdot b\right) \cdot \left(-a\right)\right)\\
\end{array}
\end{array}
if z < 1.9999999999999999e-47Initial program 95.3%
sub-neg95.3%
distribute-lft-neg-in95.3%
associate-*l*95.9%
*-commutative95.9%
*-commutative95.9%
cancel-sign-sub-inv95.9%
*-commutative95.9%
*-commutative95.9%
associate-*l*95.3%
associate-*l*92.7%
associate-*l*92.6%
Simplified92.6%
associate-+l-92.6%
associate-*r*95.3%
associate-*r*95.3%
associate-*r*92.7%
associate-*l*93.2%
associate-*r*93.2%
Applied egg-rr93.2%
if 1.9999999999999999e-47 < z Initial program 90.4%
sub-neg90.4%
distribute-lft-neg-in90.4%
associate-*l*90.5%
*-commutative90.5%
*-commutative90.5%
cancel-sign-sub-inv90.5%
*-commutative90.5%
*-commutative90.5%
associate-*l*90.4%
associate-*l*92.8%
associate-*l*92.8%
Simplified92.8%
associate-+l-92.8%
associate-*r*90.4%
associate-*r*90.4%
associate-*r*92.8%
associate-*l*92.8%
associate-*r*92.8%
Applied egg-rr92.8%
cancel-sign-sub-inv92.8%
*-commutative92.8%
associate-*r*92.8%
associate-*r*90.5%
fma-def90.5%
*-commutative90.5%
Applied egg-rr90.5%
Final simplification92.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 (* 9.0 (* y (* z t))))
(t_2 (* 27.0 (* a b)))
(t_3 (+ (* x 2.0) t_2)))
(if (<= (* x 2.0) -1e+93)
t_3
(if (<= (* x 2.0) 2e-52)
(- t_2 t_1)
(if (<= (* x 2.0) 1e+212) (- (* x 2.0) t_1) t_3)))))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 t_2 = 27.0 * (a * b);
double t_3 = (x * 2.0) + t_2;
double tmp;
if ((x * 2.0) <= -1e+93) {
tmp = t_3;
} else if ((x * 2.0) <= 2e-52) {
tmp = t_2 - t_1;
} else if ((x * 2.0) <= 1e+212) {
tmp = (x * 2.0) - t_1;
} else {
tmp = t_3;
}
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) :: t_3
real(8) :: tmp
t_1 = 9.0d0 * (y * (z * t))
t_2 = 27.0d0 * (a * b)
t_3 = (x * 2.0d0) + t_2
if ((x * 2.0d0) <= (-1d+93)) then
tmp = t_3
else if ((x * 2.0d0) <= 2d-52) then
tmp = t_2 - t_1
else if ((x * 2.0d0) <= 1d+212) then
tmp = (x * 2.0d0) - t_1
else
tmp = t_3
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 t_2 = 27.0 * (a * b);
double t_3 = (x * 2.0) + t_2;
double tmp;
if ((x * 2.0) <= -1e+93) {
tmp = t_3;
} else if ((x * 2.0) <= 2e-52) {
tmp = t_2 - t_1;
} else if ((x * 2.0) <= 1e+212) {
tmp = (x * 2.0) - t_1;
} else {
tmp = t_3;
}
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)) t_2 = 27.0 * (a * b) t_3 = (x * 2.0) + t_2 tmp = 0 if (x * 2.0) <= -1e+93: tmp = t_3 elif (x * 2.0) <= 2e-52: tmp = t_2 - t_1 elif (x * 2.0) <= 1e+212: tmp = (x * 2.0) - t_1 else: tmp = t_3 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))) t_2 = Float64(27.0 * Float64(a * b)) t_3 = Float64(Float64(x * 2.0) + t_2) tmp = 0.0 if (Float64(x * 2.0) <= -1e+93) tmp = t_3; elseif (Float64(x * 2.0) <= 2e-52) tmp = Float64(t_2 - t_1); elseif (Float64(x * 2.0) <= 1e+212) tmp = Float64(Float64(x * 2.0) - t_1); else tmp = t_3; 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));
t_2 = 27.0 * (a * b);
t_3 = (x * 2.0) + t_2;
tmp = 0.0;
if ((x * 2.0) <= -1e+93)
tmp = t_3;
elseif ((x * 2.0) <= 2e-52)
tmp = t_2 - t_1;
elseif ((x * 2.0) <= 1e+212)
tmp = (x * 2.0) - t_1;
else
tmp = t_3;
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]}, Block[{t$95$2 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * 2.0), $MachinePrecision] + t$95$2), $MachinePrecision]}, If[LessEqual[N[(x * 2.0), $MachinePrecision], -1e+93], t$95$3, If[LessEqual[N[(x * 2.0), $MachinePrecision], 2e-52], N[(t$95$2 - t$95$1), $MachinePrecision], If[LessEqual[N[(x * 2.0), $MachinePrecision], 1e+212], N[(N[(x * 2.0), $MachinePrecision] - t$95$1), $MachinePrecision], t$95$3]]]]]]
\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)\\
t_2 := 27 \cdot \left(a \cdot b\right)\\
t_3 := x \cdot 2 + t_2\\
\mathbf{if}\;x \cdot 2 \leq -1 \cdot 10^{+93}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \cdot 2 \leq 2 \cdot 10^{-52}:\\
\;\;\;\;t_2 - t_1\\
\mathbf{elif}\;x \cdot 2 \leq 10^{+212}:\\
\;\;\;\;x \cdot 2 - t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if (*.f64 x 2) < -1.00000000000000004e93 or 9.9999999999999991e211 < (*.f64 x 2) Initial program 95.4%
sub-neg95.4%
distribute-lft-neg-in95.4%
associate-*l*95.4%
*-commutative95.4%
*-commutative95.4%
cancel-sign-sub-inv95.4%
*-commutative95.4%
*-commutative95.4%
associate-*l*95.4%
associate-*l*94.0%
associate-*l*94.0%
Simplified94.0%
Taylor expanded in y around 0 88.3%
if -1.00000000000000004e93 < (*.f64 x 2) < 2e-52Initial 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*92.2%
associate-*l*92.2%
Simplified92.2%
Taylor expanded in x around 0 83.5%
if 2e-52 < (*.f64 x 2) < 9.9999999999999991e211Initial program 92.3%
sub-neg92.3%
distribute-lft-neg-in92.3%
associate-*l*94.2%
*-commutative94.2%
*-commutative94.2%
cancel-sign-sub-inv94.2%
*-commutative94.2%
*-commutative94.2%
associate-*l*92.3%
associate-*l*92.3%
associate-*l*92.3%
Simplified92.3%
Taylor expanded in a around 0 77.8%
Final simplification83.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 2e-5) (+ (* a (* 27.0 b)) (- (* x 2.0) (* y (* z (* t 9.0))))) (+ (* b (* a 27.0)) (- (* x 2.0) (* t (* (* z 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 tmp;
if (z <= 2e-5) {
tmp = (a * (27.0 * b)) + ((x * 2.0) - (y * (z * (t * 9.0))));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * ((z * 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) :: tmp
if (z <= 2d-5) then
tmp = (a * (27.0d0 * b)) + ((x * 2.0d0) - (y * (z * (t * 9.0d0))))
else
tmp = (b * (a * 27.0d0)) + ((x * 2.0d0) - (t * ((z * 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 tmp;
if (z <= 2e-5) {
tmp = (a * (27.0 * b)) + ((x * 2.0) - (y * (z * (t * 9.0))));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * ((z * 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): tmp = 0 if z <= 2e-5: tmp = (a * (27.0 * b)) + ((x * 2.0) - (y * (z * (t * 9.0)))) else: tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * ((z * 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) tmp = 0.0 if (z <= 2e-5) tmp = Float64(Float64(a * Float64(27.0 * b)) + Float64(Float64(x * 2.0) - Float64(y * Float64(z * Float64(t * 9.0))))); else tmp = Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(t * Float64(Float64(z * 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)
tmp = 0.0;
if (z <= 2e-5)
tmp = (a * (27.0 * b)) + ((x * 2.0) - (y * (z * (t * 9.0))));
else
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * ((z * 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_] := If[LessEqual[z, 2e-5], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(y * N[(z * N[(t * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(N[(z * y), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2 \cdot 10^{-5}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + \left(x \cdot 2 - y \cdot \left(z \cdot \left(t \cdot 9\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - t \cdot \left(\left(z \cdot y\right) \cdot 9\right)\right)\\
\end{array}
\end{array}
if z < 2.00000000000000016e-5Initial program 95.7%
sub-neg95.7%
distribute-lft-neg-in95.7%
associate-*l*96.2%
*-commutative96.2%
*-commutative96.2%
cancel-sign-sub-inv96.2%
*-commutative96.2%
*-commutative96.2%
associate-*l*95.7%
associate-*l*93.2%
associate-*l*93.1%
Simplified93.1%
Taylor expanded in y around 0 93.7%
*-commutative93.7%
associate-*r*93.6%
*-commutative93.6%
associate-*l*93.7%
Simplified93.7%
if 2.00000000000000016e-5 < z Initial program 88.7%
Taylor expanded in y around 0 88.7%
Final simplification92.3%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 15200000000000.0) (+ (* a (* 27.0 b)) (- (* x 2.0) (* (* z t) (* y 9.0)))) (+ (* b (* a 27.0)) (- (* x 2.0) (* t (* (* z 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 tmp;
if (z <= 15200000000000.0) {
tmp = (a * (27.0 * b)) + ((x * 2.0) - ((z * t) * (y * 9.0)));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * ((z * 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) :: tmp
if (z <= 15200000000000.0d0) then
tmp = (a * (27.0d0 * b)) + ((x * 2.0d0) - ((z * t) * (y * 9.0d0)))
else
tmp = (b * (a * 27.0d0)) + ((x * 2.0d0) - (t * ((z * 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 tmp;
if (z <= 15200000000000.0) {
tmp = (a * (27.0 * b)) + ((x * 2.0) - ((z * t) * (y * 9.0)));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * ((z * 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): tmp = 0 if z <= 15200000000000.0: tmp = (a * (27.0 * b)) + ((x * 2.0) - ((z * t) * (y * 9.0))) else: tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * ((z * 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) tmp = 0.0 if (z <= 15200000000000.0) tmp = Float64(Float64(a * Float64(27.0 * b)) + Float64(Float64(x * 2.0) - Float64(Float64(z * t) * Float64(y * 9.0)))); else tmp = Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(t * Float64(Float64(z * 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)
tmp = 0.0;
if (z <= 15200000000000.0)
tmp = (a * (27.0 * b)) + ((x * 2.0) - ((z * t) * (y * 9.0)));
else
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * ((z * 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_] := If[LessEqual[z, 15200000000000.0], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(N[(z * t), $MachinePrecision] * N[(y * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(N[(z * y), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 15200000000000:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + \left(x \cdot 2 - \left(z \cdot t\right) \cdot \left(y \cdot 9\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - t \cdot \left(\left(z \cdot y\right) \cdot 9\right)\right)\\
\end{array}
\end{array}
if z < 1.52e13Initial program 95.7%
sub-neg95.7%
distribute-lft-neg-in95.7%
associate-*l*96.2%
*-commutative96.2%
*-commutative96.2%
cancel-sign-sub-inv96.2%
*-commutative96.2%
*-commutative96.2%
associate-*l*95.7%
associate-*l*93.2%
associate-*l*93.2%
Simplified93.2%
if 1.52e13 < z Initial program 88.3%
Taylor expanded in y around 0 88.3%
Final simplification91.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 (<= z 1.4e-5) (+ (* x 2.0) (- (* a (* 27.0 b)) (* y (* 9.0 (* z t))))) (+ (* b (* a 27.0)) (- (* x 2.0) (* t (* (* z 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 tmp;
if (z <= 1.4e-5) {
tmp = (x * 2.0) + ((a * (27.0 * b)) - (y * (9.0 * (z * t))));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * ((z * 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) :: tmp
if (z <= 1.4d-5) then
tmp = (x * 2.0d0) + ((a * (27.0d0 * b)) - (y * (9.0d0 * (z * t))))
else
tmp = (b * (a * 27.0d0)) + ((x * 2.0d0) - (t * ((z * 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 tmp;
if (z <= 1.4e-5) {
tmp = (x * 2.0) + ((a * (27.0 * b)) - (y * (9.0 * (z * t))));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * ((z * 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): tmp = 0 if z <= 1.4e-5: tmp = (x * 2.0) + ((a * (27.0 * b)) - (y * (9.0 * (z * t)))) else: tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * ((z * 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) tmp = 0.0 if (z <= 1.4e-5) tmp = Float64(Float64(x * 2.0) + Float64(Float64(a * Float64(27.0 * b)) - Float64(y * Float64(9.0 * Float64(z * t))))); else tmp = Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(t * Float64(Float64(z * 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)
tmp = 0.0;
if (z <= 1.4e-5)
tmp = (x * 2.0) + ((a * (27.0 * b)) - (y * (9.0 * (z * t))));
else
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * ((z * 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_] := If[LessEqual[z, 1.4e-5], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] - N[(y * N[(9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(N[(z * y), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.4 \cdot 10^{-5}:\\
\;\;\;\;x \cdot 2 + \left(a \cdot \left(27 \cdot b\right) - y \cdot \left(9 \cdot \left(z \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - t \cdot \left(\left(z \cdot y\right) \cdot 9\right)\right)\\
\end{array}
\end{array}
if z < 1.39999999999999998e-5Initial program 95.7%
sub-neg95.7%
distribute-lft-neg-in95.7%
associate-*l*96.2%
*-commutative96.2%
*-commutative96.2%
cancel-sign-sub-inv96.2%
*-commutative96.2%
*-commutative96.2%
associate-*l*95.7%
associate-*l*93.2%
associate-*l*93.1%
Simplified93.1%
associate-+l-93.1%
associate-*r*95.6%
associate-*r*95.7%
associate-*r*93.2%
associate-*l*93.7%
associate-*r*93.6%
Applied egg-rr93.6%
if 1.39999999999999998e-5 < z Initial program 88.7%
Taylor expanded in y around 0 88.7%
Final simplification92.3%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (* 27.0 b))))
(if (<= z 5e-48)
(+ (* x 2.0) (- t_1 (* y (* 9.0 (* z t)))))
(+ (* x 2.0) (- t_1 (* (* z y) (* t 9.0)))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (27.0 * b);
double tmp;
if (z <= 5e-48) {
tmp = (x * 2.0) + (t_1 - (y * (9.0 * (z * t))));
} else {
tmp = (x * 2.0) + (t_1 - ((z * y) * (t * 9.0)));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = a * (27.0d0 * b)
if (z <= 5d-48) then
tmp = (x * 2.0d0) + (t_1 - (y * (9.0d0 * (z * t))))
else
tmp = (x * 2.0d0) + (t_1 - ((z * y) * (t * 9.0d0)))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (27.0 * b);
double tmp;
if (z <= 5e-48) {
tmp = (x * 2.0) + (t_1 - (y * (9.0 * (z * t))));
} else {
tmp = (x * 2.0) + (t_1 - ((z * y) * (t * 9.0)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = a * (27.0 * b) tmp = 0 if z <= 5e-48: tmp = (x * 2.0) + (t_1 - (y * (9.0 * (z * t)))) else: tmp = (x * 2.0) + (t_1 - ((z * y) * (t * 9.0))) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(27.0 * b)) tmp = 0.0 if (z <= 5e-48) tmp = Float64(Float64(x * 2.0) + Float64(t_1 - Float64(y * Float64(9.0 * Float64(z * t))))); else tmp = Float64(Float64(x * 2.0) + Float64(t_1 - Float64(Float64(z * y) * Float64(t * 9.0)))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = a * (27.0 * b);
tmp = 0.0;
if (z <= 5e-48)
tmp = (x * 2.0) + (t_1 - (y * (9.0 * (z * t))));
else
tmp = (x * 2.0) + (t_1 - ((z * y) * (t * 9.0)));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 5e-48], N[(N[(x * 2.0), $MachinePrecision] + N[(t$95$1 - N[(y * N[(9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(t$95$1 - N[(N[(z * y), $MachinePrecision] * N[(t * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := a \cdot \left(27 \cdot b\right)\\
\mathbf{if}\;z \leq 5 \cdot 10^{-48}:\\
\;\;\;\;x \cdot 2 + \left(t_1 - y \cdot \left(9 \cdot \left(z \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + \left(t_1 - \left(z \cdot y\right) \cdot \left(t \cdot 9\right)\right)\\
\end{array}
\end{array}
if z < 4.9999999999999999e-48Initial program 95.3%
sub-neg95.3%
distribute-lft-neg-in95.3%
associate-*l*95.9%
*-commutative95.9%
*-commutative95.9%
cancel-sign-sub-inv95.9%
*-commutative95.9%
*-commutative95.9%
associate-*l*95.3%
associate-*l*92.7%
associate-*l*92.6%
Simplified92.6%
associate-+l-92.6%
associate-*r*95.3%
associate-*r*95.3%
associate-*r*92.7%
associate-*l*93.2%
associate-*r*93.2%
Applied egg-rr93.2%
if 4.9999999999999999e-48 < z Initial program 90.4%
sub-neg90.4%
distribute-lft-neg-in90.4%
associate-*l*90.5%
*-commutative90.5%
*-commutative90.5%
cancel-sign-sub-inv90.5%
*-commutative90.5%
*-commutative90.5%
associate-*l*90.4%
associate-*l*92.8%
associate-*l*92.8%
Simplified92.8%
associate-+l-92.8%
associate-*r*90.4%
associate-*r*90.4%
associate-*r*92.8%
associate-*l*92.8%
associate-*r*92.8%
Applied egg-rr92.8%
cancel-sign-sub-inv92.8%
*-commutative92.8%
associate-*r*92.8%
associate-*r*90.5%
fma-def90.5%
*-commutative90.5%
Applied egg-rr90.5%
fma-udef90.5%
distribute-lft-neg-out90.5%
associate-*l*90.5%
unsub-neg90.5%
associate-*l*90.5%
Applied egg-rr90.5%
Final simplification92.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 (+ (* a (* 27.0 b)) (- (* x 2.0) (* y (* z (* t 9.0))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
return (a * (27.0 * b)) + ((x * 2.0) - (y * (z * (t * 9.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 = (a * (27.0d0 * b)) + ((x * 2.0d0) - (y * (z * (t * 9.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 (a * (27.0 * b)) + ((x * 2.0) - (y * (z * (t * 9.0))));
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): return (a * (27.0 * b)) + ((x * 2.0) - (y * (z * (t * 9.0))))
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) return Float64(Float64(a * Float64(27.0 * b)) + Float64(Float64(x * 2.0) - Float64(y * Float64(z * Float64(t * 9.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 = (a * (27.0 * b)) + ((x * 2.0) - (y * (z * (t * 9.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[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(y * N[(z * N[(t * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
a \cdot \left(27 \cdot b\right) + \left(x \cdot 2 - y \cdot \left(z \cdot \left(t \cdot 9\right)\right)\right)
\end{array}
Initial program 93.8%
sub-neg93.8%
distribute-lft-neg-in93.8%
associate-*l*94.2%
*-commutative94.2%
*-commutative94.2%
cancel-sign-sub-inv94.2%
*-commutative94.2%
*-commutative94.2%
associate-*l*93.8%
associate-*l*92.7%
associate-*l*92.7%
Simplified92.7%
Taylor expanded in y around 0 93.1%
*-commutative93.1%
associate-*r*93.1%
*-commutative93.1%
associate-*l*93.1%
Simplified93.1%
Final simplification93.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
(let* ((t_1 (* -9.0 (* y (* z t)))))
(if (<= a -3.25e+109)
(* a (* 27.0 b))
(if (<= a -9.6e-5)
t_1
(if (<= a -8.2e-108)
(* x 2.0)
(if (<= a 2.15e-238)
t_1
(if (<= a 4.6e-111) (* 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 t_1 = -9.0 * (y * (z * t));
double tmp;
if (a <= -3.25e+109) {
tmp = a * (27.0 * b);
} else if (a <= -9.6e-5) {
tmp = t_1;
} else if (a <= -8.2e-108) {
tmp = x * 2.0;
} else if (a <= 2.15e-238) {
tmp = t_1;
} else if (a <= 4.6e-111) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (-9.0d0) * (y * (z * t))
if (a <= (-3.25d+109)) then
tmp = a * (27.0d0 * b)
else if (a <= (-9.6d-5)) then
tmp = t_1
else if (a <= (-8.2d-108)) then
tmp = x * 2.0d0
else if (a <= 2.15d-238) then
tmp = t_1
else if (a <= 4.6d-111) then
tmp = x * 2.0d0
else
tmp = 27.0d0 * (a * b)
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -9.0 * (y * (z * t));
double tmp;
if (a <= -3.25e+109) {
tmp = a * (27.0 * b);
} else if (a <= -9.6e-5) {
tmp = t_1;
} else if (a <= -8.2e-108) {
tmp = x * 2.0;
} else if (a <= 2.15e-238) {
tmp = t_1;
} else if (a <= 4.6e-111) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = -9.0 * (y * (z * t)) tmp = 0 if a <= -3.25e+109: tmp = a * (27.0 * b) elif a <= -9.6e-5: tmp = t_1 elif a <= -8.2e-108: tmp = x * 2.0 elif a <= 2.15e-238: tmp = t_1 elif a <= 4.6e-111: tmp = x * 2.0 else: tmp = 27.0 * (a * b) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(-9.0 * Float64(y * Float64(z * t))) tmp = 0.0 if (a <= -3.25e+109) tmp = Float64(a * Float64(27.0 * b)); elseif (a <= -9.6e-5) tmp = t_1; elseif (a <= -8.2e-108) tmp = Float64(x * 2.0); elseif (a <= 2.15e-238) tmp = t_1; elseif (a <= 4.6e-111) tmp = Float64(x * 2.0); else tmp = Float64(27.0 * Float64(a * b)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = -9.0 * (y * (z * t));
tmp = 0.0;
if (a <= -3.25e+109)
tmp = a * (27.0 * b);
elseif (a <= -9.6e-5)
tmp = t_1;
elseif (a <= -8.2e-108)
tmp = x * 2.0;
elseif (a <= 2.15e-238)
tmp = t_1;
elseif (a <= 4.6e-111)
tmp = x * 2.0;
else
tmp = 27.0 * (a * b);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -3.25e+109], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, -9.6e-5], t$95$1, If[LessEqual[a, -8.2e-108], N[(x * 2.0), $MachinePrecision], If[LessEqual[a, 2.15e-238], t$95$1, If[LessEqual[a, 4.6e-111], N[(x * 2.0), $MachinePrecision], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := -9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{if}\;a \leq -3.25 \cdot 10^{+109}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;a \leq -9.6 \cdot 10^{-5}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq -8.2 \cdot 10^{-108}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;a \leq 2.15 \cdot 10^{-238}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 4.6 \cdot 10^{-111}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if a < -3.25e109Initial program 90.6%
sub-neg90.6%
distribute-lft-neg-in90.6%
associate-*l*90.6%
*-commutative90.6%
*-commutative90.6%
cancel-sign-sub-inv90.6%
*-commutative90.6%
*-commutative90.6%
associate-*l*90.6%
associate-*l*88.4%
associate-*l*88.4%
Simplified88.4%
Taylor expanded in y around 0 91.1%
Taylor expanded in x around 0 72.3%
*-commutative72.3%
associate-*r*72.4%
Simplified72.4%
if -3.25e109 < a < -9.6000000000000002e-5 or -8.20000000000000074e-108 < a < 2.14999999999999984e-238Initial program 93.1%
sub-neg93.1%
distribute-lft-neg-in93.1%
associate-*l*93.0%
*-commutative93.0%
*-commutative93.0%
cancel-sign-sub-inv93.0%
*-commutative93.0%
*-commutative93.0%
associate-*l*93.1%
associate-*l*94.4%
associate-*l*94.3%
Simplified94.3%
Taylor expanded in y around inf 52.6%
if -9.6000000000000002e-5 < a < -8.20000000000000074e-108 or 2.14999999999999984e-238 < a < 4.6e-111Initial program 97.2%
sub-neg97.2%
distribute-lft-neg-in97.2%
associate-*l*97.2%
*-commutative97.2%
*-commutative97.2%
cancel-sign-sub-inv97.2%
*-commutative97.2%
*-commutative97.2%
associate-*l*97.2%
associate-*l*94.4%
associate-*l*94.3%
Simplified94.3%
Taylor expanded in x around inf 65.6%
if 4.6e-111 < a Initial program 94.5%
sub-neg94.5%
distribute-lft-neg-in94.5%
associate-*l*95.4%
*-commutative95.4%
*-commutative95.4%
cancel-sign-sub-inv95.4%
*-commutative95.4%
*-commutative95.4%
associate-*l*94.5%
associate-*l*92.8%
associate-*l*92.8%
Simplified92.8%
Taylor expanded in a around inf 46.5%
Final simplification55.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 (<= a -3.65e+109) (not (<= a 2.65e-76))) (+ (* x 2.0) (* 27.0 (* a b))) (- (* x 2.0) (* 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 ((a <= -3.65e+109) || !(a <= 2.65e-76)) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) - (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 ((a <= (-3.65d+109)) .or. (.not. (a <= 2.65d-76))) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else
tmp = (x * 2.0d0) - (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 ((a <= -3.65e+109) || !(a <= 2.65e-76)) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) - (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 (a <= -3.65e+109) or not (a <= 2.65e-76): tmp = (x * 2.0) + (27.0 * (a * b)) else: tmp = (x * 2.0) - (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 ((a <= -3.65e+109) || !(a <= 2.65e-76)) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); else tmp = Float64(Float64(x * 2.0) - 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 ((a <= -3.65e+109) || ~((a <= 2.65e-76)))
tmp = (x * 2.0) + (27.0 * (a * b));
else
tmp = (x * 2.0) - (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[Or[LessEqual[a, -3.65e+109], N[Not[LessEqual[a, 2.65e-76]], $MachinePrecision]], 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[(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}\;a \leq -3.65 \cdot 10^{+109} \lor \neg \left(a \leq 2.65 \cdot 10^{-76}\right):\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if a < -3.6499999999999999e109 or 2.65e-76 < a Initial program 93.5%
sub-neg93.5%
distribute-lft-neg-in93.5%
associate-*l*94.3%
*-commutative94.3%
*-commutative94.3%
cancel-sign-sub-inv94.3%
*-commutative94.3%
*-commutative94.3%
associate-*l*93.5%
associate-*l*90.9%
associate-*l*91.0%
Simplified91.0%
Taylor expanded in y around 0 75.0%
if -3.6499999999999999e109 < a < 2.65e-76Initial program 94.1%
sub-neg94.1%
distribute-lft-neg-in94.1%
associate-*l*94.1%
*-commutative94.1%
*-commutative94.1%
cancel-sign-sub-inv94.1%
*-commutative94.1%
*-commutative94.1%
associate-*l*94.1%
associate-*l*94.8%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in a around 0 76.3%
Final simplification75.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 -3.8e+43) (* -9.0 (* y (* z t))) (if (<= z 4.5e+54) (+ (* x 2.0) (* 27.0 (* a b))) (* (* 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 tmp;
if (z <= -3.8e+43) {
tmp = -9.0 * (y * (z * t));
} else if (z <= 4.5e+54) {
tmp = (x * 2.0) + (27.0 * (a * b));
} 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) :: tmp
if (z <= (-3.8d+43)) then
tmp = (-9.0d0) * (y * (z * t))
else if (z <= 4.5d+54) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
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 tmp;
if (z <= -3.8e+43) {
tmp = -9.0 * (y * (z * t));
} else if (z <= 4.5e+54) {
tmp = (x * 2.0) + (27.0 * (a * b));
} 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): tmp = 0 if z <= -3.8e+43: tmp = -9.0 * (y * (z * t)) elif z <= 4.5e+54: tmp = (x * 2.0) + (27.0 * (a * b)) 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) tmp = 0.0 if (z <= -3.8e+43) tmp = Float64(-9.0 * Float64(y * Float64(z * t))); elseif (z <= 4.5e+54) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); 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)
tmp = 0.0;
if (z <= -3.8e+43)
tmp = -9.0 * (y * (z * t));
elseif (z <= 4.5e+54)
tmp = (x * 2.0) + (27.0 * (a * b));
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_] := If[LessEqual[z, -3.8e+43], N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 4.5e+54], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 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}
\mathbf{if}\;z \leq -3.8 \cdot 10^{+43}:\\
\;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;z \leq 4.5 \cdot 10^{+54}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot t\right) \cdot \left(y \cdot -9\right)\\
\end{array}
\end{array}
if z < -3.80000000000000008e43Initial program 88.7%
sub-neg88.7%
distribute-lft-neg-in88.7%
associate-*l*88.7%
*-commutative88.7%
*-commutative88.7%
cancel-sign-sub-inv88.7%
*-commutative88.7%
*-commutative88.7%
associate-*l*88.7%
associate-*l*83.3%
associate-*l*83.2%
Simplified83.2%
Taylor expanded in y around inf 47.7%
if -3.80000000000000008e43 < z < 4.49999999999999984e54Initial program 98.5%
sub-neg98.5%
distribute-lft-neg-in98.5%
associate-*l*99.1%
*-commutative99.1%
*-commutative99.1%
cancel-sign-sub-inv99.1%
*-commutative99.1%
*-commutative99.1%
associate-*l*98.5%
associate-*l*97.2%
associate-*l*97.2%
Simplified97.2%
Taylor expanded in y around 0 81.8%
if 4.49999999999999984e54 < z Initial program 85.8%
sub-neg85.8%
distribute-lft-neg-in85.8%
associate-*l*85.8%
*-commutative85.8%
*-commutative85.8%
cancel-sign-sub-inv85.8%
*-commutative85.8%
*-commutative85.8%
associate-*l*85.8%
associate-*l*89.2%
associate-*l*89.3%
Simplified89.3%
Taylor expanded in y around 0 89.2%
*-commutative89.2%
associate-*r*89.3%
*-commutative89.3%
associate-*l*89.3%
Simplified89.3%
Taylor expanded in y around inf 56.5%
*-commutative56.5%
*-commutative56.5%
*-commutative56.5%
associate-*l*56.5%
*-commutative56.5%
Simplified56.5%
Final simplification69.5%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= a -8.6e-5) (not (<= a 9.2e-119))) (* 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 <= -8.6e-5) || !(a <= 9.2e-119)) {
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 <= (-8.6d-5)) .or. (.not. (a <= 9.2d-119))) 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 <= -8.6e-5) || !(a <= 9.2e-119)) {
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 <= -8.6e-5) or not (a <= 9.2e-119): 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 <= -8.6e-5) || !(a <= 9.2e-119)) 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 <= -8.6e-5) || ~((a <= 9.2e-119)))
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, -8.6e-5], N[Not[LessEqual[a, 9.2e-119]], $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 -8.6 \cdot 10^{-5} \lor \neg \left(a \leq 9.2 \cdot 10^{-119}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if a < -8.6000000000000003e-5 or 9.19999999999999973e-119 < a Initial program 93.9%
sub-neg93.9%
distribute-lft-neg-in93.9%
associate-*l*94.5%
*-commutative94.5%
*-commutative94.5%
cancel-sign-sub-inv94.5%
*-commutative94.5%
*-commutative94.5%
associate-*l*93.9%
associate-*l*91.7%
associate-*l*91.7%
Simplified91.7%
Taylor expanded in a around inf 52.3%
if -8.6000000000000003e-5 < a < 9.19999999999999973e-119Initial 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*94.6%
associate-*l*94.6%
Simplified94.6%
Taylor expanded in x around inf 46.1%
Final simplification50.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 (<= a -0.00033) (* a (* 27.0 b)) (if (<= a 2.35e-116) (* 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 (a <= -0.00033) {
tmp = a * (27.0 * b);
} else if (a <= 2.35e-116) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-0.00033d0)) then
tmp = a * (27.0d0 * b)
else if (a <= 2.35d-116) then
tmp = x * 2.0d0
else
tmp = 27.0d0 * (a * b)
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -0.00033) {
tmp = a * (27.0 * b);
} else if (a <= 2.35e-116) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if a <= -0.00033: tmp = a * (27.0 * b) elif a <= 2.35e-116: tmp = x * 2.0 else: tmp = 27.0 * (a * b) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -0.00033) tmp = Float64(a * Float64(27.0 * b)); elseif (a <= 2.35e-116) tmp = Float64(x * 2.0); else tmp = Float64(27.0 * Float64(a * b)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (a <= -0.00033)
tmp = a * (27.0 * b);
elseif (a <= 2.35e-116)
tmp = x * 2.0;
else
tmp = 27.0 * (a * b);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -0.00033], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.35e-116], N[(x * 2.0), $MachinePrecision], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -0.00033:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;a \leq 2.35 \cdot 10^{-116}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if a < -3.3e-4Initial program 92.9%
sub-neg92.9%
distribute-lft-neg-in92.9%
associate-*l*92.8%
*-commutative92.8%
*-commutative92.8%
cancel-sign-sub-inv92.8%
*-commutative92.8%
*-commutative92.8%
associate-*l*92.9%
associate-*l*89.5%
associate-*l*89.5%
Simplified89.5%
Taylor expanded in y around 0 77.6%
Taylor expanded in x around 0 63.5%
*-commutative63.5%
associate-*r*63.5%
Simplified63.5%
if -3.3e-4 < a < 2.34999999999999997e-116Initial 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*94.6%
associate-*l*94.6%
Simplified94.6%
Taylor expanded in x around inf 46.1%
if 2.34999999999999997e-116 < a Initial program 94.5%
sub-neg94.5%
distribute-lft-neg-in94.5%
associate-*l*95.4%
*-commutative95.4%
*-commutative95.4%
cancel-sign-sub-inv95.4%
*-commutative95.4%
*-commutative95.4%
associate-*l*94.5%
associate-*l*92.8%
associate-*l*92.8%
Simplified92.8%
Taylor expanded in a around inf 46.5%
Final simplification50.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 (* 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 93.8%
sub-neg93.8%
distribute-lft-neg-in93.8%
associate-*l*94.2%
*-commutative94.2%
*-commutative94.2%
cancel-sign-sub-inv94.2%
*-commutative94.2%
*-commutative94.2%
associate-*l*93.8%
associate-*l*92.7%
associate-*l*92.7%
Simplified92.7%
Taylor expanded in x around inf 29.9%
Final simplification29.9%
(FPCore (x y z t a b) :precision binary64 (if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (y < 7.590524218811189d-161) then
tmp = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + (a * (27.0d0 * b))
else
tmp = ((x * 2.0d0) - (9.0d0 * (y * (t * z)))) + ((a * 27.0d0) * b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y < 7.590524218811189e-161: tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)) else: tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y < 7.590524218811189e-161) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(t * z)))) + Float64(Float64(a * 27.0) * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y < 7.590524218811189e-161) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)); else tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Less[y, 7.590524218811189e-161], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y < 7.590524218811189 \cdot 10^{-161}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\
\end{array}
\end{array}
herbie shell --seed 2023268
(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)))