
(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 -18000000000.0) (fma a (* 27.0 b) (fma x 2.0 (* y (* t (* z -9.0))))) (fma a (* 27.0 b) (fma x 2.0 (* t (* -9.0 (* z y)))))))
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 <= -18000000000.0) {
tmp = fma(a, (27.0 * b), fma(x, 2.0, (y * (t * (z * -9.0)))));
} else {
tmp = fma(a, (27.0 * b), fma(x, 2.0, (t * (-9.0 * (z * y)))));
}
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 <= -18000000000.0) tmp = fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(y * Float64(t * Float64(z * -9.0))))); else tmp = fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(t * Float64(-9.0 * Float64(z * y))))); 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, -18000000000.0], 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[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0 + N[(t * N[(-9.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -18000000000:\\
\;\;\;\;\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(a, 27 \cdot b, \mathsf{fma}\left(x, 2, t \cdot \left(-9 \cdot \left(z \cdot y\right)\right)\right)\right)\\
\end{array}
\end{array}
if z < -1.8e10Initial program 88.5%
Simplified90.4%
if -1.8e10 < z Initial program 96.2%
+-commutative96.2%
associate-+r-96.2%
*-commutative96.2%
cancel-sign-sub-inv96.2%
associate-*r*94.8%
distribute-lft-neg-in94.8%
*-commutative94.8%
cancel-sign-sub-inv94.8%
associate-+r-94.8%
associate-*l*94.7%
fma-def94.7%
cancel-sign-sub-inv94.7%
fma-def94.7%
distribute-lft-neg-in94.7%
distribute-rgt-neg-in94.7%
*-commutative94.7%
associate-*r*96.2%
distribute-rgt-neg-out96.2%
*-commutative96.2%
associate-*r*96.3%
Simplified96.3%
Final simplification94.7%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z -20000000000.0) (fma a (* 27.0 b) (- (* x 2.0) (* y (* 9.0 (* z t))))) (fma a (* 27.0 b) (fma x 2.0 (* t (* -9.0 (* z y)))))))
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 <= -20000000000.0) {
tmp = fma(a, (27.0 * b), ((x * 2.0) - (y * (9.0 * (z * t)))));
} else {
tmp = fma(a, (27.0 * b), fma(x, 2.0, (t * (-9.0 * (z * y)))));
}
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 <= -20000000000.0) tmp = fma(a, Float64(27.0 * b), Float64(Float64(x * 2.0) - Float64(y * Float64(9.0 * Float64(z * t))))); else tmp = fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(t * Float64(-9.0 * Float64(z * y))))); 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, -20000000000.0], N[(a * N[(27.0 * b), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(y * N[(9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0 + N[(t * N[(-9.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -20000000000:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 - y \cdot \left(9 \cdot \left(z \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, \mathsf{fma}\left(x, 2, t \cdot \left(-9 \cdot \left(z \cdot y\right)\right)\right)\right)\\
\end{array}
\end{array}
if z < -2e10Initial program 88.5%
+-commutative88.5%
associate-+r-88.5%
*-commutative88.5%
cancel-sign-sub-inv88.5%
associate-*r*95.4%
distribute-lft-neg-in95.4%
*-commutative95.4%
cancel-sign-sub-inv95.4%
associate-+r-95.4%
associate-*l*95.4%
fma-def98.3%
cancel-sign-sub-inv98.3%
fma-def98.3%
distribute-lft-neg-in98.3%
distribute-rgt-neg-in98.3%
*-commutative98.3%
associate-*r*91.4%
distribute-rgt-neg-out91.4%
*-commutative91.4%
associate-*r*91.4%
Simplified91.4%
*-commutative91.4%
associate-*l*91.5%
*-commutative91.5%
associate-*r*91.4%
metadata-eval91.4%
distribute-rgt-neg-in91.4%
distribute-lft-neg-in91.4%
distribute-lft-neg-in91.4%
fma-neg91.4%
associate-*r*90.4%
associate-*l*90.4%
Applied egg-rr90.4%
if -2e10 < z Initial program 96.2%
+-commutative96.2%
associate-+r-96.2%
*-commutative96.2%
cancel-sign-sub-inv96.2%
associate-*r*94.8%
distribute-lft-neg-in94.8%
*-commutative94.8%
cancel-sign-sub-inv94.8%
associate-+r-94.8%
associate-*l*94.7%
fma-def94.7%
cancel-sign-sub-inv94.7%
fma-def94.7%
distribute-lft-neg-in94.7%
distribute-rgt-neg-in94.7%
*-commutative94.7%
associate-*r*96.2%
distribute-rgt-neg-out96.2%
*-commutative96.2%
associate-*r*96.3%
Simplified96.3%
Final simplification94.7%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= (* z (* y 9.0)) 2e+305) (+ (- (* x 2.0) (* t (* (* z y) 9.0))) (* b (* a 27.0))) (fma (* a 27.0) b (* 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 tmp;
if ((z * (y * 9.0)) <= 2e+305) {
tmp = ((x * 2.0) - (t * ((z * y) * 9.0))) + (b * (a * 27.0));
} else {
tmp = fma((a * 27.0), b, (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) tmp = 0.0 if (Float64(z * Float64(y * 9.0)) <= 2e+305) tmp = Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(Float64(z * y) * 9.0))) + Float64(b * Float64(a * 27.0))); else tmp = fma(Float64(a * 27.0), b, Float64(z * Float64(y * Float64(t * -9.0)))); end return tmp end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(z * N[(y * 9.0), $MachinePrecision]), $MachinePrecision], 2e+305], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(N[(z * y), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * 27.0), $MachinePrecision] * b + N[(z * N[(y * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \cdot \left(y \cdot 9\right) \leq 2 \cdot 10^{+305}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(\left(z \cdot y\right) \cdot 9\right)\right) + b \cdot \left(a \cdot 27\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a \cdot 27, b, z \cdot \left(y \cdot \left(t \cdot -9\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y 9) z) < 1.9999999999999999e305Initial program 96.9%
Taylor expanded in y around 0 97.0%
if 1.9999999999999999e305 < (*.f64 (*.f64 y 9) z) Initial program 57.5%
sub-neg57.5%
sub-neg57.5%
associate-*l*88.6%
associate-*l*88.6%
Simplified88.6%
Taylor expanded in x around 0 57.5%
cancel-sign-sub-inv57.5%
associate-*r*57.5%
fma-def68.6%
*-commutative68.6%
metadata-eval68.6%
associate-*r*94.4%
associate-*r*94.5%
*-commutative94.5%
*-commutative94.5%
*-commutative94.5%
associate-*l*94.4%
Applied egg-rr94.4%
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 (<= z -2e-17) (fma a (* 27.0 b) (- (* x 2.0) (* y (* 9.0 (* z t))))) (+ (- (* x 2.0) (* t (* (* z y) 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 <= -2e-17) {
tmp = fma(a, (27.0 * b), ((x * 2.0) - (y * (9.0 * (z * t)))));
} else {
tmp = ((x * 2.0) - (t * ((z * y) * 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 <= -2e-17) tmp = fma(a, Float64(27.0 * b), Float64(Float64(x * 2.0) - Float64(y * Float64(9.0 * Float64(z * t))))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(Float64(z * y) * 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, -2e-17], N[(a * N[(27.0 * b), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(y * N[(9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(N[(z * y), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{-17}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 - y \cdot \left(9 \cdot \left(z \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(\left(z \cdot y\right) \cdot 9\right)\right) + b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if z < -2.00000000000000014e-17Initial program 89.4%
+-commutative89.4%
associate-+r-89.4%
*-commutative89.4%
cancel-sign-sub-inv89.4%
associate-*r*95.8%
distribute-lft-neg-in95.8%
*-commutative95.8%
cancel-sign-sub-inv95.8%
associate-+r-95.8%
associate-*l*95.8%
fma-def98.5%
cancel-sign-sub-inv98.5%
fma-def98.5%
distribute-lft-neg-in98.5%
distribute-rgt-neg-in98.5%
*-commutative98.5%
associate-*r*92.1%
distribute-rgt-neg-out92.1%
*-commutative92.1%
associate-*r*92.1%
Simplified92.1%
*-commutative92.1%
associate-*l*92.2%
*-commutative92.2%
associate-*r*92.1%
metadata-eval92.1%
distribute-rgt-neg-in92.1%
distribute-lft-neg-in92.1%
distribute-lft-neg-in92.1%
fma-neg92.1%
associate-*r*91.2%
associate-*l*91.2%
Applied egg-rr91.2%
if -2.00000000000000014e-17 < z Initial program 96.1%
Taylor expanded in y around 0 96.2%
Final simplification94.7%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* 27.0 (* a b))))
(if (<= y -5.2e+50)
(- t_1 (* (* z t) (* y 9.0)))
(if (or (<= y -390000000000.0)
(and (not (<= y -2.05e-22)) (<= y -4.2e-208)))
(+ (* x 2.0) t_1)
(- t_1 (* 9.0 (* t (* z y))))))))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 (y <= -5.2e+50) {
tmp = t_1 - ((z * t) * (y * 9.0));
} else if ((y <= -390000000000.0) || (!(y <= -2.05e-22) && (y <= -4.2e-208))) {
tmp = (x * 2.0) + t_1;
} else {
tmp = t_1 - (9.0 * (t * (z * y)));
}
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 (y <= (-5.2d+50)) then
tmp = t_1 - ((z * t) * (y * 9.0d0))
else if ((y <= (-390000000000.0d0)) .or. (.not. (y <= (-2.05d-22))) .and. (y <= (-4.2d-208))) then
tmp = (x * 2.0d0) + t_1
else
tmp = t_1 - (9.0d0 * (t * (z * y)))
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 (y <= -5.2e+50) {
tmp = t_1 - ((z * t) * (y * 9.0));
} else if ((y <= -390000000000.0) || (!(y <= -2.05e-22) && (y <= -4.2e-208))) {
tmp = (x * 2.0) + t_1;
} else {
tmp = t_1 - (9.0 * (t * (z * y)));
}
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 y <= -5.2e+50: tmp = t_1 - ((z * t) * (y * 9.0)) elif (y <= -390000000000.0) or (not (y <= -2.05e-22) and (y <= -4.2e-208)): tmp = (x * 2.0) + t_1 else: tmp = t_1 - (9.0 * (t * (z * y))) 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 (y <= -5.2e+50) tmp = Float64(t_1 - Float64(Float64(z * t) * Float64(y * 9.0))); elseif ((y <= -390000000000.0) || (!(y <= -2.05e-22) && (y <= -4.2e-208))) tmp = Float64(Float64(x * 2.0) + t_1); else tmp = Float64(t_1 - Float64(9.0 * Float64(t * Float64(z * y)))); 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 (y <= -5.2e+50)
tmp = t_1 - ((z * t) * (y * 9.0));
elseif ((y <= -390000000000.0) || (~((y <= -2.05e-22)) && (y <= -4.2e-208)))
tmp = (x * 2.0) + t_1;
else
tmp = t_1 - (9.0 * (t * (z * y)));
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[y, -5.2e+50], N[(t$95$1 - N[(N[(z * t), $MachinePrecision] * N[(y * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[y, -390000000000.0], And[N[Not[LessEqual[y, -2.05e-22]], $MachinePrecision], LessEqual[y, -4.2e-208]]], N[(N[(x * 2.0), $MachinePrecision] + t$95$1), $MachinePrecision], N[(t$95$1 - N[(9.0 * N[(t * N[(z * y), $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 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;y \leq -5.2 \cdot 10^{+50}:\\
\;\;\;\;t_1 - \left(z \cdot t\right) \cdot \left(y \cdot 9\right)\\
\mathbf{elif}\;y \leq -390000000000 \lor \neg \left(y \leq -2.05 \cdot 10^{-22}\right) \land y \leq -4.2 \cdot 10^{-208}:\\
\;\;\;\;x \cdot 2 + t_1\\
\mathbf{else}:\\
\;\;\;\;t_1 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if y < -5.2000000000000004e50Initial program 84.3%
sub-neg84.3%
sub-neg84.3%
associate-*l*94.5%
associate-*l*94.5%
Simplified94.5%
Taylor expanded in x around 0 77.5%
expm1-log1p-u49.7%
expm1-udef46.3%
associate-*r*46.3%
*-commutative46.3%
associate-*r*50.9%
associate-*r*50.9%
*-commutative50.9%
*-commutative50.9%
*-commutative50.9%
associate-*l*50.9%
*-commutative50.9%
Applied egg-rr50.9%
expm1-def52.6%
expm1-log1p86.0%
*-commutative86.0%
associate-*r*86.0%
associate-*l*85.8%
*-commutative85.8%
associate-*l*85.9%
*-commutative85.9%
*-commutative85.9%
Simplified85.9%
if -5.2000000000000004e50 < y < -3.9e11 or -2.05e-22 < y < -4.20000000000000024e-208Initial program 99.7%
sub-neg99.7%
sub-neg99.7%
associate-*l*94.2%
associate-*l*94.0%
Simplified94.0%
Taylor expanded in y around 0 77.6%
if -3.9e11 < y < -2.05e-22 or -4.20000000000000024e-208 < y Initial program 96.0%
sub-neg96.0%
sub-neg96.0%
associate-*l*94.2%
associate-*l*94.1%
Simplified94.1%
Taylor expanded in x around 0 74.8%
Final simplification77.8%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (+ (* z (* y (* t -9.0))) (* a (* 27.0 b)))))
(if (<= z -2.05e-41)
t_1
(if (<= z 1.35e-202)
(+ (* x 2.0) (* 27.0 (* a b)))
(if (<= z 6.1e-58) (- (* x 2.0) (* 9.0 (* t (* z y)))) t_1)))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z * (y * (t * -9.0))) + (a * (27.0 * b));
double tmp;
if (z <= -2.05e-41) {
tmp = t_1;
} else if (z <= 1.35e-202) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else if (z <= 6.1e-58) {
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
} else {
tmp = t_1;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (z * (y * (t * (-9.0d0)))) + (a * (27.0d0 * b))
if (z <= (-2.05d-41)) then
tmp = t_1
else if (z <= 1.35d-202) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else if (z <= 6.1d-58) then
tmp = (x * 2.0d0) - (9.0d0 * (t * (z * y)))
else
tmp = t_1
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z * (y * (t * -9.0))) + (a * (27.0 * b));
double tmp;
if (z <= -2.05e-41) {
tmp = t_1;
} else if (z <= 1.35e-202) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else if (z <= 6.1e-58) {
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
} else {
tmp = t_1;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = (z * (y * (t * -9.0))) + (a * (27.0 * b)) tmp = 0 if z <= -2.05e-41: tmp = t_1 elif z <= 1.35e-202: tmp = (x * 2.0) + (27.0 * (a * b)) elif z <= 6.1e-58: tmp = (x * 2.0) - (9.0 * (t * (z * y))) else: tmp = t_1 return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(z * Float64(y * Float64(t * -9.0))) + Float64(a * Float64(27.0 * b))) tmp = 0.0 if (z <= -2.05e-41) tmp = t_1; elseif (z <= 1.35e-202) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); elseif (z <= 6.1e-58) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(z * y)))); else tmp = t_1; end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = (z * (y * (t * -9.0))) + (a * (27.0 * b));
tmp = 0.0;
if (z <= -2.05e-41)
tmp = t_1;
elseif (z <= 1.35e-202)
tmp = (x * 2.0) + (27.0 * (a * b));
elseif (z <= 6.1e-58)
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
else
tmp = t_1;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z * N[(y * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2.05e-41], t$95$1, If[LessEqual[z, 1.35e-202], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.1e-58], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{if}\;z \leq -2.05 \cdot 10^{-41}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.35 \cdot 10^{-202}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;z \leq 6.1 \cdot 10^{-58}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if z < -2.05000000000000007e-41 or 6.1000000000000003e-58 < z Initial program 91.2%
sub-neg91.2%
sub-neg91.2%
associate-*l*91.9%
associate-*l*91.9%
Simplified91.9%
Taylor expanded in x around 0 73.5%
sub-neg73.5%
+-commutative73.5%
distribute-lft-neg-in73.5%
metadata-eval73.5%
associate-*r*78.6%
associate-*r*78.6%
*-commutative78.6%
*-commutative78.6%
*-commutative78.6%
associate-*l*78.1%
associate-*r*78.0%
*-commutative78.0%
associate-*r*78.0%
Applied egg-rr78.0%
if -2.05000000000000007e-41 < z < 1.3499999999999999e-202Initial program 99.7%
sub-neg99.7%
sub-neg99.7%
associate-*l*98.4%
associate-*l*98.3%
Simplified98.3%
Taylor expanded in y around 0 86.7%
if 1.3499999999999999e-202 < z < 6.1000000000000003e-58Initial program 99.7%
sub-neg99.7%
sub-neg99.7%
associate-*l*99.7%
associate-*l*99.4%
Simplified99.4%
Taylor expanded in a around 0 51.8%
Final simplification78.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
(let* ((t_1 (* a (* 27.0 b))))
(if (<= z 4.3e+86)
(+ t_1 (- (* x 2.0) (* 9.0 (* y (* z t)))))
(+ (* z (* y (* t -9.0))) t_1))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (27.0 * b);
double tmp;
if (z <= 4.3e+86) {
tmp = t_1 + ((x * 2.0) - (9.0 * (y * (z * t))));
} else {
tmp = (z * (y * (t * -9.0))) + t_1;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = a * (27.0d0 * b)
if (z <= 4.3d+86) then
tmp = t_1 + ((x * 2.0d0) - (9.0d0 * (y * (z * t))))
else
tmp = (z * (y * (t * (-9.0d0)))) + t_1
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (27.0 * b);
double tmp;
if (z <= 4.3e+86) {
tmp = t_1 + ((x * 2.0) - (9.0 * (y * (z * t))));
} else {
tmp = (z * (y * (t * -9.0))) + t_1;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = a * (27.0 * b) tmp = 0 if z <= 4.3e+86: tmp = t_1 + ((x * 2.0) - (9.0 * (y * (z * t)))) else: tmp = (z * (y * (t * -9.0))) + t_1 return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(27.0 * b)) tmp = 0.0 if (z <= 4.3e+86) tmp = Float64(t_1 + Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t))))); else tmp = Float64(Float64(z * Float64(y * Float64(t * -9.0))) + t_1); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = a * (27.0 * b);
tmp = 0.0;
if (z <= 4.3e+86)
tmp = t_1 + ((x * 2.0) - (9.0 * (y * (z * t))));
else
tmp = (z * (y * (t * -9.0))) + t_1;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, 4.3e+86], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * N[(y * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := a \cdot \left(27 \cdot b\right)\\
\mathbf{if}\;z \leq 4.3 \cdot 10^{+86}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + t_1\\
\end{array}
\end{array}
if z < 4.3000000000000002e86Initial program 95.6%
sub-neg95.6%
sub-neg95.6%
associate-*l*94.8%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in y around 0 95.6%
*-commutative95.6%
associate-*l*94.8%
*-commutative94.8%
Simplified94.8%
if 4.3000000000000002e86 < z Initial program 87.4%
sub-neg87.4%
sub-neg87.4%
associate-*l*91.5%
associate-*l*91.5%
Simplified91.5%
Taylor expanded in x around 0 70.2%
sub-neg70.2%
+-commutative70.2%
distribute-lft-neg-in70.2%
metadata-eval70.2%
associate-*r*82.5%
associate-*r*82.5%
*-commutative82.5%
*-commutative82.5%
*-commutative82.5%
associate-*l*82.5%
associate-*r*82.5%
*-commutative82.5%
associate-*r*82.5%
Applied egg-rr82.5%
Final simplification92.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 -1000000.0) (+ (* a (* 27.0 b)) (- (* x 2.0) (* 9.0 (* y (* z t))))) (+ (- (* x 2.0) (* t (* (* z y) 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 <= -1000000.0) {
tmp = (a * (27.0 * b)) + ((x * 2.0) - (9.0 * (y * (z * t))));
} else {
tmp = ((x * 2.0) - (t * ((z * y) * 9.0))) + (b * (a * 27.0));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-1000000.0d0)) then
tmp = (a * (27.0d0 * b)) + ((x * 2.0d0) - (9.0d0 * (y * (z * t))))
else
tmp = ((x * 2.0d0) - (t * ((z * y) * 9.0d0))) + (b * (a * 27.0d0))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1000000.0) {
tmp = (a * (27.0 * b)) + ((x * 2.0) - (9.0 * (y * (z * t))));
} else {
tmp = ((x * 2.0) - (t * ((z * y) * 9.0))) + (b * (a * 27.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -1000000.0: tmp = (a * (27.0 * b)) + ((x * 2.0) - (9.0 * (y * (z * t)))) else: tmp = ((x * 2.0) - (t * ((z * y) * 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 <= -1000000.0) tmp = Float64(Float64(a * Float64(27.0 * b)) + Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t))))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(Float64(z * y) * 9.0))) + Float64(b * Float64(a * 27.0))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -1000000.0)
tmp = (a * (27.0 * b)) + ((x * 2.0) - (9.0 * (y * (z * t))));
else
tmp = ((x * 2.0) - (t * ((z * y) * 9.0))) + (b * (a * 27.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1000000.0], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(N[(z * y), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1000000:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + \left(x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(\left(z \cdot y\right) \cdot 9\right)\right) + b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if z < -1e6Initial program 88.7%
sub-neg88.7%
sub-neg88.7%
associate-*l*87.7%
associate-*l*87.7%
Simplified87.7%
Taylor expanded in y around 0 88.7%
*-commutative88.7%
associate-*l*87.6%
*-commutative87.6%
Simplified87.6%
if -1e6 < z Initial program 96.2%
Taylor expanded in y around 0 96.3%
Final simplification93.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 -5000000000.0) (- (+ (* x 2.0) (* a (* 27.0 b))) (* y (* 9.0 (* z t)))) (+ (- (* x 2.0) (* t (* (* z y) 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 <= -5000000000.0) {
tmp = ((x * 2.0) + (a * (27.0 * b))) - (y * (9.0 * (z * t)));
} else {
tmp = ((x * 2.0) - (t * ((z * y) * 9.0))) + (b * (a * 27.0));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-5000000000.0d0)) then
tmp = ((x * 2.0d0) + (a * (27.0d0 * b))) - (y * (9.0d0 * (z * t)))
else
tmp = ((x * 2.0d0) - (t * ((z * y) * 9.0d0))) + (b * (a * 27.0d0))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -5000000000.0) {
tmp = ((x * 2.0) + (a * (27.0 * b))) - (y * (9.0 * (z * t)));
} else {
tmp = ((x * 2.0) - (t * ((z * y) * 9.0))) + (b * (a * 27.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -5000000000.0: tmp = ((x * 2.0) + (a * (27.0 * b))) - (y * (9.0 * (z * t))) else: tmp = ((x * 2.0) - (t * ((z * y) * 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 <= -5000000000.0) tmp = Float64(Float64(Float64(x * 2.0) + Float64(a * Float64(27.0 * b))) - Float64(y * Float64(9.0 * Float64(z * t)))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(Float64(z * y) * 9.0))) + Float64(b * Float64(a * 27.0))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -5000000000.0)
tmp = ((x * 2.0) + (a * (27.0 * b))) - (y * (9.0 * (z * t)));
else
tmp = ((x * 2.0) - (t * ((z * y) * 9.0))) + (b * (a * 27.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -5000000000.0], N[(N[(N[(x * 2.0), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(y * N[(9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(N[(z * y), $MachinePrecision] * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -5000000000:\\
\;\;\;\;\left(x \cdot 2 + a \cdot \left(27 \cdot b\right)\right) - y \cdot \left(9 \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(\left(z \cdot y\right) \cdot 9\right)\right) + b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if z < -5e9Initial program 88.5%
sub-neg88.5%
sub-neg88.5%
associate-*l*87.5%
associate-*l*87.5%
Simplified87.5%
+-commutative87.5%
associate-+r-87.5%
associate-*l*87.5%
Applied egg-rr87.5%
if -5e9 < z Initial program 96.2%
Taylor expanded in y around 0 96.3%
Final simplification93.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
(let* ((t_1 (* 27.0 (* a b))))
(if (<= z -3.8e-31)
(+ (* z (* y (* t -9.0))) (* a (* 27.0 b)))
(if (<= z 5e-184) (+ (* x 2.0) t_1) (- t_1 (* 9.0 (* t (* z y))))))))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 <= -3.8e-31) {
tmp = (z * (y * (t * -9.0))) + (a * (27.0 * b));
} else if (z <= 5e-184) {
tmp = (x * 2.0) + t_1;
} else {
tmp = t_1 - (9.0 * (t * (z * y)));
}
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 <= (-3.8d-31)) then
tmp = (z * (y * (t * (-9.0d0)))) + (a * (27.0d0 * b))
else if (z <= 5d-184) then
tmp = (x * 2.0d0) + t_1
else
tmp = t_1 - (9.0d0 * (t * (z * y)))
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 <= -3.8e-31) {
tmp = (z * (y * (t * -9.0))) + (a * (27.0 * b));
} else if (z <= 5e-184) {
tmp = (x * 2.0) + t_1;
} else {
tmp = t_1 - (9.0 * (t * (z * y)));
}
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 <= -3.8e-31: tmp = (z * (y * (t * -9.0))) + (a * (27.0 * b)) elif z <= 5e-184: tmp = (x * 2.0) + t_1 else: tmp = t_1 - (9.0 * (t * (z * y))) 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 <= -3.8e-31) tmp = Float64(Float64(z * Float64(y * Float64(t * -9.0))) + Float64(a * Float64(27.0 * b))); elseif (z <= 5e-184) tmp = Float64(Float64(x * 2.0) + t_1); else tmp = Float64(t_1 - Float64(9.0 * Float64(t * Float64(z * y)))); 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 <= -3.8e-31)
tmp = (z * (y * (t * -9.0))) + (a * (27.0 * b));
elseif (z <= 5e-184)
tmp = (x * 2.0) + t_1;
else
tmp = t_1 - (9.0 * (t * (z * y)));
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, -3.8e-31], N[(N[(z * N[(y * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5e-184], N[(N[(x * 2.0), $MachinePrecision] + t$95$1), $MachinePrecision], N[(t$95$1 - N[(9.0 * N[(t * N[(z * y), $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 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;z \leq -3.8 \cdot 10^{-31}:\\
\;\;\;\;z \cdot \left(y \cdot \left(t \cdot -9\right)\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-184}:\\
\;\;\;\;x \cdot 2 + t_1\\
\mathbf{else}:\\
\;\;\;\;t_1 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if z < -3.8e-31Initial program 89.6%
sub-neg89.6%
sub-neg89.6%
associate-*l*88.8%
associate-*l*88.8%
Simplified88.8%
Taylor expanded in x around 0 76.1%
sub-neg76.1%
+-commutative76.1%
distribute-lft-neg-in76.1%
metadata-eval76.1%
associate-*r*80.0%
associate-*r*80.1%
*-commutative80.1%
*-commutative80.1%
*-commutative80.1%
associate-*l*78.9%
associate-*r*78.9%
*-commutative78.9%
associate-*r*78.9%
Applied egg-rr78.9%
if -3.8e-31 < z < 5.00000000000000003e-184Initial program 99.8%
sub-neg99.8%
sub-neg99.8%
associate-*l*98.5%
associate-*l*98.4%
Simplified98.4%
Taylor expanded in y around 0 87.4%
if 5.00000000000000003e-184 < z Initial program 93.3%
sub-neg93.3%
sub-neg93.3%
associate-*l*95.1%
associate-*l*95.1%
Simplified95.1%
Taylor expanded in x around 0 74.5%
Final simplification79.7%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= a -8.6e+147) (not (<= a 3e-83))) (+ (* x 2.0) (* 27.0 (* a b))) (- (* x 2.0) (* 9.0 (* t (* z y))))))
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+147) || !(a <= 3e-83)) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
}
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+147)) .or. (.not. (a <= 3d-83))) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else
tmp = (x * 2.0d0) - (9.0d0 * (t * (z * y)))
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+147) || !(a <= 3e-83)) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
}
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+147) or not (a <= 3e-83): tmp = (x * 2.0) + (27.0 * (a * b)) else: tmp = (x * 2.0) - (9.0 * (t * (z * y))) 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+147) || !(a <= 3e-83)) 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(z * y)))); 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+147) || ~((a <= 3e-83)))
tmp = (x * 2.0) + (27.0 * (a * b));
else
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
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+147], N[Not[LessEqual[a, 3e-83]], $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[(t * N[(z * y), $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 -8.6 \cdot 10^{+147} \lor \neg \left(a \leq 3 \cdot 10^{-83}\right):\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if a < -8.5999999999999997e147 or 3.0000000000000001e-83 < a Initial program 94.9%
sub-neg94.9%
sub-neg94.9%
associate-*l*95.7%
associate-*l*95.7%
Simplified95.7%
Taylor expanded in y around 0 69.7%
if -8.5999999999999997e147 < a < 3.0000000000000001e-83Initial program 93.6%
sub-neg93.6%
sub-neg93.6%
associate-*l*93.0%
associate-*l*92.9%
Simplified92.9%
Taylor expanded in a around 0 76.7%
Final simplification73.5%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= z -1.32e+73)
(* z (* t (* y -9.0)))
(if (<= z 57000000.0)
(+ (* x 2.0) (* 27.0 (* a b)))
(* -9.0 (* z (* y 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 (z <= -1.32e+73) {
tmp = z * (t * (y * -9.0));
} else if (z <= 57000000.0) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = -9.0 * (z * (y * 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 (z <= (-1.32d+73)) then
tmp = z * (t * (y * (-9.0d0)))
else if (z <= 57000000.0d0) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else
tmp = (-9.0d0) * (z * (y * 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 (z <= -1.32e+73) {
tmp = z * (t * (y * -9.0));
} else if (z <= 57000000.0) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = -9.0 * (z * (y * 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 z <= -1.32e+73: tmp = z * (t * (y * -9.0)) elif z <= 57000000.0: tmp = (x * 2.0) + (27.0 * (a * b)) else: tmp = -9.0 * (z * (y * 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 (z <= -1.32e+73) tmp = Float64(z * Float64(t * Float64(y * -9.0))); elseif (z <= 57000000.0) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); else tmp = Float64(-9.0 * Float64(z * Float64(y * 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 (z <= -1.32e+73)
tmp = z * (t * (y * -9.0));
elseif (z <= 57000000.0)
tmp = (x * 2.0) + (27.0 * (a * b));
else
tmp = -9.0 * (z * (y * t));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.32e+73], N[(z * N[(t * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 57000000.0], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-9.0 * N[(z * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.32 \cdot 10^{+73}:\\
\;\;\;\;z \cdot \left(t \cdot \left(y \cdot -9\right)\right)\\
\mathbf{elif}\;z \leq 57000000:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(z \cdot \left(y \cdot t\right)\right)\\
\end{array}
\end{array}
if z < -1.32e73Initial program 85.7%
+-commutative85.7%
associate-+r-85.7%
*-commutative85.7%
cancel-sign-sub-inv85.7%
associate-*r*94.4%
distribute-lft-neg-in94.4%
*-commutative94.4%
cancel-sign-sub-inv94.4%
associate-+r-94.4%
associate-*l*94.4%
fma-def98.0%
cancel-sign-sub-inv98.0%
fma-def98.0%
distribute-lft-neg-in98.0%
distribute-rgt-neg-in98.0%
*-commutative98.0%
associate-*r*89.3%
distribute-rgt-neg-out89.3%
*-commutative89.3%
associate-*r*89.4%
Simplified89.4%
*-commutative89.4%
associate-*l*89.5%
*-commutative89.5%
associate-*r*89.3%
metadata-eval89.3%
distribute-rgt-neg-in89.3%
distribute-lft-neg-in89.3%
distribute-lft-neg-in89.3%
fma-neg89.3%
associate-*r*88.1%
associate-*l*88.1%
Applied egg-rr88.1%
Taylor expanded in y around inf 67.6%
associate-*r*72.5%
associate-*r*72.5%
metadata-eval72.5%
distribute-lft-neg-in72.5%
associate-*l*70.9%
*-commutative70.9%
associate-*l*72.5%
distribute-lft-neg-in72.5%
metadata-eval72.5%
Simplified72.5%
expm1-log1p-u34.8%
expm1-udef22.6%
*-commutative22.6%
*-commutative22.6%
associate-*l*22.6%
Applied egg-rr22.6%
expm1-def34.8%
expm1-log1p70.9%
*-commutative70.9%
associate-*l*72.5%
Simplified72.5%
if -1.32e73 < z < 5.7e7Initial program 99.7%
sub-neg99.7%
sub-neg99.7%
associate-*l*99.0%
associate-*l*98.9%
Simplified98.9%
Taylor expanded in y around 0 75.6%
if 5.7e7 < z Initial program 89.9%
sub-neg89.9%
sub-neg89.9%
associate-*l*92.7%
associate-*l*92.6%
Simplified92.6%
Taylor expanded in y around inf 53.2%
expm1-log1p-u31.1%
expm1-udef29.5%
*-commutative29.5%
associate-*l*28.2%
Applied egg-rr28.2%
expm1-def29.8%
expm1-log1p57.5%
*-commutative57.5%
associate-*l*60.4%
Simplified60.4%
Final simplification71.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 (<= a -8.6e+147) (* b (* a 27.0)) (if (<= a 2.9e-81) (* -9.0 (* t (* z y))) (* 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 (a <= -8.6e+147) {
tmp = b * (a * 27.0);
} else if (a <= 2.9e-81) {
tmp = -9.0 * (t * (z * y));
} else {
tmp = a * (27.0 * b);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-8.6d+147)) then
tmp = b * (a * 27.0d0)
else if (a <= 2.9d-81) then
tmp = (-9.0d0) * (t * (z * y))
else
tmp = a * (27.0d0 * b)
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -8.6e+147) {
tmp = b * (a * 27.0);
} else if (a <= 2.9e-81) {
tmp = -9.0 * (t * (z * y));
} else {
tmp = a * (27.0 * b);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if a <= -8.6e+147: tmp = b * (a * 27.0) elif a <= 2.9e-81: tmp = -9.0 * (t * (z * y)) else: tmp = a * (27.0 * b) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -8.6e+147) tmp = Float64(b * Float64(a * 27.0)); elseif (a <= 2.9e-81) tmp = Float64(-9.0 * Float64(t * Float64(z * y))); else tmp = Float64(a * Float64(27.0 * b)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (a <= -8.6e+147)
tmp = b * (a * 27.0);
elseif (a <= 2.9e-81)
tmp = -9.0 * (t * (z * y));
else
tmp = a * (27.0 * b);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -8.6e+147], N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.9e-81], N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -8.6 \cdot 10^{+147}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right)\\
\mathbf{elif}\;a \leq 2.9 \cdot 10^{-81}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\end{array}
\end{array}
if a < -8.5999999999999997e147Initial program 96.7%
+-commutative96.7%
associate-+r-96.7%
*-commutative96.7%
cancel-sign-sub-inv96.7%
associate-*r*93.6%
distribute-lft-neg-in93.6%
*-commutative93.6%
cancel-sign-sub-inv93.6%
associate-+r-93.6%
associate-*l*93.5%
fma-def96.7%
cancel-sign-sub-inv96.7%
fma-def96.7%
distribute-lft-neg-in96.7%
distribute-rgt-neg-in96.7%
*-commutative96.7%
associate-*r*99.8%
distribute-rgt-neg-out99.8%
*-commutative99.8%
associate-*r*99.7%
Simplified99.7%
*-commutative99.7%
associate-*l*99.8%
*-commutative99.8%
associate-*r*99.8%
metadata-eval99.8%
distribute-rgt-neg-in99.8%
distribute-lft-neg-in99.8%
distribute-lft-neg-in99.8%
fma-neg99.8%
associate-*r*99.8%
associate-*l*99.8%
Applied egg-rr99.8%
Taylor expanded in a around inf 62.2%
*-commutative62.2%
*-commutative62.2%
associate-*l*62.2%
*-commutative62.2%
Simplified62.2%
if -8.5999999999999997e147 < a < 2.89999999999999989e-81Initial program 93.6%
sub-neg93.6%
sub-neg93.6%
associate-*l*93.0%
associate-*l*92.9%
Simplified92.9%
Taylor expanded in y around inf 52.2%
if 2.89999999999999989e-81 < a Initial program 94.2%
sub-neg94.2%
sub-neg94.2%
associate-*l*95.4%
associate-*l*95.4%
Simplified95.4%
Taylor expanded in a around inf 46.0%
associate-*r*46.0%
*-commutative46.0%
associate-*r*46.0%
Simplified46.0%
Final simplification51.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 (or (<= b -5e-157) (not (<= b 4.5e+60))) (* 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 <= -5e-157) || !(b <= 4.5e+60)) {
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 <= (-5d-157)) .or. (.not. (b <= 4.5d+60))) 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 <= -5e-157) || !(b <= 4.5e+60)) {
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 <= -5e-157) or not (b <= 4.5e+60): 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 <= -5e-157) || !(b <= 4.5e+60)) 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 <= -5e-157) || ~((b <= 4.5e+60)))
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, -5e-157], N[Not[LessEqual[b, 4.5e+60]], $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 -5 \cdot 10^{-157} \lor \neg \left(b \leq 4.5 \cdot 10^{+60}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if b < -5.0000000000000002e-157 or 4.50000000000000013e60 < b Initial program 93.6%
sub-neg93.6%
sub-neg93.6%
associate-*l*93.7%
associate-*l*93.6%
Simplified93.6%
Taylor expanded in a around inf 45.1%
if -5.0000000000000002e-157 < b < 4.50000000000000013e60Initial program 95.1%
sub-neg95.1%
sub-neg95.1%
associate-*l*95.1%
associate-*l*95.1%
Simplified95.1%
Taylor expanded in x around inf 32.6%
Final simplification40.2%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= b -1.55e-176) (* b (* a 27.0)) (if (<= b 1.3e+63) (* 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 (b <= -1.55e-176) {
tmp = b * (a * 27.0);
} else if (b <= 1.3e+63) {
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 (b <= (-1.55d-176)) then
tmp = b * (a * 27.0d0)
else if (b <= 1.3d+63) 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 (b <= -1.55e-176) {
tmp = b * (a * 27.0);
} else if (b <= 1.3e+63) {
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 b <= -1.55e-176: tmp = b * (a * 27.0) elif b <= 1.3e+63: 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 (b <= -1.55e-176) tmp = Float64(b * Float64(a * 27.0)); elseif (b <= 1.3e+63) 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 (b <= -1.55e-176)
tmp = b * (a * 27.0);
elseif (b <= 1.3e+63)
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[b, -1.55e-176], N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.3e+63], 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}\;b \leq -1.55 \cdot 10^{-176}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right)\\
\mathbf{elif}\;b \leq 1.3 \cdot 10^{+63}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if b < -1.54999999999999996e-176Initial program 96.6%
+-commutative96.6%
associate-+r-96.6%
*-commutative96.6%
cancel-sign-sub-inv96.6%
associate-*r*96.7%
distribute-lft-neg-in96.7%
*-commutative96.7%
cancel-sign-sub-inv96.7%
associate-+r-96.7%
associate-*l*96.7%
fma-def96.7%
cancel-sign-sub-inv96.7%
fma-def96.7%
distribute-lft-neg-in96.7%
distribute-rgt-neg-in96.7%
*-commutative96.7%
associate-*r*96.6%
distribute-rgt-neg-out96.6%
*-commutative96.6%
associate-*r*96.7%
Simplified96.7%
*-commutative96.7%
associate-*l*95.7%
*-commutative95.7%
associate-*r*96.6%
metadata-eval96.6%
distribute-rgt-neg-in96.6%
distribute-lft-neg-in96.6%
distribute-lft-neg-in96.6%
fma-neg96.6%
associate-*r*95.8%
associate-*l*95.8%
Applied egg-rr95.8%
Taylor expanded in a around inf 40.5%
*-commutative40.5%
*-commutative40.5%
associate-*l*40.4%
*-commutative40.4%
Simplified40.4%
if -1.54999999999999996e-176 < b < 1.3000000000000001e63Initial program 94.9%
sub-neg94.9%
sub-neg94.9%
associate-*l*95.9%
associate-*l*95.8%
Simplified95.8%
Taylor expanded in x around inf 31.7%
if 1.3000000000000001e63 < b Initial program 89.6%
sub-neg89.6%
sub-neg89.6%
associate-*l*89.7%
associate-*l*89.6%
Simplified89.6%
Taylor expanded in a around inf 49.1%
Final simplification39.4%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (* x 2.0))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * 2.0d0
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): return x * 2.0
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) return Float64(x * 2.0) end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = x * 2.0;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(x * 2.0), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
x \cdot 2
\end{array}
Initial program 94.2%
sub-neg94.2%
sub-neg94.2%
associate-*l*94.2%
associate-*l*94.2%
Simplified94.2%
Taylor expanded in x around inf 24.5%
Final simplification24.5%
(FPCore (x y z t a b) :precision binary64 (if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (y < 7.590524218811189d-161) then
tmp = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + (a * (27.0d0 * b))
else
tmp = ((x * 2.0d0) - (9.0d0 * (y * (t * z)))) + ((a * 27.0d0) * b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y < 7.590524218811189e-161: tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)) else: tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y < 7.590524218811189e-161) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(t * z)))) + Float64(Float64(a * 27.0) * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y < 7.590524218811189e-161) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)); else tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Less[y, 7.590524218811189e-161], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y < 7.590524218811189 \cdot 10^{-161}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\
\end{array}
\end{array}
herbie shell --seed 2023309
(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)))