
(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 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\end{array}
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= (* (* y 9.0) z) 1e+150) (+ (- (* x 2.0) (* (* 9.0 (* y z)) t)) (* (* a 27.0) b)) (fma a (* 27.0 b) (- (* x 2.0) (* 9.0 (* y (* z t)))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (((y * 9.0) * z) <= 1e+150) {
tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + ((a * 27.0) * b);
} else {
tmp = fma(a, (27.0 * b), ((x * 2.0) - (9.0 * (y * (z * t)))));
}
return tmp;
}
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(Float64(y * 9.0) * z) <= 1e+150) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(9.0 * Float64(y * z)) * t)) + Float64(Float64(a * 27.0) * b)); else tmp = fma(a, Float64(27.0 * b), Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t))))); end return tmp end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision], 1e+150], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision], 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]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;\left(y \cdot 9\right) \cdot z \leq 10^{+150}:\\
\;\;\;\;\left(x \cdot 2 - \left(9 \cdot \left(y \cdot z\right)\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y 9) z) < 9.99999999999999981e149Initial program 97.6%
Taylor expanded in y around 0 97.6%
*-commutative97.6%
Simplified97.6%
if 9.99999999999999981e149 < (*.f64 (*.f64 y 9) z) Initial program 88.1%
+-commutative88.1%
associate-*l*88.0%
fma-def88.0%
associate-*l*97.5%
*-commutative97.5%
associate-*l*97.4%
Simplified97.4%
Final simplification97.6%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* a 27.0) b)))
(if (<= (* (* y 9.0) z) 1e+150)
(+ (- (* x 2.0) (* (* 9.0 (* y z)) t)) t_1)
(+ t_1 (- (* x 2.0) (* y (* t (* 9.0 z))))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * 27.0) * b;
double tmp;
if (((y * 9.0) * z) <= 1e+150) {
tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + t_1;
} else {
tmp = t_1 + ((x * 2.0) - (y * (t * (9.0 * z))));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (a * 27.0d0) * b
if (((y * 9.0d0) * z) <= 1d+150) then
tmp = ((x * 2.0d0) - ((9.0d0 * (y * z)) * t)) + t_1
else
tmp = t_1 + ((x * 2.0d0) - (y * (t * (9.0d0 * z))))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * 27.0) * b;
double tmp;
if (((y * 9.0) * z) <= 1e+150) {
tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + t_1;
} else {
tmp = t_1 + ((x * 2.0) - (y * (t * (9.0 * z))));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = (a * 27.0) * b tmp = 0 if ((y * 9.0) * z) <= 1e+150: tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + t_1 else: tmp = t_1 + ((x * 2.0) - (y * (t * (9.0 * z)))) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * 27.0) * b) tmp = 0.0 if (Float64(Float64(y * 9.0) * z) <= 1e+150) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(9.0 * Float64(y * z)) * t)) + t_1); else tmp = Float64(t_1 + Float64(Float64(x * 2.0) - Float64(y * Float64(t * Float64(9.0 * z))))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = (a * 27.0) * b;
tmp = 0.0;
if (((y * 9.0) * z) <= 1e+150)
tmp = ((x * 2.0) - ((9.0 * (y * z)) * t)) + t_1;
else
tmp = t_1 + ((x * 2.0) - (y * (t * (9.0 * z))));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision], 1e+150], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] - N[(y * N[(t * N[(9.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := \left(a \cdot 27\right) \cdot b\\
\mathbf{if}\;\left(y \cdot 9\right) \cdot z \leq 10^{+150}:\\
\;\;\;\;\left(x \cdot 2 - \left(9 \cdot \left(y \cdot z\right)\right) \cdot t\right) + t_1\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - y \cdot \left(t \cdot \left(9 \cdot z\right)\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 y 9) z) < 9.99999999999999981e149Initial program 97.6%
Taylor expanded in y around 0 97.6%
*-commutative97.6%
Simplified97.6%
if 9.99999999999999981e149 < (*.f64 (*.f64 y 9) z) Initial program 88.1%
Taylor expanded in y around 0 97.5%
*-commutative97.5%
associate-*r*97.4%
associate-*l*97.5%
Simplified97.5%
Final simplification97.6%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* 27.0 (* a b))) (t_2 (* (* y (* z t)) -9.0)))
(if (<= z -5.7e-30)
t_2
(if (<= z -4.4e-74)
(* a (* 27.0 b))
(if (<= z -1.2e-294)
(* x 2.0)
(if (<= z 1.4e-289)
t_1
(if (<= z 8.8e-244)
(* x 2.0)
(if (<= z 1.1e-158) t_1 (if (<= z 1.8e+27) (* x 2.0) t_2)))))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double t_2 = (y * (z * t)) * -9.0;
double tmp;
if (z <= -5.7e-30) {
tmp = t_2;
} else if (z <= -4.4e-74) {
tmp = a * (27.0 * b);
} else if (z <= -1.2e-294) {
tmp = x * 2.0;
} else if (z <= 1.4e-289) {
tmp = t_1;
} else if (z <= 8.8e-244) {
tmp = x * 2.0;
} else if (z <= 1.1e-158) {
tmp = t_1;
} else if (z <= 1.8e+27) {
tmp = x * 2.0;
} else {
tmp = t_2;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 27.0d0 * (a * b)
t_2 = (y * (z * t)) * (-9.0d0)
if (z <= (-5.7d-30)) then
tmp = t_2
else if (z <= (-4.4d-74)) then
tmp = a * (27.0d0 * b)
else if (z <= (-1.2d-294)) then
tmp = x * 2.0d0
else if (z <= 1.4d-289) then
tmp = t_1
else if (z <= 8.8d-244) then
tmp = x * 2.0d0
else if (z <= 1.1d-158) then
tmp = t_1
else if (z <= 1.8d+27) then
tmp = x * 2.0d0
else
tmp = t_2
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double t_2 = (y * (z * t)) * -9.0;
double tmp;
if (z <= -5.7e-30) {
tmp = t_2;
} else if (z <= -4.4e-74) {
tmp = a * (27.0 * b);
} else if (z <= -1.2e-294) {
tmp = x * 2.0;
} else if (z <= 1.4e-289) {
tmp = t_1;
} else if (z <= 8.8e-244) {
tmp = x * 2.0;
} else if (z <= 1.1e-158) {
tmp = t_1;
} else if (z <= 1.8e+27) {
tmp = x * 2.0;
} else {
tmp = t_2;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = 27.0 * (a * b) t_2 = (y * (z * t)) * -9.0 tmp = 0 if z <= -5.7e-30: tmp = t_2 elif z <= -4.4e-74: tmp = a * (27.0 * b) elif z <= -1.2e-294: tmp = x * 2.0 elif z <= 1.4e-289: tmp = t_1 elif z <= 8.8e-244: tmp = x * 2.0 elif z <= 1.1e-158: tmp = t_1 elif z <= 1.8e+27: tmp = x * 2.0 else: tmp = t_2 return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(27.0 * Float64(a * b)) t_2 = Float64(Float64(y * Float64(z * t)) * -9.0) tmp = 0.0 if (z <= -5.7e-30) tmp = t_2; elseif (z <= -4.4e-74) tmp = Float64(a * Float64(27.0 * b)); elseif (z <= -1.2e-294) tmp = Float64(x * 2.0); elseif (z <= 1.4e-289) tmp = t_1; elseif (z <= 8.8e-244) tmp = Float64(x * 2.0); elseif (z <= 1.1e-158) tmp = t_1; elseif (z <= 1.8e+27) tmp = Float64(x * 2.0); else tmp = t_2; end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = 27.0 * (a * b);
t_2 = (y * (z * t)) * -9.0;
tmp = 0.0;
if (z <= -5.7e-30)
tmp = t_2;
elseif (z <= -4.4e-74)
tmp = a * (27.0 * b);
elseif (z <= -1.2e-294)
tmp = x * 2.0;
elseif (z <= 1.4e-289)
tmp = t_1;
elseif (z <= 8.8e-244)
tmp = x * 2.0;
elseif (z <= 1.1e-158)
tmp = t_1;
elseif (z <= 1.8e+27)
tmp = x * 2.0;
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision] * -9.0), $MachinePrecision]}, If[LessEqual[z, -5.7e-30], t$95$2, If[LessEqual[z, -4.4e-74], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.2e-294], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, 1.4e-289], t$95$1, If[LessEqual[z, 8.8e-244], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, 1.1e-158], t$95$1, If[LessEqual[z, 1.8e+27], N[(x * 2.0), $MachinePrecision], t$95$2]]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right)\\
t_2 := \left(y \cdot \left(z \cdot t\right)\right) \cdot -9\\
\mathbf{if}\;z \leq -5.7 \cdot 10^{-30}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -4.4 \cdot 10^{-74}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;z \leq -1.2 \cdot 10^{-294}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{-289}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 8.8 \cdot 10^{-244}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-158}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+27}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -5.69999999999999977e-30 or 1.79999999999999991e27 < z Initial program 92.5%
Taylor expanded in y around 0 92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in y around inf 51.7%
if -5.69999999999999977e-30 < z < -4.40000000000000021e-74Initial program 99.7%
Taylor expanded in y around 0 99.7%
*-commutative99.7%
Simplified99.7%
associate-+l-99.7%
associate-*l*99.7%
associate-*l*99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 91.0%
*-commutative91.0%
associate-*r*91.0%
Simplified91.0%
Taylor expanded in x around 0 60.6%
*-commutative60.6%
associate-*r*60.6%
Simplified60.6%
if -4.40000000000000021e-74 < z < -1.19999999999999999e-294 or 1.39999999999999993e-289 < z < 8.79999999999999939e-244 or 1.1000000000000001e-158 < z < 1.79999999999999991e27Initial program 99.9%
associate-+l-99.9%
fma-neg99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
*-commutative99.9%
associate-*r*99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 47.5%
if -1.19999999999999999e-294 < z < 1.39999999999999993e-289 or 8.79999999999999939e-244 < z < 1.1000000000000001e-158Initial program 99.6%
Taylor expanded in y around 0 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in a around inf 43.2%
Final simplification49.7%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* 27.0 (* a b))) (t_2 (* y (* (* z t) -9.0))))
(if (<= z -1.4e-29)
t_2
(if (<= z -2.8e-74)
(* a (* 27.0 b))
(if (<= z -1.8e-294)
(* x 2.0)
(if (<= z 3.65e-289)
t_1
(if (<= z 8.5e-244)
(* x 2.0)
(if (<= z 2.5e-152) t_1 (if (<= z 1.8e+27) (* x 2.0) t_2)))))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double t_2 = y * ((z * t) * -9.0);
double tmp;
if (z <= -1.4e-29) {
tmp = t_2;
} else if (z <= -2.8e-74) {
tmp = a * (27.0 * b);
} else if (z <= -1.8e-294) {
tmp = x * 2.0;
} else if (z <= 3.65e-289) {
tmp = t_1;
} else if (z <= 8.5e-244) {
tmp = x * 2.0;
} else if (z <= 2.5e-152) {
tmp = t_1;
} else if (z <= 1.8e+27) {
tmp = x * 2.0;
} else {
tmp = t_2;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = 27.0d0 * (a * b)
t_2 = y * ((z * t) * (-9.0d0))
if (z <= (-1.4d-29)) then
tmp = t_2
else if (z <= (-2.8d-74)) then
tmp = a * (27.0d0 * b)
else if (z <= (-1.8d-294)) then
tmp = x * 2.0d0
else if (z <= 3.65d-289) then
tmp = t_1
else if (z <= 8.5d-244) then
tmp = x * 2.0d0
else if (z <= 2.5d-152) then
tmp = t_1
else if (z <= 1.8d+27) then
tmp = x * 2.0d0
else
tmp = t_2
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double t_2 = y * ((z * t) * -9.0);
double tmp;
if (z <= -1.4e-29) {
tmp = t_2;
} else if (z <= -2.8e-74) {
tmp = a * (27.0 * b);
} else if (z <= -1.8e-294) {
tmp = x * 2.0;
} else if (z <= 3.65e-289) {
tmp = t_1;
} else if (z <= 8.5e-244) {
tmp = x * 2.0;
} else if (z <= 2.5e-152) {
tmp = t_1;
} else if (z <= 1.8e+27) {
tmp = x * 2.0;
} else {
tmp = t_2;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = 27.0 * (a * b) t_2 = y * ((z * t) * -9.0) tmp = 0 if z <= -1.4e-29: tmp = t_2 elif z <= -2.8e-74: tmp = a * (27.0 * b) elif z <= -1.8e-294: tmp = x * 2.0 elif z <= 3.65e-289: tmp = t_1 elif z <= 8.5e-244: tmp = x * 2.0 elif z <= 2.5e-152: tmp = t_1 elif z <= 1.8e+27: tmp = x * 2.0 else: tmp = t_2 return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(27.0 * Float64(a * b)) t_2 = Float64(y * Float64(Float64(z * t) * -9.0)) tmp = 0.0 if (z <= -1.4e-29) tmp = t_2; elseif (z <= -2.8e-74) tmp = Float64(a * Float64(27.0 * b)); elseif (z <= -1.8e-294) tmp = Float64(x * 2.0); elseif (z <= 3.65e-289) tmp = t_1; elseif (z <= 8.5e-244) tmp = Float64(x * 2.0); elseif (z <= 2.5e-152) tmp = t_1; elseif (z <= 1.8e+27) tmp = Float64(x * 2.0); else tmp = t_2; end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = 27.0 * (a * b);
t_2 = y * ((z * t) * -9.0);
tmp = 0.0;
if (z <= -1.4e-29)
tmp = t_2;
elseif (z <= -2.8e-74)
tmp = a * (27.0 * b);
elseif (z <= -1.8e-294)
tmp = x * 2.0;
elseif (z <= 3.65e-289)
tmp = t_1;
elseif (z <= 8.5e-244)
tmp = x * 2.0;
elseif (z <= 2.5e-152)
tmp = t_1;
elseif (z <= 1.8e+27)
tmp = x * 2.0;
else
tmp = t_2;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(y * N[(N[(z * t), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.4e-29], t$95$2, If[LessEqual[z, -2.8e-74], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.8e-294], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, 3.65e-289], t$95$1, If[LessEqual[z, 8.5e-244], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, 2.5e-152], t$95$1, If[LessEqual[z, 1.8e+27], N[(x * 2.0), $MachinePrecision], t$95$2]]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right)\\
t_2 := y \cdot \left(\left(z \cdot t\right) \cdot -9\right)\\
\mathbf{if}\;z \leq -1.4 \cdot 10^{-29}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;z \leq -2.8 \cdot 10^{-74}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;z \leq -1.8 \cdot 10^{-294}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 3.65 \cdot 10^{-289}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 8.5 \cdot 10^{-244}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 2.5 \cdot 10^{-152}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.8 \cdot 10^{+27}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;t_2\\
\end{array}
\end{array}
if z < -1.4000000000000001e-29 or 1.79999999999999991e27 < z Initial program 92.5%
Taylor expanded in y around 0 92.4%
*-commutative92.4%
Simplified92.4%
Taylor expanded in y around inf 51.7%
*-commutative51.7%
*-commutative51.7%
associate-*l*51.7%
*-commutative51.7%
Simplified51.7%
if -1.4000000000000001e-29 < z < -2.79999999999999988e-74Initial program 99.7%
Taylor expanded in y around 0 99.7%
*-commutative99.7%
Simplified99.7%
associate-+l-99.7%
associate-*l*99.7%
associate-*l*99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 91.0%
*-commutative91.0%
associate-*r*91.0%
Simplified91.0%
Taylor expanded in x around 0 60.6%
*-commutative60.6%
associate-*r*60.6%
Simplified60.6%
if -2.79999999999999988e-74 < z < -1.8000000000000001e-294 or 3.64999999999999978e-289 < z < 8.4999999999999999e-244 or 2.4999999999999998e-152 < z < 1.79999999999999991e27Initial program 99.9%
associate-+l-99.9%
fma-neg99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
*-commutative99.9%
associate-*r*99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 47.5%
if -1.8000000000000001e-294 < z < 3.64999999999999978e-289 or 8.4999999999999999e-244 < z < 2.4999999999999998e-152Initial program 99.6%
Taylor expanded in y around 0 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in a around inf 43.2%
Final simplification49.7%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* 27.0 (* a b))))
(if (<= z -6e-29)
(* y (* (* z t) -9.0))
(if (<= z -1.15e-76)
(* a (* 27.0 b))
(if (<= z -1.5e-294)
(* x 2.0)
(if (<= z 6.5e-294)
t_1
(if (<= z 1.1e-243)
(* x 2.0)
(if (<= z 1e-149)
t_1
(if (<= z 1.6e+29) (* x 2.0) (* (* y z) (* t -9.0)))))))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double tmp;
if (z <= -6e-29) {
tmp = y * ((z * t) * -9.0);
} else if (z <= -1.15e-76) {
tmp = a * (27.0 * b);
} else if (z <= -1.5e-294) {
tmp = x * 2.0;
} else if (z <= 6.5e-294) {
tmp = t_1;
} else if (z <= 1.1e-243) {
tmp = x * 2.0;
} else if (z <= 1e-149) {
tmp = t_1;
} else if (z <= 1.6e+29) {
tmp = x * 2.0;
} else {
tmp = (y * z) * (t * -9.0);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = 27.0d0 * (a * b)
if (z <= (-6d-29)) then
tmp = y * ((z * t) * (-9.0d0))
else if (z <= (-1.15d-76)) then
tmp = a * (27.0d0 * b)
else if (z <= (-1.5d-294)) then
tmp = x * 2.0d0
else if (z <= 6.5d-294) then
tmp = t_1
else if (z <= 1.1d-243) then
tmp = x * 2.0d0
else if (z <= 1d-149) then
tmp = t_1
else if (z <= 1.6d+29) then
tmp = x * 2.0d0
else
tmp = (y * z) * (t * (-9.0d0))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = 27.0 * (a * b);
double tmp;
if (z <= -6e-29) {
tmp = y * ((z * t) * -9.0);
} else if (z <= -1.15e-76) {
tmp = a * (27.0 * b);
} else if (z <= -1.5e-294) {
tmp = x * 2.0;
} else if (z <= 6.5e-294) {
tmp = t_1;
} else if (z <= 1.1e-243) {
tmp = x * 2.0;
} else if (z <= 1e-149) {
tmp = t_1;
} else if (z <= 1.6e+29) {
tmp = x * 2.0;
} else {
tmp = (y * z) * (t * -9.0);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = 27.0 * (a * b) tmp = 0 if z <= -6e-29: tmp = y * ((z * t) * -9.0) elif z <= -1.15e-76: tmp = a * (27.0 * b) elif z <= -1.5e-294: tmp = x * 2.0 elif z <= 6.5e-294: tmp = t_1 elif z <= 1.1e-243: tmp = x * 2.0 elif z <= 1e-149: tmp = t_1 elif z <= 1.6e+29: tmp = x * 2.0 else: tmp = (y * z) * (t * -9.0) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (z <= -6e-29) tmp = Float64(y * Float64(Float64(z * t) * -9.0)); elseif (z <= -1.15e-76) tmp = Float64(a * Float64(27.0 * b)); elseif (z <= -1.5e-294) tmp = Float64(x * 2.0); elseif (z <= 6.5e-294) tmp = t_1; elseif (z <= 1.1e-243) tmp = Float64(x * 2.0); elseif (z <= 1e-149) tmp = t_1; elseif (z <= 1.6e+29) tmp = Float64(x * 2.0); else tmp = Float64(Float64(y * z) * Float64(t * -9.0)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = 27.0 * (a * b);
tmp = 0.0;
if (z <= -6e-29)
tmp = y * ((z * t) * -9.0);
elseif (z <= -1.15e-76)
tmp = a * (27.0 * b);
elseif (z <= -1.5e-294)
tmp = x * 2.0;
elseif (z <= 6.5e-294)
tmp = t_1;
elseif (z <= 1.1e-243)
tmp = x * 2.0;
elseif (z <= 1e-149)
tmp = t_1;
elseif (z <= 1.6e+29)
tmp = x * 2.0;
else
tmp = (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.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -6e-29], N[(y * N[(N[(z * t), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.15e-76], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, -1.5e-294], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, 6.5e-294], t$95$1, If[LessEqual[z, 1.1e-243], N[(x * 2.0), $MachinePrecision], If[LessEqual[z, 1e-149], t$95$1, If[LessEqual[z, 1.6e+29], N[(x * 2.0), $MachinePrecision], N[(N[(y * z), $MachinePrecision] * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;z \leq -6 \cdot 10^{-29}:\\
\;\;\;\;y \cdot \left(\left(z \cdot t\right) \cdot -9\right)\\
\mathbf{elif}\;z \leq -1.15 \cdot 10^{-76}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;z \leq -1.5 \cdot 10^{-294}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 6.5 \cdot 10^{-294}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.1 \cdot 10^{-243}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;z \leq 10^{-149}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;z \leq 1.6 \cdot 10^{+29}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot z\right) \cdot \left(t \cdot -9\right)\\
\end{array}
\end{array}
if z < -6.0000000000000005e-29Initial program 89.4%
Taylor expanded in y around 0 89.4%
*-commutative89.4%
Simplified89.4%
Taylor expanded in y around inf 50.6%
*-commutative50.6%
*-commutative50.6%
associate-*l*50.6%
*-commutative50.6%
Simplified50.6%
if -6.0000000000000005e-29 < z < -1.15000000000000003e-76Initial program 99.7%
Taylor expanded in y around 0 99.7%
*-commutative99.7%
Simplified99.7%
associate-+l-99.7%
associate-*l*99.7%
associate-*l*99.8%
Applied egg-rr99.8%
Taylor expanded in y around 0 91.0%
*-commutative91.0%
associate-*r*91.0%
Simplified91.0%
Taylor expanded in x around 0 60.6%
*-commutative60.6%
associate-*r*60.6%
Simplified60.6%
if -1.15000000000000003e-76 < z < -1.4999999999999999e-294 or 6.4999999999999995e-294 < z < 1.1e-243 or 9.99999999999999979e-150 < z < 1.59999999999999993e29Initial program 99.9%
associate-+l-99.9%
fma-neg99.9%
neg-sub099.9%
associate-+l-99.9%
neg-sub099.9%
*-commutative99.9%
distribute-rgt-neg-in99.9%
fma-def99.9%
*-commutative99.9%
associate-*r*99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
metadata-eval99.9%
Simplified99.9%
Taylor expanded in x around inf 47.0%
if -1.4999999999999999e-294 < z < 6.4999999999999995e-294 or 1.1e-243 < z < 9.99999999999999979e-150Initial program 99.6%
Taylor expanded in y around 0 99.7%
*-commutative99.7%
Simplified99.7%
Taylor expanded in a around inf 41.7%
if 1.59999999999999993e29 < z Initial program 95.4%
Taylor expanded in y around 0 95.4%
*-commutative95.4%
Simplified95.4%
associate-+l-95.4%
associate-*l*95.4%
associate-*l*93.8%
Applied egg-rr93.8%
Taylor expanded in y around inf 52.8%
*-commutative52.8%
*-commutative52.8%
associate-*r*60.9%
associate-*l*60.9%
Simplified60.9%
Final simplification51.3%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* a 27.0) b)))
(if (<= z -2e-21)
(+ t_1 (- (* x 2.0) (* y (* t (* 9.0 z)))))
(+ t_1 (- (* x 2.0) (* (* (* y 9.0) z) t))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * 27.0) * b;
double tmp;
if (z <= -2e-21) {
tmp = t_1 + ((x * 2.0) - (y * (t * (9.0 * z))));
} else {
tmp = t_1 + ((x * 2.0) - (((y * 9.0) * z) * t));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = (a * 27.0d0) * b
if (z <= (-2d-21)) then
tmp = t_1 + ((x * 2.0d0) - (y * (t * (9.0d0 * z))))
else
tmp = t_1 + ((x * 2.0d0) - (((y * 9.0d0) * z) * t))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (a * 27.0) * b;
double tmp;
if (z <= -2e-21) {
tmp = t_1 + ((x * 2.0) - (y * (t * (9.0 * z))));
} else {
tmp = t_1 + ((x * 2.0) - (((y * 9.0) * z) * t));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = (a * 27.0) * b tmp = 0 if z <= -2e-21: tmp = t_1 + ((x * 2.0) - (y * (t * (9.0 * z)))) else: tmp = t_1 + ((x * 2.0) - (((y * 9.0) * z) * t)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(a * 27.0) * b) tmp = 0.0 if (z <= -2e-21) tmp = Float64(t_1 + Float64(Float64(x * 2.0) - Float64(y * Float64(t * Float64(9.0 * z))))); else tmp = Float64(t_1 + Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = (a * 27.0) * b;
tmp = 0.0;
if (z <= -2e-21)
tmp = t_1 + ((x * 2.0) - (y * (t * (9.0 * z))));
else
tmp = t_1 + ((x * 2.0) - (((y * 9.0) * z) * t));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]}, If[LessEqual[z, -2e-21], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] - N[(y * N[(t * N[(9.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := \left(a \cdot 27\right) \cdot b\\
\mathbf{if}\;z \leq -2 \cdot 10^{-21}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - y \cdot \left(t \cdot \left(9 \cdot z\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right)\\
\end{array}
\end{array}
if z < -1.99999999999999982e-21Initial program 89.4%
Taylor expanded in y around 0 95.1%
*-commutative95.1%
associate-*r*95.1%
associate-*l*95.1%
Simplified95.1%
if -1.99999999999999982e-21 < z Initial program 98.3%
Final simplification97.5%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* y (* z t))))
(if (<= z -1.4e-29)
(- (* x 2.0) (* 9.0 t_1))
(if (<= z 1.4e+18)
(- (* x 2.0) (* (* a b) -27.0))
(+ (* a (* 27.0 b)) (* t_1 -9.0))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y * (z * t);
double tmp;
if (z <= -1.4e-29) {
tmp = (x * 2.0) - (9.0 * t_1);
} else if (z <= 1.4e+18) {
tmp = (x * 2.0) - ((a * b) * -27.0);
} else {
tmp = (a * (27.0 * b)) + (t_1 * -9.0);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: t_1
real(8) :: tmp
t_1 = y * (z * t)
if (z <= (-1.4d-29)) then
tmp = (x * 2.0d0) - (9.0d0 * t_1)
else if (z <= 1.4d+18) then
tmp = (x * 2.0d0) - ((a * b) * (-27.0d0))
else
tmp = (a * (27.0d0 * b)) + (t_1 * (-9.0d0))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double t_1 = y * (z * t);
double tmp;
if (z <= -1.4e-29) {
tmp = (x * 2.0) - (9.0 * t_1);
} else if (z <= 1.4e+18) {
tmp = (x * 2.0) - ((a * b) * -27.0);
} else {
tmp = (a * (27.0 * b)) + (t_1 * -9.0);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): t_1 = y * (z * t) tmp = 0 if z <= -1.4e-29: tmp = (x * 2.0) - (9.0 * t_1) elif z <= 1.4e+18: tmp = (x * 2.0) - ((a * b) * -27.0) else: tmp = (a * (27.0 * b)) + (t_1 * -9.0) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) t_1 = Float64(y * Float64(z * t)) tmp = 0.0 if (z <= -1.4e-29) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * t_1)); elseif (z <= 1.4e+18) tmp = Float64(Float64(x * 2.0) - Float64(Float64(a * b) * -27.0)); else tmp = Float64(Float64(a * Float64(27.0 * b)) + Float64(t_1 * -9.0)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = y * (z * t);
tmp = 0.0;
if (z <= -1.4e-29)
tmp = (x * 2.0) - (9.0 * t_1);
elseif (z <= 1.4e+18)
tmp = (x * 2.0) - ((a * b) * -27.0);
else
tmp = (a * (27.0 * b)) + (t_1 * -9.0);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[z, -1.4e-29], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.4e+18], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * -27.0), $MachinePrecision]), $MachinePrecision], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(t$95$1 * -9.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := y \cdot \left(z \cdot t\right)\\
\mathbf{if}\;z \leq -1.4 \cdot 10^{-29}:\\
\;\;\;\;x \cdot 2 - 9 \cdot t_1\\
\mathbf{elif}\;z \leq 1.4 \cdot 10^{+18}:\\
\;\;\;\;x \cdot 2 - \left(a \cdot b\right) \cdot -27\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + t_1 \cdot -9\\
\end{array}
\end{array}
if z < -1.4000000000000001e-29Initial program 89.4%
Taylor expanded in a around 0 71.1%
if -1.4000000000000001e-29 < z < 1.4e18Initial 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*96.8%
associate-*l*96.8%
Simplified96.8%
Taylor expanded in y around 0 82.3%
*-commutative82.3%
Simplified82.3%
if 1.4e18 < z Initial program 95.6%
Taylor expanded in x around 0 72.0%
cancel-sign-sub-inv72.0%
associate-*r*72.0%
*-commutative72.0%
associate-*l*72.0%
metadata-eval72.0%
*-commutative72.0%
Applied egg-rr72.0%
Final simplification76.8%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (+ (* (* a 27.0) b) (- (* x 2.0) (* y (* t (* 9.0 z))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
return ((a * 27.0) * b) + ((x * 2.0) - (y * (t * (9.0 * z))));
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((a * 27.0d0) * b) + ((x * 2.0d0) - (y * (t * (9.0d0 * z))))
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return ((a * 27.0) * b) + ((x * 2.0) - (y * (t * (9.0 * z))));
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): return ((a * 27.0) * b) + ((x * 2.0) - (y * (t * (9.0 * z))))
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) return Float64(Float64(Float64(a * 27.0) * b) + Float64(Float64(x * 2.0) - Float64(y * Float64(t * Float64(9.0 * z))))) end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = ((a * 27.0) * b) + ((x * 2.0) - (y * (t * (9.0 * z))));
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(y * N[(t * N[(9.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\left(a \cdot 27\right) \cdot b + \left(x \cdot 2 - y \cdot \left(t \cdot \left(9 \cdot z\right)\right)\right)
\end{array}
Initial program 96.1%
Taylor expanded in y around 0 94.0%
*-commutative94.0%
associate-*r*94.0%
associate-*l*94.0%
Simplified94.0%
Final simplification94.0%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z -740000000.0) (* y (* (* z t) -9.0)) (if (<= z 2.7e+29) (- (* x 2.0) (* a (* b -27.0))) (* (* y z) (* t -9.0)))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -740000000.0) {
tmp = y * ((z * t) * -9.0);
} else if (z <= 2.7e+29) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = (y * z) * (t * -9.0);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-740000000.0d0)) then
tmp = y * ((z * t) * (-9.0d0))
else if (z <= 2.7d+29) then
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
else
tmp = (y * z) * (t * (-9.0d0))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -740000000.0) {
tmp = y * ((z * t) * -9.0);
} else if (z <= 2.7e+29) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = (y * z) * (t * -9.0);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -740000000.0: tmp = y * ((z * t) * -9.0) elif z <= 2.7e+29: tmp = (x * 2.0) - (a * (b * -27.0)) else: tmp = (y * z) * (t * -9.0) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -740000000.0) tmp = Float64(y * Float64(Float64(z * t) * -9.0)); elseif (z <= 2.7e+29) tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); else tmp = Float64(Float64(y * z) * Float64(t * -9.0)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -740000000.0)
tmp = y * ((z * t) * -9.0);
elseif (z <= 2.7e+29)
tmp = (x * 2.0) - (a * (b * -27.0));
else
tmp = (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. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -740000000.0], N[(y * N[(N[(z * t), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.7e+29], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(y * z), $MachinePrecision] * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -740000000:\\
\;\;\;\;y \cdot \left(\left(z \cdot t\right) \cdot -9\right)\\
\mathbf{elif}\;z \leq 2.7 \cdot 10^{+29}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot z\right) \cdot \left(t \cdot -9\right)\\
\end{array}
\end{array}
if z < -7.4e8Initial program 88.5%
Taylor expanded in y around 0 88.5%
*-commutative88.5%
Simplified88.5%
Taylor expanded in y around inf 48.1%
*-commutative48.1%
*-commutative48.1%
associate-*l*48.1%
*-commutative48.1%
Simplified48.1%
if -7.4e8 < z < 2.7e29Initial program 99.8%
Taylor expanded in y around 0 99.8%
*-commutative99.8%
Simplified99.8%
associate-+l-99.8%
associate-*l*99.0%
associate-*l*99.1%
Applied egg-rr99.1%
Taylor expanded in y around 0 79.8%
*-commutative79.8%
associate-*r*79.7%
Simplified79.7%
if 2.7e29 < z Initial program 95.4%
Taylor expanded in y around 0 95.4%
*-commutative95.4%
Simplified95.4%
associate-+l-95.4%
associate-*l*95.4%
associate-*l*93.8%
Applied egg-rr93.8%
Taylor expanded in y around inf 52.8%
*-commutative52.8%
*-commutative52.8%
associate-*r*60.9%
associate-*l*60.9%
Simplified60.9%
Final simplification67.8%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= z -310000000000.0)
(* y (* (* z t) -9.0))
(if (<= z 1.65e+29)
(- (* x 2.0) (* (* a b) -27.0))
(* (* y z) (* t -9.0)))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -310000000000.0) {
tmp = y * ((z * t) * -9.0);
} else if (z <= 1.65e+29) {
tmp = (x * 2.0) - ((a * b) * -27.0);
} else {
tmp = (y * z) * (t * -9.0);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-310000000000.0d0)) then
tmp = y * ((z * t) * (-9.0d0))
else if (z <= 1.65d+29) then
tmp = (x * 2.0d0) - ((a * b) * (-27.0d0))
else
tmp = (y * z) * (t * (-9.0d0))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -310000000000.0) {
tmp = y * ((z * t) * -9.0);
} else if (z <= 1.65e+29) {
tmp = (x * 2.0) - ((a * b) * -27.0);
} else {
tmp = (y * z) * (t * -9.0);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -310000000000.0: tmp = y * ((z * t) * -9.0) elif z <= 1.65e+29: tmp = (x * 2.0) - ((a * b) * -27.0) else: tmp = (y * z) * (t * -9.0) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -310000000000.0) tmp = Float64(y * Float64(Float64(z * t) * -9.0)); elseif (z <= 1.65e+29) tmp = Float64(Float64(x * 2.0) - Float64(Float64(a * b) * -27.0)); else tmp = Float64(Float64(y * z) * Float64(t * -9.0)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -310000000000.0)
tmp = y * ((z * t) * -9.0);
elseif (z <= 1.65e+29)
tmp = (x * 2.0) - ((a * b) * -27.0);
else
tmp = (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. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -310000000000.0], N[(y * N[(N[(z * t), $MachinePrecision] * -9.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.65e+29], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * -27.0), $MachinePrecision]), $MachinePrecision], N[(N[(y * z), $MachinePrecision] * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -310000000000:\\
\;\;\;\;y \cdot \left(\left(z \cdot t\right) \cdot -9\right)\\
\mathbf{elif}\;z \leq 1.65 \cdot 10^{+29}:\\
\;\;\;\;x \cdot 2 - \left(a \cdot b\right) \cdot -27\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot z\right) \cdot \left(t \cdot -9\right)\\
\end{array}
\end{array}
if z < -3.1e11Initial program 88.3%
Taylor expanded in y around 0 88.3%
*-commutative88.3%
Simplified88.3%
Taylor expanded in y around inf 47.2%
*-commutative47.2%
*-commutative47.2%
associate-*l*47.2%
*-commutative47.2%
Simplified47.2%
if -3.1e11 < z < 1.64999999999999992e29Initial 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*97.0%
associate-*l*97.0%
Simplified97.0%
Taylor expanded in y around 0 79.2%
*-commutative79.2%
Simplified79.2%
if 1.64999999999999992e29 < z Initial program 95.4%
Taylor expanded in y around 0 95.4%
*-commutative95.4%
Simplified95.4%
associate-+l-95.4%
associate-*l*95.4%
associate-*l*93.8%
Applied egg-rr93.8%
Taylor expanded in y around inf 52.8%
*-commutative52.8%
*-commutative52.8%
associate-*r*60.9%
associate-*l*60.9%
Simplified60.9%
Final simplification67.4%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z -1.65e-29) (- (* x 2.0) (* 9.0 (* y (* z t)))) (if (<= z 5.6e+28) (- (* x 2.0) (* (* a b) -27.0)) (* (* y z) (* t -9.0)))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.65e-29) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else if (z <= 5.6e+28) {
tmp = (x * 2.0) - ((a * b) * -27.0);
} else {
tmp = (y * z) * (t * -9.0);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-1.65d-29)) then
tmp = (x * 2.0d0) - (9.0d0 * (y * (z * t)))
else if (z <= 5.6d+28) then
tmp = (x * 2.0d0) - ((a * b) * (-27.0d0))
else
tmp = (y * z) * (t * (-9.0d0))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.65e-29) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else if (z <= 5.6e+28) {
tmp = (x * 2.0) - ((a * b) * -27.0);
} else {
tmp = (y * z) * (t * -9.0);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -1.65e-29: tmp = (x * 2.0) - (9.0 * (y * (z * t))) elif z <= 5.6e+28: tmp = (x * 2.0) - ((a * b) * -27.0) else: tmp = (y * z) * (t * -9.0) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.65e-29) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))); elseif (z <= 5.6e+28) tmp = Float64(Float64(x * 2.0) - Float64(Float64(a * b) * -27.0)); else tmp = Float64(Float64(y * z) * Float64(t * -9.0)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -1.65e-29)
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
elseif (z <= 5.6e+28)
tmp = (x * 2.0) - ((a * b) * -27.0);
else
tmp = (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. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.65e-29], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 5.6e+28], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * -27.0), $MachinePrecision]), $MachinePrecision], N[(N[(y * z), $MachinePrecision] * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.65 \cdot 10^{-29}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{elif}\;z \leq 5.6 \cdot 10^{+28}:\\
\;\;\;\;x \cdot 2 - \left(a \cdot b\right) \cdot -27\\
\mathbf{else}:\\
\;\;\;\;\left(y \cdot z\right) \cdot \left(t \cdot -9\right)\\
\end{array}
\end{array}
if z < -1.65000000000000014e-29Initial program 89.4%
Taylor expanded in a around 0 71.1%
if -1.65000000000000014e-29 < z < 5.6000000000000003e28Initial 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*96.8%
associate-*l*96.8%
Simplified96.8%
Taylor expanded in y around 0 81.9%
*-commutative81.9%
Simplified81.9%
if 5.6000000000000003e28 < z Initial program 95.4%
Taylor expanded in y around 0 95.4%
*-commutative95.4%
Simplified95.4%
associate-+l-95.4%
associate-*l*95.4%
associate-*l*93.8%
Applied egg-rr93.8%
Taylor expanded in y around inf 52.8%
*-commutative52.8%
*-commutative52.8%
associate-*r*60.9%
associate-*l*60.9%
Simplified60.9%
Final simplification73.9%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= b -2.6e-27) (not (<= b 7.6e+24))) (* 27.0 (* a b)) (* x 2.0)))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -2.6e-27) || !(b <= 7.6e+24)) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((b <= (-2.6d-27)) .or. (.not. (b <= 7.6d+24))) then
tmp = 27.0d0 * (a * b)
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((b <= -2.6e-27) || !(b <= 7.6e+24)) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if (b <= -2.6e-27) or not (b <= 7.6e+24): tmp = 27.0 * (a * b) else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((b <= -2.6e-27) || !(b <= 7.6e+24)) tmp = Float64(27.0 * Float64(a * b)); else tmp = Float64(x * 2.0); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((b <= -2.6e-27) || ~((b <= 7.6e+24)))
tmp = 27.0 * (a * b);
else
tmp = x * 2.0;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[b, -2.6e-27], N[Not[LessEqual[b, 7.6e+24]], $MachinePrecision]], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.6 \cdot 10^{-27} \lor \neg \left(b \leq 7.6 \cdot 10^{+24}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if b < -2.60000000000000017e-27 or 7.6000000000000003e24 < b Initial program 95.5%
Taylor expanded in y around 0 95.4%
*-commutative95.4%
Simplified95.4%
Taylor expanded in a around inf 48.4%
if -2.60000000000000017e-27 < b < 7.6000000000000003e24Initial program 96.9%
associate-+l-96.9%
fma-neg96.9%
neg-sub096.9%
associate-+l-96.9%
neg-sub096.9%
*-commutative96.9%
distribute-rgt-neg-in96.9%
fma-def96.9%
*-commutative96.9%
associate-*r*96.9%
distribute-rgt-neg-in96.9%
*-commutative96.9%
metadata-eval96.9%
Simplified96.9%
Taylor expanded in x around inf 44.0%
Final simplification46.3%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= b -5e-24) (* 27.0 (* a b)) (if (<= b 3.05e+29) (* x 2.0) (* a (* 27.0 b)))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -5e-24) {
tmp = 27.0 * (a * b);
} else if (b <= 3.05e+29) {
tmp = x * 2.0;
} else {
tmp = a * (27.0 * b);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (b <= (-5d-24)) then
tmp = 27.0d0 * (a * b)
else if (b <= 3.05d+29) then
tmp = x * 2.0d0
else
tmp = a * (27.0d0 * b)
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (b <= -5e-24) {
tmp = 27.0 * (a * b);
} else if (b <= 3.05e+29) {
tmp = x * 2.0;
} else {
tmp = a * (27.0 * b);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if b <= -5e-24: tmp = 27.0 * (a * b) elif b <= 3.05e+29: tmp = x * 2.0 else: tmp = a * (27.0 * b) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (b <= -5e-24) tmp = Float64(27.0 * Float64(a * b)); elseif (b <= 3.05e+29) tmp = Float64(x * 2.0); else tmp = Float64(a * Float64(27.0 * b)); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (b <= -5e-24)
tmp = 27.0 * (a * b);
elseif (b <= 3.05e+29)
tmp = x * 2.0;
else
tmp = a * (27.0 * b);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[b, -5e-24], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 3.05e+29], N[(x * 2.0), $MachinePrecision], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -5 \cdot 10^{-24}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;b \leq 3.05 \cdot 10^{+29}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\end{array}
\end{array}
if b < -4.9999999999999998e-24Initial program 96.1%
Taylor expanded in y around 0 96.1%
*-commutative96.1%
Simplified96.1%
Taylor expanded in a around inf 48.2%
if -4.9999999999999998e-24 < b < 3.0499999999999999e29Initial program 96.9%
associate-+l-96.9%
fma-neg96.9%
neg-sub096.9%
associate-+l-96.9%
neg-sub096.9%
*-commutative96.9%
distribute-rgt-neg-in96.9%
fma-def96.9%
*-commutative96.9%
associate-*r*96.9%
distribute-rgt-neg-in96.9%
*-commutative96.9%
metadata-eval96.9%
Simplified96.9%
Taylor expanded in x around inf 44.0%
if 3.0499999999999999e29 < b Initial program 94.7%
Taylor expanded in y around 0 94.6%
*-commutative94.6%
Simplified94.6%
associate-+l-94.6%
associate-*l*92.8%
associate-*l*91.1%
Applied egg-rr91.1%
Taylor expanded in y around 0 71.8%
*-commutative71.8%
associate-*r*70.1%
Simplified70.1%
Taylor expanded in x around 0 48.8%
*-commutative48.8%
associate-*r*48.9%
Simplified48.9%
Final simplification46.3%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (* x 2.0))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = x * 2.0d0
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): return x * 2.0
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) return Float64(x * 2.0) end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = x * 2.0;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(x * 2.0), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
x \cdot 2
\end{array}
Initial program 96.1%
associate-+l-96.1%
fma-neg96.1%
neg-sub096.1%
associate-+l-96.1%
neg-sub096.1%
*-commutative96.1%
distribute-rgt-neg-in96.1%
fma-def96.1%
*-commutative96.1%
associate-*r*96.1%
distribute-rgt-neg-in96.1%
*-commutative96.1%
metadata-eval96.1%
Simplified96.1%
Taylor expanded in x around inf 34.2%
Final simplification34.2%
(FPCore (x y z t a b) :precision binary64 (if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (y < 7.590524218811189d-161) then
tmp = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + (a * (27.0d0 * b))
else
tmp = ((x * 2.0d0) - (9.0d0 * (y * (t * z)))) + ((a * 27.0d0) * b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y < 7.590524218811189e-161: tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)) else: tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y < 7.590524218811189e-161) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(t * z)))) + Float64(Float64(a * 27.0) * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y < 7.590524218811189e-161) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)); else tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Less[y, 7.590524218811189e-161], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y < 7.590524218811189 \cdot 10^{-161}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\
\end{array}
\end{array}
herbie shell --seed 2023185
(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)))