
(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 2.5e-38) (+ (+ (* a (* 27.0 b)) (* x 2.0)) (* y (* t (* z -9.0)))) (- (* x 2.0) (fma (* y (* z 9.0)) t (* a (* b -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 <= 2.5e-38) {
tmp = ((a * (27.0 * b)) + (x * 2.0)) + (y * (t * (z * -9.0)));
} else {
tmp = (x * 2.0) - fma((y * (z * 9.0)), t, (a * (b * -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 <= 2.5e-38) tmp = Float64(Float64(Float64(a * Float64(27.0 * b)) + Float64(x * 2.0)) + Float64(y * Float64(t * Float64(z * -9.0)))); else tmp = Float64(Float64(x * 2.0) - fma(Float64(y * Float64(z * 9.0)), t, Float64(a * Float64(b * -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, 2.5e-38], N[(N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision] + N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * N[(z * 9.0), $MachinePrecision]), $MachinePrecision] * t + N[(a * N[(b * -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 2.5 \cdot 10^{-38}:\\
\;\;\;\;\left(a \cdot \left(27 \cdot b\right) + x \cdot 2\right) + y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - \mathsf{fma}\left(y \cdot \left(z \cdot 9\right), t, a \cdot \left(b \cdot -27\right)\right)\\
\end{array}
\end{array}
if z < 2.50000000000000017e-38Initial program 95.1%
+-commutative95.1%
associate-*l*95.1%
fma-def95.1%
associate-*l*95.4%
*-commutative95.4%
associate-*l*95.4%
Simplified95.4%
fma-udef95.4%
associate-*r*95.4%
associate-*r*95.4%
*-commutative95.4%
associate-*r*95.1%
*-commutative95.1%
cancel-sign-sub-inv95.1%
distribute-lft-neg-in95.1%
associate-+r+95.1%
associate-*r*95.1%
*-commutative95.1%
associate-*r*95.4%
*-commutative95.4%
associate-*r*95.4%
*-commutative95.4%
distribute-rgt-neg-in95.4%
metadata-eval95.4%
associate-*r*94.9%
*-commutative94.9%
associate-*r*94.9%
Applied egg-rr94.9%
if 2.50000000000000017e-38 < z Initial program 96.4%
associate-+l-96.4%
sub-neg96.4%
neg-mul-196.4%
metadata-eval96.4%
metadata-eval96.4%
cancel-sign-sub-inv96.4%
metadata-eval96.4%
*-lft-identity96.4%
associate-*l*94.2%
associate-*l*94.2%
Simplified94.2%
sub-neg94.2%
associate-*r*96.4%
fma-def97.6%
associate-*l*97.6%
distribute-rgt-neg-in97.6%
*-commutative97.6%
distribute-rgt-neg-in97.6%
metadata-eval97.6%
Applied egg-rr97.6%
Final simplification95.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 (fma x 2.0 (fma y (* -9.0 (* z t)) (* (* 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) {
return fma(x, 2.0, fma(y, (-9.0 * (z * t)), ((a * 27.0) * b)));
}
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) return fma(x, 2.0, fma(y, Float64(-9.0 * Float64(z * t)), Float64(Float64(a * 27.0) * b))) 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 + N[(y * N[(-9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\mathsf{fma}\left(x, 2, \mathsf{fma}\left(y, -9 \cdot \left(z \cdot t\right), \left(a \cdot 27\right) \cdot b\right)\right)
\end{array}
Initial program 95.5%
associate-+l-95.5%
fma-neg95.5%
neg-sub095.5%
associate-+l-95.5%
neg-sub095.5%
associate-*l*95.0%
associate-*l*94.6%
distribute-rgt-neg-in94.6%
fma-def94.6%
*-commutative94.6%
distribute-rgt-neg-in94.6%
metadata-eval94.6%
Simplified94.6%
Final simplification94.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
(let* ((t_1 (- (* x 2.0) (* a (* b -27.0)))))
(if (<= b -6.5e-32)
t_1
(if (<= b 2.3e+26)
(- (* x 2.0) (* y (* 9.0 (* z t))))
(if (<= b 5.6e+253) (+ (* a (* 27.0 b)) (* y (* -9.0 (* z t)))) t_1)))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (x * 2.0) - (a * (b * -27.0));
double tmp;
if (b <= -6.5e-32) {
tmp = t_1;
} else if (b <= 2.3e+26) {
tmp = (x * 2.0) - (y * (9.0 * (z * t)));
} else if (b <= 5.6e+253) {
tmp = (a * (27.0 * b)) + (y * (-9.0 * (z * t)));
} 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 = (x * 2.0d0) - (a * (b * (-27.0d0)))
if (b <= (-6.5d-32)) then
tmp = t_1
else if (b <= 2.3d+26) then
tmp = (x * 2.0d0) - (y * (9.0d0 * (z * t)))
else if (b <= 5.6d+253) then
tmp = (a * (27.0d0 * b)) + (y * ((-9.0d0) * (z * t)))
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 = (x * 2.0) - (a * (b * -27.0));
double tmp;
if (b <= -6.5e-32) {
tmp = t_1;
} else if (b <= 2.3e+26) {
tmp = (x * 2.0) - (y * (9.0 * (z * t)));
} else if (b <= 5.6e+253) {
tmp = (a * (27.0 * b)) + (y * (-9.0 * (z * t)));
} 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 = (x * 2.0) - (a * (b * -27.0)) tmp = 0 if b <= -6.5e-32: tmp = t_1 elif b <= 2.3e+26: tmp = (x * 2.0) - (y * (9.0 * (z * t))) elif b <= 5.6e+253: tmp = (a * (27.0 * b)) + (y * (-9.0 * (z * t))) 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(x * 2.0) - Float64(a * Float64(b * -27.0))) tmp = 0.0 if (b <= -6.5e-32) tmp = t_1; elseif (b <= 2.3e+26) tmp = Float64(Float64(x * 2.0) - Float64(y * Float64(9.0 * Float64(z * t)))); elseif (b <= 5.6e+253) tmp = Float64(Float64(a * Float64(27.0 * b)) + Float64(y * Float64(-9.0 * Float64(z * t)))); 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 = (x * 2.0) - (a * (b * -27.0));
tmp = 0.0;
if (b <= -6.5e-32)
tmp = t_1;
elseif (b <= 2.3e+26)
tmp = (x * 2.0) - (y * (9.0 * (z * t)));
elseif (b <= 5.6e+253)
tmp = (a * (27.0 * b)) + (y * (-9.0 * (z * t)));
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[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -6.5e-32], t$95$1, If[LessEqual[b, 2.3e+26], N[(N[(x * 2.0), $MachinePrecision] - N[(y * N[(9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.6e+253], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(y * N[(-9.0 * N[(z * t), $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 := x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{if}\;b \leq -6.5 \cdot 10^{-32}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq 2.3 \cdot 10^{+26}:\\
\;\;\;\;x \cdot 2 - y \cdot \left(9 \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;b \leq 5.6 \cdot 10^{+253}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + y \cdot \left(-9 \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if b < -6.49999999999999988e-32 or 5.5999999999999999e253 < b Initial program 93.2%
associate-+l-93.2%
sub-neg93.2%
neg-mul-193.2%
metadata-eval93.2%
metadata-eval93.2%
cancel-sign-sub-inv93.2%
metadata-eval93.2%
*-lft-identity93.2%
associate-*l*95.8%
associate-*l*95.8%
Simplified95.8%
Taylor expanded in y around 0 70.1%
*-commutative70.1%
Simplified70.1%
Taylor expanded in a around 0 70.1%
*-commutative70.1%
associate-*l*70.1%
Simplified70.1%
if -6.49999999999999988e-32 < b < 2.3000000000000001e26Initial program 95.0%
Taylor expanded in a around 0 83.4%
expm1-log1p-u64.6%
expm1-udef60.9%
*-commutative60.9%
associate-*r*60.8%
Applied egg-rr60.8%
expm1-def64.1%
expm1-log1p83.0%
*-commutative83.0%
associate-*l*83.4%
*-commutative83.4%
associate-*l*83.5%
Simplified83.5%
if 2.3000000000000001e26 < b < 5.5999999999999999e253Initial program 99.8%
Taylor expanded in x around 0 77.0%
cancel-sign-sub-inv77.0%
metadata-eval77.0%
*-commutative77.0%
associate-*r*77.1%
*-commutative77.1%
*-commutative77.1%
associate-*r*77.1%
*-commutative77.1%
associate-*l*77.1%
*-commutative77.1%
associate-*l*77.1%
Applied egg-rr77.1%
Final simplification78.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 (<= a -2.25e+114)
(and (not (<= a -6.2e+71))
(or (<= a -9e-77)
(and (not (<= a 4e-197))
(or (<= a 3.55e-149) (not (<= a 2.35e-62)))))))
(* 27.0 (* a b))
(* x 2.0)))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -2.25e+114) || (!(a <= -6.2e+71) && ((a <= -9e-77) || (!(a <= 4e-197) && ((a <= 3.55e-149) || !(a <= 2.35e-62)))))) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-2.25d+114)) .or. (.not. (a <= (-6.2d+71))) .and. (a <= (-9d-77)) .or. (.not. (a <= 4d-197)) .and. (a <= 3.55d-149) .or. (.not. (a <= 2.35d-62))) then
tmp = 27.0d0 * (a * b)
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -2.25e+114) || (!(a <= -6.2e+71) && ((a <= -9e-77) || (!(a <= 4e-197) && ((a <= 3.55e-149) || !(a <= 2.35e-62)))))) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if (a <= -2.25e+114) or (not (a <= -6.2e+71) and ((a <= -9e-77) or (not (a <= 4e-197) and ((a <= 3.55e-149) or not (a <= 2.35e-62))))): tmp = 27.0 * (a * b) else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -2.25e+114) || (!(a <= -6.2e+71) && ((a <= -9e-77) || (!(a <= 4e-197) && ((a <= 3.55e-149) || !(a <= 2.35e-62)))))) tmp = Float64(27.0 * Float64(a * b)); else tmp = Float64(x * 2.0); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((a <= -2.25e+114) || (~((a <= -6.2e+71)) && ((a <= -9e-77) || (~((a <= 4e-197)) && ((a <= 3.55e-149) || ~((a <= 2.35e-62)))))))
tmp = 27.0 * (a * b);
else
tmp = x * 2.0;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -2.25e+114], And[N[Not[LessEqual[a, -6.2e+71]], $MachinePrecision], Or[LessEqual[a, -9e-77], And[N[Not[LessEqual[a, 4e-197]], $MachinePrecision], Or[LessEqual[a, 3.55e-149], N[Not[LessEqual[a, 2.35e-62]], $MachinePrecision]]]]]], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.25 \cdot 10^{+114} \lor \neg \left(a \leq -6.2 \cdot 10^{+71}\right) \land \left(a \leq -9 \cdot 10^{-77} \lor \neg \left(a \leq 4 \cdot 10^{-197}\right) \land \left(a \leq 3.55 \cdot 10^{-149} \lor \neg \left(a \leq 2.35 \cdot 10^{-62}\right)\right)\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if a < -2.25e114 or -6.20000000000000036e71 < a < -9.0000000000000001e-77 or 3.9999999999999999e-197 < a < 3.5500000000000001e-149 or 2.34999999999999992e-62 < a Initial program 96.8%
Taylor expanded in a around inf 50.5%
if -2.25e114 < a < -6.20000000000000036e71 or -9.0000000000000001e-77 < a < 3.9999999999999999e-197 or 3.5500000000000001e-149 < a < 2.34999999999999992e-62Initial program 93.5%
Taylor expanded in x around inf 48.4%
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
(let* ((t_1 (* a (* 27.0 b))))
(if (<= a -1.8e+114)
t_1
(if (<= a -3.4e+71)
(* x 2.0)
(if (<= a -1.04e-76)
t_1
(if (<= a 3.8e-197)
(* x 2.0)
(if (<= a 1.36e-148)
(* 27.0 (* a b))
(if (<= a 2.3e-62) (* x 2.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 (a <= -1.8e+114) {
tmp = t_1;
} else if (a <= -3.4e+71) {
tmp = x * 2.0;
} else if (a <= -1.04e-76) {
tmp = t_1;
} else if (a <= 3.8e-197) {
tmp = x * 2.0;
} else if (a <= 1.36e-148) {
tmp = 27.0 * (a * b);
} else if (a <= 2.3e-62) {
tmp = x * 2.0;
} 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 = a * (27.0d0 * b)
if (a <= (-1.8d+114)) then
tmp = t_1
else if (a <= (-3.4d+71)) then
tmp = x * 2.0d0
else if (a <= (-1.04d-76)) then
tmp = t_1
else if (a <= 3.8d-197) then
tmp = x * 2.0d0
else if (a <= 1.36d-148) then
tmp = 27.0d0 * (a * b)
else if (a <= 2.3d-62) then
tmp = x * 2.0d0
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 = a * (27.0 * b);
double tmp;
if (a <= -1.8e+114) {
tmp = t_1;
} else if (a <= -3.4e+71) {
tmp = x * 2.0;
} else if (a <= -1.04e-76) {
tmp = t_1;
} else if (a <= 3.8e-197) {
tmp = x * 2.0;
} else if (a <= 1.36e-148) {
tmp = 27.0 * (a * b);
} else if (a <= 2.3e-62) {
tmp = x * 2.0;
} 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 = a * (27.0 * b) tmp = 0 if a <= -1.8e+114: tmp = t_1 elif a <= -3.4e+71: tmp = x * 2.0 elif a <= -1.04e-76: tmp = t_1 elif a <= 3.8e-197: tmp = x * 2.0 elif a <= 1.36e-148: tmp = 27.0 * (a * b) elif a <= 2.3e-62: tmp = x * 2.0 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(a * Float64(27.0 * b)) tmp = 0.0 if (a <= -1.8e+114) tmp = t_1; elseif (a <= -3.4e+71) tmp = Float64(x * 2.0); elseif (a <= -1.04e-76) tmp = t_1; elseif (a <= 3.8e-197) tmp = Float64(x * 2.0); elseif (a <= 1.36e-148) tmp = Float64(27.0 * Float64(a * b)); elseif (a <= 2.3e-62) tmp = Float64(x * 2.0); 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 = a * (27.0 * b);
tmp = 0.0;
if (a <= -1.8e+114)
tmp = t_1;
elseif (a <= -3.4e+71)
tmp = x * 2.0;
elseif (a <= -1.04e-76)
tmp = t_1;
elseif (a <= 3.8e-197)
tmp = x * 2.0;
elseif (a <= 1.36e-148)
tmp = 27.0 * (a * b);
elseif (a <= 2.3e-62)
tmp = x * 2.0;
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[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.8e+114], t$95$1, If[LessEqual[a, -3.4e+71], N[(x * 2.0), $MachinePrecision], If[LessEqual[a, -1.04e-76], t$95$1, If[LessEqual[a, 3.8e-197], N[(x * 2.0), $MachinePrecision], If[LessEqual[a, 1.36e-148], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 2.3e-62], N[(x * 2.0), $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 := a \cdot \left(27 \cdot b\right)\\
\mathbf{if}\;a \leq -1.8 \cdot 10^{+114}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq -3.4 \cdot 10^{+71}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;a \leq -1.04 \cdot 10^{-76}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 3.8 \cdot 10^{-197}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;a \leq 1.36 \cdot 10^{-148}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;a \leq 2.3 \cdot 10^{-62}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if a < -1.8e114 or -3.3999999999999998e71 < a < -1.04e-76 or 2.3e-62 < a Initial program 96.4%
+-commutative96.4%
associate-*l*96.4%
fma-def96.4%
associate-*l*95.8%
*-commutative95.8%
associate-*l*95.8%
Simplified95.8%
fma-udef95.8%
associate-*r*95.8%
associate-*r*95.8%
*-commutative95.8%
associate-*r*96.4%
*-commutative96.4%
cancel-sign-sub-inv96.4%
distribute-lft-neg-in96.4%
associate-+r+96.4%
associate-*r*96.4%
*-commutative96.4%
associate-*r*95.8%
*-commutative95.8%
associate-*r*95.8%
*-commutative95.8%
distribute-rgt-neg-in95.8%
metadata-eval95.8%
associate-*r*95.8%
*-commutative95.8%
associate-*r*95.8%
Applied egg-rr95.8%
Taylor expanded in a around inf 53.0%
associate-*r*53.1%
*-commutative53.1%
associate-*r*53.1%
Simplified53.1%
if -1.8e114 < a < -3.3999999999999998e71 or -1.04e-76 < a < 3.7999999999999999e-197 or 1.36e-148 < a < 2.3e-62Initial program 93.5%
Taylor expanded in x around inf 48.4%
if 3.7999999999999999e-197 < a < 1.36e-148Initial program 99.7%
Taylor expanded in a around inf 27.9%
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 (+ (+ (* a (* 27.0 b)) (* x 2.0)) (* y (* t (* z -9.0)))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
return ((a * (27.0 * b)) + (x * 2.0)) + (y * (t * (z * -9.0)));
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((a * (27.0d0 * b)) + (x * 2.0d0)) + (y * (t * (z * (-9.0d0))))
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return ((a * (27.0 * b)) + (x * 2.0)) + (y * (t * (z * -9.0)));
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): return ((a * (27.0 * b)) + (x * 2.0)) + (y * (t * (z * -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(Float64(a * Float64(27.0 * b)) + Float64(x * 2.0)) + Float64(y * Float64(t * Float64(z * -9.0)))) end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = ((a * (27.0 * b)) + (x * 2.0)) + (y * (t * (z * -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[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision] + N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\left(a \cdot \left(27 \cdot b\right) + x \cdot 2\right) + y \cdot \left(t \cdot \left(z \cdot -9\right)\right)
\end{array}
Initial program 95.5%
+-commutative95.5%
associate-*l*95.5%
fma-def95.5%
associate-*l*95.0%
*-commutative95.0%
associate-*l*95.0%
Simplified95.0%
fma-udef95.0%
associate-*r*95.0%
associate-*r*95.0%
*-commutative95.0%
associate-*r*95.5%
*-commutative95.5%
cancel-sign-sub-inv95.5%
distribute-lft-neg-in95.5%
associate-+r+95.5%
associate-*r*95.5%
*-commutative95.5%
associate-*r*95.0%
*-commutative95.0%
associate-*r*95.0%
*-commutative95.0%
distribute-rgt-neg-in95.0%
metadata-eval95.0%
associate-*r*94.6%
*-commutative94.6%
associate-*r*94.6%
Applied egg-rr94.6%
Final simplification94.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
(let* ((t_1 (* a (* 27.0 b))) (t_2 (* -9.0 (* y (* z t)))))
(if (<= z -3.7e-31)
t_2
(if (<= z -9e-190)
t_1
(if (<= z 5e-245) (* x 2.0) (if (<= z 6e-82) t_1 t_2))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (27.0 * b);
double t_2 = -9.0 * (y * (z * t));
double tmp;
if (z <= -3.7e-31) {
tmp = t_2;
} else if (z <= -9e-190) {
tmp = t_1;
} else if (z <= 5e-245) {
tmp = x * 2.0;
} else if (z <= 6e-82) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = a * (27.0d0 * b)
t_2 = (-9.0d0) * (y * (z * t))
if (z <= (-3.7d-31)) then
tmp = t_2
else if (z <= (-9d-190)) then
tmp = t_1
else if (z <= 5d-245) then
tmp = x * 2.0d0
else if (z <= 6d-82) then
tmp = t_1
else
tmp = t_2
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (27.0 * b);
double t_2 = -9.0 * (y * (z * t));
double tmp;
if (z <= -3.7e-31) {
tmp = t_2;
} else if (z <= -9e-190) {
tmp = t_1;
} else if (z <= 5e-245) {
tmp = x * 2.0;
} else if (z <= 6e-82) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = a * (27.0 * b) t_2 = -9.0 * (y * (z * t)) tmp = 0 if z <= -3.7e-31: tmp = t_2 elif z <= -9e-190: tmp = t_1 elif z <= 5e-245: tmp = x * 2.0 elif z <= 6e-82: tmp = t_1 else: tmp = t_2 return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(27.0 * b)) t_2 = Float64(-9.0 * Float64(y * Float64(z * t))) tmp = 0.0 if (z <= -3.7e-31) tmp = t_2; elseif (z <= -9e-190) tmp = t_1; elseif (z <= 5e-245) tmp = Float64(x * 2.0); elseif (z <= 6e-82) tmp = t_1; else tmp = t_2; end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = a * (27.0 * b);
t_2 = -9.0 * (y * (z * t));
tmp = 0.0;
if (z <= -3.7e-31)
tmp = t_2;
elseif (z <= -9e-190)
tmp = t_1;
elseif (z <= 5e-245)
tmp = x * 2.0;
elseif (z <= 6e-82)
tmp = t_1;
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -3.7e-31], t$95$2, If[LessEqual[z, -9e-190], t$95$1, If[LessEqual[z, 5e-245], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, 6e-82], t$95$1, t$95$2]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := a \cdot \left(27 \cdot b\right)\\
t_2 := -9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{if}\;z \leq -3.7 \cdot 10^{-31}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -9 \cdot 10^{-190}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 5 \cdot 10^{-245}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-82}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -3.6999999999999998e-31 or 5.9999999999999998e-82 < z Initial program 93.8%
Taylor expanded in y around inf 48.5%
if -3.6999999999999998e-31 < z < -9.00000000000000042e-190 or 4.9999999999999997e-245 < z < 5.9999999999999998e-82Initial program 97.5%
+-commutative97.5%
associate-*l*97.6%
fma-def97.6%
associate-*l*99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
fma-udef99.8%
associate-*r*99.7%
associate-*r*99.8%
*-commutative99.8%
associate-*r*97.5%
*-commutative97.5%
cancel-sign-sub-inv97.5%
distribute-lft-neg-in97.5%
associate-+r+97.5%
associate-*r*97.6%
*-commutative97.6%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.9%
Applied egg-rr99.9%
Taylor expanded in a around inf 45.0%
associate-*r*44.9%
*-commutative44.9%
associate-*r*45.0%
Simplified45.0%
if -9.00000000000000042e-190 < z < 4.9999999999999997e-245Initial program 99.7%
Taylor expanded in x around inf 45.4%
Final simplification47.3%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* a (* 27.0 b))))
(if (<= z -5e-31)
(* (* z t) (* y -9.0))
(if (<= z -9e-190)
t_1
(if (<= z 3.3e-240)
(* x 2.0)
(if (<= z 8e-82) t_1 (* -9.0 (* y (* z t)))))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (27.0 * b);
double tmp;
if (z <= -5e-31) {
tmp = (z * t) * (y * -9.0);
} else if (z <= -9e-190) {
tmp = t_1;
} else if (z <= 3.3e-240) {
tmp = x * 2.0;
} else if (z <= 8e-82) {
tmp = t_1;
} else {
tmp = -9.0 * (y * (z * t));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = a * (27.0d0 * b)
if (z <= (-5d-31)) then
tmp = (z * t) * (y * (-9.0d0))
else if (z <= (-9d-190)) then
tmp = t_1
else if (z <= 3.3d-240) then
tmp = x * 2.0d0
else if (z <= 8d-82) then
tmp = t_1
else
tmp = (-9.0d0) * (y * (z * t))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = a * (27.0 * b);
double tmp;
if (z <= -5e-31) {
tmp = (z * t) * (y * -9.0);
} else if (z <= -9e-190) {
tmp = t_1;
} else if (z <= 3.3e-240) {
tmp = x * 2.0;
} else if (z <= 8e-82) {
tmp = t_1;
} else {
tmp = -9.0 * (y * (z * t));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = a * (27.0 * b) tmp = 0 if z <= -5e-31: tmp = (z * t) * (y * -9.0) elif z <= -9e-190: tmp = t_1 elif z <= 3.3e-240: tmp = x * 2.0 elif z <= 8e-82: tmp = t_1 else: tmp = -9.0 * (y * (z * t)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(a * Float64(27.0 * b)) tmp = 0.0 if (z <= -5e-31) tmp = Float64(Float64(z * t) * Float64(y * -9.0)); elseif (z <= -9e-190) tmp = t_1; elseif (z <= 3.3e-240) tmp = Float64(x * 2.0); elseif (z <= 8e-82) tmp = t_1; else tmp = Float64(-9.0 * Float64(y * Float64(z * t))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = a * (27.0 * b);
tmp = 0.0;
if (z <= -5e-31)
tmp = (z * t) * (y * -9.0);
elseif (z <= -9e-190)
tmp = t_1;
elseif (z <= 3.3e-240)
tmp = x * 2.0;
elseif (z <= 8e-82)
tmp = t_1;
else
tmp = -9.0 * (y * (z * t));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -5e-31], N[(N[(z * t), $MachinePrecision] * N[(y * -9.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -9e-190], t$95$1, If[LessEqual[z, 3.3e-240], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, 8e-82], t$95$1, N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := a \cdot \left(27 \cdot b\right)\\
\mathbf{if}\;z \leq -5 \cdot 10^{-31}:\\
\;\;\;\;\left(z \cdot t\right) \cdot \left(y \cdot -9\right)\\
\mathbf{elif}\;z \leq -9 \cdot 10^{-190}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 3.3 \cdot 10^{-240}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-82}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if z < -5e-31Initial program 89.4%
Taylor expanded in y around inf 43.8%
*-commutative43.8%
*-commutative43.8%
*-commutative43.8%
associate-*l*43.8%
*-commutative43.8%
Simplified43.8%
if -5e-31 < z < -9.00000000000000042e-190 or 3.3000000000000002e-240 < z < 8e-82Initial program 97.5%
+-commutative97.5%
associate-*l*97.6%
fma-def97.6%
associate-*l*99.8%
*-commutative99.8%
associate-*l*99.8%
Simplified99.8%
fma-udef99.8%
associate-*r*99.7%
associate-*r*99.8%
*-commutative99.8%
associate-*r*97.5%
*-commutative97.5%
cancel-sign-sub-inv97.5%
distribute-lft-neg-in97.5%
associate-+r+97.5%
associate-*r*97.6%
*-commutative97.6%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.8%
*-commutative99.8%
distribute-rgt-neg-in99.8%
metadata-eval99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.9%
Applied egg-rr99.9%
Taylor expanded in a around inf 45.0%
associate-*r*44.9%
*-commutative44.9%
associate-*r*45.0%
Simplified45.0%
if -9.00000000000000042e-190 < z < 3.3000000000000002e-240Initial program 99.7%
Taylor expanded in x around inf 45.4%
if 8e-82 < z Initial program 96.8%
Taylor expanded in y around inf 51.7%
Final simplification47.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 (or (<= y -1.22e+78) (not (<= y 5.8e-152))) (+ (* x 2.0) (* -9.0 (* t (* y z)))) (- (* x 2.0) (* a (* b -27.0)))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.22e+78) || !(y <= 5.8e-152)) {
tmp = (x * 2.0) + (-9.0 * (t * (y * z)));
} else {
tmp = (x * 2.0) - (a * (b * -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 ((y <= (-1.22d+78)) .or. (.not. (y <= 5.8d-152))) then
tmp = (x * 2.0d0) + ((-9.0d0) * (t * (y * z)))
else
tmp = (x * 2.0d0) - (a * (b * (-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 ((y <= -1.22e+78) || !(y <= 5.8e-152)) {
tmp = (x * 2.0) + (-9.0 * (t * (y * z)));
} else {
tmp = (x * 2.0) - (a * (b * -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 (y <= -1.22e+78) or not (y <= 5.8e-152): tmp = (x * 2.0) + (-9.0 * (t * (y * z))) else: tmp = (x * 2.0) - (a * (b * -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 ((y <= -1.22e+78) || !(y <= 5.8e-152)) tmp = Float64(Float64(x * 2.0) + Float64(-9.0 * Float64(t * Float64(y * z)))); else tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -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 ((y <= -1.22e+78) || ~((y <= 5.8e-152)))
tmp = (x * 2.0) + (-9.0 * (t * (y * z)));
else
tmp = (x * 2.0) - (a * (b * -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[Or[LessEqual[y, -1.22e+78], N[Not[LessEqual[y, 5.8e-152]], $MachinePrecision]], N[(N[(x * 2.0), $MachinePrecision] + N[(-9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -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}\;y \leq -1.22 \cdot 10^{+78} \lor \neg \left(y \leq 5.8 \cdot 10^{-152}\right):\\
\;\;\;\;x \cdot 2 + -9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\end{array}
\end{array}
if y < -1.22000000000000006e78 or 5.8000000000000003e-152 < y Initial program 93.0%
Taylor expanded in a around 0 71.9%
cancel-sign-sub-inv71.9%
metadata-eval71.9%
*-commutative71.9%
associate-*r*68.2%
Applied egg-rr68.2%
if -1.22000000000000006e78 < y < 5.8000000000000003e-152Initial program 98.0%
associate-+l-98.0%
sub-neg98.0%
neg-mul-198.0%
metadata-eval98.0%
metadata-eval98.0%
cancel-sign-sub-inv98.0%
metadata-eval98.0%
*-lft-identity98.0%
associate-*l*91.9%
associate-*l*91.8%
Simplified91.8%
Taylor expanded in y around 0 78.4%
*-commutative78.4%
Simplified78.4%
Taylor expanded in a around 0 78.4%
*-commutative78.4%
associate-*l*78.4%
Simplified78.4%
Final simplification73.4%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= y -9.1e+77)
(- (* x 2.0) (* 9.0 (* y (* z t))))
(if (<= y 3.4e-152)
(- (* x 2.0) (* a (* b -27.0)))
(+ (* x 2.0) (* -9.0 (* t (* y z)))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -9.1e+77) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else if (y <= 3.4e-152) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = (x * 2.0) + (-9.0 * (t * (y * z)));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (y <= (-9.1d+77)) then
tmp = (x * 2.0d0) - (9.0d0 * (y * (z * t)))
else if (y <= 3.4d-152) then
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
else
tmp = (x * 2.0d0) + ((-9.0d0) * (t * (y * z)))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y <= -9.1e+77) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else if (y <= 3.4e-152) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = (x * 2.0) + (-9.0 * (t * (y * z)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if y <= -9.1e+77: tmp = (x * 2.0) - (9.0 * (y * (z * t))) elif y <= 3.4e-152: tmp = (x * 2.0) - (a * (b * -27.0)) else: tmp = (x * 2.0) + (-9.0 * (t * (y * z))) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (y <= -9.1e+77) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))); elseif (y <= 3.4e-152) tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); else tmp = Float64(Float64(x * 2.0) + Float64(-9.0 * Float64(t * Float64(y * z)))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (y <= -9.1e+77)
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
elseif (y <= 3.4e-152)
tmp = (x * 2.0) - (a * (b * -27.0));
else
tmp = (x * 2.0) + (-9.0 * (t * (y * z)));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[y, -9.1e+77], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[y, 3.4e-152], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(-9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -9.1 \cdot 10^{+77}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;y \leq 3.4 \cdot 10^{-152}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + -9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if y < -9.10000000000000014e77Initial program 93.4%
Taylor expanded in a around 0 76.3%
if -9.10000000000000014e77 < y < 3.39999999999999984e-152Initial program 98.0%
associate-+l-98.0%
sub-neg98.0%
neg-mul-198.0%
metadata-eval98.0%
metadata-eval98.0%
cancel-sign-sub-inv98.0%
metadata-eval98.0%
*-lft-identity98.0%
associate-*l*91.9%
associate-*l*91.8%
Simplified91.8%
Taylor expanded in y around 0 78.4%
*-commutative78.4%
Simplified78.4%
Taylor expanded in a around 0 78.4%
*-commutative78.4%
associate-*l*78.4%
Simplified78.4%
if 3.39999999999999984e-152 < y Initial program 92.7%
Taylor expanded in a around 0 69.4%
cancel-sign-sub-inv69.4%
metadata-eval69.4%
*-commutative69.4%
associate-*r*66.0%
Applied egg-rr66.0%
Final simplification74.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 (or (<= z -2.1e+33) (not (<= z 1050000000000.0))) (* (* z t) (* y -9.0)) (- (* x 2.0) (* a (* b -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 <= -2.1e+33) || !(z <= 1050000000000.0)) {
tmp = (z * t) * (y * -9.0);
} else {
tmp = (x * 2.0) - (a * (b * -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 <= (-2.1d+33)) .or. (.not. (z <= 1050000000000.0d0))) then
tmp = (z * t) * (y * (-9.0d0))
else
tmp = (x * 2.0d0) - (a * (b * (-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 <= -2.1e+33) || !(z <= 1050000000000.0)) {
tmp = (z * t) * (y * -9.0);
} else {
tmp = (x * 2.0) - (a * (b * -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 <= -2.1e+33) or not (z <= 1050000000000.0): tmp = (z * t) * (y * -9.0) else: tmp = (x * 2.0) - (a * (b * -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 <= -2.1e+33) || !(z <= 1050000000000.0)) tmp = Float64(Float64(z * t) * Float64(y * -9.0)); else tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -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 <= -2.1e+33) || ~((z <= 1050000000000.0)))
tmp = (z * t) * (y * -9.0);
else
tmp = (x * 2.0) - (a * (b * -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[Or[LessEqual[z, -2.1e+33], N[Not[LessEqual[z, 1050000000000.0]], $MachinePrecision]], N[(N[(z * t), $MachinePrecision] * N[(y * -9.0), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -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.1 \cdot 10^{+33} \lor \neg \left(z \leq 1050000000000\right):\\
\;\;\;\;\left(z \cdot t\right) \cdot \left(y \cdot -9\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\end{array}
\end{array}
if z < -2.1000000000000001e33 or 1.05e12 < z Initial program 92.6%
Taylor expanded in y around inf 50.5%
*-commutative50.5%
*-commutative50.5%
*-commutative50.5%
associate-*l*50.5%
*-commutative50.5%
Simplified50.5%
if -2.1000000000000001e33 < z < 1.05e12Initial program 98.0%
associate-+l-98.0%
sub-neg98.0%
neg-mul-198.0%
metadata-eval98.0%
metadata-eval98.0%
cancel-sign-sub-inv98.0%
metadata-eval98.0%
*-lft-identity98.0%
associate-*l*99.1%
associate-*l*99.1%
Simplified99.1%
Taylor expanded in y around 0 80.8%
*-commutative80.8%
Simplified80.8%
Taylor expanded in a around 0 80.8%
*-commutative80.8%
associate-*l*80.8%
Simplified80.8%
Final simplification66.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 (* x 2.0))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * 2.0d0
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): return x * 2.0
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) return Float64(x * 2.0) end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = x * 2.0;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(x * 2.0), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
x \cdot 2
\end{array}
Initial program 95.5%
Taylor expanded in x around inf 30.2%
Final simplification30.2%
(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 2023258
(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)))