
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (x y z t a b) :precision binary64 (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + ((a * 27.0d0) * b)
end function
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b);
}
def code(x, y, z, t, a, b): return ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b)
function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(Float64(a * 27.0) * b)) end
function tmp = code(x, y, z, t, a, b) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + ((a * 27.0) * b); end
code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + \left(a \cdot 27\right) \cdot b
\end{array}
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z -2e-247) (+ (* x 2.0) (- (* a (* 27.0 b)) (* (* y 9.0) (* z t)))) (+ (- (* x 2.0) (* t (* y (* z 9.0)))) (* b (* a 27.0)))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2e-247) {
tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (z * t)));
} else {
tmp = ((x * 2.0) - (t * (y * (z * 9.0)))) + (b * (a * 27.0));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-2d-247)) then
tmp = (x * 2.0d0) + ((a * (27.0d0 * b)) - ((y * 9.0d0) * (z * t)))
else
tmp = ((x * 2.0d0) - (t * (y * (z * 9.0d0)))) + (b * (a * 27.0d0))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -2e-247) {
tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (z * t)));
} else {
tmp = ((x * 2.0) - (t * (y * (z * 9.0)))) + (b * (a * 27.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -2e-247: tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (z * t))) else: tmp = ((x * 2.0) - (t * (y * (z * 9.0)))) + (b * (a * 27.0)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -2e-247) 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(Float64(x * 2.0) - Float64(t * Float64(y * Float64(z * 9.0)))) + Float64(b * Float64(a * 27.0))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -2e-247)
tmp = (x * 2.0) + ((a * (27.0 * b)) - ((y * 9.0) * (z * t)));
else
tmp = ((x * 2.0) - (t * (y * (z * 9.0)))) + (b * (a * 27.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -2e-247], 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[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(y * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2 \cdot 10^{-247}:\\
\;\;\;\;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}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(y \cdot \left(z \cdot 9\right)\right)\right) + b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if z < -2e-247Initial program 97.4%
associate-+l-97.4%
sub-neg97.4%
neg-mul-197.4%
metadata-eval97.4%
metadata-eval97.4%
cancel-sign-sub-inv97.4%
metadata-eval97.4%
*-lft-identity97.4%
associate-*l*95.8%
associate-*l*95.8%
Simplified95.8%
if -2e-247 < z Initial program 98.4%
Taylor expanded in y around 0 98.4%
associate-*r*98.4%
*-commutative98.4%
associate-*r*98.4%
Simplified98.4%
Final simplification97.2%
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(let* ((t_1 (* b (* a 27.0))))
(if (or (<= t_1 -4e+38) (not (<= t_1 3e+124)))
(+ t_1 (* t (* z (* y -9.0))))
(+ (* 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 = b * (a * 27.0);
double tmp;
if ((t_1 <= -4e+38) || !(t_1 <= 3e+124)) {
tmp = t_1 + (t * (z * (y * -9.0)));
} else {
tmp = (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 = b * (a * 27.0d0)
if ((t_1 <= (-4d+38)) .or. (.not. (t_1 <= 3d+124))) then
tmp = t_1 + (t * (z * (y * (-9.0d0))))
else
tmp = (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 = b * (a * 27.0);
double tmp;
if ((t_1 <= -4e+38) || !(t_1 <= 3e+124)) {
tmp = t_1 + (t * (z * (y * -9.0)));
} else {
tmp = (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 = b * (a * 27.0) tmp = 0 if (t_1 <= -4e+38) or not (t_1 <= 3e+124): tmp = t_1 + (t * (z * (y * -9.0))) else: tmp = (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(b * Float64(a * 27.0)) tmp = 0.0 if ((t_1 <= -4e+38) || !(t_1 <= 3e+124)) tmp = Float64(t_1 + Float64(t * Float64(z * Float64(y * -9.0)))); else tmp = Float64(Float64(x * 2.0) + Float64(Float64(y * -9.0) * Float64(z * t))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
t_1 = b * (a * 27.0);
tmp = 0.0;
if ((t_1 <= -4e+38) || ~((t_1 <= 3e+124)))
tmp = t_1 + (t * (z * (y * -9.0)));
else
tmp = (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[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$1, -4e+38], N[Not[LessEqual[t$95$1, 3e+124]], $MachinePrecision]], N[(t$95$1 + N[(t * N[(z * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(y * -9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a \cdot 27\right)\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+38} \lor \neg \left(t_1 \leq 3 \cdot 10^{+124}\right):\\
\;\;\;\;t_1 + t \cdot \left(z \cdot \left(y \cdot -9\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + \left(y \cdot -9\right) \cdot \left(z \cdot t\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 a 27) b) < -3.99999999999999991e38 or 3e124 < (*.f64 (*.f64 a 27) b) Initial program 99.8%
Taylor expanded in y around 0 99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
add-sqr-sqrt59.5%
sqrt-unprod79.9%
swap-sqr79.9%
metadata-eval79.9%
metadata-eval79.9%
swap-sqr79.9%
*-commutative79.9%
*-commutative79.9%
sqrt-unprod28.2%
add-sqr-sqrt77.6%
associate-*r*76.7%
*-commutative76.7%
add-sqr-sqrt52.4%
sqrt-unprod80.9%
pow280.9%
Applied egg-rr80.9%
associate-*r*81.8%
Simplified81.8%
sqrt-pow197.9%
metadata-eval97.9%
pow197.9%
Applied egg-rr97.9%
Taylor expanded in x around 0 91.1%
associate-*r*91.1%
*-commutative91.1%
*-commutative91.1%
associate-*r*95.1%
*-commutative95.1%
Simplified95.1%
if -3.99999999999999991e38 < (*.f64 (*.f64 a 27) b) < 3e124Initial 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*95.7%
associate-*l*95.6%
Simplified95.6%
Taylor expanded in a around 0 81.8%
cancel-sign-sub-inv81.8%
metadata-eval81.8%
associate-*l*81.8%
*-commutative81.8%
*-commutative81.8%
Applied egg-rr81.8%
Final simplification87.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
(let* ((t_1 (* b (* a 27.0))))
(if (<= t_1 -4e+38)
(+ t_1 (* t (* z (* y -9.0))))
(if (<= t_1 3e+124)
(+ (* x 2.0) (* (* y -9.0) (* z t)))
(+ t_1 (* y (* t (* z -9.0))))))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a * 27.0);
double tmp;
if (t_1 <= -4e+38) {
tmp = t_1 + (t * (z * (y * -9.0)));
} else if (t_1 <= 3e+124) {
tmp = (x * 2.0) + ((y * -9.0) * (z * t));
} else {
tmp = t_1 + (y * (t * (z * -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 = b * (a * 27.0d0)
if (t_1 <= (-4d+38)) then
tmp = t_1 + (t * (z * (y * (-9.0d0))))
else if (t_1 <= 3d+124) then
tmp = (x * 2.0d0) + ((y * (-9.0d0)) * (z * t))
else
tmp = t_1 + (y * (t * (z * (-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 = b * (a * 27.0);
double tmp;
if (t_1 <= -4e+38) {
tmp = t_1 + (t * (z * (y * -9.0)));
} else if (t_1 <= 3e+124) {
tmp = (x * 2.0) + ((y * -9.0) * (z * t));
} else {
tmp = t_1 + (y * (t * (z * -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 = b * (a * 27.0) tmp = 0 if t_1 <= -4e+38: tmp = t_1 + (t * (z * (y * -9.0))) elif t_1 <= 3e+124: tmp = (x * 2.0) + ((y * -9.0) * (z * t)) else: tmp = t_1 + (y * (t * (z * -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(b * Float64(a * 27.0)) tmp = 0.0 if (t_1 <= -4e+38) tmp = Float64(t_1 + Float64(t * Float64(z * Float64(y * -9.0)))); elseif (t_1 <= 3e+124) tmp = Float64(Float64(x * 2.0) + Float64(Float64(y * -9.0) * Float64(z * t))); else tmp = Float64(t_1 + Float64(y * Float64(t * Float64(z * -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 = b * (a * 27.0);
tmp = 0.0;
if (t_1 <= -4e+38)
tmp = t_1 + (t * (z * (y * -9.0)));
elseif (t_1 <= 3e+124)
tmp = (x * 2.0) + ((y * -9.0) * (z * t));
else
tmp = t_1 + (y * (t * (z * -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[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+38], N[(t$95$1 + N[(t * N[(z * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 3e+124], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(y * -9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(y * N[(t * N[(z * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a \cdot 27\right)\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+38}:\\
\;\;\;\;t_1 + t \cdot \left(z \cdot \left(y \cdot -9\right)\right)\\
\mathbf{elif}\;t_1 \leq 3 \cdot 10^{+124}:\\
\;\;\;\;x \cdot 2 + \left(y \cdot -9\right) \cdot \left(z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;t_1 + y \cdot \left(t \cdot \left(z \cdot -9\right)\right)\\
\end{array}
\end{array}
if (*.f64 (*.f64 a 27) b) < -3.99999999999999991e38Initial program 99.8%
Taylor expanded in y around 0 99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
add-sqr-sqrt59.9%
sqrt-unprod82.0%
swap-sqr82.0%
metadata-eval82.0%
metadata-eval82.0%
swap-sqr82.0%
*-commutative82.0%
*-commutative82.0%
sqrt-unprod30.9%
add-sqr-sqrt79.9%
associate-*r*80.0%
*-commutative80.0%
add-sqr-sqrt58.2%
sqrt-unprod87.4%
pow287.4%
Applied egg-rr87.4%
associate-*r*89.1%
Simplified89.1%
sqrt-pow199.8%
metadata-eval99.8%
pow199.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 89.3%
associate-*r*89.3%
*-commutative89.3%
*-commutative89.3%
associate-*r*94.3%
*-commutative94.3%
Simplified94.3%
if -3.99999999999999991e38 < (*.f64 (*.f64 a 27) b) < 3e124Initial 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*95.7%
associate-*l*95.6%
Simplified95.6%
Taylor expanded in a around 0 81.8%
cancel-sign-sub-inv81.8%
metadata-eval81.8%
associate-*l*81.8%
*-commutative81.8%
*-commutative81.8%
Applied egg-rr81.8%
if 3e124 < (*.f64 (*.f64 a 27) b) Initial program 99.8%
Taylor expanded in x around 0 93.4%
*-commutative93.4%
*-commutative93.4%
associate-*r*93.3%
associate-*r*93.3%
*-commutative93.3%
associate-*l*93.3%
*-commutative93.3%
Simplified93.3%
Final simplification86.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 (* b (* a 27.0))) (t_2 (* (* y -9.0) (* z t))))
(if (<= t_1 -4e+38)
(+ t_1 (* t (* z (* y -9.0))))
(if (<= t_1 3e+124) (+ (* x 2.0) t_2) (+ t_1 t_2)))))assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double t_1 = b * (a * 27.0);
double t_2 = (y * -9.0) * (z * t);
double tmp;
if (t_1 <= -4e+38) {
tmp = t_1 + (t * (z * (y * -9.0)));
} else if (t_1 <= 3e+124) {
tmp = (x * 2.0) + t_2;
} else {
tmp = t_1 + 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 = b * (a * 27.0d0)
t_2 = (y * (-9.0d0)) * (z * t)
if (t_1 <= (-4d+38)) then
tmp = t_1 + (t * (z * (y * (-9.0d0))))
else if (t_1 <= 3d+124) then
tmp = (x * 2.0d0) + t_2
else
tmp = t_1 + 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 = b * (a * 27.0);
double t_2 = (y * -9.0) * (z * t);
double tmp;
if (t_1 <= -4e+38) {
tmp = t_1 + (t * (z * (y * -9.0)));
} else if (t_1 <= 3e+124) {
tmp = (x * 2.0) + t_2;
} else {
tmp = t_1 + 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 = b * (a * 27.0) t_2 = (y * -9.0) * (z * t) tmp = 0 if t_1 <= -4e+38: tmp = t_1 + (t * (z * (y * -9.0))) elif t_1 <= 3e+124: tmp = (x * 2.0) + t_2 else: tmp = t_1 + 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(b * Float64(a * 27.0)) t_2 = Float64(Float64(y * -9.0) * Float64(z * t)) tmp = 0.0 if (t_1 <= -4e+38) tmp = Float64(t_1 + Float64(t * Float64(z * Float64(y * -9.0)))); elseif (t_1 <= 3e+124) tmp = Float64(Float64(x * 2.0) + t_2); else tmp = Float64(t_1 + 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 = b * (a * 27.0);
t_2 = (y * -9.0) * (z * t);
tmp = 0.0;
if (t_1 <= -4e+38)
tmp = t_1 + (t * (z * (y * -9.0)));
elseif (t_1 <= 3e+124)
tmp = (x * 2.0) + t_2;
else
tmp = t_1 + 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[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(y * -9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, -4e+38], N[(t$95$1 + N[(t * N[(z * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$1, 3e+124], N[(N[(x * 2.0), $MachinePrecision] + t$95$2), $MachinePrecision], N[(t$95$1 + t$95$2), $MachinePrecision]]]]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
t_1 := b \cdot \left(a \cdot 27\right)\\
t_2 := \left(y \cdot -9\right) \cdot \left(z \cdot t\right)\\
\mathbf{if}\;t_1 \leq -4 \cdot 10^{+38}:\\
\;\;\;\;t_1 + t \cdot \left(z \cdot \left(y \cdot -9\right)\right)\\
\mathbf{elif}\;t_1 \leq 3 \cdot 10^{+124}:\\
\;\;\;\;x \cdot 2 + t_2\\
\mathbf{else}:\\
\;\;\;\;t_1 + t_2\\
\end{array}
\end{array}
if (*.f64 (*.f64 a 27) b) < -3.99999999999999991e38Initial program 99.8%
Taylor expanded in y around 0 99.8%
associate-*r*99.8%
*-commutative99.8%
associate-*r*99.8%
Simplified99.8%
add-sqr-sqrt59.9%
sqrt-unprod82.0%
swap-sqr82.0%
metadata-eval82.0%
metadata-eval82.0%
swap-sqr82.0%
*-commutative82.0%
*-commutative82.0%
sqrt-unprod30.9%
add-sqr-sqrt79.9%
associate-*r*80.0%
*-commutative80.0%
add-sqr-sqrt58.2%
sqrt-unprod87.4%
pow287.4%
Applied egg-rr87.4%
associate-*r*89.1%
Simplified89.1%
sqrt-pow199.8%
metadata-eval99.8%
pow199.8%
Applied egg-rr99.8%
Taylor expanded in x around 0 89.3%
associate-*r*89.3%
*-commutative89.3%
*-commutative89.3%
associate-*r*94.3%
*-commutative94.3%
Simplified94.3%
if -3.99999999999999991e38 < (*.f64 (*.f64 a 27) b) < 3e124Initial 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*95.7%
associate-*l*95.6%
Simplified95.6%
Taylor expanded in a around 0 81.8%
cancel-sign-sub-inv81.8%
metadata-eval81.8%
associate-*l*81.8%
*-commutative81.8%
*-commutative81.8%
Applied egg-rr81.8%
if 3e124 < (*.f64 (*.f64 a 27) b) Initial program 99.8%
Taylor expanded in x around 0 93.4%
associate-*r*93.3%
Simplified93.3%
Final simplification86.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 (+ (* b (* a 27.0)) (- (* x 2.0) (* (* z 9.0) (* y t)))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
return (b * (a * 27.0)) + ((x * 2.0) - ((z * 9.0) * (y * t)));
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
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 = (b * (a * 27.0d0)) + ((x * 2.0d0) - ((z * 9.0d0) * (y * t)))
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 (b * (a * 27.0)) + ((x * 2.0) - ((z * 9.0) * (y * t)));
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): return (b * (a * 27.0)) + ((x * 2.0) - ((z * 9.0) * (y * t)))
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) return Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(Float64(z * 9.0) * Float64(y * t)))) end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = (b * (a * 27.0)) + ((x * 2.0) - ((z * 9.0) * (y * t)));
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(N[(z * 9.0), $MachinePrecision] * N[(y * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - \left(z \cdot 9\right) \cdot \left(y \cdot t\right)\right)
\end{array}
Initial program 97.9%
Taylor expanded in y around 0 97.9%
associate-*r*97.9%
*-commutative97.9%
associate-*r*97.9%
Simplified97.9%
add-sqr-sqrt50.3%
sqrt-unprod73.1%
swap-sqr73.1%
metadata-eval73.1%
metadata-eval73.1%
swap-sqr73.1%
*-commutative73.1%
*-commutative73.1%
sqrt-unprod31.3%
add-sqr-sqrt64.9%
associate-*r*64.1%
*-commutative64.1%
add-sqr-sqrt44.5%
sqrt-unprod75.1%
pow275.1%
Applied egg-rr75.1%
associate-*r*76.5%
Simplified76.5%
sqrt-pow196.9%
metadata-eval96.9%
pow196.9%
Applied egg-rr96.9%
Final simplification96.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 (+ (- (* x 2.0) (* t (* y (* z 9.0)))) (* b (* a 27.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) - (t * (y * (z * 9.0)))) + (b * (a * 27.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) - (t * (y * (z * 9.0d0)))) + (b * (a * 27.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) - (t * (y * (z * 9.0)))) + (b * (a * 27.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) - (t * (y * (z * 9.0)))) + (b * (a * 27.0))
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(y * Float64(z * 9.0)))) + Float64(b * Float64(a * 27.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) - (t * (y * (z * 9.0)))) + (b * (a * 27.0));
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(y * N[(z * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\left(x \cdot 2 - t \cdot \left(y \cdot \left(z \cdot 9\right)\right)\right) + b \cdot \left(a \cdot 27\right)
\end{array}
Initial program 97.9%
Taylor expanded in y around 0 97.9%
associate-*r*97.9%
*-commutative97.9%
associate-*r*97.9%
Simplified97.9%
Final simplification97.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 (+ (* b (* a 27.0)) (- (* x 2.0) (* t (* z (* y 9.0))))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
return (b * (a * 27.0)) + ((x * 2.0) - (t * (z * (y * 9.0))));
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
code = (b * (a * 27.0d0)) + ((x * 2.0d0) - (t * (z * (y * 9.0d0))))
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return (b * (a * 27.0)) + ((x * 2.0) - (t * (z * (y * 9.0))));
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): return (b * (a * 27.0)) + ((x * 2.0) - (t * (z * (y * 9.0))))
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) return Float64(Float64(b * Float64(a * 27.0)) + Float64(Float64(x * 2.0) - Float64(t * Float64(z * Float64(y * 9.0))))) end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = (b * (a * 27.0)) + ((x * 2.0) - (t * (z * (y * 9.0))));
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(z * N[(y * 9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - t \cdot \left(z \cdot \left(y \cdot 9\right)\right)\right)
\end{array}
Initial program 97.9%
Final simplification97.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 (<= y -1.9e+79) (not (<= y 460000000000.0))) (+ (* x 2.0) (* (* y -9.0) (* z t))) (+ (* x 2.0) (* b (* a 27.0)))))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.9e+79) || !(y <= 460000000000.0)) {
tmp = (x * 2.0) + ((y * -9.0) * (z * t));
} else {
tmp = (x * 2.0) + (b * (a * 27.0));
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((y <= (-1.9d+79)) .or. (.not. (y <= 460000000000.0d0))) then
tmp = (x * 2.0d0) + ((y * (-9.0d0)) * (z * t))
else
tmp = (x * 2.0d0) + (b * (a * 27.0d0))
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((y <= -1.9e+79) || !(y <= 460000000000.0)) {
tmp = (x * 2.0) + ((y * -9.0) * (z * t));
} else {
tmp = (x * 2.0) + (b * (a * 27.0));
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if (y <= -1.9e+79) or not (y <= 460000000000.0): tmp = (x * 2.0) + ((y * -9.0) * (z * t)) else: tmp = (x * 2.0) + (b * (a * 27.0)) return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((y <= -1.9e+79) || !(y <= 460000000000.0)) tmp = Float64(Float64(x * 2.0) + Float64(Float64(y * -9.0) * Float64(z * t))); else tmp = Float64(Float64(x * 2.0) + Float64(b * Float64(a * 27.0))); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((y <= -1.9e+79) || ~((y <= 460000000000.0)))
tmp = (x * 2.0) + ((y * -9.0) * (z * t));
else
tmp = (x * 2.0) + (b * (a * 27.0));
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[y, -1.9e+79], N[Not[LessEqual[y, 460000000000.0]], $MachinePrecision]], N[(N[(x * 2.0), $MachinePrecision] + N[(N[(y * -9.0), $MachinePrecision] * N[(z * t), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;y \leq -1.9 \cdot 10^{+79} \lor \neg \left(y \leq 460000000000\right):\\
\;\;\;\;x \cdot 2 + \left(y \cdot -9\right) \cdot \left(z \cdot t\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if y < -1.9000000000000001e79 or 4.6e11 < y Initial program 97.3%
associate-+l-97.3%
sub-neg97.3%
neg-mul-197.3%
metadata-eval97.3%
metadata-eval97.3%
cancel-sign-sub-inv97.3%
metadata-eval97.3%
*-lft-identity97.3%
associate-*l*99.0%
associate-*l*99.0%
Simplified99.0%
Taylor expanded in a around 0 73.0%
cancel-sign-sub-inv73.0%
metadata-eval73.0%
associate-*l*73.0%
*-commutative73.0%
*-commutative73.0%
Applied egg-rr73.0%
if -1.9000000000000001e79 < y < 4.6e11Initial program 98.4%
Taylor expanded in x around inf 78.5%
Final simplification76.1%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= a -1e+41) (not (<= a 1.2e-72))) (* 27.0 (* a b)) (* x 2.0)))
assert(y < z && z < t);
assert(a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1e+41) || !(a <= 1.2e-72)) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
NOTE: y, z, and t should be sorted in increasing order before calling this function.
NOTE: a and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if ((a <= (-1d+41)) .or. (.not. (a <= 1.2d-72))) then
tmp = 27.0d0 * (a * b)
else
tmp = x * 2.0d0
end if
code = tmp
end function
assert y < z && z < t;
assert a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((a <= -1e+41) || !(a <= 1.2e-72)) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
return tmp;
}
[y, z, t] = sort([y, z, t]) [a, b] = sort([a, b]) def code(x, y, z, t, a, b): tmp = 0 if (a <= -1e+41) or not (a <= 1.2e-72): tmp = 27.0 * (a * b) else: tmp = x * 2.0 return tmp
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((a <= -1e+41) || !(a <= 1.2e-72)) tmp = Float64(27.0 * Float64(a * b)); else tmp = Float64(x * 2.0); end return tmp end
y, z, t = num2cell(sort([y, z, t])){:}
a, b = num2cell(sort([a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((a <= -1e+41) || ~((a <= 1.2e-72)))
tmp = 27.0 * (a * b);
else
tmp = x * 2.0;
end
tmp_2 = tmp;
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[a, -1e+41], N[Not[LessEqual[a, 1.2e-72]], $MachinePrecision]], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;a \leq -1 \cdot 10^{+41} \lor \neg \left(a \leq 1.2 \cdot 10^{-72}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if a < -1.00000000000000001e41 or 1.2e-72 < a Initial program 99.9%
Taylor expanded in x around inf 79.0%
Taylor expanded in x around 0 56.8%
if -1.00000000000000001e41 < a < 1.2e-72Initial program 96.1%
Taylor expanded in y around 0 96.0%
associate-*r*96.1%
*-commutative96.1%
associate-*r*96.1%
Simplified96.1%
add-sqr-sqrt48.0%
sqrt-unprod65.5%
swap-sqr65.5%
metadata-eval65.5%
metadata-eval65.5%
swap-sqr65.5%
*-commutative65.5%
*-commutative65.5%
sqrt-unprod29.1%
add-sqr-sqrt55.0%
associate-*r*55.0%
*-commutative55.0%
add-sqr-sqrt38.9%
sqrt-unprod69.3%
pow269.3%
Applied egg-rr69.3%
associate-*r*70.7%
Simplified70.7%
Taylor expanded in x around inf 36.1%
Final simplification46.2%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= a -2.5e+43) (* b (* a 27.0)) (if (<= a 5.2e-74) (* x 2.0) (* 27.0 (* a 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 (a <= -2.5e+43) {
tmp = b * (a * 27.0);
} else if (a <= 5.2e-74) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * 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 (a <= (-2.5d+43)) then
tmp = b * (a * 27.0d0)
else if (a <= 5.2d-74) then
tmp = x * 2.0d0
else
tmp = 27.0d0 * (a * 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 (a <= -2.5e+43) {
tmp = b * (a * 27.0);
} else if (a <= 5.2e-74) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * 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 a <= -2.5e+43: tmp = b * (a * 27.0) elif a <= 5.2e-74: tmp = x * 2.0 else: tmp = 27.0 * (a * 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 (a <= -2.5e+43) tmp = Float64(b * Float64(a * 27.0)); elseif (a <= 5.2e-74) tmp = Float64(x * 2.0); else tmp = Float64(27.0 * Float64(a * 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 (a <= -2.5e+43)
tmp = b * (a * 27.0);
elseif (a <= 5.2e-74)
tmp = x * 2.0;
else
tmp = 27.0 * (a * 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[a, -2.5e+43], N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision], If[LessEqual[a, 5.2e-74], N[(x * 2.0), $MachinePrecision], N[(27.0 * N[(a * 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}\;a \leq -2.5 \cdot 10^{+43}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right)\\
\mathbf{elif}\;a \leq 5.2 \cdot 10^{-74}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if a < -2.5000000000000002e43Initial program 99.9%
Taylor expanded in y around 0 99.9%
associate-*r*99.9%
*-commutative99.9%
associate-*r*99.9%
Simplified99.9%
add-sqr-sqrt53.9%
sqrt-unprod86.2%
swap-sqr86.2%
metadata-eval86.2%
metadata-eval86.2%
swap-sqr86.2%
*-commutative86.2%
*-commutative86.2%
sqrt-unprod36.0%
add-sqr-sqrt82.0%
associate-*r*82.1%
*-commutative82.1%
add-sqr-sqrt60.1%
sqrt-unprod82.5%
pow282.5%
Applied egg-rr82.5%
associate-*r*84.4%
Simplified84.4%
sqrt-pow199.8%
metadata-eval99.8%
pow199.8%
Applied egg-rr99.8%
Taylor expanded in a around inf 65.0%
*-commutative65.0%
*-commutative65.0%
associate-*r*65.1%
*-commutative65.1%
Simplified65.1%
if -2.5000000000000002e43 < a < 5.2000000000000002e-74Initial program 96.1%
Taylor expanded in y around 0 96.0%
associate-*r*96.1%
*-commutative96.1%
associate-*r*96.1%
Simplified96.1%
add-sqr-sqrt47.6%
sqrt-unprod65.0%
swap-sqr65.0%
metadata-eval65.0%
metadata-eval65.0%
swap-sqr65.0%
*-commutative65.0%
*-commutative65.0%
sqrt-unprod28.9%
add-sqr-sqrt54.6%
associate-*r*54.6%
*-commutative54.6%
add-sqr-sqrt38.6%
sqrt-unprod68.8%
pow268.8%
Applied egg-rr68.8%
associate-*r*70.2%
Simplified70.2%
Taylor expanded in x around inf 35.8%
if 5.2000000000000002e-74 < a Initial program 99.9%
Taylor expanded in x around inf 76.1%
Taylor expanded in x around 0 52.0%
Final simplification46.2%
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (+ (* x 2.0) (* b (* a 27.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) + (b * (a * 27.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) + (b * (a * 27.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) + (b * (a * 27.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) + (b * (a * 27.0))
y, z, t = sort([y, z, t]) a, b = sort([a, b]) function code(x, y, z, t, a, b) return Float64(Float64(x * 2.0) + Float64(b * Float64(a * 27.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) + (b * (a * 27.0));
end
NOTE: y, z, and t should be sorted in increasing order before calling this function. NOTE: a and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(N[(x * 2.0), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[y, z, t] = \mathsf{sort}([y, z, t])\\
[a, b] = \mathsf{sort}([a, b])\\
\\
x \cdot 2 + b \cdot \left(a \cdot 27\right)
\end{array}
Initial program 97.9%
Taylor expanded in x around inf 67.3%
Final simplification67.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 97.9%
Taylor expanded in y around 0 97.9%
associate-*r*97.9%
*-commutative97.9%
associate-*r*97.9%
Simplified97.9%
add-sqr-sqrt50.3%
sqrt-unprod73.1%
swap-sqr73.1%
metadata-eval73.1%
metadata-eval73.1%
swap-sqr73.1%
*-commutative73.1%
*-commutative73.1%
sqrt-unprod31.3%
add-sqr-sqrt64.9%
associate-*r*64.1%
*-commutative64.1%
add-sqr-sqrt44.5%
sqrt-unprod75.1%
pow275.1%
Applied egg-rr75.1%
associate-*r*76.5%
Simplified76.5%
Taylor expanded in x around inf 29.4%
Final simplification29.4%
(FPCore (x y z t a b) :precision binary64 (if (< y 7.590524218811189e-161) (+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* a (* 27.0 b))) (+ (- (* x 2.0) (* 9.0 (* y (* t z)))) (* (* a 27.0) b))))
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (y < 7.590524218811189d-161) then
tmp = ((x * 2.0d0) - (((y * 9.0d0) * z) * t)) + (a * (27.0d0 * b))
else
tmp = ((x * 2.0d0) - (9.0d0 * (y * (t * z)))) + ((a * 27.0d0) * b)
end if
code = tmp
end function
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (y < 7.590524218811189e-161) {
tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b));
} else {
tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b);
}
return tmp;
}
def code(x, y, z, t, a, b): tmp = 0 if y < 7.590524218811189e-161: tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)) else: tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b) return tmp
function code(x, y, z, t, a, b) tmp = 0.0 if (y < 7.590524218811189e-161) tmp = Float64(Float64(Float64(x * 2.0) - Float64(Float64(Float64(y * 9.0) * z) * t)) + Float64(a * Float64(27.0 * b))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(9.0 * Float64(y * Float64(t * z)))) + Float64(Float64(a * 27.0) * b)); end return tmp end
function tmp_2 = code(x, y, z, t, a, b) tmp = 0.0; if (y < 7.590524218811189e-161) tmp = ((x * 2.0) - (((y * 9.0) * z) * t)) + (a * (27.0 * b)); else tmp = ((x * 2.0) - (9.0 * (y * (t * z)))) + ((a * 27.0) * b); end tmp_2 = tmp; end
code[x_, y_, z_, t_, a_, b_] := If[Less[y, 7.590524218811189e-161], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(N[(N[(y * 9.0), $MachinePrecision] * z), $MachinePrecision] * t), $MachinePrecision]), $MachinePrecision] + N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(y * N[(t * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(a * 27.0), $MachinePrecision] * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;y < 7.590524218811189 \cdot 10^{-161}:\\
\;\;\;\;\left(x \cdot 2 - \left(\left(y \cdot 9\right) \cdot z\right) \cdot t\right) + a \cdot \left(27 \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - 9 \cdot \left(y \cdot \left(t \cdot z\right)\right)\right) + \left(a \cdot 27\right) \cdot b\\
\end{array}
\end{array}
herbie shell --seed 2023217
(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)))