
(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 13 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.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* a 27.0) b)))
(if (<= z -5e-36)
(fma x 2.0 (fma z (* y (* t -9.0)) t_1))
(+ t_1 (- (* x 2.0) (* t (* z (* y 9.0))))))))assert(y < z && z < t);
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-36) {
tmp = fma(x, 2.0, fma(z, (y * (t * -9.0)), t_1));
} else {
tmp = t_1 + ((x * 2.0) - (t * (z * (y * 9.0))));
}
return tmp;
}
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * 27.0) * b) tmp = 0.0 if (z <= -5e-36) tmp = fma(x, 2.0, fma(z, Float64(y * Float64(t * -9.0)), t_1)); else tmp = Float64(t_1 + Float64(Float64(x * 2.0) - Float64(t * Float64(z * Float64(y * 9.0))))); end return tmp end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[z, -5e-36], N[(x * 2.0 + N[(z * N[(y * N[(t * -9.0), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(z * N[(y * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := \left(a \cdot 27\right) \cdot b\\
\mathbf{if}\;z \leq -5 \cdot 10^{-36}:\\
\;\;\;\;\mathsf{fma}\left(x, 2, \mathsf{fma}\left(z, y \cdot \left(t \cdot -9\right), t_1\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - t \cdot \left(z \cdot \left(y \cdot 9\right)\right)\right)\\
\end{array}
\end{array}
if z < -5.00000000000000004e-36Initial program 90.5%
+-commutative90.5%
associate-+r-90.5%
cancel-sign-sub-inv90.5%
*-commutative90.5%
distribute-rgt-neg-out90.5%
associate-*r*95.7%
*-commutative95.7%
distribute-rgt-neg-in95.7%
associate-+r+95.7%
sub-neg95.7%
+-commutative95.7%
associate-+l-95.7%
fma-neg95.7%
associate-*l*89.3%
fma-neg92.1%
*-commutative92.1%
fma-neg89.3%
Simplified98.5%
if -5.00000000000000004e-36 < z Initial program 97.2%
Final simplification97.6%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 2e-54) (+ (- (* x 2.0) (* (* y 9.0) (* z t))) (* a (* 27.0 b))) (+ (* (* a 27.0) b) (- (* x 2.0) (* t (* z (* y 9.0)))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 2e-54) {
tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
} else {
tmp = ((a * 27.0) * b) + ((x * 2.0) - (t * (z * (y * 9.0))));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= 2d-54) then
tmp = ((x * 2.0d0) - ((y * 9.0d0) * (z * t))) + (a * (27.0d0 * b))
else
tmp = ((a * 27.0d0) * b) + ((x * 2.0d0) - (t * (z * (y * 9.0d0))))
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 2e-54) {
tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
} else {
tmp = ((a * 27.0) * b) + ((x * 2.0) - (t * (z * (y * 9.0))));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= 2e-54: tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b)) else: tmp = ((a * 27.0) * b) + ((x * 2.0) - (t * (z * (y * 9.0)))) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 2e-54) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(y * 9.0) * Float64(z * t))) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(Float64(a * 27.0) * b) + Float64(Float64(x * 2.0) - Float64(t * Float64(z * Float64(y * 9.0))))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= 2e-54)
tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
else
tmp = ((a * 27.0) * b) + ((x * 2.0) - (t * (z * (y * 9.0))));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 2e-54], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(z * N[(y * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 2 \cdot 10^{-54}:\\
\;\;\;\;\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - t \cdot \left(z \cdot \left(y \cdot 9\right)\right)\right)\\
\end{array}
\end{array}
if z < 2.0000000000000001e-54Initial program 94.3%
sub-neg94.3%
distribute-lft-neg-in94.3%
associate-*l*94.9%
*-commutative94.9%
*-commutative94.9%
cancel-sign-sub-inv94.9%
*-commutative94.9%
*-commutative94.9%
associate-*l*94.3%
associate-*l*94.4%
associate-*l*94.9%
Simplified94.9%
if 2.0000000000000001e-54 < z Initial program 97.4%
Final simplification95.7%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* t (* -9.0 (* z y)))) (t_2 (* 27.0 (* a b))))
(if (<= x -5.5e+102)
(* x 2.0)
(if (<= x -8e-158)
t_2
(if (<= x -5.5e-242)
t_1
(if (<= x 1.02e-229)
t_2
(if (<= x 3.5e-153) t_1 (if (<= x 2.4e-36) t_2 (* x 2.0)))))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t * (-9.0 * (z * y));
double t_2 = 27.0 * (a * b);
double tmp;
if (x <= -5.5e+102) {
tmp = x * 2.0;
} else if (x <= -8e-158) {
tmp = t_2;
} else if (x <= -5.5e-242) {
tmp = t_1;
} else if (x <= 1.02e-229) {
tmp = t_2;
} else if (x <= 3.5e-153) {
tmp = t_1;
} else if (x <= 2.4e-36) {
tmp = t_2;
} else {
tmp = x * 2.0;
}
return tmp;
}
NOTE: y, z, and t 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 = t * ((-9.0d0) * (z * y))
t_2 = 27.0d0 * (a * b)
if (x <= (-5.5d+102)) then
tmp = x * 2.0d0
else if (x <= (-8d-158)) then
tmp = t_2
else if (x <= (-5.5d-242)) then
tmp = t_1
else if (x <= 1.02d-229) then
tmp = t_2
else if (x <= 3.5d-153) then
tmp = t_1
else if (x <= 2.4d-36) then
tmp = t_2
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = t * (-9.0 * (z * y));
double t_2 = 27.0 * (a * b);
double tmp;
if (x <= -5.5e+102) {
tmp = x * 2.0;
} else if (x <= -8e-158) {
tmp = t_2;
} else if (x <= -5.5e-242) {
tmp = t_1;
} else if (x <= 1.02e-229) {
tmp = t_2;
} else if (x <= 3.5e-153) {
tmp = t_1;
} else if (x <= 2.4e-36) {
tmp = t_2;
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = t * (-9.0 * (z * y)) t_2 = 27.0 * (a * b) tmp = 0 if x <= -5.5e+102: tmp = x * 2.0 elif x <= -8e-158: tmp = t_2 elif x <= -5.5e-242: tmp = t_1 elif x <= 1.02e-229: tmp = t_2 elif x <= 3.5e-153: tmp = t_1 elif x <= 2.4e-36: tmp = t_2 else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(t * Float64(-9.0 * Float64(z * y))) t_2 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (x <= -5.5e+102) tmp = Float64(x * 2.0); elseif (x <= -8e-158) tmp = t_2; elseif (x <= -5.5e-242) tmp = t_1; elseif (x <= 1.02e-229) tmp = t_2; elseif (x <= 3.5e-153) tmp = t_1; elseif (x <= 2.4e-36) tmp = t_2; else tmp = Float64(x * 2.0); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = t * (-9.0 * (z * y));
t_2 = 27.0 * (a * b);
tmp = 0.0;
if (x <= -5.5e+102)
tmp = x * 2.0;
elseif (x <= -8e-158)
tmp = t_2;
elseif (x <= -5.5e-242)
tmp = t_1;
elseif (x <= 1.02e-229)
tmp = t_2;
elseif (x <= 3.5e-153)
tmp = t_1;
elseif (x <= 2.4e-36)
tmp = t_2;
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.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(t * N[(-9.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -5.5e+102], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, -8e-158], t$95$2, If[LessEqual[x, -5.5e-242], t$95$1, If[LessEqual[x, 1.02e-229], t$95$2, If[LessEqual[x, 3.5e-153], t$95$1, If[LessEqual[x, 2.4e-36], t$95$2, N[(x * 2.0), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := t \cdot \left(-9 \cdot \left(z \cdot y\right)\right)\\
t_2 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;x \leq -5.5 \cdot 10^{+102}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -8 \cdot 10^{-158}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -5.5 \cdot 10^{-242}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.02 \cdot 10^{-229}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 3.5 \cdot 10^{-153}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-36}:\\
\;\;\;\;t_2\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -5.49999999999999981e102 or 2.4e-36 < x Initial program 95.6%
sub-neg95.6%
distribute-lft-neg-in95.6%
associate-*l*95.6%
*-commutative95.6%
*-commutative95.6%
cancel-sign-sub-inv95.6%
*-commutative95.6%
*-commutative95.6%
associate-*l*95.6%
associate-*l*94.8%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in x around inf 57.7%
if -5.49999999999999981e102 < x < -8.00000000000000052e-158 or -5.4999999999999998e-242 < x < 1.02e-229 or 3.49999999999999981e-153 < x < 2.4e-36Initial program 94.2%
sub-neg94.2%
distribute-lft-neg-in94.2%
associate-*l*95.1%
*-commutative95.1%
*-commutative95.1%
cancel-sign-sub-inv95.1%
*-commutative95.1%
*-commutative95.1%
associate-*l*94.2%
associate-*l*92.5%
associate-*l*93.4%
Simplified93.4%
Taylor expanded in a around inf 58.6%
if -8.00000000000000052e-158 < x < -5.4999999999999998e-242 or 1.02e-229 < x < 3.49999999999999981e-153Initial program 97.4%
sub-neg97.4%
distribute-lft-neg-in97.4%
associate-*l*97.2%
*-commutative97.2%
*-commutative97.2%
cancel-sign-sub-inv97.2%
*-commutative97.2%
*-commutative97.2%
associate-*l*97.4%
associate-*l*97.2%
associate-*l*97.2%
Simplified97.2%
Taylor expanded in y around inf 63.0%
*-commutative63.0%
associate-*r*58.1%
associate-*r*58.2%
associate-*l*63.0%
Simplified63.0%
Taylor expanded in y around 0 63.0%
associate-*r*62.9%
*-commutative62.9%
associate-*r*63.0%
associate-*l*62.9%
*-commutative62.9%
associate-*l*62.9%
Simplified62.9%
Final simplification58.9%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* 27.0 (* a b))))
(if (<= x -1.15e+91)
(* x 2.0)
(if (<= x -1.2e-156)
t_1
(if (<= x -1.45e-242)
(* t (* y (* z -9.0)))
(if (<= x 4.6e-229)
t_1
(if (<= x 5.8e-151)
(* t (* -9.0 (* z y)))
(if (<= x 2.4e-36) t_1 (* x 2.0)))))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double tmp;
if (x <= -1.15e+91) {
tmp = x * 2.0;
} else if (x <= -1.2e-156) {
tmp = t_1;
} else if (x <= -1.45e-242) {
tmp = t * (y * (z * -9.0));
} else if (x <= 4.6e-229) {
tmp = t_1;
} else if (x <= 5.8e-151) {
tmp = t * (-9.0 * (z * y));
} else if (x <= 2.4e-36) {
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.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = 27.0d0 * (a * b)
if (x <= (-1.15d+91)) then
tmp = x * 2.0d0
else if (x <= (-1.2d-156)) then
tmp = t_1
else if (x <= (-1.45d-242)) then
tmp = t * (y * (z * (-9.0d0)))
else if (x <= 4.6d-229) then
tmp = t_1
else if (x <= 5.8d-151) then
tmp = t * ((-9.0d0) * (z * y))
else if (x <= 2.4d-36) then
tmp = t_1
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double tmp;
if (x <= -1.15e+91) {
tmp = x * 2.0;
} else if (x <= -1.2e-156) {
tmp = t_1;
} else if (x <= -1.45e-242) {
tmp = t * (y * (z * -9.0));
} else if (x <= 4.6e-229) {
tmp = t_1;
} else if (x <= 5.8e-151) {
tmp = t * (-9.0 * (z * y));
} else if (x <= 2.4e-36) {
tmp = t_1;
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = 27.0 * (a * b) tmp = 0 if x <= -1.15e+91: tmp = x * 2.0 elif x <= -1.2e-156: tmp = t_1 elif x <= -1.45e-242: tmp = t * (y * (z * -9.0)) elif x <= 4.6e-229: tmp = t_1 elif x <= 5.8e-151: tmp = t * (-9.0 * (z * y)) elif x <= 2.4e-36: tmp = t_1 else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (x <= -1.15e+91) tmp = Float64(x * 2.0); elseif (x <= -1.2e-156) tmp = t_1; elseif (x <= -1.45e-242) tmp = Float64(t * Float64(y * Float64(z * -9.0))); elseif (x <= 4.6e-229) tmp = t_1; elseif (x <= 5.8e-151) tmp = Float64(t * Float64(-9.0 * Float64(z * y))); elseif (x <= 2.4e-36) tmp = t_1; else tmp = Float64(x * 2.0); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = 27.0 * (a * b);
tmp = 0.0;
if (x <= -1.15e+91)
tmp = x * 2.0;
elseif (x <= -1.2e-156)
tmp = t_1;
elseif (x <= -1.45e-242)
tmp = t * (y * (z * -9.0));
elseif (x <= 4.6e-229)
tmp = t_1;
elseif (x <= 5.8e-151)
tmp = t * (-9.0 * (z * y));
elseif (x <= 2.4e-36)
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.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -1.15e+91], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, -1.2e-156], t$95$1, If[LessEqual[x, -1.45e-242], N[(t * N[(y * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 4.6e-229], t$95$1, If[LessEqual[x, 5.8e-151], N[(t * N[(-9.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.4e-36], t$95$1, N[(x * 2.0), $MachinePrecision]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;x \leq -1.15 \cdot 10^{+91}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -1.2 \cdot 10^{-156}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -1.45 \cdot 10^{-242}:\\
\;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
\mathbf{elif}\;x \leq 4.6 \cdot 10^{-229}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 5.8 \cdot 10^{-151}:\\
\;\;\;\;t \cdot \left(-9 \cdot \left(z \cdot y\right)\right)\\
\mathbf{elif}\;x \leq 2.4 \cdot 10^{-36}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -1.14999999999999996e91 or 2.4e-36 < x Initial program 95.6%
sub-neg95.6%
distribute-lft-neg-in95.6%
associate-*l*95.6%
*-commutative95.6%
*-commutative95.6%
cancel-sign-sub-inv95.6%
*-commutative95.6%
*-commutative95.6%
associate-*l*95.6%
associate-*l*94.8%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in x around inf 57.7%
if -1.14999999999999996e91 < x < -1.2e-156 or -1.45e-242 < x < 4.59999999999999992e-229 or 5.80000000000000025e-151 < x < 2.4e-36Initial program 94.2%
sub-neg94.2%
distribute-lft-neg-in94.2%
associate-*l*95.1%
*-commutative95.1%
*-commutative95.1%
cancel-sign-sub-inv95.1%
*-commutative95.1%
*-commutative95.1%
associate-*l*94.2%
associate-*l*92.5%
associate-*l*93.4%
Simplified93.4%
Taylor expanded in a around inf 58.6%
if -1.2e-156 < x < -1.45e-242Initial program 99.8%
sub-neg99.8%
distribute-lft-neg-in99.8%
associate-*l*99.6%
*-commutative99.6%
*-commutative99.6%
cancel-sign-sub-inv99.6%
*-commutative99.6%
*-commutative99.6%
associate-*l*99.8%
associate-*l*99.6%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in y around inf 67.7%
*-commutative67.7%
associate-*r*58.7%
associate-*r*58.7%
*-commutative58.7%
associate-*l*67.6%
Simplified67.6%
if 4.59999999999999992e-229 < x < 5.80000000000000025e-151Initial program 94.6%
sub-neg94.6%
distribute-lft-neg-in94.6%
associate-*l*94.5%
*-commutative94.5%
*-commutative94.5%
cancel-sign-sub-inv94.5%
*-commutative94.5%
*-commutative94.5%
associate-*l*94.6%
associate-*l*94.3%
associate-*l*94.3%
Simplified94.3%
Taylor expanded in y around inf 57.4%
*-commutative57.4%
associate-*r*57.4%
associate-*r*57.6%
associate-*l*57.5%
Simplified57.5%
Taylor expanded in y around 0 57.4%
associate-*r*57.3%
*-commutative57.3%
associate-*r*57.5%
associate-*l*57.4%
*-commutative57.4%
associate-*l*57.4%
Simplified57.4%
Final simplification58.9%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* 27.0 (* a b))))
(if (<= x -7.4e+102)
(* x 2.0)
(if (<= x -8.5e-156)
t_1
(if (<= x -3.8e-242)
(* t (* y (* z -9.0)))
(if (<= x 7.4e-230)
t_1
(if (<= x 4.1e-151)
(* t (* z (* y -9.0)))
(if (<= x 2.2e-36) t_1 (* x 2.0)))))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double tmp;
if (x <= -7.4e+102) {
tmp = x * 2.0;
} else if (x <= -8.5e-156) {
tmp = t_1;
} else if (x <= -3.8e-242) {
tmp = t * (y * (z * -9.0));
} else if (x <= 7.4e-230) {
tmp = t_1;
} else if (x <= 4.1e-151) {
tmp = t * (z * (y * -9.0));
} else if (x <= 2.2e-36) {
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.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = 27.0d0 * (a * b)
if (x <= (-7.4d+102)) then
tmp = x * 2.0d0
else if (x <= (-8.5d-156)) then
tmp = t_1
else if (x <= (-3.8d-242)) then
tmp = t * (y * (z * (-9.0d0)))
else if (x <= 7.4d-230) then
tmp = t_1
else if (x <= 4.1d-151) then
tmp = t * (z * (y * (-9.0d0)))
else if (x <= 2.2d-36) then
tmp = t_1
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double tmp;
if (x <= -7.4e+102) {
tmp = x * 2.0;
} else if (x <= -8.5e-156) {
tmp = t_1;
} else if (x <= -3.8e-242) {
tmp = t * (y * (z * -9.0));
} else if (x <= 7.4e-230) {
tmp = t_1;
} else if (x <= 4.1e-151) {
tmp = t * (z * (y * -9.0));
} else if (x <= 2.2e-36) {
tmp = t_1;
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = 27.0 * (a * b) tmp = 0 if x <= -7.4e+102: tmp = x * 2.0 elif x <= -8.5e-156: tmp = t_1 elif x <= -3.8e-242: tmp = t * (y * (z * -9.0)) elif x <= 7.4e-230: tmp = t_1 elif x <= 4.1e-151: tmp = t * (z * (y * -9.0)) elif x <= 2.2e-36: tmp = t_1 else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (x <= -7.4e+102) tmp = Float64(x * 2.0); elseif (x <= -8.5e-156) tmp = t_1; elseif (x <= -3.8e-242) tmp = Float64(t * Float64(y * Float64(z * -9.0))); elseif (x <= 7.4e-230) tmp = t_1; elseif (x <= 4.1e-151) tmp = Float64(t * Float64(z * Float64(y * -9.0))); elseif (x <= 2.2e-36) tmp = t_1; else tmp = Float64(x * 2.0); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = 27.0 * (a * b);
tmp = 0.0;
if (x <= -7.4e+102)
tmp = x * 2.0;
elseif (x <= -8.5e-156)
tmp = t_1;
elseif (x <= -3.8e-242)
tmp = t * (y * (z * -9.0));
elseif (x <= 7.4e-230)
tmp = t_1;
elseif (x <= 4.1e-151)
tmp = t * (z * (y * -9.0));
elseif (x <= 2.2e-36)
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.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.4e+102], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, -8.5e-156], t$95$1, If[LessEqual[x, -3.8e-242], N[(t * N[(y * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 7.4e-230], t$95$1, If[LessEqual[x, 4.1e-151], N[(t * N[(z * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, 2.2e-36], t$95$1, N[(x * 2.0), $MachinePrecision]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;x \leq -7.4 \cdot 10^{+102}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -8.5 \cdot 10^{-156}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq -3.8 \cdot 10^{-242}:\\
\;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right)\\
\mathbf{elif}\;x \leq 7.4 \cdot 10^{-230}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 4.1 \cdot 10^{-151}:\\
\;\;\;\;t \cdot \left(z \cdot \left(y \cdot -9\right)\right)\\
\mathbf{elif}\;x \leq 2.2 \cdot 10^{-36}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -7.40000000000000045e102 or 2.1999999999999999e-36 < x Initial program 95.6%
sub-neg95.6%
distribute-lft-neg-in95.6%
associate-*l*95.6%
*-commutative95.6%
*-commutative95.6%
cancel-sign-sub-inv95.6%
*-commutative95.6%
*-commutative95.6%
associate-*l*95.6%
associate-*l*94.8%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in x around inf 57.7%
if -7.40000000000000045e102 < x < -8.5e-156 or -3.8000000000000002e-242 < x < 7.39999999999999963e-230 or 4.1000000000000001e-151 < x < 2.1999999999999999e-36Initial program 94.2%
sub-neg94.2%
distribute-lft-neg-in94.2%
associate-*l*95.1%
*-commutative95.1%
*-commutative95.1%
cancel-sign-sub-inv95.1%
*-commutative95.1%
*-commutative95.1%
associate-*l*94.2%
associate-*l*92.5%
associate-*l*93.4%
Simplified93.4%
Taylor expanded in a around inf 58.6%
if -8.5e-156 < x < -3.8000000000000002e-242Initial program 99.8%
sub-neg99.8%
distribute-lft-neg-in99.8%
associate-*l*99.6%
*-commutative99.6%
*-commutative99.6%
cancel-sign-sub-inv99.6%
*-commutative99.6%
*-commutative99.6%
associate-*l*99.8%
associate-*l*99.6%
associate-*l*99.7%
Simplified99.7%
Taylor expanded in y around inf 67.7%
*-commutative67.7%
associate-*r*58.7%
associate-*r*58.7%
*-commutative58.7%
associate-*l*67.6%
Simplified67.6%
if 7.39999999999999963e-230 < x < 4.1000000000000001e-151Initial program 94.6%
sub-neg94.6%
distribute-lft-neg-in94.6%
associate-*l*94.5%
*-commutative94.5%
*-commutative94.5%
cancel-sign-sub-inv94.5%
*-commutative94.5%
*-commutative94.5%
associate-*l*94.6%
associate-*l*94.3%
associate-*l*94.3%
Simplified94.3%
Taylor expanded in y around inf 57.4%
*-commutative57.4%
associate-*r*57.4%
associate-*r*57.6%
*-commutative57.6%
associate-*l*57.4%
Simplified57.4%
Taylor expanded in y around 0 57.4%
associate-*r*57.5%
Simplified57.5%
Final simplification58.9%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* 27.0 (* a b)))
(t_2 (* 9.0 (* y (* z t))))
(t_3 (- (* x 2.0) t_2)))
(if (<= x -5.2e+115)
t_3
(if (<= x 3.8e+26)
(- t_1 t_2)
(if (<= x 9.5e+129) (+ (* x 2.0) t_1) t_3)))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double t_2 = 9.0 * (y * (z * t));
double t_3 = (x * 2.0) - t_2;
double tmp;
if (x <= -5.2e+115) {
tmp = t_3;
} else if (x <= 3.8e+26) {
tmp = t_1 - t_2;
} else if (x <= 9.5e+129) {
tmp = (x * 2.0) + t_1;
} else {
tmp = t_3;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: t_3
real(8) :: tmp
t_1 = 27.0d0 * (a * b)
t_2 = 9.0d0 * (y * (z * t))
t_3 = (x * 2.0d0) - t_2
if (x <= (-5.2d+115)) then
tmp = t_3
else if (x <= 3.8d+26) then
tmp = t_1 - t_2
else if (x <= 9.5d+129) then
tmp = (x * 2.0d0) + t_1
else
tmp = t_3
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double t_2 = 9.0 * (y * (z * t));
double t_3 = (x * 2.0) - t_2;
double tmp;
if (x <= -5.2e+115) {
tmp = t_3;
} else if (x <= 3.8e+26) {
tmp = t_1 - t_2;
} else if (x <= 9.5e+129) {
tmp = (x * 2.0) + t_1;
} else {
tmp = t_3;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = 27.0 * (a * b) t_2 = 9.0 * (y * (z * t)) t_3 = (x * 2.0) - t_2 tmp = 0 if x <= -5.2e+115: tmp = t_3 elif x <= 3.8e+26: tmp = t_1 - t_2 elif x <= 9.5e+129: tmp = (x * 2.0) + t_1 else: tmp = t_3 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(27.0 * Float64(a * b)) t_2 = Float64(9.0 * Float64(y * Float64(z * t))) t_3 = Float64(Float64(x * 2.0) - t_2) tmp = 0.0 if (x <= -5.2e+115) tmp = t_3; elseif (x <= 3.8e+26) tmp = Float64(t_1 - t_2); elseif (x <= 9.5e+129) tmp = Float64(Float64(x * 2.0) + t_1); else tmp = t_3; end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = 27.0 * (a * b);
t_2 = 9.0 * (y * (z * t));
t_3 = (x * 2.0) - t_2;
tmp = 0.0;
if (x <= -5.2e+115)
tmp = t_3;
elseif (x <= 3.8e+26)
tmp = t_1 - t_2;
elseif (x <= 9.5e+129)
tmp = (x * 2.0) + t_1;
else
tmp = t_3;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[(x * 2.0), $MachinePrecision] - t$95$2), $MachinePrecision]}, If[LessEqual[x, -5.2e+115], t$95$3, If[LessEqual[x, 3.8e+26], N[(t$95$1 - t$95$2), $MachinePrecision], If[LessEqual[x, 9.5e+129], N[(N[(x * 2.0), $MachinePrecision] + t$95$1), $MachinePrecision], t$95$3]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right)\\
t_2 := 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
t_3 := x \cdot 2 - t_2\\
\mathbf{if}\;x \leq -5.2 \cdot 10^{+115}:\\
\;\;\;\;t_3\\
\mathbf{elif}\;x \leq 3.8 \cdot 10^{+26}:\\
\;\;\;\;t_1 - t_2\\
\mathbf{elif}\;x \leq 9.5 \cdot 10^{+129}:\\
\;\;\;\;x \cdot 2 + t_1\\
\mathbf{else}:\\
\;\;\;\;t_3\\
\end{array}
\end{array}
if x < -5.2000000000000001e115 or 9.5000000000000004e129 < x Initial program 95.4%
sub-neg95.4%
distribute-lft-neg-in95.4%
associate-*l*95.4%
*-commutative95.4%
*-commutative95.4%
cancel-sign-sub-inv95.4%
*-commutative95.4%
*-commutative95.4%
associate-*l*95.4%
associate-*l*93.2%
associate-*l*93.2%
Simplified93.2%
Taylor expanded in a around 0 85.6%
if -5.2000000000000001e115 < x < 3.8000000000000002e26Initial program 95.4%
sub-neg95.4%
distribute-lft-neg-in95.4%
associate-*l*96.0%
*-commutative96.0%
*-commutative96.0%
cancel-sign-sub-inv96.0%
*-commutative96.0%
*-commutative96.0%
associate-*l*95.4%
associate-*l*94.2%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in x around 0 84.6%
if 3.8000000000000002e26 < x < 9.5000000000000004e129Initial program 93.1%
sub-neg93.1%
distribute-lft-neg-in93.1%
associate-*l*93.1%
*-commutative93.1%
*-commutative93.1%
cancel-sign-sub-inv93.1%
*-commutative93.1%
*-commutative93.1%
associate-*l*93.1%
associate-*l*99.8%
associate-*l*99.8%
Simplified99.8%
Taylor expanded in y around 0 93.3%
Final simplification85.4%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= b -1.85e-85)
(+ (* x 2.0) (* 27.0 (* a b)))
(if (<= b 2.7e+14)
(- (* x 2.0) (* 9.0 (* y (* z t))))
(+ (* a (* 27.0 b)) (* y (* z (* t -9.0)))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.85e-85) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else if (b <= 2.7e+14) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else {
tmp = (a * (27.0 * b)) + (y * (z * (t * -9.0)));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-1.85d-85)) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else if (b <= 2.7d+14) then
tmp = (x * 2.0d0) - (9.0d0 * (y * (z * t)))
else
tmp = (a * (27.0d0 * b)) + (y * (z * (t * (-9.0d0))))
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -1.85e-85) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else if (b <= 2.7e+14) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else {
tmp = (a * (27.0 * b)) + (y * (z * (t * -9.0)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if b <= -1.85e-85: tmp = (x * 2.0) + (27.0 * (a * b)) elif b <= 2.7e+14: tmp = (x * 2.0) - (9.0 * (y * (z * t))) else: tmp = (a * (27.0 * b)) + (y * (z * (t * -9.0))) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.85e-85) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); elseif (b <= 2.7e+14) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))); else tmp = Float64(Float64(a * Float64(27.0 * b)) + Float64(y * Float64(z * Float64(t * -9.0)))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (b <= -1.85e-85)
tmp = (x * 2.0) + (27.0 * (a * b));
elseif (b <= 2.7e+14)
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
else
tmp = (a * (27.0 * b)) + (y * (z * (t * -9.0)));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.85e-85], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 2.7e+14], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(y * N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.85 \cdot 10^{-85}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;b \leq 2.7 \cdot 10^{+14}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\
\end{array}
\end{array}
if b < -1.84999999999999992e-85Initial program 91.6%
sub-neg91.6%
distribute-lft-neg-in91.6%
associate-*l*91.6%
*-commutative91.6%
*-commutative91.6%
cancel-sign-sub-inv91.6%
*-commutative91.6%
*-commutative91.6%
associate-*l*91.6%
associate-*l*93.7%
associate-*l*93.7%
Simplified93.7%
Taylor expanded in y around 0 73.4%
if -1.84999999999999992e-85 < b < 2.7e14Initial program 97.1%
sub-neg97.1%
distribute-lft-neg-in97.1%
associate-*l*98.0%
*-commutative98.0%
*-commutative98.0%
cancel-sign-sub-inv98.0%
*-commutative98.0%
*-commutative98.0%
associate-*l*97.1%
associate-*l*92.8%
associate-*l*93.6%
Simplified93.6%
Taylor expanded in a around 0 79.9%
if 2.7e14 < b Initial 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.9%
associate-*l*97.9%
Simplified97.9%
Taylor expanded in x around 0 82.0%
sub-neg82.0%
*-commutative82.0%
associate-*r*82.0%
*-commutative82.0%
distribute-rgt-neg-in82.0%
associate-*r*83.8%
metadata-eval83.8%
associate-*r*83.8%
associate-*l*82.0%
*-commutative82.0%
associate-*r*82.1%
Applied egg-rr82.1%
Final simplification78.0%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* y 9.0) (* z t))) (* a (* 27.0 b))))
assert(y < z && z < t);
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));
}
NOTE: y, z, and t 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) - ((y * 9.0d0) * (z * t))) + (a * (27.0d0 * b))
end function
assert y < z && z < t;
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));
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): return ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b))
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(y * 9.0) * Float64(z * t))) + Float64(a * Float64(27.0 * b))) end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp = code(x, y, z, t, a, b)
tmp = ((x * 2.0) - ((y * 9.0) * (z * t))) + (a * (27.0 * b));
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\left(x \cdot 2 - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right) + a \cdot \left(27 \cdot b\right)
\end{array}
Initial program 95.3%
sub-neg95.3%
distribute-lft-neg-in95.3%
associate-*l*95.6%
*-commutative95.6%
*-commutative95.6%
cancel-sign-sub-inv95.6%
*-commutative95.6%
*-commutative95.6%
associate-*l*95.3%
associate-*l*94.2%
associate-*l*94.6%
Simplified94.6%
Final simplification94.6%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* 27.0 (* a b))))
(if (<= a -1e+27)
t_1
(if (<= a -4.8e-170)
(* x 2.0)
(if (<= a 1.15e-188)
(* -9.0 (* y (* z t)))
(if (<= a 9.5e-115) (* x 2.0) t_1))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double tmp;
if (a <= -1e+27) {
tmp = t_1;
} else if (a <= -4.8e-170) {
tmp = x * 2.0;
} else if (a <= 1.15e-188) {
tmp = -9.0 * (y * (z * t));
} else if (a <= 9.5e-115) {
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.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = 27.0d0 * (a * b)
if (a <= (-1d+27)) then
tmp = t_1
else if (a <= (-4.8d-170)) then
tmp = x * 2.0d0
else if (a <= 1.15d-188) then
tmp = (-9.0d0) * (y * (z * t))
else if (a <= 9.5d-115) then
tmp = x * 2.0d0
else
tmp = t_1
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double tmp;
if (a <= -1e+27) {
tmp = t_1;
} else if (a <= -4.8e-170) {
tmp = x * 2.0;
} else if (a <= 1.15e-188) {
tmp = -9.0 * (y * (z * t));
} else if (a <= 9.5e-115) {
tmp = x * 2.0;
} else {
tmp = t_1;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = 27.0 * (a * b) tmp = 0 if a <= -1e+27: tmp = t_1 elif a <= -4.8e-170: tmp = x * 2.0 elif a <= 1.15e-188: tmp = -9.0 * (y * (z * t)) elif a <= 9.5e-115: tmp = x * 2.0 else: tmp = t_1 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (a <= -1e+27) tmp = t_1; elseif (a <= -4.8e-170) tmp = Float64(x * 2.0); elseif (a <= 1.15e-188) tmp = Float64(-9.0 * Float64(y * Float64(z * t))); elseif (a <= 9.5e-115) tmp = Float64(x * 2.0); else tmp = t_1; end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = 27.0 * (a * b);
tmp = 0.0;
if (a <= -1e+27)
tmp = t_1;
elseif (a <= -4.8e-170)
tmp = x * 2.0;
elseif (a <= 1.15e-188)
tmp = -9.0 * (y * (z * t));
elseif (a <= 9.5e-115)
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.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1e+27], t$95$1, If[LessEqual[a, -4.8e-170], N[(x * 2.0), $MachinePrecision], If[LessEqual[a, 1.15e-188], N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 9.5e-115], N[(x * 2.0), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;a \leq -1 \cdot 10^{+27}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq -4.8 \cdot 10^{-170}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;a \leq 1.15 \cdot 10^{-188}:\\
\;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;a \leq 9.5 \cdot 10^{-115}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if a < -1e27 or 9.4999999999999996e-115 < a Initial program 94.0%
sub-neg94.0%
distribute-lft-neg-in94.0%
associate-*l*94.6%
*-commutative94.6%
*-commutative94.6%
cancel-sign-sub-inv94.6%
*-commutative94.6%
*-commutative94.6%
associate-*l*94.0%
associate-*l*95.3%
associate-*l*95.9%
Simplified95.9%
Taylor expanded in a around inf 54.5%
if -1e27 < a < -4.7999999999999999e-170 or 1.15e-188 < a < 9.4999999999999996e-115Initial program 98.1%
sub-neg98.1%
distribute-lft-neg-in98.1%
associate-*l*98.1%
*-commutative98.1%
*-commutative98.1%
cancel-sign-sub-inv98.1%
*-commutative98.1%
*-commutative98.1%
associate-*l*98.1%
associate-*l*90.2%
associate-*l*90.2%
Simplified90.2%
Taylor expanded in x around inf 46.2%
if -4.7999999999999999e-170 < a < 1.15e-188Initial program 95.7%
sub-neg95.7%
distribute-lft-neg-in95.7%
associate-*l*95.8%
*-commutative95.8%
*-commutative95.8%
cancel-sign-sub-inv95.8%
*-commutative95.8%
*-commutative95.8%
associate-*l*95.7%
associate-*l*95.7%
associate-*l*95.7%
Simplified95.7%
Taylor expanded in y around inf 55.2%
Final simplification52.8%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= t 3.7e+133) (+ (* x 2.0) (* 27.0 (* a b))) (- (* x 2.0) (* 9.0 (* y (* z t))))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 3.7e+133) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
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 (t <= 3.7d+133) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else
tmp = (x * 2.0d0) - (9.0d0 * (y * (z * t)))
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 3.7e+133) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if t <= 3.7e+133: tmp = (x * 2.0) + (27.0 * (a * b)) else: tmp = (x * 2.0) - (9.0 * (y * (z * t))) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (t <= 3.7e+133) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); else tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (t <= 3.7e+133)
tmp = (x * 2.0) + (27.0 * (a * b));
else
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 3.7e+133], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 3.7 \cdot 10^{+133}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\end{array}
\end{array}
if t < 3.70000000000000023e133Initial program 95.0%
sub-neg95.0%
distribute-lft-neg-in95.0%
associate-*l*95.4%
*-commutative95.4%
*-commutative95.4%
cancel-sign-sub-inv95.4%
*-commutative95.4%
*-commutative95.4%
associate-*l*95.0%
associate-*l*95.0%
associate-*l*95.5%
Simplified95.5%
Taylor expanded in y around 0 69.6%
if 3.70000000000000023e133 < t Initial program 96.9%
sub-neg96.9%
distribute-lft-neg-in96.9%
associate-*l*97.0%
*-commutative97.0%
*-commutative97.0%
cancel-sign-sub-inv97.0%
*-commutative97.0%
*-commutative97.0%
associate-*l*96.9%
associate-*l*88.8%
associate-*l*88.7%
Simplified88.7%
Taylor expanded in a around 0 77.5%
Final simplification70.6%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= t 1.32e+166) (+ (* x 2.0) (* 27.0 (* a b))) (* t (* z (* y -9.0)))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 1.32e+166) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = t * (z * (y * -9.0));
}
return tmp;
}
NOTE: y, z, and t 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 (t <= 1.32d+166) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else
tmp = t * (z * (y * (-9.0d0)))
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (t <= 1.32e+166) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = t * (z * (y * -9.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if t <= 1.32e+166: tmp = (x * 2.0) + (27.0 * (a * b)) else: tmp = t * (z * (y * -9.0)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (t <= 1.32e+166) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); else tmp = Float64(t * Float64(z * Float64(y * -9.0))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (t <= 1.32e+166)
tmp = (x * 2.0) + (27.0 * (a * b));
else
tmp = t * (z * (y * -9.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[t, 1.32e+166], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(z * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq 1.32 \cdot 10^{+166}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(z \cdot \left(y \cdot -9\right)\right)\\
\end{array}
\end{array}
if t < 1.3199999999999999e166Initial program 95.0%
sub-neg95.0%
distribute-lft-neg-in95.0%
associate-*l*95.5%
*-commutative95.5%
*-commutative95.5%
cancel-sign-sub-inv95.5%
*-commutative95.5%
*-commutative95.5%
associate-*l*95.0%
associate-*l*94.2%
associate-*l*94.7%
Simplified94.7%
Taylor expanded in y around 0 69.4%
if 1.3199999999999999e166 < t Initial program 96.8%
sub-neg96.8%
distribute-lft-neg-in96.8%
associate-*l*96.8%
*-commutative96.8%
*-commutative96.8%
cancel-sign-sub-inv96.8%
*-commutative96.8%
*-commutative96.8%
associate-*l*96.8%
associate-*l*93.9%
associate-*l*93.9%
Simplified93.9%
Taylor expanded in y around inf 57.6%
*-commutative57.6%
associate-*r*55.2%
associate-*r*55.3%
*-commutative55.3%
associate-*l*57.7%
Simplified57.7%
Taylor expanded in y around 0 57.6%
associate-*r*57.7%
Simplified57.7%
Final simplification67.9%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= a -1e+27) (not (<= a 4.6e-141))) (* 27.0 (* a b)) (* x 2.0)))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1e+27) || !(a <= 4.6e-141)) {
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.
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 <= (-1d+27)) .or. (.not. (a <= 4.6d-141))) then
tmp = 27.0d0 * (a * b)
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1e+27) || !(a <= 4.6e-141)) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if (a <= -1e+27) or not (a <= 4.6e-141): tmp = 27.0 * (a * b) else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1e+27) || !(a <= 4.6e-141)) 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])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((a <= -1e+27) || ~((a <= 4.6e-141)))
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. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1e+27], N[Not[LessEqual[a, 4.6e-141]], $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])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1 \cdot 10^{+27} \lor \neg \left(a \leq 4.6 \cdot 10^{-141}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if a < -1e27 or 4.5999999999999999e-141 < a Initial program 94.2%
sub-neg94.2%
distribute-lft-neg-in94.2%
associate-*l*94.7%
*-commutative94.7%
*-commutative94.7%
cancel-sign-sub-inv94.7%
*-commutative94.7%
*-commutative94.7%
associate-*l*94.2%
associate-*l*95.4%
associate-*l*96.0%
Simplified96.0%
Taylor expanded in a around inf 53.5%
if -1e27 < a < 4.5999999999999999e-141Initial program 97.0%
sub-neg97.0%
distribute-lft-neg-in97.0%
associate-*l*97.0%
*-commutative97.0%
*-commutative97.0%
cancel-sign-sub-inv97.0%
*-commutative97.0%
*-commutative97.0%
associate-*l*97.0%
associate-*l*92.4%
associate-*l*92.4%
Simplified92.4%
Taylor expanded in x around inf 44.3%
Final simplification49.8%
NOTE: y, z, and t 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);
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.
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;
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]) def code(x, y, z, t, a, b): return x * 2.0
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) return Float64(x * 2.0) end
y, z, t = num2cell(sort([y, z, t])){:}
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. code[x_, y_, z_, t_, a_, b_] := N[(x * 2.0), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
x \cdot 2
\end{array}
Initial program 95.3%
sub-neg95.3%
distribute-lft-neg-in95.3%
associate-*l*95.6%
*-commutative95.6%
*-commutative95.6%
cancel-sign-sub-inv95.6%
*-commutative95.6%
*-commutative95.6%
associate-*l*95.3%
associate-*l*94.2%
associate-*l*94.6%
Simplified94.6%
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 2023279
(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)))