
(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 15 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 (if (<= z 2e-88) (fma a (* 27.0 b) (- (* x 2.0) (* 9.0 (* y (* z t))))) (fma x 2.0 (fma t (* (* z y) -9.0) (* b (* a 27.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-88) {
tmp = fma(a, (27.0 * b), ((x * 2.0) - (9.0 * (y * (z * t)))));
} else {
tmp = fma(x, 2.0, fma(t, ((z * y) * -9.0), (b * (a * 27.0))));
}
return tmp;
}
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 2e-88) tmp = fma(a, Float64(27.0 * b), Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t))))); else tmp = fma(x, 2.0, fma(t, Float64(Float64(z * y) * -9.0), Float64(b * Float64(a * 27.0)))); end return tmp end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 2e-88], N[(a * N[(27.0 * b), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * 2.0 + N[(t * N[(N[(z * y), $MachinePrecision] * -9.0), $MachinePrecision] + N[(b * N[(a * 27.0), $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^{-88}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, 2, \mathsf{fma}\left(t, \left(z \cdot y\right) \cdot -9, b \cdot \left(a \cdot 27\right)\right)\right)\\
\end{array}
\end{array}
if z < 1.99999999999999987e-88Initial program 97.3%
+-commutative97.3%
associate-*l*97.2%
fma-def97.2%
associate-*l*95.6%
*-commutative95.6%
associate-*l*95.6%
Simplified95.6%
if 1.99999999999999987e-88 < z Initial program 90.0%
associate-+l-90.0%
fma-neg90.0%
neg-sub090.0%
associate-+l-90.0%
neg-sub090.0%
*-commutative90.0%
distribute-rgt-neg-in90.0%
fma-def91.3%
*-commutative91.3%
associate-*r*91.3%
distribute-rgt-neg-in91.3%
*-commutative91.3%
metadata-eval91.3%
Simplified91.3%
Final simplification94.3%
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 4.1e-86) (fma a (* 27.0 b) (- (* x 2.0) (* 9.0 (* y (* z t))))) (+ (* b (* a 27.0)) (- (* x 2.0) (* t (* y (* z 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 <= 4.1e-86) {
tmp = fma(a, (27.0 * b), ((x * 2.0) - (9.0 * (y * (z * t)))));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (y * (z * 9.0))));
}
return tmp;
}
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 4.1e-86) tmp = fma(a, Float64(27.0 * b), Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t))))); else tmp = Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(t * Float64(y * Float64(z * 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_] := If[LessEqual[z, 4.1e-86], N[(a * N[(27.0 * b), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(y * N[(z * 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 4.1 \cdot 10^{-86}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - t \cdot \left(y \cdot \left(z \cdot 9\right)\right)\right)\\
\end{array}
\end{array}
if z < 4.09999999999999979e-86Initial program 97.3%
+-commutative97.3%
associate-*l*97.2%
fma-def97.2%
associate-*l*95.6%
*-commutative95.6%
associate-*l*95.6%
Simplified95.6%
if 4.09999999999999979e-86 < z Initial program 90.0%
Taylor expanded in y around 0 90.0%
expm1-log1p-u51.5%
expm1-udef48.4%
Applied egg-rr48.4%
expm1-def51.5%
expm1-log1p90.0%
associate-*r*90.0%
*-commutative90.0%
associate-*l*90.0%
Simplified90.0%
Final simplification93.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 (* -9.0 (* y (* z t)))) (t_2 (* 27.0 (* a b))))
(if (<= b -5.5e-106)
t_2
(if (<= b 2.4e-239)
(* x 2.0)
(if (<= b 1.6e-58)
t_1
(if (<= b 8e+46)
(* x 2.0)
(if (<= b 4e+93)
t_1
(if (<= b 9.2e+159) (* x 2.0) (if (<= b 3.3e+196) t_1 t_2)))))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -9.0 * (y * (z * t));
double t_2 = 27.0 * (a * b);
double tmp;
if (b <= -5.5e-106) {
tmp = t_2;
} else if (b <= 2.4e-239) {
tmp = x * 2.0;
} else if (b <= 1.6e-58) {
tmp = t_1;
} else if (b <= 8e+46) {
tmp = x * 2.0;
} else if (b <= 4e+93) {
tmp = t_1;
} else if (b <= 9.2e+159) {
tmp = x * 2.0;
} else if (b <= 3.3e+196) {
tmp = t_1;
} else {
tmp = t_2;
}
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 = (-9.0d0) * (y * (z * t))
t_2 = 27.0d0 * (a * b)
if (b <= (-5.5d-106)) then
tmp = t_2
else if (b <= 2.4d-239) then
tmp = x * 2.0d0
else if (b <= 1.6d-58) then
tmp = t_1
else if (b <= 8d+46) then
tmp = x * 2.0d0
else if (b <= 4d+93) then
tmp = t_1
else if (b <= 9.2d+159) then
tmp = x * 2.0d0
else if (b <= 3.3d+196) then
tmp = t_1
else
tmp = t_2
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 = -9.0 * (y * (z * t));
double t_2 = 27.0 * (a * b);
double tmp;
if (b <= -5.5e-106) {
tmp = t_2;
} else if (b <= 2.4e-239) {
tmp = x * 2.0;
} else if (b <= 1.6e-58) {
tmp = t_1;
} else if (b <= 8e+46) {
tmp = x * 2.0;
} else if (b <= 4e+93) {
tmp = t_1;
} else if (b <= 9.2e+159) {
tmp = x * 2.0;
} else if (b <= 3.3e+196) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = -9.0 * (y * (z * t)) t_2 = 27.0 * (a * b) tmp = 0 if b <= -5.5e-106: tmp = t_2 elif b <= 2.4e-239: tmp = x * 2.0 elif b <= 1.6e-58: tmp = t_1 elif b <= 8e+46: tmp = x * 2.0 elif b <= 4e+93: tmp = t_1 elif b <= 9.2e+159: tmp = x * 2.0 elif b <= 3.3e+196: tmp = t_1 else: tmp = t_2 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(-9.0 * Float64(y * Float64(z * t))) t_2 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (b <= -5.5e-106) tmp = t_2; elseif (b <= 2.4e-239) tmp = Float64(x * 2.0); elseif (b <= 1.6e-58) tmp = t_1; elseif (b <= 8e+46) tmp = Float64(x * 2.0); elseif (b <= 4e+93) tmp = t_1; elseif (b <= 9.2e+159) tmp = Float64(x * 2.0); elseif (b <= 3.3e+196) tmp = t_1; else tmp = t_2; end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = -9.0 * (y * (z * t));
t_2 = 27.0 * (a * b);
tmp = 0.0;
if (b <= -5.5e-106)
tmp = t_2;
elseif (b <= 2.4e-239)
tmp = x * 2.0;
elseif (b <= 1.6e-58)
tmp = t_1;
elseif (b <= 8e+46)
tmp = x * 2.0;
elseif (b <= 4e+93)
tmp = t_1;
elseif (b <= 9.2e+159)
tmp = x * 2.0;
elseif (b <= 3.3e+196)
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.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -5.5e-106], t$95$2, If[LessEqual[b, 2.4e-239], N[(x * 2.0), $MachinePrecision], If[LessEqual[b, 1.6e-58], t$95$1, If[LessEqual[b, 8e+46], N[(x * 2.0), $MachinePrecision], If[LessEqual[b, 4e+93], t$95$1, If[LessEqual[b, 9.2e+159], N[(x * 2.0), $MachinePrecision], If[LessEqual[b, 3.3e+196], t$95$1, t$95$2]]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := -9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
t_2 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;b \leq -5.5 \cdot 10^{-106}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;b \leq 2.4 \cdot 10^{-239}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;b \leq 1.6 \cdot 10^{-58}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq 8 \cdot 10^{+46}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;b \leq 4 \cdot 10^{+93}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq 9.2 \cdot 10^{+159}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;b \leq 3.3 \cdot 10^{+196}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if b < -5.5000000000000001e-106 or 3.3000000000000002e196 < b Initial program 96.7%
Taylor expanded in a around inf 48.5%
if -5.5000000000000001e-106 < b < 2.39999999999999993e-239 or 1.6e-58 < b < 7.9999999999999999e46 or 4.00000000000000017e93 < b < 9.19999999999999981e159Initial program 93.3%
Taylor expanded in x around inf 55.5%
if 2.39999999999999993e-239 < b < 1.6e-58 or 7.9999999999999999e46 < b < 4.00000000000000017e93 or 9.19999999999999981e159 < b < 3.3000000000000002e196Initial program 94.2%
Taylor expanded in y around inf 46.0%
Final simplification50.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
(let* ((t_1 (* -9.0 (* y (* z t)))) (t_2 (* 27.0 (* a b))))
(if (<= b -5.5e-106)
t_2
(if (<= b 8.5e-242)
(* x 2.0)
(if (<= b 3.8e-58)
t_1
(if (<= b 1e+47)
(* x 2.0)
(if (<= b 1e+94)
(* -9.0 (* t (* z y)))
(if (<= b 7.5e+160) (* x 2.0) (if (<= b 8.2e+194) t_1 t_2)))))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = -9.0 * (y * (z * t));
double t_2 = 27.0 * (a * b);
double tmp;
if (b <= -5.5e-106) {
tmp = t_2;
} else if (b <= 8.5e-242) {
tmp = x * 2.0;
} else if (b <= 3.8e-58) {
tmp = t_1;
} else if (b <= 1e+47) {
tmp = x * 2.0;
} else if (b <= 1e+94) {
tmp = -9.0 * (t * (z * y));
} else if (b <= 7.5e+160) {
tmp = x * 2.0;
} else if (b <= 8.2e+194) {
tmp = t_1;
} else {
tmp = t_2;
}
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 = (-9.0d0) * (y * (z * t))
t_2 = 27.0d0 * (a * b)
if (b <= (-5.5d-106)) then
tmp = t_2
else if (b <= 8.5d-242) then
tmp = x * 2.0d0
else if (b <= 3.8d-58) then
tmp = t_1
else if (b <= 1d+47) then
tmp = x * 2.0d0
else if (b <= 1d+94) then
tmp = (-9.0d0) * (t * (z * y))
else if (b <= 7.5d+160) then
tmp = x * 2.0d0
else if (b <= 8.2d+194) then
tmp = t_1
else
tmp = t_2
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 = -9.0 * (y * (z * t));
double t_2 = 27.0 * (a * b);
double tmp;
if (b <= -5.5e-106) {
tmp = t_2;
} else if (b <= 8.5e-242) {
tmp = x * 2.0;
} else if (b <= 3.8e-58) {
tmp = t_1;
} else if (b <= 1e+47) {
tmp = x * 2.0;
} else if (b <= 1e+94) {
tmp = -9.0 * (t * (z * y));
} else if (b <= 7.5e+160) {
tmp = x * 2.0;
} else if (b <= 8.2e+194) {
tmp = t_1;
} else {
tmp = t_2;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = -9.0 * (y * (z * t)) t_2 = 27.0 * (a * b) tmp = 0 if b <= -5.5e-106: tmp = t_2 elif b <= 8.5e-242: tmp = x * 2.0 elif b <= 3.8e-58: tmp = t_1 elif b <= 1e+47: tmp = x * 2.0 elif b <= 1e+94: tmp = -9.0 * (t * (z * y)) elif b <= 7.5e+160: tmp = x * 2.0 elif b <= 8.2e+194: tmp = t_1 else: tmp = t_2 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(-9.0 * Float64(y * Float64(z * t))) t_2 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (b <= -5.5e-106) tmp = t_2; elseif (b <= 8.5e-242) tmp = Float64(x * 2.0); elseif (b <= 3.8e-58) tmp = t_1; elseif (b <= 1e+47) tmp = Float64(x * 2.0); elseif (b <= 1e+94) tmp = Float64(-9.0 * Float64(t * Float64(z * y))); elseif (b <= 7.5e+160) tmp = Float64(x * 2.0); elseif (b <= 8.2e+194) tmp = t_1; else tmp = t_2; end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = -9.0 * (y * (z * t));
t_2 = 27.0 * (a * b);
tmp = 0.0;
if (b <= -5.5e-106)
tmp = t_2;
elseif (b <= 8.5e-242)
tmp = x * 2.0;
elseif (b <= 3.8e-58)
tmp = t_1;
elseif (b <= 1e+47)
tmp = x * 2.0;
elseif (b <= 1e+94)
tmp = -9.0 * (t * (z * y));
elseif (b <= 7.5e+160)
tmp = x * 2.0;
elseif (b <= 8.2e+194)
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.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -5.5e-106], t$95$2, If[LessEqual[b, 8.5e-242], N[(x * 2.0), $MachinePrecision], If[LessEqual[b, 3.8e-58], t$95$1, If[LessEqual[b, 1e+47], N[(x * 2.0), $MachinePrecision], If[LessEqual[b, 1e+94], N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.5e+160], N[(x * 2.0), $MachinePrecision], If[LessEqual[b, 8.2e+194], t$95$1, t$95$2]]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := -9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
t_2 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;b \leq -5.5 \cdot 10^{-106}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;b \leq 8.5 \cdot 10^{-242}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;b \leq 3.8 \cdot 10^{-58}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq 10^{+47}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;b \leq 10^{+94}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\mathbf{elif}\;b \leq 7.5 \cdot 10^{+160}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;b \leq 8.2 \cdot 10^{+194}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if b < -5.5000000000000001e-106 or 8.2000000000000001e194 < b Initial program 96.7%
Taylor expanded in a around inf 48.5%
if -5.5000000000000001e-106 < b < 8.4999999999999997e-242 or 3.7999999999999997e-58 < b < 1e47 or 1e94 < b < 7.50000000000000028e160Initial program 93.3%
Taylor expanded in x around inf 55.5%
if 8.4999999999999997e-242 < b < 3.7999999999999997e-58 or 7.50000000000000028e160 < b < 8.2000000000000001e194Initial program 94.7%
Taylor expanded in y around inf 50.5%
if 1e47 < b < 1e94Initial program 92.8%
Taylor expanded in y around 0 92.8%
Taylor expanded in y around inf 33.1%
*-commutative33.1%
associate-*r*40.9%
Simplified40.9%
Final simplification50.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
(let* ((t_1 (* 27.0 (* a b))))
(if (<= b -5.5e-106)
t_1
(if (<= b 1.8e-238)
(* x 2.0)
(if (<= b 1.2e-58)
(* y (* (* z t) -9.0))
(if (<= b 3e+46)
(* x 2.0)
(if (<= b 1.25e+97)
(* -9.0 (* t (* z y)))
(if (<= b 7.8e+159)
(* x 2.0)
(if (<= b 8.2e+194) (* -9.0 (* y (* z t))) 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 (b <= -5.5e-106) {
tmp = t_1;
} else if (b <= 1.8e-238) {
tmp = x * 2.0;
} else if (b <= 1.2e-58) {
tmp = y * ((z * t) * -9.0);
} else if (b <= 3e+46) {
tmp = x * 2.0;
} else if (b <= 1.25e+97) {
tmp = -9.0 * (t * (z * y));
} else if (b <= 7.8e+159) {
tmp = x * 2.0;
} else if (b <= 8.2e+194) {
tmp = -9.0 * (y * (z * t));
} 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 (b <= (-5.5d-106)) then
tmp = t_1
else if (b <= 1.8d-238) then
tmp = x * 2.0d0
else if (b <= 1.2d-58) then
tmp = y * ((z * t) * (-9.0d0))
else if (b <= 3d+46) then
tmp = x * 2.0d0
else if (b <= 1.25d+97) then
tmp = (-9.0d0) * (t * (z * y))
else if (b <= 7.8d+159) then
tmp = x * 2.0d0
else if (b <= 8.2d+194) then
tmp = (-9.0d0) * (y * (z * t))
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 (b <= -5.5e-106) {
tmp = t_1;
} else if (b <= 1.8e-238) {
tmp = x * 2.0;
} else if (b <= 1.2e-58) {
tmp = y * ((z * t) * -9.0);
} else if (b <= 3e+46) {
tmp = x * 2.0;
} else if (b <= 1.25e+97) {
tmp = -9.0 * (t * (z * y));
} else if (b <= 7.8e+159) {
tmp = x * 2.0;
} else if (b <= 8.2e+194) {
tmp = -9.0 * (y * (z * t));
} 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 b <= -5.5e-106: tmp = t_1 elif b <= 1.8e-238: tmp = x * 2.0 elif b <= 1.2e-58: tmp = y * ((z * t) * -9.0) elif b <= 3e+46: tmp = x * 2.0 elif b <= 1.25e+97: tmp = -9.0 * (t * (z * y)) elif b <= 7.8e+159: tmp = x * 2.0 elif b <= 8.2e+194: tmp = -9.0 * (y * (z * t)) 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 (b <= -5.5e-106) tmp = t_1; elseif (b <= 1.8e-238) tmp = Float64(x * 2.0); elseif (b <= 1.2e-58) tmp = Float64(y * Float64(Float64(z * t) * -9.0)); elseif (b <= 3e+46) tmp = Float64(x * 2.0); elseif (b <= 1.25e+97) tmp = Float64(-9.0 * Float64(t * Float64(z * y))); elseif (b <= 7.8e+159) tmp = Float64(x * 2.0); elseif (b <= 8.2e+194) tmp = Float64(-9.0 * Float64(y * Float64(z * t))); 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 (b <= -5.5e-106)
tmp = t_1;
elseif (b <= 1.8e-238)
tmp = x * 2.0;
elseif (b <= 1.2e-58)
tmp = y * ((z * t) * -9.0);
elseif (b <= 3e+46)
tmp = x * 2.0;
elseif (b <= 1.25e+97)
tmp = -9.0 * (t * (z * y));
elseif (b <= 7.8e+159)
tmp = x * 2.0;
elseif (b <= 8.2e+194)
tmp = -9.0 * (y * (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.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[b, -5.5e-106], t$95$1, If[LessEqual[b, 1.8e-238], N[(x * 2.0), $MachinePrecision], If[LessEqual[b, 1.2e-58], N[(y * N[(N[(z * t), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3e+46], N[(x * 2.0), $MachinePrecision], If[LessEqual[b, 1.25e+97], N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 7.8e+159], N[(x * 2.0), $MachinePrecision], If[LessEqual[b, 8.2e+194], N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $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}\;b \leq -5.5 \cdot 10^{-106}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;b \leq 1.8 \cdot 10^{-238}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;b \leq 1.2 \cdot 10^{-58}:\\
\;\;\;\;y \cdot \left(\left(z \cdot t\right) \cdot -9\right)\\
\mathbf{elif}\;b \leq 3 \cdot 10^{+46}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;b \leq 1.25 \cdot 10^{+97}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\mathbf{elif}\;b \leq 7.8 \cdot 10^{+159}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;b \leq 8.2 \cdot 10^{+194}:\\
\;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if b < -5.5000000000000001e-106 or 8.2000000000000001e194 < b Initial program 96.7%
Taylor expanded in a around inf 48.5%
if -5.5000000000000001e-106 < b < 1.80000000000000005e-238 or 1.2e-58 < b < 3.00000000000000023e46 or 1.25e97 < b < 7.8000000000000001e159Initial program 93.3%
Taylor expanded in x around inf 55.5%
if 1.80000000000000005e-238 < b < 1.2e-58Initial program 91.9%
Taylor expanded in y around inf 47.8%
*-commutative47.8%
*-commutative47.8%
associate-*l*47.7%
*-commutative47.7%
*-commutative47.7%
Simplified47.7%
if 3.00000000000000023e46 < b < 1.25e97Initial program 92.8%
Taylor expanded in y around 0 92.8%
Taylor expanded in y around inf 33.1%
*-commutative33.1%
associate-*r*40.9%
Simplified40.9%
if 7.8000000000000001e159 < b < 8.2000000000000001e194Initial program 100.0%
Taylor expanded in y around inf 55.6%
Final simplification50.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
(let* ((t_1 (* b (* a 27.0))))
(if (<= z -2600.0)
(+ t_1 (- (* x 2.0) (* (* z 9.0) (* y t))))
(+ t_1 (- (* x 2.0) (* t (* 9.0 (* z y))))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a * 27.0);
double tmp;
if (z <= -2600.0) {
tmp = t_1 + ((x * 2.0) - ((z * 9.0) * (y * t)));
} else {
tmp = t_1 + ((x * 2.0) - (t * (9.0 * (z * y))));
}
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 = b * (a * 27.0d0)
if (z <= (-2600.0d0)) then
tmp = t_1 + ((x * 2.0d0) - ((z * 9.0d0) * (y * t)))
else
tmp = t_1 + ((x * 2.0d0) - (t * (9.0d0 * (z * y))))
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 = b * (a * 27.0);
double tmp;
if (z <= -2600.0) {
tmp = t_1 + ((x * 2.0) - ((z * 9.0) * (y * t)));
} else {
tmp = t_1 + ((x * 2.0) - (t * (9.0 * (z * y))));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = b * (a * 27.0) tmp = 0 if z <= -2600.0: tmp = t_1 + ((x * 2.0) - ((z * 9.0) * (y * t))) else: tmp = t_1 + ((x * 2.0) - (t * (9.0 * (z * y)))) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a * 27.0)) tmp = 0.0 if (z <= -2600.0) tmp = Float64(t_1 + Float64(Float64(x * 2.0) - Float64(Float64(z * 9.0) * Float64(y * t)))); else tmp = Float64(t_1 + Float64(Float64(x * 2.0) - Float64(t * Float64(9.0 * Float64(z * y))))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = b * (a * 27.0);
tmp = 0.0;
if (z <= -2600.0)
tmp = t_1 + ((x * 2.0) - ((z * 9.0) * (y * t)));
else
tmp = t_1 + ((x * 2.0) - (t * (9.0 * (z * y))));
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[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -2600.0], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(9.0 * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a \cdot 27\right)\\
\mathbf{if}\;z \leq -2600:\\
\;\;\;\;t_1 + \left(x \cdot 2 - \left(z \cdot 9\right) \cdot \left(y \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - t \cdot \left(9 \cdot \left(z \cdot y\right)\right)\right)\\
\end{array}
\end{array}
if z < -2600Initial program 91.8%
Taylor expanded in y around 0 86.6%
*-commutative86.6%
*-commutative86.6%
associate-*l*86.5%
associate-*r*86.5%
associate-*l*99.7%
*-commutative99.7%
Simplified99.7%
if -2600 < z Initial program 96.0%
Taylor expanded in y around 0 96.0%
Final simplification96.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
(let* ((t_1 (* b (* a 27.0))))
(if (<= z -500000.0)
(+ t_1 (- (* x 2.0) (* (* z 9.0) (* y t))))
(+ t_1 (- (* x 2.0) (* t (* y (* z 9.0))))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a * 27.0);
double tmp;
if (z <= -500000.0) {
tmp = t_1 + ((x * 2.0) - ((z * 9.0) * (y * t)));
} else {
tmp = t_1 + ((x * 2.0) - (t * (y * (z * 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) :: t_1
real(8) :: tmp
t_1 = b * (a * 27.0d0)
if (z <= (-500000.0d0)) then
tmp = t_1 + ((x * 2.0d0) - ((z * 9.0d0) * (y * t)))
else
tmp = t_1 + ((x * 2.0d0) - (t * (y * (z * 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 t_1 = b * (a * 27.0);
double tmp;
if (z <= -500000.0) {
tmp = t_1 + ((x * 2.0) - ((z * 9.0) * (y * t)));
} else {
tmp = t_1 + ((x * 2.0) - (t * (y * (z * 9.0))));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = b * (a * 27.0) tmp = 0 if z <= -500000.0: tmp = t_1 + ((x * 2.0) - ((z * 9.0) * (y * t))) else: tmp = t_1 + ((x * 2.0) - (t * (y * (z * 9.0)))) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(b * Float64(a * 27.0)) tmp = 0.0 if (z <= -500000.0) tmp = Float64(t_1 + Float64(Float64(x * 2.0) - Float64(Float64(z * 9.0) * Float64(y * t)))); else tmp = Float64(t_1 + Float64(Float64(x * 2.0) - Float64(t * Float64(y * Float64(z * 9.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 = b * (a * 27.0);
tmp = 0.0;
if (z <= -500000.0)
tmp = t_1 + ((x * 2.0) - ((z * 9.0) * (y * t)));
else
tmp = t_1 + ((x * 2.0) - (t * (y * (z * 9.0))));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -500000.0], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(y * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a \cdot 27\right)\\
\mathbf{if}\;z \leq -500000:\\
\;\;\;\;t_1 + \left(x \cdot 2 - \left(z \cdot 9\right) \cdot \left(y \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - t \cdot \left(y \cdot \left(z \cdot 9\right)\right)\right)\\
\end{array}
\end{array}
if z < -5e5Initial program 91.8%
Taylor expanded in y around 0 86.6%
*-commutative86.6%
*-commutative86.6%
associate-*l*86.5%
associate-*r*86.5%
associate-*l*99.7%
*-commutative99.7%
Simplified99.7%
if -5e5 < z Initial program 96.0%
Taylor expanded in y around 0 96.0%
expm1-log1p-u73.0%
expm1-udef64.6%
Applied egg-rr64.6%
expm1-def73.0%
expm1-log1p96.0%
associate-*r*96.0%
*-commutative96.0%
associate-*l*96.0%
Simplified96.0%
Final simplification96.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 (<= z 4.5e-87) (+ (* x 2.0) (- (* a (* 27.0 b)) (* (* z t) (* 9.0 y)))) (+ (* b (* a 27.0)) (- (* x 2.0) (* t (* y (* z 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 <= 4.5e-87) {
tmp = (x * 2.0) + ((a * (27.0 * b)) - ((z * t) * (9.0 * y)));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (y * (z * 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 <= 4.5d-87) then
tmp = (x * 2.0d0) + ((a * (27.0d0 * b)) - ((z * t) * (9.0d0 * y)))
else
tmp = (b * (a * 27.0d0)) + ((x * 2.0d0) - (t * (y * (z * 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 <= 4.5e-87) {
tmp = (x * 2.0) + ((a * (27.0 * b)) - ((z * t) * (9.0 * y)));
} else {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (y * (z * 9.0))));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= 4.5e-87: tmp = (x * 2.0) + ((a * (27.0 * b)) - ((z * t) * (9.0 * y))) else: tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (y * (z * 9.0)))) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 4.5e-87) tmp = Float64(Float64(x * 2.0) + Float64(Float64(a * Float64(27.0 * b)) - Float64(Float64(z * t) * Float64(9.0 * y)))); else tmp = Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(t * Float64(y * Float64(z * 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 <= 4.5e-87)
tmp = (x * 2.0) + ((a * (27.0 * b)) - ((z * t) * (9.0 * y)));
else
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (y * (z * 9.0))));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 4.5e-87], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] - N[(N[(z * t), $MachinePrecision] * N[(9.0 * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(y * N[(z * 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 4.5 \cdot 10^{-87}:\\
\;\;\;\;x \cdot 2 + \left(a \cdot \left(27 \cdot b\right) - \left(z \cdot t\right) \cdot \left(9 \cdot y\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - t \cdot \left(y \cdot \left(z \cdot 9\right)\right)\right)\\
\end{array}
\end{array}
if z < 4.49999999999999958e-87Initial program 97.3%
associate-+l-97.3%
sub-neg97.3%
neg-mul-197.3%
metadata-eval97.3%
metadata-eval97.3%
cancel-sign-sub-inv97.3%
metadata-eval97.3%
*-lft-identity97.3%
associate-*l*95.6%
associate-*l*95.6%
Simplified95.6%
if 4.49999999999999958e-87 < z Initial program 90.0%
Taylor expanded in y around 0 90.0%
expm1-log1p-u51.5%
expm1-udef48.4%
Applied egg-rr48.4%
expm1-def51.5%
expm1-log1p90.0%
associate-*r*90.0%
*-commutative90.0%
associate-*l*90.0%
Simplified90.0%
Final simplification93.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 (- (* x 2.0) (* a (* b -27.0)))))
(if (<= z -3.4e+72)
(* y (* z (* t -9.0)))
(if (<= z 2.2e-70)
t_1
(if (<= z 1.8e-35)
(* -9.0 (* y (* z t)))
(if (<= z 2.2e+115) t_1 (* -9.0 (* t (* z y)))))))))assert(y < z && z < t);
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 (z <= -3.4e+72) {
tmp = y * (z * (t * -9.0));
} else if (z <= 2.2e-70) {
tmp = t_1;
} else if (z <= 1.8e-35) {
tmp = -9.0 * (y * (z * t));
} else if (z <= 2.2e+115) {
tmp = t_1;
} else {
tmp = -9.0 * (t * (z * y));
}
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 = (x * 2.0d0) - (a * (b * (-27.0d0)))
if (z <= (-3.4d+72)) then
tmp = y * (z * (t * (-9.0d0)))
else if (z <= 2.2d-70) then
tmp = t_1
else if (z <= 1.8d-35) then
tmp = (-9.0d0) * (y * (z * t))
else if (z <= 2.2d+115) then
tmp = t_1
else
tmp = (-9.0d0) * (t * (z * y))
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 = (x * 2.0) - (a * (b * -27.0));
double tmp;
if (z <= -3.4e+72) {
tmp = y * (z * (t * -9.0));
} else if (z <= 2.2e-70) {
tmp = t_1;
} else if (z <= 1.8e-35) {
tmp = -9.0 * (y * (z * t));
} else if (z <= 2.2e+115) {
tmp = t_1;
} else {
tmp = -9.0 * (t * (z * y));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = (x * 2.0) - (a * (b * -27.0)) tmp = 0 if z <= -3.4e+72: tmp = y * (z * (t * -9.0)) elif z <= 2.2e-70: tmp = t_1 elif z <= 1.8e-35: tmp = -9.0 * (y * (z * t)) elif z <= 2.2e+115: tmp = t_1 else: tmp = -9.0 * (t * (z * y)) return tmp
y, z, t = sort([y, z, t]) 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 (z <= -3.4e+72) tmp = Float64(y * Float64(z * Float64(t * -9.0))); elseif (z <= 2.2e-70) tmp = t_1; elseif (z <= 1.8e-35) tmp = Float64(-9.0 * Float64(y * Float64(z * t))); elseif (z <= 2.2e+115) tmp = t_1; else tmp = Float64(-9.0 * Float64(t * Float64(z * y))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = (x * 2.0) - (a * (b * -27.0));
tmp = 0.0;
if (z <= -3.4e+72)
tmp = y * (z * (t * -9.0));
elseif (z <= 2.2e-70)
tmp = t_1;
elseif (z <= 1.8e-35)
tmp = -9.0 * (y * (z * t));
elseif (z <= 2.2e+115)
tmp = t_1;
else
tmp = -9.0 * (t * (z * y));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
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[z, -3.4e+72], N[(y * N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e-70], t$95$1, If[LessEqual[z, 1.8e-35], N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e+115], t$95$1, N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{if}\;z \leq -3.4 \cdot 10^{+72}:\\
\;\;\;\;y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-70}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{-35}:\\
\;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{+115}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if z < -3.3999999999999998e72Initial program 90.1%
Taylor expanded in y around 0 90.2%
Taylor expanded in y around inf 44.7%
*-commutative44.7%
*-commutative44.7%
*-commutative44.7%
*-commutative44.7%
associate-*r*44.7%
associate-*l*44.7%
Simplified44.7%
if -3.3999999999999998e72 < z < 2.1999999999999999e-70 or 1.80000000000000009e-35 < z < 2.2e115Initial program 99.8%
associate-+l-99.8%
sub-neg99.8%
neg-mul-199.8%
metadata-eval99.8%
metadata-eval99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
*-lft-identity99.8%
associate-*l*98.0%
associate-*l*98.0%
Simplified98.0%
Taylor expanded in y around 0 73.7%
*-commutative73.7%
associate-*r*73.7%
Simplified73.7%
if 2.1999999999999999e-70 < z < 1.80000000000000009e-35Initial program 99.6%
Taylor expanded in y around inf 38.6%
if 2.2e115 < z Initial program 82.3%
Taylor expanded in y around 0 82.3%
Taylor expanded in y around inf 64.8%
*-commutative64.8%
associate-*r*56.2%
Simplified56.2%
Final simplification64.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 (<= z -1.95e+77)
(* y (* z (* t -9.0)))
(if (<= z 2.2e-70)
(- (* x 2.0) (* b (* a -27.0)))
(if (<= z 1e-38)
(* -9.0 (* y (* z t)))
(if (<= z 3.7e+115)
(- (* x 2.0) (* a (* b -27.0)))
(* -9.0 (* t (* z y))))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.95e+77) {
tmp = y * (z * (t * -9.0));
} else if (z <= 2.2e-70) {
tmp = (x * 2.0) - (b * (a * -27.0));
} else if (z <= 1e-38) {
tmp = -9.0 * (y * (z * t));
} else if (z <= 3.7e+115) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = -9.0 * (t * (z * y));
}
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 <= (-1.95d+77)) then
tmp = y * (z * (t * (-9.0d0)))
else if (z <= 2.2d-70) then
tmp = (x * 2.0d0) - (b * (a * (-27.0d0)))
else if (z <= 1d-38) then
tmp = (-9.0d0) * (y * (z * t))
else if (z <= 3.7d+115) then
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
else
tmp = (-9.0d0) * (t * (z * y))
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 <= -1.95e+77) {
tmp = y * (z * (t * -9.0));
} else if (z <= 2.2e-70) {
tmp = (x * 2.0) - (b * (a * -27.0));
} else if (z <= 1e-38) {
tmp = -9.0 * (y * (z * t));
} else if (z <= 3.7e+115) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = -9.0 * (t * (z * y));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= -1.95e+77: tmp = y * (z * (t * -9.0)) elif z <= 2.2e-70: tmp = (x * 2.0) - (b * (a * -27.0)) elif z <= 1e-38: tmp = -9.0 * (y * (z * t)) elif z <= 3.7e+115: tmp = (x * 2.0) - (a * (b * -27.0)) else: tmp = -9.0 * (t * (z * y)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.95e+77) tmp = Float64(y * Float64(z * Float64(t * -9.0))); elseif (z <= 2.2e-70) tmp = Float64(Float64(x * 2.0) - Float64(b * Float64(a * -27.0))); elseif (z <= 1e-38) tmp = Float64(-9.0 * Float64(y * Float64(z * t))); elseif (z <= 3.7e+115) tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); else tmp = Float64(-9.0 * Float64(t * Float64(z * y))); 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 <= -1.95e+77)
tmp = y * (z * (t * -9.0));
elseif (z <= 2.2e-70)
tmp = (x * 2.0) - (b * (a * -27.0));
elseif (z <= 1e-38)
tmp = -9.0 * (y * (z * t));
elseif (z <= 3.7e+115)
tmp = (x * 2.0) - (a * (b * -27.0));
else
tmp = -9.0 * (t * (z * y));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.95e+77], N[(y * N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.2e-70], N[(N[(x * 2.0), $MachinePrecision] - N[(b * N[(a * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1e-38], N[(-9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 3.7e+115], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-9.0 * N[(t * N[(z * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.95 \cdot 10^{+77}:\\
\;\;\;\;y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\
\mathbf{elif}\;z \leq 2.2 \cdot 10^{-70}:\\
\;\;\;\;x \cdot 2 - b \cdot \left(a \cdot -27\right)\\
\mathbf{elif}\;z \leq 10^{-38}:\\
\;\;\;\;-9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;z \leq 3.7 \cdot 10^{+115}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot \left(t \cdot \left(z \cdot y\right)\right)\\
\end{array}
\end{array}
if z < -1.9499999999999999e77Initial program 89.9%
Taylor expanded in y around 0 89.9%
Taylor expanded in y around inf 45.6%
*-commutative45.6%
*-commutative45.6%
*-commutative45.6%
*-commutative45.6%
associate-*r*45.6%
associate-*l*45.6%
Simplified45.6%
if -1.9499999999999999e77 < z < 2.1999999999999999e-70Initial program 99.8%
associate-+l-99.8%
sub-neg99.8%
neg-mul-199.8%
metadata-eval99.8%
metadata-eval99.8%
cancel-sign-sub-inv99.8%
metadata-eval99.8%
*-lft-identity99.8%
associate-*l*99.1%
associate-*l*99.1%
Simplified99.1%
Taylor expanded in y around 0 76.4%
*-commutative76.4%
*-commutative76.4%
associate-*l*76.4%
Simplified76.4%
if 2.1999999999999999e-70 < z < 9.9999999999999996e-39Initial program 99.6%
Taylor expanded in y around inf 38.6%
if 9.9999999999999996e-39 < z < 3.70000000000000006e115Initial program 99.7%
associate-+l-99.7%
sub-neg99.7%
neg-mul-199.7%
metadata-eval99.7%
metadata-eval99.7%
cancel-sign-sub-inv99.7%
metadata-eval99.7%
*-lft-identity99.7%
associate-*l*91.9%
associate-*l*91.8%
Simplified91.8%
Taylor expanded in y around 0 59.9%
*-commutative59.9%
associate-*r*59.8%
Simplified59.8%
if 3.70000000000000006e115 < z Initial program 82.3%
Taylor expanded in y around 0 82.3%
Taylor expanded in y around inf 64.8%
*-commutative64.8%
associate-*r*56.2%
Simplified56.2%
Final simplification64.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 (if (or (<= b -5e-106) (not (<= b 1.1e+160))) (+ (* t (* y (* z -9.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 ((b <= -5e-106) || !(b <= 1.1e+160)) {
tmp = (t * (y * (z * -9.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 ((b <= (-5d-106)) .or. (.not. (b <= 1.1d+160))) then
tmp = (t * (y * (z * (-9.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 ((b <= -5e-106) || !(b <= 1.1e+160)) {
tmp = (t * (y * (z * -9.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 (b <= -5e-106) or not (b <= 1.1e+160): tmp = (t * (y * (z * -9.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 ((b <= -5e-106) || !(b <= 1.1e+160)) tmp = Float64(Float64(t * Float64(y * Float64(z * -9.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 ((b <= -5e-106) || ~((b <= 1.1e+160)))
tmp = (t * (y * (z * -9.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[Or[LessEqual[b, -5e-106], N[Not[LessEqual[b, 1.1e+160]], $MachinePrecision]], N[(N[(t * N[(y * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $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}\;b \leq -5 \cdot 10^{-106} \lor \neg \left(b \leq 1.1 \cdot 10^{+160}\right):\\
\;\;\;\;t \cdot \left(y \cdot \left(z \cdot -9\right)\right) + 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 b < -4.99999999999999983e-106 or 1.09999999999999996e160 < b Initial program 97.0%
Taylor expanded in x around 0 75.2%
cancel-sign-sub-inv75.2%
metadata-eval75.2%
+-commutative75.2%
*-commutative75.2%
associate-*r*74.0%
associate-*l*74.0%
associate-*r*74.0%
*-commutative74.0%
associate-*r*74.0%
fma-udef74.7%
*-commutative74.7%
fma-def74.0%
associate-*r*76.6%
fma-def77.4%
associate-*r*77.4%
*-commutative77.4%
associate-*r*77.4%
Simplified77.4%
fma-udef76.6%
Applied egg-rr76.6%
if -4.99999999999999983e-106 < b < 1.09999999999999996e160Initial program 93.0%
Taylor expanded in a around 0 81.8%
Final simplification79.1%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (+ (* b (* a 27.0)) (- (* x 2.0) (* (* z 9.0) (* y t)))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
return (b * (a * 27.0)) + ((x * 2.0) - ((z * 9.0) * (y * t)));
}
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 = (b * (a * 27.0d0)) + ((x * 2.0d0) - ((z * 9.0d0) * (y * t)))
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
return (b * (a * 27.0)) + ((x * 2.0) - ((z * 9.0) * (y * t)));
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): return (b * (a * 27.0)) + ((x * 2.0) - ((z * 9.0) * (y * t)))
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) return Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(Float64(z * 9.0) * Float64(y * t)))) end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp = code(x, y, z, t, a, b)
tmp = (b * (a * 27.0)) + ((x * 2.0) - ((z * 9.0) * (y * t)));
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[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - \left(z \cdot 9\right) \cdot \left(y \cdot t\right)\right)
\end{array}
Initial program 95.1%
Taylor expanded in y around 0 95.0%
*-commutative95.0%
*-commutative95.0%
associate-*l*95.0%
associate-*r*95.0%
associate-*l*94.6%
*-commutative94.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
(if (<= b -1.8e+45)
(- (* x 2.0) (* a (* b -27.0)))
(if (<= b 1.02e+195)
(- (* x 2.0) (* 9.0 (* y (* z t))))
(- (* x 2.0) (* b (* a -27.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.8e+45) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else if (b <= 1.02e+195) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else {
tmp = (x * 2.0) - (b * (a * -27.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.8d+45)) then
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
else if (b <= 1.02d+195) then
tmp = (x * 2.0d0) - (9.0d0 * (y * (z * t)))
else
tmp = (x * 2.0d0) - (b * (a * (-27.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.8e+45) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else if (b <= 1.02e+195) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else {
tmp = (x * 2.0) - (b * (a * -27.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if b <= -1.8e+45: tmp = (x * 2.0) - (a * (b * -27.0)) elif b <= 1.02e+195: tmp = (x * 2.0) - (9.0 * (y * (z * t))) else: tmp = (x * 2.0) - (b * (a * -27.0)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -1.8e+45) tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); elseif (b <= 1.02e+195) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))); else tmp = Float64(Float64(x * 2.0) - Float64(b * Float64(a * -27.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.8e+45)
tmp = (x * 2.0) - (a * (b * -27.0));
elseif (b <= 1.02e+195)
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
else
tmp = (x * 2.0) - (b * (a * -27.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -1.8e+45], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 1.02e+195], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(b * N[(a * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -1.8 \cdot 10^{+45}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{elif}\;b \leq 1.02 \cdot 10^{+195}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - b \cdot \left(a \cdot -27\right)\\
\end{array}
\end{array}
if b < -1.8e45Initial program 94.9%
associate-+l-94.9%
sub-neg94.9%
neg-mul-194.9%
metadata-eval94.9%
metadata-eval94.9%
cancel-sign-sub-inv94.9%
metadata-eval94.9%
*-lft-identity94.9%
associate-*l*93.0%
associate-*l*93.0%
Simplified93.0%
Taylor expanded in y around 0 74.2%
*-commutative74.2%
associate-*r*74.2%
Simplified74.2%
if -1.8e45 < b < 1.02e195Initial program 94.4%
Taylor expanded in a around 0 77.5%
if 1.02e195 < b Initial program 99.9%
associate-+l-99.9%
sub-neg99.9%
neg-mul-199.9%
metadata-eval99.9%
metadata-eval99.9%
cancel-sign-sub-inv99.9%
metadata-eval99.9%
*-lft-identity99.9%
associate-*l*92.5%
associate-*l*92.5%
Simplified92.5%
Taylor expanded in y around 0 85.2%
*-commutative85.2%
*-commutative85.2%
associate-*l*85.2%
Simplified85.2%
Final simplification77.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 (or (<= b -5.5e-106) (not (<= b 7.8e+159))) (* 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 ((b <= -5.5e-106) || !(b <= 7.8e+159)) {
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 ((b <= (-5.5d-106)) .or. (.not. (b <= 7.8d+159))) 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 ((b <= -5.5e-106) || !(b <= 7.8e+159)) {
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 (b <= -5.5e-106) or not (b <= 7.8e+159): 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 ((b <= -5.5e-106) || !(b <= 7.8e+159)) 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 ((b <= -5.5e-106) || ~((b <= 7.8e+159)))
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[b, -5.5e-106], N[Not[LessEqual[b, 7.8e+159]], $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}\;b \leq -5.5 \cdot 10^{-106} \lor \neg \left(b \leq 7.8 \cdot 10^{+159}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if b < -5.5000000000000001e-106 or 7.8000000000000001e159 < b Initial program 97.0%
Taylor expanded in a around inf 47.0%
if -5.5000000000000001e-106 < b < 7.8000000000000001e159Initial program 93.0%
Taylor expanded in x around inf 46.0%
Final simplification46.5%
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.1%
Taylor expanded in x around inf 33.4%
Final simplification33.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 2023176
(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)))