
(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. (FPCore (x y z t a b) :precision binary64 (if (<= z 6e-256) (+ (* x 2.0) (- (* a (* 27.0 b)) (* (* y 9.0) (* z t)))) (fma x 2.0 (+ (* t (* y (* z -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 <= 6e-256) {
tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (z * t)));
} else {
tmp = fma(x, 2.0, ((t * (y * (z * -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 <= 6e-256) tmp = Float64(Float64(x * 2.0) + Float64(Float64(a * Float64(27.0 * b)) - Float64(Float64(y * 9.0) * Float64(z * t)))); else tmp = fma(x, 2.0, Float64(Float64(t * Float64(y * Float64(z * -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, 6e-256], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(x * 2.0 + N[(N[(t * N[(y * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $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 6 \cdot 10^{-256}:\\
\;\;\;\;x \cdot 2 + \left(a \cdot \left(27 \cdot b\right) - \left(y \cdot 9\right) \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\mathsf{fma}\left(x, 2, t \cdot \left(y \cdot \left(z \cdot -9\right)\right) + b \cdot \left(a \cdot 27\right)\right)\\
\end{array}
\end{array}
if z < 5.9999999999999996e-256Initial program 96.8%
associate-+l-96.8%
sub-neg96.8%
neg-mul-196.8%
metadata-eval96.8%
metadata-eval96.8%
cancel-sign-sub-inv96.8%
metadata-eval96.8%
*-lft-identity96.8%
associate-*l*97.3%
associate-*l*97.2%
Simplified97.2%
if 5.9999999999999996e-256 < z Initial program 90.4%
associate-+l-90.4%
fma-neg91.4%
neg-sub091.4%
associate-+l-91.4%
neg-sub091.4%
*-commutative91.4%
distribute-rgt-neg-in91.4%
fma-def91.4%
*-commutative91.4%
associate-*r*91.5%
distribute-rgt-neg-in91.5%
*-commutative91.5%
metadata-eval91.5%
Simplified91.5%
fma-udef91.5%
associate-*l*91.5%
Applied egg-rr91.5%
Final simplification94.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 (<= (* x 2.0) -2e+108)
(- (* x 2.0) (* (* a b) -27.0))
(if (<= (* x 2.0) 2e-49)
(+ (* a (* 27.0 b)) (* y (* t (* z -9.0))))
(- (* x 2.0) (* a (* b -27.0))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * 2.0) <= -2e+108) {
tmp = (x * 2.0) - ((a * b) * -27.0);
} else if ((x * 2.0) <= 2e-49) {
tmp = (a * (27.0 * b)) + (y * (t * (z * -9.0)));
} else {
tmp = (x * 2.0) - (a * (b * -27.0));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((x * 2.0d0) <= (-2d+108)) then
tmp = (x * 2.0d0) - ((a * b) * (-27.0d0))
else if ((x * 2.0d0) <= 2d-49) then
tmp = (a * (27.0d0 * b)) + (y * (t * (z * (-9.0d0))))
else
tmp = (x * 2.0d0) - (a * (b * (-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 ((x * 2.0) <= -2e+108) {
tmp = (x * 2.0) - ((a * b) * -27.0);
} else if ((x * 2.0) <= 2e-49) {
tmp = (a * (27.0 * b)) + (y * (t * (z * -9.0)));
} else {
tmp = (x * 2.0) - (a * (b * -27.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if (x * 2.0) <= -2e+108: tmp = (x * 2.0) - ((a * b) * -27.0) elif (x * 2.0) <= 2e-49: tmp = (a * (27.0 * b)) + (y * (t * (z * -9.0))) else: tmp = (x * 2.0) - (a * (b * -27.0)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * 2.0) <= -2e+108) tmp = Float64(Float64(x * 2.0) - Float64(Float64(a * b) * -27.0)); elseif (Float64(x * 2.0) <= 2e-49) tmp = Float64(Float64(a * Float64(27.0 * b)) + Float64(y * Float64(t * Float64(z * -9.0)))); else tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((x * 2.0) <= -2e+108)
tmp = (x * 2.0) - ((a * b) * -27.0);
elseif ((x * 2.0) <= 2e-49)
tmp = (a * (27.0 * b)) + (y * (t * (z * -9.0)));
else
tmp = (x * 2.0) - (a * (b * -27.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * 2.0), $MachinePrecision], -2e+108], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * -27.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * 2.0), $MachinePrecision], 2e-49], N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] + N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 2 \leq -2 \cdot 10^{+108}:\\
\;\;\;\;x \cdot 2 - \left(a \cdot b\right) \cdot -27\\
\mathbf{elif}\;x \cdot 2 \leq 2 \cdot 10^{-49}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right) + y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\end{array}
\end{array}
if (*.f64 x 2) < -2.0000000000000001e108Initial program 88.8%
associate-+l-88.8%
sub-neg88.8%
neg-mul-188.8%
metadata-eval88.8%
metadata-eval88.8%
cancel-sign-sub-inv88.8%
metadata-eval88.8%
*-lft-identity88.8%
associate-*l*97.5%
associate-*l*97.5%
Simplified97.5%
Taylor expanded in y around 0 82.8%
*-commutative82.8%
Simplified82.8%
if -2.0000000000000001e108 < (*.f64 x 2) < 1.99999999999999987e-49Initial program 97.6%
Taylor expanded in x around 0 84.9%
cancel-sign-sub-inv84.9%
metadata-eval84.9%
*-commutative84.9%
*-commutative84.9%
associate-*r*84.8%
*-commutative84.8%
associate-*l*84.8%
associate-*r*84.8%
Applied egg-rr84.8%
if 1.99999999999999987e-49 < (*.f64 x 2) Initial program 91.2%
associate-+l-91.2%
sub-neg91.2%
neg-mul-191.2%
metadata-eval91.2%
metadata-eval91.2%
cancel-sign-sub-inv91.2%
metadata-eval91.2%
*-lft-identity91.2%
associate-*l*94.8%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in y around 0 78.9%
*-commutative78.9%
associate-*l*79.0%
Simplified79.0%
Final simplification82.8%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= (* x 2.0) -2e+108)
(- (* x 2.0) (* (* a b) -27.0))
(if (<= (* x 2.0) 2e-49)
(- (* 27.0 (* a b)) (* 9.0 (* y (* z t))))
(- (* x 2.0) (* a (* b -27.0))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x * 2.0) <= -2e+108) {
tmp = (x * 2.0) - ((a * b) * -27.0);
} else if ((x * 2.0) <= 2e-49) {
tmp = (27.0 * (a * b)) - (9.0 * (y * (z * t)));
} else {
tmp = (x * 2.0) - (a * (b * -27.0));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((x * 2.0d0) <= (-2d+108)) then
tmp = (x * 2.0d0) - ((a * b) * (-27.0d0))
else if ((x * 2.0d0) <= 2d-49) then
tmp = (27.0d0 * (a * b)) - (9.0d0 * (y * (z * t)))
else
tmp = (x * 2.0d0) - (a * (b * (-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 ((x * 2.0) <= -2e+108) {
tmp = (x * 2.0) - ((a * b) * -27.0);
} else if ((x * 2.0) <= 2e-49) {
tmp = (27.0 * (a * b)) - (9.0 * (y * (z * t)));
} else {
tmp = (x * 2.0) - (a * (b * -27.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if (x * 2.0) <= -2e+108: tmp = (x * 2.0) - ((a * b) * -27.0) elif (x * 2.0) <= 2e-49: tmp = (27.0 * (a * b)) - (9.0 * (y * (z * t))) else: tmp = (x * 2.0) - (a * (b * -27.0)) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (Float64(x * 2.0) <= -2e+108) tmp = Float64(Float64(x * 2.0) - Float64(Float64(a * b) * -27.0)); elseif (Float64(x * 2.0) <= 2e-49) tmp = Float64(Float64(27.0 * Float64(a * b)) - Float64(9.0 * Float64(y * Float64(z * t)))); else tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((x * 2.0) <= -2e+108)
tmp = (x * 2.0) - ((a * b) * -27.0);
elseif ((x * 2.0) <= 2e-49)
tmp = (27.0 * (a * b)) - (9.0 * (y * (z * t)));
else
tmp = (x * 2.0) - (a * (b * -27.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[N[(x * 2.0), $MachinePrecision], -2e+108], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * -27.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(x * 2.0), $MachinePrecision], 2e-49], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] - N[(9.0 * N[(y * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;x \cdot 2 \leq -2 \cdot 10^{+108}:\\
\;\;\;\;x \cdot 2 - \left(a \cdot b\right) \cdot -27\\
\mathbf{elif}\;x \cdot 2 \leq 2 \cdot 10^{-49}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\end{array}
\end{array}
if (*.f64 x 2) < -2.0000000000000001e108Initial program 88.8%
associate-+l-88.8%
sub-neg88.8%
neg-mul-188.8%
metadata-eval88.8%
metadata-eval88.8%
cancel-sign-sub-inv88.8%
metadata-eval88.8%
*-lft-identity88.8%
associate-*l*97.5%
associate-*l*97.5%
Simplified97.5%
Taylor expanded in y around 0 82.8%
*-commutative82.8%
Simplified82.8%
if -2.0000000000000001e108 < (*.f64 x 2) < 1.99999999999999987e-49Initial program 97.6%
Taylor expanded in x around 0 84.9%
if 1.99999999999999987e-49 < (*.f64 x 2) Initial program 91.2%
associate-+l-91.2%
sub-neg91.2%
neg-mul-191.2%
metadata-eval91.2%
metadata-eval91.2%
cancel-sign-sub-inv91.2%
metadata-eval91.2%
*-lft-identity91.2%
associate-*l*94.8%
associate-*l*94.8%
Simplified94.8%
Taylor expanded in y around 0 78.9%
*-commutative78.9%
associate-*l*79.0%
Simplified79.0%
Final simplification82.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 (* (* z -9.0) (* y t))) (t_2 (* 27.0 (* a b))))
(if (<= x -7.6e+123)
(* x 2.0)
(if (<= x -0.00096)
(* (* z t) (* y -9.0))
(if (<= x -2.2e-187)
t_2
(if (<= x -7.5e-255)
t_1
(if (<= x 3.1e-290)
t_2
(if (<= x 1.56e-117)
t_1
(if (<= x 1.45e+74) (* a (* 27.0 b)) (* x 2.0))))))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z * -9.0) * (y * t);
double t_2 = 27.0 * (a * b);
double tmp;
if (x <= -7.6e+123) {
tmp = x * 2.0;
} else if (x <= -0.00096) {
tmp = (z * t) * (y * -9.0);
} else if (x <= -2.2e-187) {
tmp = t_2;
} else if (x <= -7.5e-255) {
tmp = t_1;
} else if (x <= 3.1e-290) {
tmp = t_2;
} else if (x <= 1.56e-117) {
tmp = t_1;
} else if (x <= 1.45e+74) {
tmp = a * (27.0 * 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) :: t_1
real(8) :: t_2
real(8) :: tmp
t_1 = (z * (-9.0d0)) * (y * t)
t_2 = 27.0d0 * (a * b)
if (x <= (-7.6d+123)) then
tmp = x * 2.0d0
else if (x <= (-0.00096d0)) then
tmp = (z * t) * (y * (-9.0d0))
else if (x <= (-2.2d-187)) then
tmp = t_2
else if (x <= (-7.5d-255)) then
tmp = t_1
else if (x <= 3.1d-290) then
tmp = t_2
else if (x <= 1.56d-117) then
tmp = t_1
else if (x <= 1.45d+74) then
tmp = a * (27.0d0 * 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 t_1 = (z * -9.0) * (y * t);
double t_2 = 27.0 * (a * b);
double tmp;
if (x <= -7.6e+123) {
tmp = x * 2.0;
} else if (x <= -0.00096) {
tmp = (z * t) * (y * -9.0);
} else if (x <= -2.2e-187) {
tmp = t_2;
} else if (x <= -7.5e-255) {
tmp = t_1;
} else if (x <= 3.1e-290) {
tmp = t_2;
} else if (x <= 1.56e-117) {
tmp = t_1;
} else if (x <= 1.45e+74) {
tmp = a * (27.0 * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = (z * -9.0) * (y * t) t_2 = 27.0 * (a * b) tmp = 0 if x <= -7.6e+123: tmp = x * 2.0 elif x <= -0.00096: tmp = (z * t) * (y * -9.0) elif x <= -2.2e-187: tmp = t_2 elif x <= -7.5e-255: tmp = t_1 elif x <= 3.1e-290: tmp = t_2 elif x <= 1.56e-117: tmp = t_1 elif x <= 1.45e+74: tmp = a * (27.0 * b) else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(z * -9.0) * Float64(y * t)) t_2 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (x <= -7.6e+123) tmp = Float64(x * 2.0); elseif (x <= -0.00096) tmp = Float64(Float64(z * t) * Float64(y * -9.0)); elseif (x <= -2.2e-187) tmp = t_2; elseif (x <= -7.5e-255) tmp = t_1; elseif (x <= 3.1e-290) tmp = t_2; elseif (x <= 1.56e-117) tmp = t_1; elseif (x <= 1.45e+74) tmp = Float64(a * Float64(27.0 * 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)
t_1 = (z * -9.0) * (y * t);
t_2 = 27.0 * (a * b);
tmp = 0.0;
if (x <= -7.6e+123)
tmp = x * 2.0;
elseif (x <= -0.00096)
tmp = (z * t) * (y * -9.0);
elseif (x <= -2.2e-187)
tmp = t_2;
elseif (x <= -7.5e-255)
tmp = t_1;
elseif (x <= 3.1e-290)
tmp = t_2;
elseif (x <= 1.56e-117)
tmp = t_1;
elseif (x <= 1.45e+74)
tmp = a * (27.0 * 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_] := Block[{t$95$1 = N[(N[(z * -9.0), $MachinePrecision] * N[(y * t), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[x, -7.6e+123], N[(x * 2.0), $MachinePrecision], If[LessEqual[x, -0.00096], N[(N[(z * t), $MachinePrecision] * N[(y * -9.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[x, -2.2e-187], t$95$2, If[LessEqual[x, -7.5e-255], t$95$1, If[LessEqual[x, 3.1e-290], t$95$2, If[LessEqual[x, 1.56e-117], t$95$1, If[LessEqual[x, 1.45e+74], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := \left(z \cdot -9\right) \cdot \left(y \cdot t\right)\\
t_2 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;x \leq -7.6 \cdot 10^{+123}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;x \leq -0.00096:\\
\;\;\;\;\left(z \cdot t\right) \cdot \left(y \cdot -9\right)\\
\mathbf{elif}\;x \leq -2.2 \cdot 10^{-187}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq -7.5 \cdot 10^{-255}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 3.1 \cdot 10^{-290}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;x \leq 1.56 \cdot 10^{-117}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;x \leq 1.45 \cdot 10^{+74}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if x < -7.59999999999999989e123 or 1.4500000000000001e74 < x Initial program 90.8%
associate-+l-90.8%
fma-neg91.9%
neg-sub091.9%
associate-+l-91.9%
neg-sub091.9%
*-commutative91.9%
distribute-rgt-neg-in91.9%
fma-def91.9%
*-commutative91.9%
associate-*r*91.9%
distribute-rgt-neg-in91.9%
*-commutative91.9%
metadata-eval91.9%
Simplified91.9%
Taylor expanded in x around inf 63.3%
if -7.59999999999999989e123 < x < -9.60000000000000024e-4Initial program 99.7%
Taylor expanded in x around 0 66.7%
Taylor expanded in a around 0 47.8%
associate-*r*47.7%
Simplified47.7%
if -9.60000000000000024e-4 < x < -2.20000000000000008e-187 or -7.50000000000000029e-255 < x < 3.0999999999999999e-290Initial program 99.7%
associate-+l-99.7%
fma-neg99.7%
neg-sub099.7%
associate-+l-99.7%
neg-sub099.7%
*-commutative99.7%
distribute-rgt-neg-in99.7%
fma-def99.7%
*-commutative99.7%
associate-*r*99.8%
distribute-rgt-neg-in99.8%
*-commutative99.8%
metadata-eval99.8%
Simplified99.8%
fma-udef99.8%
associate-*l*99.8%
Applied egg-rr99.8%
Taylor expanded in a around inf 55.4%
if -2.20000000000000008e-187 < x < -7.50000000000000029e-255 or 3.0999999999999999e-290 < x < 1.56e-117Initial program 93.7%
Taylor expanded in y around 0 93.7%
*-commutative93.7%
Simplified93.7%
Taylor expanded in y around 0 93.7%
*-commutative93.7%
associate-*r*93.8%
Simplified93.8%
Taylor expanded in y around inf 67.2%
*-commutative67.2%
associate-*r*67.2%
associate-*l*67.1%
Simplified67.1%
if 1.56e-117 < x < 1.4500000000000001e74Initial program 91.5%
associate-+l-91.5%
fma-neg91.5%
neg-sub091.5%
associate-+l-91.5%
neg-sub091.5%
*-commutative91.5%
distribute-rgt-neg-in91.5%
fma-def91.5%
*-commutative91.5%
associate-*r*91.5%
distribute-rgt-neg-in91.5%
*-commutative91.5%
metadata-eval91.5%
Simplified91.5%
fma-udef91.5%
associate-*l*91.5%
Applied egg-rr91.5%
Taylor expanded in a around inf 49.7%
associate-*r*49.7%
*-commutative49.7%
associate-*r*49.7%
Simplified49.7%
Final simplification58.8%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z 1.85e+68) (+ (* b (* a 27.0)) (- (* x 2.0) (* y (* 9.0 (* z t))))) (* (* z -9.0) (* y t))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= 1.85e+68) {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (y * (9.0 * (z * t))));
} else {
tmp = (z * -9.0) * (y * 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 (z <= 1.85d+68) then
tmp = (b * (a * 27.0d0)) + ((x * 2.0d0) - (y * (9.0d0 * (z * t))))
else
tmp = (z * (-9.0d0)) * (y * 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 (z <= 1.85e+68) {
tmp = (b * (a * 27.0)) + ((x * 2.0) - (y * (9.0 * (z * t))));
} else {
tmp = (z * -9.0) * (y * t);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= 1.85e+68: tmp = (b * (a * 27.0)) + ((x * 2.0) - (y * (9.0 * (z * t)))) else: tmp = (z * -9.0) * (y * t) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= 1.85e+68) tmp = Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(y * Float64(9.0 * Float64(z * t))))); else tmp = Float64(Float64(z * -9.0) * Float64(y * 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 (z <= 1.85e+68)
tmp = (b * (a * 27.0)) + ((x * 2.0) - (y * (9.0 * (z * t))));
else
tmp = (z * -9.0) * (y * t);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, 1.85e+68], N[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(y * N[(9.0 * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * -9.0), $MachinePrecision] * N[(y * t), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq 1.85 \cdot 10^{+68}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - y \cdot \left(9 \cdot \left(z \cdot t\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot -9\right) \cdot \left(y \cdot t\right)\\
\end{array}
\end{array}
if z < 1.84999999999999999e68Initial program 97.2%
Taylor expanded in y around 0 98.0%
*-commutative98.0%
associate-*r*98.0%
Simplified98.0%
if 1.84999999999999999e68 < z Initial program 78.5%
Taylor expanded in y around 0 78.7%
*-commutative78.7%
Simplified78.7%
Taylor expanded in y around 0 78.7%
*-commutative78.7%
associate-*r*78.7%
Simplified78.7%
Taylor expanded in y around inf 61.3%
*-commutative61.3%
associate-*r*68.4%
associate-*l*68.3%
Simplified68.3%
Final simplification93.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
(let* ((t_1 (* b (* a 27.0))))
(if (<= z 5e-256)
(+ t_1 (- (* x 2.0) (* y (* 9.0 (* z 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 <= 5e-256) {
tmp = t_1 + ((x * 2.0) - (y * (9.0 * (z * 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 <= 5d-256) then
tmp = t_1 + ((x * 2.0d0) - (y * (9.0d0 * (z * 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 <= 5e-256) {
tmp = t_1 + ((x * 2.0) - (y * (9.0 * (z * 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 <= 5e-256: tmp = t_1 + ((x * 2.0) - (y * (9.0 * (z * 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 <= 5e-256) tmp = Float64(t_1 + Float64(Float64(x * 2.0) - Float64(y * Float64(9.0 * Float64(z * 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 <= 5e-256)
tmp = t_1 + ((x * 2.0) - (y * (9.0 * (z * 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, 5e-256], N[(t$95$1 + N[(N[(x * 2.0), $MachinePrecision] - N[(y * N[(9.0 * N[(z * t), $MachinePrecision]), $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 5 \cdot 10^{-256}:\\
\;\;\;\;t_1 + \left(x \cdot 2 - y \cdot \left(9 \cdot \left(z \cdot t\right)\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 < 5e-256Initial program 96.8%
Taylor expanded in y around 0 97.3%
*-commutative97.3%
associate-*r*97.2%
Simplified97.2%
if 5e-256 < z Initial program 90.4%
Taylor expanded in y around 0 90.5%
*-commutative90.5%
Simplified90.5%
Taylor expanded in y around 0 90.5%
*-commutative90.5%
associate-*r*90.5%
Simplified90.5%
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 (<= z 5e-256) (+ (* x 2.0) (- (* a (* 27.0 b)) (* (* y 9.0) (* 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 <= 5e-256) {
tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (z * t)));
} 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 <= 5d-256) then
tmp = (x * 2.0d0) + ((a * (27.0d0 * b)) - ((y * 9.0d0) * (z * t)))
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 <= 5e-256) {
tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (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]) def code(x, y, z, t, a, b): tmp = 0 if z <= 5e-256: tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (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 <= 5e-256) tmp = Float64(Float64(x * 2.0) + Float64(Float64(a * Float64(27.0 * b)) - Float64(Float64(y * 9.0) * 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
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= 5e-256)
tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (z * t)));
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, 5e-256], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision] - N[(N[(y * 9.0), $MachinePrecision] * N[(z * t), $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 5 \cdot 10^{-256}:\\
\;\;\;\;x \cdot 2 + \left(a \cdot \left(27 \cdot b\right) - \left(y \cdot 9\right) \cdot \left(z \cdot t\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 < 5e-256Initial program 96.8%
associate-+l-96.8%
sub-neg96.8%
neg-mul-196.8%
metadata-eval96.8%
metadata-eval96.8%
cancel-sign-sub-inv96.8%
metadata-eval96.8%
*-lft-identity96.8%
associate-*l*97.3%
associate-*l*97.2%
Simplified97.2%
if 5e-256 < z Initial program 90.4%
Taylor expanded in y around 0 90.5%
*-commutative90.5%
Simplified90.5%
Taylor expanded in y around 0 90.5%
*-commutative90.5%
associate-*r*90.5%
Simplified90.5%
Final simplification94.6%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* (* z t) (* y -9.0))) (t_2 (* 27.0 (* a b))))
(if (<= a -1.95e+239)
t_2
(if (<= a -3e+222)
t_1
(if (<= a -3.2e-5)
t_2
(if (<= a -8.2e-84)
(* x 2.0)
(if (<= a -8e-288)
t_1
(if (<= a 2.9e-89) (* x 2.0) (* a (* 27.0 b))))))))))assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = (z * t) * (y * -9.0);
double t_2 = 27.0 * (a * b);
double tmp;
if (a <= -1.95e+239) {
tmp = t_2;
} else if (a <= -3e+222) {
tmp = t_1;
} else if (a <= -3.2e-5) {
tmp = t_2;
} else if (a <= -8.2e-84) {
tmp = x * 2.0;
} else if (a <= -8e-288) {
tmp = t_1;
} else if (a <= 2.9e-89) {
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.
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 = (z * t) * (y * (-9.0d0))
t_2 = 27.0d0 * (a * b)
if (a <= (-1.95d+239)) then
tmp = t_2
else if (a <= (-3d+222)) then
tmp = t_1
else if (a <= (-3.2d-5)) then
tmp = t_2
else if (a <= (-8.2d-84)) then
tmp = x * 2.0d0
else if (a <= (-8d-288)) then
tmp = t_1
else if (a <= 2.9d-89) then
tmp = x * 2.0d0
else
tmp = a * (27.0d0 * b)
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 = (z * t) * (y * -9.0);
double t_2 = 27.0 * (a * b);
double tmp;
if (a <= -1.95e+239) {
tmp = t_2;
} else if (a <= -3e+222) {
tmp = t_1;
} else if (a <= -3.2e-5) {
tmp = t_2;
} else if (a <= -8.2e-84) {
tmp = x * 2.0;
} else if (a <= -8e-288) {
tmp = t_1;
} else if (a <= 2.9e-89) {
tmp = x * 2.0;
} else {
tmp = a * (27.0 * b);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): t_1 = (z * t) * (y * -9.0) t_2 = 27.0 * (a * b) tmp = 0 if a <= -1.95e+239: tmp = t_2 elif a <= -3e+222: tmp = t_1 elif a <= -3.2e-5: tmp = t_2 elif a <= -8.2e-84: tmp = x * 2.0 elif a <= -8e-288: tmp = t_1 elif a <= 2.9e-89: tmp = x * 2.0 else: tmp = a * (27.0 * b) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) t_1 = Float64(Float64(z * t) * Float64(y * -9.0)) t_2 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if (a <= -1.95e+239) tmp = t_2; elseif (a <= -3e+222) tmp = t_1; elseif (a <= -3.2e-5) tmp = t_2; elseif (a <= -8.2e-84) tmp = Float64(x * 2.0); elseif (a <= -8e-288) tmp = t_1; elseif (a <= 2.9e-89) 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])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = (z * t) * (y * -9.0);
t_2 = 27.0 * (a * b);
tmp = 0.0;
if (a <= -1.95e+239)
tmp = t_2;
elseif (a <= -3e+222)
tmp = t_1;
elseif (a <= -3.2e-5)
tmp = t_2;
elseif (a <= -8.2e-84)
tmp = x * 2.0;
elseif (a <= -8e-288)
tmp = t_1;
elseif (a <= 2.9e-89)
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.
code[x_, y_, z_, t_, a_, b_] := Block[{t$95$1 = N[(N[(z * t), $MachinePrecision] * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[a, -1.95e+239], t$95$2, If[LessEqual[a, -3e+222], t$95$1, If[LessEqual[a, -3.2e-5], t$95$2, If[LessEqual[a, -8.2e-84], N[(x * 2.0), $MachinePrecision], If[LessEqual[a, -8e-288], t$95$1, If[LessEqual[a, 2.9e-89], N[(x * 2.0), $MachinePrecision], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
t_1 := \left(z \cdot t\right) \cdot \left(y \cdot -9\right)\\
t_2 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;a \leq -1.95 \cdot 10^{+239}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \leq -3 \cdot 10^{+222}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq -3.2 \cdot 10^{-5}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;a \leq -8.2 \cdot 10^{-84}:\\
\;\;\;\;x \cdot 2\\
\mathbf{elif}\;a \leq -8 \cdot 10^{-288}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;a \leq 2.9 \cdot 10^{-89}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\end{array}
\end{array}
if a < -1.9499999999999999e239 or -3.00000000000000014e222 < a < -3.19999999999999986e-5Initial program 98.0%
associate-+l-98.0%
fma-neg98.0%
neg-sub098.0%
associate-+l-98.0%
neg-sub098.0%
*-commutative98.0%
distribute-rgt-neg-in98.0%
fma-def98.0%
*-commutative98.0%
associate-*r*98.0%
distribute-rgt-neg-in98.0%
*-commutative98.0%
metadata-eval98.0%
Simplified98.0%
fma-udef98.0%
associate-*l*98.1%
Applied egg-rr98.1%
Taylor expanded in a around inf 63.9%
if -1.9499999999999999e239 < a < -3.00000000000000014e222 or -8.2000000000000001e-84 < a < -8.00000000000000046e-288Initial program 91.2%
Taylor expanded in x around 0 61.5%
Taylor expanded in a around 0 50.3%
associate-*r*50.4%
Simplified50.4%
if -3.19999999999999986e-5 < a < -8.2000000000000001e-84 or -8.00000000000000046e-288 < a < 2.89999999999999992e-89Initial program 92.4%
associate-+l-92.4%
fma-neg92.4%
neg-sub092.4%
associate-+l-92.4%
neg-sub092.4%
*-commutative92.4%
distribute-rgt-neg-in92.4%
fma-def92.4%
*-commutative92.4%
associate-*r*92.5%
distribute-rgt-neg-in92.5%
*-commutative92.5%
metadata-eval92.5%
Simplified92.5%
Taylor expanded in x around inf 54.0%
if 2.89999999999999992e-89 < a Initial program 95.9%
associate-+l-95.9%
fma-neg97.2%
neg-sub097.2%
associate-+l-97.2%
neg-sub097.2%
*-commutative97.2%
distribute-rgt-neg-in97.2%
fma-def97.2%
*-commutative97.2%
associate-*r*97.2%
distribute-rgt-neg-in97.2%
*-commutative97.2%
metadata-eval97.2%
Simplified97.2%
fma-udef97.2%
associate-*l*97.2%
Applied egg-rr97.2%
Taylor expanded in a around inf 52.9%
associate-*r*53.0%
*-commutative53.0%
associate-*r*52.9%
Simplified52.9%
Final simplification54.9%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= t -4.8e-176) (not (<= t 2.1e+119))) (- (* x 2.0) (* 9.0 (* y (* z t)))) (- (* x 2.0) (* (* a b) -27.0))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((t <= -4.8e-176) || !(t <= 2.1e+119)) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else {
tmp = (x * 2.0) - ((a * b) * -27.0);
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((t <= (-4.8d-176)) .or. (.not. (t <= 2.1d+119))) then
tmp = (x * 2.0d0) - (9.0d0 * (y * (z * t)))
else
tmp = (x * 2.0d0) - ((a * b) * (-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 ((t <= -4.8e-176) || !(t <= 2.1e+119)) {
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
} else {
tmp = (x * 2.0) - ((a * b) * -27.0);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if (t <= -4.8e-176) or not (t <= 2.1e+119): tmp = (x * 2.0) - (9.0 * (y * (z * t))) else: tmp = (x * 2.0) - ((a * b) * -27.0) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if ((t <= -4.8e-176) || !(t <= 2.1e+119)) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(z * t)))); else tmp = Float64(Float64(x * 2.0) - Float64(Float64(a * b) * -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 ((t <= -4.8e-176) || ~((t <= 2.1e+119)))
tmp = (x * 2.0) - (9.0 * (y * (z * t)));
else
tmp = (x * 2.0) - ((a * b) * -27.0);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[t, -4.8e-176], N[Not[LessEqual[t, 2.1e+119]], $MachinePrecision]], 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[(N[(a * b), $MachinePrecision] * -27.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;t \leq -4.8 \cdot 10^{-176} \lor \neg \left(t \leq 2.1 \cdot 10^{+119}\right):\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(y \cdot \left(z \cdot t\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - \left(a \cdot b\right) \cdot -27\\
\end{array}
\end{array}
if t < -4.80000000000000012e-176 or 2.09999999999999983e119 < t Initial program 95.9%
Taylor expanded in a around 0 69.3%
if -4.80000000000000012e-176 < t < 2.09999999999999983e119Initial program 92.2%
associate-+l-92.2%
sub-neg92.2%
neg-mul-192.2%
metadata-eval92.2%
metadata-eval92.2%
cancel-sign-sub-inv92.2%
metadata-eval92.2%
*-lft-identity92.2%
associate-*l*98.1%
associate-*l*98.0%
Simplified98.0%
Taylor expanded in y around 0 80.3%
*-commutative80.3%
Simplified80.3%
Final simplification74.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 (if (<= z -7.5e+82) (* (* z t) (* y -9.0)) (if (<= z 2.3e+66) (- (* x 2.0) (* a (* b -27.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) {
double tmp;
if (z <= -7.5e+82) {
tmp = (z * t) * (y * -9.0);
} else if (z <= 2.3e+66) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = (z * -9.0) * (y * 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 (z <= (-7.5d+82)) then
tmp = (z * t) * (y * (-9.0d0))
else if (z <= 2.3d+66) then
tmp = (x * 2.0d0) - (a * (b * (-27.0d0)))
else
tmp = (z * (-9.0d0)) * (y * 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 (z <= -7.5e+82) {
tmp = (z * t) * (y * -9.0);
} else if (z <= 2.3e+66) {
tmp = (x * 2.0) - (a * (b * -27.0));
} else {
tmp = (z * -9.0) * (y * t);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= -7.5e+82: tmp = (z * t) * (y * -9.0) elif z <= 2.3e+66: tmp = (x * 2.0) - (a * (b * -27.0)) else: tmp = (z * -9.0) * (y * t) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -7.5e+82) tmp = Float64(Float64(z * t) * Float64(y * -9.0)); elseif (z <= 2.3e+66) tmp = Float64(Float64(x * 2.0) - Float64(a * Float64(b * -27.0))); else tmp = Float64(Float64(z * -9.0) * Float64(y * 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 (z <= -7.5e+82)
tmp = (z * t) * (y * -9.0);
elseif (z <= 2.3e+66)
tmp = (x * 2.0) - (a * (b * -27.0));
else
tmp = (z * -9.0) * (y * t);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -7.5e+82], N[(N[(z * t), $MachinePrecision] * N[(y * -9.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.3e+66], N[(N[(x * 2.0), $MachinePrecision] - N[(a * N[(b * -27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(z * -9.0), $MachinePrecision] * N[(y * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{+82}:\\
\;\;\;\;\left(z \cdot t\right) \cdot \left(y \cdot -9\right)\\
\mathbf{elif}\;z \leq 2.3 \cdot 10^{+66}:\\
\;\;\;\;x \cdot 2 - a \cdot \left(b \cdot -27\right)\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot -9\right) \cdot \left(y \cdot t\right)\\
\end{array}
\end{array}
if z < -7.4999999999999999e82Initial program 89.6%
Taylor expanded in x around 0 75.8%
Taylor expanded in a around 0 53.7%
associate-*r*53.7%
Simplified53.7%
if -7.4999999999999999e82 < z < 2.3e66Initial program 99.2%
associate-+l-99.2%
sub-neg99.2%
neg-mul-199.2%
metadata-eval99.2%
metadata-eval99.2%
cancel-sign-sub-inv99.2%
metadata-eval99.2%
*-lft-identity99.2%
associate-*l*99.1%
associate-*l*99.1%
Simplified99.1%
Taylor expanded in y around 0 77.9%
*-commutative77.9%
associate-*l*77.9%
Simplified77.9%
if 2.3e66 < z Initial program 78.5%
Taylor expanded in y around 0 78.7%
*-commutative78.7%
Simplified78.7%
Taylor expanded in y around 0 78.7%
*-commutative78.7%
associate-*r*78.7%
Simplified78.7%
Taylor expanded in y around inf 61.3%
*-commutative61.3%
associate-*r*68.4%
associate-*l*68.3%
Simplified68.3%
Final simplification72.0%
NOTE: y, z, and t should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z -1e+79) (* (* z t) (* y -9.0)) (if (<= z 2.1e+64) (- (* x 2.0) (* (* a b) -27.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) {
double tmp;
if (z <= -1e+79) {
tmp = (z * t) * (y * -9.0);
} else if (z <= 2.1e+64) {
tmp = (x * 2.0) - ((a * b) * -27.0);
} else {
tmp = (z * -9.0) * (y * 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 (z <= (-1d+79)) then
tmp = (z * t) * (y * (-9.0d0))
else if (z <= 2.1d+64) then
tmp = (x * 2.0d0) - ((a * b) * (-27.0d0))
else
tmp = (z * (-9.0d0)) * (y * 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 (z <= -1e+79) {
tmp = (z * t) * (y * -9.0);
} else if (z <= 2.1e+64) {
tmp = (x * 2.0) - ((a * b) * -27.0);
} else {
tmp = (z * -9.0) * (y * t);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if z <= -1e+79: tmp = (z * t) * (y * -9.0) elif z <= 2.1e+64: tmp = (x * 2.0) - ((a * b) * -27.0) else: tmp = (z * -9.0) * (y * t) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1e+79) tmp = Float64(Float64(z * t) * Float64(y * -9.0)); elseif (z <= 2.1e+64) tmp = Float64(Float64(x * 2.0) - Float64(Float64(a * b) * -27.0)); else tmp = Float64(Float64(z * -9.0) * Float64(y * 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 (z <= -1e+79)
tmp = (z * t) * (y * -9.0);
elseif (z <= 2.1e+64)
tmp = (x * 2.0) - ((a * b) * -27.0);
else
tmp = (z * -9.0) * (y * t);
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1e+79], N[(N[(z * t), $MachinePrecision] * N[(y * -9.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 2.1e+64], N[(N[(x * 2.0), $MachinePrecision] - N[(N[(a * b), $MachinePrecision] * -27.0), $MachinePrecision]), $MachinePrecision], N[(N[(z * -9.0), $MachinePrecision] * N[(y * t), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1 \cdot 10^{+79}:\\
\;\;\;\;\left(z \cdot t\right) \cdot \left(y \cdot -9\right)\\
\mathbf{elif}\;z \leq 2.1 \cdot 10^{+64}:\\
\;\;\;\;x \cdot 2 - \left(a \cdot b\right) \cdot -27\\
\mathbf{else}:\\
\;\;\;\;\left(z \cdot -9\right) \cdot \left(y \cdot t\right)\\
\end{array}
\end{array}
if z < -9.99999999999999967e78Initial program 89.9%
Taylor expanded in x around 0 76.4%
Taylor expanded in a around 0 52.6%
associate-*r*52.6%
Simplified52.6%
if -9.99999999999999967e78 < z < 2.1e64Initial program 99.2%
associate-+l-99.2%
sub-neg99.2%
neg-mul-199.2%
metadata-eval99.2%
metadata-eval99.2%
cancel-sign-sub-inv99.2%
metadata-eval99.2%
*-lft-identity99.2%
associate-*l*99.1%
associate-*l*99.1%
Simplified99.1%
Taylor expanded in y around 0 77.7%
*-commutative77.7%
Simplified77.7%
if 2.1e64 < z Initial program 79.0%
Taylor expanded in y around 0 79.3%
*-commutative79.3%
Simplified79.3%
Taylor expanded in y around 0 79.3%
*-commutative79.3%
associate-*r*79.2%
Simplified79.2%
Taylor expanded in y around inf 60.0%
*-commutative60.0%
associate-*r*66.8%
associate-*l*66.7%
Simplified66.7%
Final simplification71.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 (or (<= a -1.7e-5) (not (<= a 6.5e-89))) (* 27.0 (* a b)) (* x 2.0)))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1.7e-5) || !(a <= 6.5e-89)) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-1.7d-5)) .or. (.not. (a <= 6.5d-89))) then
tmp = 27.0d0 * (a * b)
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1.7e-5) || !(a <= 6.5e-89)) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if (a <= -1.7e-5) or not (a <= 6.5e-89): tmp = 27.0 * (a * b) else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1.7e-5) || !(a <= 6.5e-89)) tmp = Float64(27.0 * Float64(a * b)); else tmp = Float64(x * 2.0); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((a <= -1.7e-5) || ~((a <= 6.5e-89)))
tmp = 27.0 * (a * b);
else
tmp = x * 2.0;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1.7e-5], N[Not[LessEqual[a, 6.5e-89]], $MachinePrecision]], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1.7 \cdot 10^{-5} \lor \neg \left(a \leq 6.5 \cdot 10^{-89}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if a < -1.7e-5 or 6.50000000000000034e-89 < a Initial program 96.1%
associate-+l-96.1%
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%
fma-udef96.9%
associate-*l*96.9%
Applied egg-rr96.9%
Taylor expanded in a around inf 55.9%
if -1.7e-5 < a < 6.50000000000000034e-89Initial program 92.3%
associate-+l-92.3%
fma-neg92.3%
neg-sub092.3%
associate-+l-92.3%
neg-sub092.3%
*-commutative92.3%
distribute-rgt-neg-in92.3%
fma-def92.3%
*-commutative92.3%
associate-*r*92.3%
distribute-rgt-neg-in92.3%
*-commutative92.3%
metadata-eval92.3%
Simplified92.3%
Taylor expanded in x around inf 47.1%
Final simplification51.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 (<= a -2.7e-5) (* 27.0 (* a b)) (if (<= a 3.7e-93) (* x 2.0) (* a (* 27.0 b)))))
assert(y < z && z < t);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -2.7e-5) {
tmp = 27.0 * (a * b);
} else if (a <= 3.7e-93) {
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.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (a <= (-2.7d-5)) then
tmp = 27.0d0 * (a * b)
else if (a <= 3.7d-93) then
tmp = x * 2.0d0
else
tmp = a * (27.0d0 * b)
end if
code = tmp
end function
assert y < z && z < t;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (a <= -2.7e-5) {
tmp = 27.0 * (a * b);
} else if (a <= 3.7e-93) {
tmp = x * 2.0;
} else {
tmp = a * (27.0 * b);
}
return tmp;
}
[y, z, t] = sort([y, z, t]) def code(x, y, z, t, a, b): tmp = 0 if a <= -2.7e-5: tmp = 27.0 * (a * b) elif a <= 3.7e-93: tmp = x * 2.0 else: tmp = a * (27.0 * b) return tmp
y, z, t = sort([y, z, t]) function code(x, y, z, t, a, b) tmp = 0.0 if (a <= -2.7e-5) tmp = Float64(27.0 * Float64(a * b)); elseif (a <= 3.7e-93) 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])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (a <= -2.7e-5)
tmp = 27.0 * (a * b);
elseif (a <= 3.7e-93)
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. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[a, -2.7e-5], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 3.7e-93], N[(x * 2.0), $MachinePrecision], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -2.7 \cdot 10^{-5}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{elif}\;a \leq 3.7 \cdot 10^{-93}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\end{array}
\end{array}
if a < -2.6999999999999999e-5Initial program 96.5%
associate-+l-96.5%
fma-neg96.5%
neg-sub096.5%
associate-+l-96.5%
neg-sub096.5%
*-commutative96.5%
distribute-rgt-neg-in96.5%
fma-def96.5%
*-commutative96.5%
associate-*r*96.5%
distribute-rgt-neg-in96.5%
*-commutative96.5%
metadata-eval96.5%
Simplified96.5%
fma-udef96.5%
associate-*l*96.5%
Applied egg-rr96.5%
Taylor expanded in a around inf 59.7%
if -2.6999999999999999e-5 < a < 3.70000000000000002e-93Initial program 92.3%
associate-+l-92.3%
fma-neg92.3%
neg-sub092.3%
associate-+l-92.3%
neg-sub092.3%
*-commutative92.3%
distribute-rgt-neg-in92.3%
fma-def92.3%
*-commutative92.3%
associate-*r*92.3%
distribute-rgt-neg-in92.3%
*-commutative92.3%
metadata-eval92.3%
Simplified92.3%
Taylor expanded in x around inf 47.1%
if 3.70000000000000002e-93 < a Initial program 95.9%
associate-+l-95.9%
fma-neg97.2%
neg-sub097.2%
associate-+l-97.2%
neg-sub097.2%
*-commutative97.2%
distribute-rgt-neg-in97.2%
fma-def97.2%
*-commutative97.2%
associate-*r*97.2%
distribute-rgt-neg-in97.2%
*-commutative97.2%
metadata-eval97.2%
Simplified97.2%
fma-udef97.2%
associate-*l*97.2%
Applied egg-rr97.2%
Taylor expanded in a around inf 52.9%
associate-*r*53.0%
*-commutative53.0%
associate-*r*52.9%
Simplified52.9%
Final simplification51.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 (* 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 94.3%
associate-+l-94.3%
fma-neg94.7%
neg-sub094.7%
associate-+l-94.7%
neg-sub094.7%
*-commutative94.7%
distribute-rgt-neg-in94.7%
fma-def94.7%
*-commutative94.7%
associate-*r*94.7%
distribute-rgt-neg-in94.7%
*-commutative94.7%
metadata-eval94.7%
Simplified94.7%
Taylor expanded in x around inf 32.5%
Final simplification32.5%
(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 2023278
(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)))