
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\end{array}
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 4.8e-48) (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 <= 4.8e-48) {
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 <= 4.8e-48) 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, 4.8e-48], 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 4.8 \cdot 10^{-48}:\\
\;\;\;\;\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.8e-48Initial program 97.7%
+-commutative97.7%
associate-+r-97.7%
cancel-sign-sub-inv97.7%
*-commutative97.7%
distribute-rgt-neg-out97.7%
associate-*r*92.0%
*-commutative92.0%
distribute-rgt-neg-in92.0%
associate-+r+92.0%
sub-neg92.0%
associate-*l*92.1%
fma-def92.0%
fma-neg92.0%
associate-*l*92.1%
*-commutative92.1%
associate-*r*96.2%
distribute-rgt-neg-in96.2%
Simplified96.7%
if 4.8e-48 < z Initial program 93.5%
+-commutative93.5%
associate-+r-93.5%
cancel-sign-sub-inv93.5%
*-commutative93.5%
distribute-rgt-neg-out93.5%
associate-*r*99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
associate-+r+99.8%
sub-neg99.8%
+-commutative99.8%
associate-+l-99.8%
fma-neg99.8%
associate-*l*97.3%
fma-neg97.3%
*-commutative97.3%
fma-neg97.3%
Simplified99.8%
Final simplification97.6%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= (* x 2.0) -5e+62)
(- (* x 2.0) (* (* z y) (* t 9.0)))
(if (<= (* x 2.0) 5e+70)
(- (* 27.0 (* a b)) (* 9.0 (* t (* z y))))
(+ (* a (* 27.0 b)) (* x 2.0)))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * 2.0) <= -5e+62) {
tmp = (x * 2.0) - ((z * y) * (t * 9.0));
} else if ((x * 2.0) <= 5e+70) {
tmp = (27.0 * (a * b)) - (9.0 * (t * (z * y)));
} else {
tmp = (a * (27.0 * b)) + (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 ((x * 2.0d0) <= (-5d+62)) then
tmp = (x * 2.0d0) - ((z * y) * (t * 9.0d0))
else if ((x * 2.0d0) <= 5d+70) then
tmp = (27.0d0 * (a * b)) - (9.0d0 * (t * (z * y)))
else
tmp = (a * (27.0d0 * b)) + (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 ((x * 2.0) <= -5e+62) {
tmp = (x * 2.0) - ((z * y) * (t * 9.0));
} else if ((x * 2.0) <= 5e+70) {
tmp = (27.0 * (a * b)) - (9.0 * (t * (z * y)));
} else {
tmp = (a * (27.0 * b)) + (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 (x * 2.0) <= -5e+62: tmp = (x * 2.0) - ((z * y) * (t * 9.0)) elif (x * 2.0) <= 5e+70: tmp = (27.0 * (a * b)) - (9.0 * (t * (z * y))) else: tmp = (a * (27.0 * b)) + (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 (Float64(x * 2.0) <= -5e+62) tmp = Float64(Float64(x * 2.0) - Float64(Float64(z * y) * Float64(t * 9.0))); elseif (Float64(x * 2.0) <= 5e+70) tmp = Float64(Float64(27.0 * Float64(a * b)) - Float64(9.0 * Float64(t * Float64(z * y)))); else tmp = Float64(Float64(a * Float64(27.0 * b)) + 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 ((x * 2.0) <= -5e+62)
tmp = (x * 2.0) - ((z * y) * (t * 9.0));
elseif ((x * 2.0) <= 5e+70)
tmp = (27.0 * (a * b)) - (9.0 * (t * (z * y)));
else
tmp = (a * (27.0 * b)) + (x * 2.0);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * 2.0), $MachinePrecision], -5e+62], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(z * y), $MachinePrecision] * N[(t * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * 2.0), $MachinePrecision], 5e+70], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] - N[(9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 2 \leq -5 \cdot 10^{+62}:\\
\;\;\;\;x \cdot 2 - \left(z \cdot y\right) \cdot \left(t \cdot 9\right)\\
\mathbf{elif}\;x \cdot 2 \leq 5 \cdot 10^{+70}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + x \cdot 2\\
\end{array}
\end{array}
if (*.f64 x 2) < -5.00000000000000029e62Initial program 98.1%
sub-neg98.1%
distribute-lft-neg-in98.1%
associate-*l*98.0%
*-commutative98.0%
*-commutative98.0%
cancel-sign-sub-inv98.0%
*-commutative98.0%
*-commutative98.0%
associate-*l*98.1%
associate-*l*96.4%
associate-*l*96.4%
Simplified96.4%
Taylor expanded in y around 0 98.2%
associate-*r*98.1%
*-commutative98.1%
Simplified98.1%
Taylor expanded in a around 0 88.6%
associate-*r*88.5%
Simplified88.5%
if -5.00000000000000029e62 < (*.f64 x 2) < 5.0000000000000002e70Initial program 96.7%
sub-neg96.7%
distribute-lft-neg-in96.7%
associate-*l*96.7%
*-commutative96.7%
*-commutative96.7%
cancel-sign-sub-inv96.7%
*-commutative96.7%
*-commutative96.7%
associate-*l*96.7%
associate-*l*97.9%
associate-*l*97.9%
Simplified97.9%
Taylor expanded in x around 0 85.7%
if 5.0000000000000002e70 < (*.f64 x 2) Initial program 94.3%
sub-neg94.3%
distribute-lft-neg-in94.3%
associate-*l*94.3%
*-commutative94.3%
*-commutative94.3%
cancel-sign-sub-inv94.3%
*-commutative94.3%
*-commutative94.3%
associate-*l*94.3%
associate-*l*94.5%
associate-*l*94.5%
Simplified94.5%
Taylor expanded in y around 0 82.8%
+-commutative82.8%
*-commutative82.8%
fma-def82.8%
*-commutative82.8%
Simplified82.8%
fma-udef82.8%
*-commutative82.8%
associate-*r*82.8%
*-commutative82.8%
*-commutative82.8%
Applied egg-rr82.8%
Final simplification85.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 1.8e+54) (+ (* a (* 27.0 b)) (- (* x 2.0) (* (* y 9.0) (* z t)))) (- (* 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 (z <= 1.8e+54) {
tmp = (a * (27.0 * b)) + ((x * 2.0) - ((y * 9.0) * (z * t)));
} 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 (z <= 1.8d+54) then
tmp = (a * (27.0d0 * b)) + ((x * 2.0d0) - ((y * 9.0d0) * (z * t)))
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 (z <= 1.8e+54) {
tmp = (a * (27.0 * b)) + ((x * 2.0) - ((y * 9.0) * (z * t)));
} 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 z <= 1.8e+54: tmp = (a * (27.0 * b)) + ((x * 2.0) - ((y * 9.0) * (z * t))) 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 (z <= 1.8e+54) tmp = Float64(Float64(a * Float64(27.0 * b)) + Float64(Float64(x * 2.0) - Float64(Float64(y * 9.0) * Float64(z * t)))); 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 (z <= 1.8e+54)
tmp = (a * (27.0 * b)) + ((x * 2.0) - ((y * 9.0) * (z * t)));
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[LessEqual[z, 1.8e+54], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $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}\;z \leq 1.8 \cdot 10^{+54}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + \left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if z < 1.8000000000000001e54Initial program 97.9%
sub-neg97.9%
distribute-lft-neg-in97.9%
associate-*l*97.8%
*-commutative97.8%
*-commutative97.8%
cancel-sign-sub-inv97.8%
*-commutative97.8%
*-commutative97.8%
associate-*l*97.9%
associate-*l*97.0%
associate-*l*97.0%
Simplified97.0%
if 1.8000000000000001e54 < z Initial program 91.2%
sub-neg91.2%
distribute-lft-neg-in91.2%
associate-*l*91.2%
*-commutative91.2%
*-commutative91.2%
cancel-sign-sub-inv91.2%
*-commutative91.2%
*-commutative91.2%
associate-*l*91.2%
associate-*l*96.4%
associate-*l*96.4%
Simplified96.4%
Taylor expanded in a around 0 67.9%
Final simplification91.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 (+ (* a (* 27.0 b)) (- (* x 2.0) (* (* 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) {
return (a * (27.0 * b)) + ((x * 2.0) - ((z * y) * (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) - ((z * y) * (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) - ((z * y) * (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) - ((z * y) * (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(Float64(z * y) * 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) - ((z * y) * (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[(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])\\
\\
a \cdot \left(27 \cdot b\right) + \left(x \cdot 2 - \left(z \cdot y\right) \cdot \left(t \cdot 9\right)\right)
\end{array}
Initial program 96.5%
sub-neg96.5%
distribute-lft-neg-in96.5%
associate-*l*96.5%
*-commutative96.5%
*-commutative96.5%
cancel-sign-sub-inv96.5%
*-commutative96.5%
*-commutative96.5%
associate-*l*96.5%
associate-*l*96.9%
associate-*l*96.9%
Simplified96.9%
Taylor expanded in y around 0 96.5%
associate-*r*96.2%
*-commutative96.2%
Simplified96.2%
Final simplification96.2%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* -9.0 (* t (* z y)))))
(if (<= x -5.6e+112)
(* x 2.0)
(if (<= x 4.2e-272)
t_1
(if (<= x 4.2e-41)
(* 27.0 (* a b))
(if (<= x 2.3e+57) t_1 (* 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 t_1 = -9.0 * (t * (z * y));
double tmp;
if (x <= -5.6e+112) {
tmp = x * 2.0;
} else if (x <= 4.2e-272) {
tmp = t_1;
} else if (x <= 4.2e-41) {
tmp = 27.0 * (a * b);
} else if (x <= 2.3e+57) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_1 = (-9.0d0) * (t * (z * y))
if (x <= (-5.6d+112)) then
tmp = x * 2.0d0
else if (x <= 4.2d-272) then
tmp = t_1
else if (x <= 4.2d-41) then
tmp = 27.0d0 * (a * b)
else if (x <= 2.3d+57) then
tmp = t_1
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 t_1 = -9.0 * (t * (z * y));
double tmp;
if (x <= -5.6e+112) {
tmp = x * 2.0;
} else if (x <= 4.2e-272) {
tmp = t_1;
} else if (x <= 4.2e-41) {
tmp = 27.0 * (a * b);
} else if (x <= 2.3e+57) {
tmp = t_1;
} 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): t_1 = -9.0 * (t * (z * y)) tmp = 0 if x <= -5.6e+112: tmp = x * 2.0 elif x <= 4.2e-272: tmp = t_1 elif x <= 4.2e-41: tmp = 27.0 * (a * b) elif x <= 2.3e+57: tmp = t_1 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) t_1 = Float64(-9.0 * Float64(t * Float64(z * y))) tmp = 0.0 if (x <= -5.6e+112) tmp = Float64(x * 2.0); elseif (x <= 4.2e-272) tmp = t_1; elseif (x <= 4.2e-41) tmp = Float64(27.0 * Float64(a * b)); elseif (x <= 2.3e+57) tmp = t_1; 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)
t_1 = -9.0 * (t * (z * y));
tmp = 0.0;
if (x <= -5.6e+112)
tmp = x * 2.0;
elseif (x <= 4.2e-272)
tmp = t_1;
elseif (x <= 4.2e-41)
tmp = 27.0 * (a * b);
elseif (x <= 2.3e+57)
tmp = t_1;
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_] := Block[{t$95$1 = N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.6e+112], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, 4.2e-272], t$95$1, If[LessEqual[x, 4.2e-41], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.3e+57], t$95$1, 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}
t_1 := -9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\mathbf{if}\;x \leq -5.6 \cdot 10^{+112}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-272}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.2 \cdot 10^{-41}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;x \leq 2.3 \cdot 10^{+57}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -5.6000000000000003e112 or 2.2999999999999999e57 < x Initial program 95.8%
sub-neg95.8%
distribute-lft-neg-in95.8%
associate-*l*95.8%
*-commutative95.8%
*-commutative95.8%
cancel-sign-sub-inv95.8%
*-commutative95.8%
*-commutative95.8%
associate-*l*95.8%
associate-*l*95.9%
associate-*l*96.0%
Simplified96.0%
Taylor expanded in x around inf 63.0%
if -5.6000000000000003e112 < x < 4.19999999999999974e-272 or 4.20000000000000025e-41 < x < 2.2999999999999999e57Initial 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*97.2%
associate-*l*97.2%
Simplified97.2%
Taylor expanded in y around inf 56.4%
if 4.19999999999999974e-272 < x < 4.20000000000000025e-41Initial program 96.2%
sub-neg96.2%
distribute-lft-neg-in96.2%
associate-*l*96.2%
*-commutative96.2%
*-commutative96.2%
cancel-sign-sub-inv96.2%
*-commutative96.2%
*-commutative96.2%
associate-*l*96.2%
associate-*l*97.9%
associate-*l*97.9%
Simplified97.9%
Taylor expanded in a around inf 60.7%
Final simplification59.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 (<= x -1.82e+112)
(* x 2.0)
(if (<= x 2.2e-273)
(* t (* -9.0 (* z y)))
(if (<= x 1.56e-37)
(* 27.0 (* a b))
(if (<= x 5.2e+59) (* -9.0 (* t (* z y))) (* 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 (x <= -1.82e+112) {
tmp = x * 2.0;
} else if (x <= 2.2e-273) {
tmp = t * (-9.0 * (z * y));
} else if (x <= 1.56e-37) {
tmp = 27.0 * (a * b);
} else if (x <= 5.2e+59) {
tmp = -9.0 * (t * (z * y));
} 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 (x <= (-1.82d+112)) then
tmp = x * 2.0d0
else if (x <= 2.2d-273) then
tmp = t * ((-9.0d0) * (z * y))
else if (x <= 1.56d-37) then
tmp = 27.0d0 * (a * b)
else if (x <= 5.2d+59) then
tmp = (-9.0d0) * (t * (z * y))
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 (x <= -1.82e+112) {
tmp = x * 2.0;
} else if (x <= 2.2e-273) {
tmp = t * (-9.0 * (z * y));
} else if (x <= 1.56e-37) {
tmp = 27.0 * (a * b);
} else if (x <= 5.2e+59) {
tmp = -9.0 * (t * (z * y));
} 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 x <= -1.82e+112: tmp = x * 2.0 elif x <= 2.2e-273: tmp = t * (-9.0 * (z * y)) elif x <= 1.56e-37: tmp = 27.0 * (a * b) elif x <= 5.2e+59: tmp = -9.0 * (t * (z * y)) 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 (x <= -1.82e+112) tmp = Float64(x * 2.0); elseif (x <= 2.2e-273) tmp = Float64(t * Float64(-9.0 * Float64(z * y))); elseif (x <= 1.56e-37) tmp = Float64(27.0 * Float64(a * b)); elseif (x <= 5.2e+59) tmp = Float64(-9.0 * Float64(t * Float64(z * y))); 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 (x <= -1.82e+112)
tmp = x * 2.0;
elseif (x <= 2.2e-273)
tmp = t * (-9.0 * (z * y));
elseif (x <= 1.56e-37)
tmp = 27.0 * (a * b);
elseif (x <= 5.2e+59)
tmp = -9.0 * (t * (z * y));
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[LessEqual[x, -1.82e+112], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, 2.2e-273], N[(t * N[(-9.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 1.56e-37], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 5.2e+59], N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $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}\;x \leq -1.82 \cdot 10^{+112}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-273}:\\
\;\;\;\;t \cdot \left(-9 \cdot \left(z \cdot y\right)\right)\\
\mathbf{elif}\;x \leq 1.56 \cdot 10^{-37}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;x \leq 5.2 \cdot 10^{+59}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -1.82000000000000001e112 or 5.19999999999999999e59 < x Initial program 95.8%
sub-neg95.8%
distribute-lft-neg-in95.8%
associate-*l*95.8%
*-commutative95.8%
*-commutative95.8%
cancel-sign-sub-inv95.8%
*-commutative95.8%
*-commutative95.8%
associate-*l*95.8%
associate-*l*95.9%
associate-*l*96.0%
Simplified96.0%
Taylor expanded in x around inf 63.0%
if -1.82000000000000001e112 < x < 2.1999999999999998e-273Initial program 96.9%
sub-neg96.9%
distribute-lft-neg-in96.9%
associate-*l*96.8%
*-commutative96.8%
*-commutative96.8%
cancel-sign-sub-inv96.8%
*-commutative96.8%
*-commutative96.8%
associate-*l*96.9%
associate-*l*96.8%
associate-*l*96.9%
Simplified96.9%
Taylor expanded in y around 0 96.9%
associate-*r*95.9%
*-commutative95.9%
Simplified95.9%
associate-*r*95.9%
add-cube-cbrt95.6%
pow395.6%
associate-*r*95.6%
Applied egg-rr95.6%
Taylor expanded in y around inf 54.7%
associate-*r*53.7%
*-commutative53.7%
associate-*l*54.7%
Simplified54.7%
if 2.1999999999999998e-273 < x < 1.56e-37Initial program 96.2%
sub-neg96.2%
distribute-lft-neg-in96.2%
associate-*l*96.2%
*-commutative96.2%
*-commutative96.2%
cancel-sign-sub-inv96.2%
*-commutative96.2%
*-commutative96.2%
associate-*l*96.2%
associate-*l*97.9%
associate-*l*97.9%
Simplified97.9%
Taylor expanded in a around inf 60.7%
if 1.56e-37 < x < 5.19999999999999999e59Initial program 99.4%
sub-neg99.4%
distribute-lft-neg-in99.4%
associate-*l*99.2%
*-commutative99.2%
*-commutative99.2%
cancel-sign-sub-inv99.2%
*-commutative99.2%
*-commutative99.2%
associate-*l*99.4%
associate-*l*99.3%
associate-*l*99.4%
Simplified99.4%
Taylor expanded in y around inf 67.3%
Final simplification59.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 (<= z -1.05e-20) (not (<= z 5e-58))) (- (* x 2.0) (* 9.0 (* t (* z y)))) (+ (* a (* 27.0 b)) (* x 2.0))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.05e-20) || !(z <= 5e-58)) {
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
} else {
tmp = (a * (27.0 * b)) + (x * 2.0);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((z <= (-1.05d-20)) .or. (.not. (z <= 5d-58))) then
tmp = (x * 2.0d0) - (9.0d0 * (t * (z * y)))
else
tmp = (a * (27.0d0 * b)) + (x * 2.0d0)
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -1.05e-20) || !(z <= 5e-58)) {
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
} else {
tmp = (a * (27.0 * b)) + (x * 2.0);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if (z <= -1.05e-20) or not (z <= 5e-58): tmp = (x * 2.0) - (9.0 * (t * (z * y))) else: tmp = (a * (27.0 * b)) + (x * 2.0) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -1.05e-20) || !(z <= 5e-58)) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(z * y)))); else tmp = Float64(Float64(a * Float64(27.0 * b)) + Float64(x * 2.0)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((z <= -1.05e-20) || ~((z <= 5e-58)))
tmp = (x * 2.0) - (9.0 * (t * (z * y)));
else
tmp = (a * (27.0 * b)) + (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[z, -1.05e-20], N[Not[LessEqual[z, 5e-58]], $MachinePrecision]], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.05 \cdot 10^{-20} \lor \neg \left(z \leq 5 \cdot 10^{-58}\right):\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + x \cdot 2\\
\end{array}
\end{array}
if z < -1.0499999999999999e-20 or 4.99999999999999977e-58 < z Initial program 93.8%
sub-neg93.8%
distribute-lft-neg-in93.8%
associate-*l*93.8%
*-commutative93.8%
*-commutative93.8%
cancel-sign-sub-inv93.8%
*-commutative93.8%
*-commutative93.8%
associate-*l*93.8%
associate-*l*94.6%
associate-*l*94.6%
Simplified94.6%
Taylor expanded in a around 0 68.5%
if -1.0499999999999999e-20 < z < 4.99999999999999977e-58Initial program 99.8%
sub-neg99.8%
distribute-lft-neg-in99.8%
associate-*l*99.8%
*-commutative99.8%
*-commutative99.8%
cancel-sign-sub-inv99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
associate-*l*99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in y around 0 76.6%
+-commutative76.6%
*-commutative76.6%
fma-def76.6%
*-commutative76.6%
Simplified76.6%
fma-udef76.6%
*-commutative76.6%
associate-*r*76.6%
*-commutative76.6%
*-commutative76.6%
Applied egg-rr76.6%
Final simplification72.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 (<= z -1.15e-20)
(- (* x 2.0) (* (* z y) (* t 9.0)))
(if (<= z 2.2e-58)
(+ (* a (* 27.0 b)) (* x 2.0))
(- (* 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 (z <= -1.15e-20) {
tmp = (x * 2.0) - ((z * y) * (t * 9.0));
} else if (z <= 2.2e-58) {
tmp = (a * (27.0 * b)) + (x * 2.0);
} 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 (z <= (-1.15d-20)) then
tmp = (x * 2.0d0) - ((z * y) * (t * 9.0d0))
else if (z <= 2.2d-58) then
tmp = (a * (27.0d0 * b)) + (x * 2.0d0)
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 (z <= -1.15e-20) {
tmp = (x * 2.0) - ((z * y) * (t * 9.0));
} else if (z <= 2.2e-58) {
tmp = (a * (27.0 * b)) + (x * 2.0);
} 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 z <= -1.15e-20: tmp = (x * 2.0) - ((z * y) * (t * 9.0)) elif z <= 2.2e-58: tmp = (a * (27.0 * b)) + (x * 2.0) 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 (z <= -1.15e-20) tmp = Float64(Float64(x * 2.0) - Float64(Float64(z * y) * Float64(t * 9.0))); elseif (z <= 2.2e-58) tmp = Float64(Float64(a * Float64(27.0 * b)) + Float64(x * 2.0)); 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 (z <= -1.15e-20)
tmp = (x * 2.0) - ((z * y) * (t * 9.0));
elseif (z <= 2.2e-58)
tmp = (a * (27.0 * b)) + (x * 2.0);
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[LessEqual[z, -1.15e-20], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(z * y), $MachinePrecision] * N[(t * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e-58], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $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}\;z \leq -1.15 \cdot 10^{-20}:\\
\;\;\;\;x \cdot 2 - \left(z \cdot y\right) \cdot \left(t \cdot 9\right)\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-58}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if z < -1.15e-20Initial program 94.0%
sub-neg94.0%
distribute-lft-neg-in94.0%
associate-*l*94.1%
*-commutative94.1%
*-commutative94.1%
cancel-sign-sub-inv94.1%
*-commutative94.1%
*-commutative94.1%
associate-*l*94.0%
associate-*l*91.5%
associate-*l*91.5%
Simplified91.5%
Taylor expanded in y around 0 94.1%
associate-*r*94.1%
*-commutative94.1%
Simplified94.1%
Taylor expanded in a around 0 71.6%
associate-*r*71.6%
Simplified71.6%
if -1.15e-20 < z < 2.20000000000000006e-58Initial program 99.8%
sub-neg99.8%
distribute-lft-neg-in99.8%
associate-*l*99.8%
*-commutative99.8%
*-commutative99.8%
cancel-sign-sub-inv99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
associate-*l*99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in y around 0 76.6%
+-commutative76.6%
*-commutative76.6%
fma-def76.6%
*-commutative76.6%
Simplified76.6%
fma-udef76.6%
*-commutative76.6%
associate-*r*76.6%
*-commutative76.6%
*-commutative76.6%
Applied egg-rr76.6%
if 2.20000000000000006e-58 < z Initial program 93.7%
sub-neg93.7%
distribute-lft-neg-in93.7%
associate-*l*93.6%
*-commutative93.6%
*-commutative93.6%
cancel-sign-sub-inv93.6%
*-commutative93.6%
*-commutative93.6%
associate-*l*93.7%
associate-*l*97.4%
associate-*l*97.4%
Simplified97.4%
Taylor expanded in a around 0 65.7%
Final simplification72.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 (<= z -2.55e-20)
(* y (* t (* z -9.0)))
(if (<= z 59000000000000.0)
(+ (* x 2.0) (* 27.0 (* a b)))
(* t (* y (* z -9.0))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.55e-20) {
tmp = y * (t * (z * -9.0));
} else if (z <= 59000000000000.0) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = t * (y * (z * -9.0));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-2.55d-20)) then
tmp = y * (t * (z * (-9.0d0)))
else if (z <= 59000000000000.0d0) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else
tmp = t * (y * (z * (-9.0d0)))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.55e-20) {
tmp = y * (t * (z * -9.0));
} else if (z <= 59000000000000.0) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = t * (y * (z * -9.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -2.55e-20: tmp = y * (t * (z * -9.0)) elif z <= 59000000000000.0: tmp = (x * 2.0) + (27.0 * (a * b)) else: tmp = t * (y * (z * -9.0)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2.55e-20) tmp = Float64(y * Float64(t * Float64(z * -9.0))); elseif (z <= 59000000000000.0) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); else tmp = Float64(t * Float64(y * Float64(z * -9.0))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -2.55e-20)
tmp = y * (t * (z * -9.0));
elseif (z <= 59000000000000.0)
tmp = (x * 2.0) + (27.0 * (a * b));
else
tmp = t * (y * (z * -9.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2.55e-20], N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 59000000000000.0], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(y * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.55 \cdot 10^{-20}:\\
\;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\
\mathbf{elif}\;z \leq 59000000000000:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
\end{array}
\end{array}
if z < -2.55000000000000009e-20Initial program 94.0%
sub-neg94.0%
distribute-lft-neg-in94.0%
associate-*l*94.1%
*-commutative94.1%
*-commutative94.1%
cancel-sign-sub-inv94.1%
*-commutative94.1%
*-commutative94.1%
associate-*l*94.0%
associate-*l*91.5%
associate-*l*91.5%
Simplified91.5%
Taylor expanded in y around inf 47.3%
*-commutative47.3%
associate-*r*50.1%
*-commutative50.1%
associate-*r*50.1%
associate-*l*44.5%
Simplified44.5%
if -2.55000000000000009e-20 < z < 5.9e13Initial program 99.8%
sub-neg99.8%
distribute-lft-neg-in99.8%
associate-*l*99.8%
*-commutative99.8%
*-commutative99.8%
cancel-sign-sub-inv99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
associate-*l*99.7%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in y around 0 75.9%
if 5.9e13 < z Initial program 92.8%
sub-neg92.8%
distribute-lft-neg-in92.8%
associate-*l*92.8%
*-commutative92.8%
*-commutative92.8%
cancel-sign-sub-inv92.8%
*-commutative92.8%
*-commutative92.8%
associate-*l*92.8%
associate-*l*97.0%
associate-*l*97.1%
Simplified97.1%
Taylor expanded in y around inf 46.6%
*-commutative46.6%
associate-*r*52.2%
*-commutative52.2%
associate-*r*52.2%
*-commutative52.2%
associate-*l*46.5%
Simplified46.5%
Final simplification60.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 (<= z -2.05e-20) (* y (* t (* z -9.0))) (if (<= z 6.3e+16) (+ (* a (* 27.0 b)) (* x 2.0)) (* t (* y (* z -9.0))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.05e-20) {
tmp = y * (t * (z * -9.0));
} else if (z <= 6.3e+16) {
tmp = (a * (27.0 * b)) + (x * 2.0);
} else {
tmp = t * (y * (z * -9.0));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-2.05d-20)) then
tmp = y * (t * (z * (-9.0d0)))
else if (z <= 6.3d+16) then
tmp = (a * (27.0d0 * b)) + (x * 2.0d0)
else
tmp = t * (y * (z * (-9.0d0)))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2.05e-20) {
tmp = y * (t * (z * -9.0));
} else if (z <= 6.3e+16) {
tmp = (a * (27.0 * b)) + (x * 2.0);
} else {
tmp = t * (y * (z * -9.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -2.05e-20: tmp = y * (t * (z * -9.0)) elif z <= 6.3e+16: tmp = (a * (27.0 * b)) + (x * 2.0) else: tmp = t * (y * (z * -9.0)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2.05e-20) tmp = Float64(y * Float64(t * Float64(z * -9.0))); elseif (z <= 6.3e+16) tmp = Float64(Float64(a * Float64(27.0 * b)) + Float64(x * 2.0)); else tmp = Float64(t * Float64(y * Float64(z * -9.0))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -2.05e-20)
tmp = y * (t * (z * -9.0));
elseif (z <= 6.3e+16)
tmp = (a * (27.0 * b)) + (x * 2.0);
else
tmp = t * (y * (z * -9.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2.05e-20], N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6.3e+16], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], N[(t * N[(y * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.05 \cdot 10^{-20}:\\
\;\;\;\;y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\
\mathbf{elif}\;z \leq 6.3 \cdot 10^{+16}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
\end{array}
\end{array}
if z < -2.05e-20Initial program 94.0%
sub-neg94.0%
distribute-lft-neg-in94.0%
associate-*l*94.1%
*-commutative94.1%
*-commutative94.1%
cancel-sign-sub-inv94.1%
*-commutative94.1%
*-commutative94.1%
associate-*l*94.0%
associate-*l*91.5%
associate-*l*91.5%
Simplified91.5%
Taylor expanded in y around inf 47.3%
*-commutative47.3%
associate-*r*50.1%
*-commutative50.1%
associate-*r*50.1%
associate-*l*44.5%
Simplified44.5%
if -2.05e-20 < z < 6.3e16Initial program 99.8%
sub-neg99.8%
distribute-lft-neg-in99.8%
associate-*l*99.8%
*-commutative99.8%
*-commutative99.8%
cancel-sign-sub-inv99.8%
*-commutative99.8%
*-commutative99.8%
associate-*l*99.8%
associate-*l*99.7%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in y around 0 76.1%
+-commutative76.1%
*-commutative76.1%
fma-def76.1%
*-commutative76.1%
Simplified76.1%
fma-udef76.1%
*-commutative76.1%
associate-*r*76.1%
*-commutative76.1%
*-commutative76.1%
Applied egg-rr76.1%
if 6.3e16 < z Initial program 92.7%
sub-neg92.7%
distribute-lft-neg-in92.7%
associate-*l*92.6%
*-commutative92.6%
*-commutative92.6%
cancel-sign-sub-inv92.6%
*-commutative92.6%
*-commutative92.6%
associate-*l*92.7%
associate-*l*97.0%
associate-*l*97.0%
Simplified97.0%
Taylor expanded in y around inf 47.2%
*-commutative47.2%
associate-*r*53.0%
*-commutative53.0%
associate-*r*53.0%
*-commutative53.0%
associate-*l*47.2%
Simplified47.2%
Final simplification60.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 (<= x -12000.0) (* x 2.0) (if (<= x 2.45e+80) (* 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 (x <= -12000.0) {
tmp = x * 2.0;
} else if (x <= 2.45e+80) {
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 (x <= (-12000.0d0)) then
tmp = x * 2.0d0
else if (x <= 2.45d+80) 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 (x <= -12000.0) {
tmp = x * 2.0;
} else if (x <= 2.45e+80) {
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 x <= -12000.0: tmp = x * 2.0 elif x <= 2.45e+80: 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 (x <= -12000.0) tmp = Float64(x * 2.0); elseif (x <= 2.45e+80) 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 (x <= -12000.0)
tmp = x * 2.0;
elseif (x <= 2.45e+80)
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[LessEqual[x, -12000.0], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, 2.45e+80], 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}\;x \leq -12000:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq 2.45 \cdot 10^{+80}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -12000 or 2.4499999999999998e80 < x Initial program 96.4%
sub-neg96.4%
distribute-lft-neg-in96.4%
associate-*l*96.3%
*-commutative96.3%
*-commutative96.3%
cancel-sign-sub-inv96.3%
*-commutative96.3%
*-commutative96.3%
associate-*l*96.4%
associate-*l*95.7%
associate-*l*95.7%
Simplified95.7%
Taylor expanded in x around inf 57.8%
if -12000 < x < 2.4499999999999998e80Initial program 96.6%
sub-neg96.6%
distribute-lft-neg-in96.6%
associate-*l*96.6%
*-commutative96.6%
*-commutative96.6%
cancel-sign-sub-inv96.6%
*-commutative96.6%
*-commutative96.6%
associate-*l*96.6%
associate-*l*97.8%
associate-*l*97.8%
Simplified97.8%
Taylor expanded in a around inf 43.5%
Final simplification49.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 (* x 2.0))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * 2.0d0
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): return x * 2.0
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) return Float64(x * 2.0) end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = x * 2.0;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(x * 2.0), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
x \cdot 2
\end{array}
Initial program 96.5%
sub-neg96.5%
distribute-lft-neg-in96.5%
associate-*l*96.5%
*-commutative96.5%
*-commutative96.5%
cancel-sign-sub-inv96.5%
*-commutative96.5%
*-commutative96.5%
associate-*l*96.5%
associate-*l*96.9%
associate-*l*96.9%
Simplified96.9%
Taylor expanded in x around inf 31.4%
Final simplification31.4%
(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 2023285
(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)))