
(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 11 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: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (fma a (* 27.0 b) (fma x 2.0 (* t (* y (* -9.0 z))))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return fma(a, (27.0 * b), fma(x, 2.0, (t * (y * (-9.0 * z)))));
}
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(t * Float64(y * Float64(-9.0 * z))))) end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := N[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0 + N[(t * N[(y * N[(-9.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\mathsf{fma}\left(a, 27 \cdot b, \mathsf{fma}\left(x, 2, t \cdot \left(y \cdot \left(-9 \cdot z\right)\right)\right)\right)
\end{array}
Initial program 94.9%
+-commutative94.9%
associate-+r-94.9%
*-commutative94.9%
cancel-sign-sub-inv94.9%
associate-*r*95.5%
distribute-lft-neg-in95.5%
*-commutative95.5%
cancel-sign-sub-inv95.5%
associate-+r-95.5%
associate-*l*95.5%
fma-define97.1%
cancel-sign-sub-inv97.1%
fma-define97.1%
distribute-lft-neg-in97.1%
distribute-rgt-neg-in97.1%
*-commutative97.1%
associate-*r*96.5%
associate-*l*96.5%
neg-mul-196.5%
associate-*r*96.5%
Simplified96.5%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.1e-28) (not (<= z 2.85e-159))) (- (* x 2.0) (* 9.0 (* t (* y z)))) (+ (* x 2.0) (* 27.0 (* a b)))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.1e-28) || !(z <= 2.85e-159)) {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
} else {
tmp = (x * 2.0) + (27.0 * (a * b));
}
return tmp;
}
NOTE: x, y, z, t, 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 <= (-2.1d-28)) .or. (.not. (z <= 2.85d-159))) then
tmp = (x * 2.0d0) - (9.0d0 * (t * (y * z)))
else
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.1e-28) || !(z <= 2.85e-159)) {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
} else {
tmp = (x * 2.0) + (27.0 * (a * b));
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if (z <= -2.1e-28) or not (z <= 2.85e-159): tmp = (x * 2.0) - (9.0 * (t * (y * z))) else: tmp = (x * 2.0) + (27.0 * (a * b)) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.1e-28) || !(z <= 2.85e-159)) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(y * z)))); else tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((z <= -2.1e-28) || ~((z <= 2.85e-159)))
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
else
tmp = (x * 2.0) + (27.0 * (a * b));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.1e-28], N[Not[LessEqual[z, 2.85e-159]], $MachinePrecision]], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.1 \cdot 10^{-28} \lor \neg \left(z \leq 2.85 \cdot 10^{-159}\right):\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if z < -2.10000000000000006e-28 or 2.84999999999999981e-159 < z Initial program 94.2%
sub-neg94.2%
sub-neg94.2%
associate-*l*94.2%
associate-*l*94.2%
Simplified94.2%
Taylor expanded in a around 0 70.0%
if -2.10000000000000006e-28 < z < 2.84999999999999981e-159Initial program 96.9%
+-commutative96.9%
associate-+r-96.9%
*-commutative96.9%
cancel-sign-sub-inv96.9%
associate-*r*93.8%
distribute-lft-neg-in93.8%
*-commutative93.8%
cancel-sign-sub-inv93.8%
associate-+r-93.8%
associate-*l*93.8%
fma-define93.8%
cancel-sign-sub-inv93.8%
fma-define93.8%
distribute-lft-neg-in93.8%
distribute-rgt-neg-in93.8%
*-commutative93.8%
associate-*r*96.8%
associate-*l*96.9%
neg-mul-196.9%
associate-*r*96.9%
Simplified96.9%
Taylor expanded in t around 0 82.2%
Final simplification73.1%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
(FPCore (x y z t a b)
:precision binary64
(if (<= z -6.5e-29)
(* z (- (* 2.0 (/ x z)) (* 9.0 (* t y))))
(if (<= z 8e-158)
(+ (* x 2.0) (* 27.0 (* a b)))
(- (* x 2.0) (* 9.0 (* t (* y z)))))))assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -6.5e-29) {
tmp = z * ((2.0 * (x / z)) - (9.0 * (t * y)));
} else if (z <= 8e-158) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
}
return tmp;
}
NOTE: x, y, z, t, 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 <= (-6.5d-29)) then
tmp = z * ((2.0d0 * (x / z)) - (9.0d0 * (t * y)))
else if (z <= 8d-158) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else
tmp = (x * 2.0d0) - (9.0d0 * (t * (y * z)))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -6.5e-29) {
tmp = z * ((2.0 * (x / z)) - (9.0 * (t * y)));
} else if (z <= 8e-158) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -6.5e-29: tmp = z * ((2.0 * (x / z)) - (9.0 * (t * y))) elif z <= 8e-158: tmp = (x * 2.0) + (27.0 * (a * b)) else: tmp = (x * 2.0) - (9.0 * (t * (y * z))) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -6.5e-29) tmp = Float64(z * Float64(Float64(2.0 * Float64(x / z)) - Float64(9.0 * Float64(t * y)))); elseif (z <= 8e-158) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); else tmp = Float64(Float64(x * 2.0) - Float64(9.0 * Float64(t * Float64(y * z)))); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -6.5e-29)
tmp = z * ((2.0 * (x / z)) - (9.0 * (t * y)));
elseif (z <= 8e-158)
tmp = (x * 2.0) + (27.0 * (a * b));
else
tmp = (x * 2.0) - (9.0 * (t * (y * z)));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -6.5e-29], N[(z * N[(N[(2.0 * N[(x / z), $MachinePrecision]), $MachinePrecision] - N[(9.0 * N[(t * y), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8e-158], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -6.5 \cdot 10^{-29}:\\
\;\;\;\;z \cdot \left(2 \cdot \frac{x}{z} - 9 \cdot \left(t \cdot y\right)\right)\\
\mathbf{elif}\;z \leq 8 \cdot 10^{-158}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2 - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\end{array}
\end{array}
if z < -6.5e-29Initial program 91.8%
sub-neg91.8%
sub-neg91.8%
associate-*l*95.6%
associate-*l*95.7%
Simplified95.7%
Taylor expanded in z around inf 98.2%
Taylor expanded in a around 0 78.1%
if -6.5e-29 < z < 8.00000000000000052e-158Initial program 96.9%
+-commutative96.9%
associate-+r-96.9%
*-commutative96.9%
cancel-sign-sub-inv96.9%
associate-*r*93.9%
distribute-lft-neg-in93.9%
*-commutative93.9%
cancel-sign-sub-inv93.9%
associate-+r-93.9%
associate-*l*93.9%
fma-define93.9%
cancel-sign-sub-inv93.9%
fma-define93.9%
distribute-lft-neg-in93.9%
distribute-rgt-neg-in93.9%
*-commutative93.9%
associate-*r*96.9%
associate-*l*96.9%
neg-mul-196.9%
associate-*r*96.9%
Simplified96.9%
Taylor expanded in t around 0 82.4%
if 8.00000000000000052e-158 < z Initial program 95.6%
sub-neg95.6%
sub-neg95.6%
associate-*l*93.3%
associate-*l*93.3%
Simplified93.3%
Taylor expanded in a around 0 68.1%
Final simplification74.6%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z -4.2e+24) (* z (* t (* y -9.0))) (if (<= z 8.4e-29) (+ (* x 2.0) (* 27.0 (* a b))) (* t (* y (* -9.0 z))))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -4.2e+24) {
tmp = z * (t * (y * -9.0));
} else if (z <= 8.4e-29) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = t * (y * (-9.0 * z));
}
return tmp;
}
NOTE: x, y, z, t, 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 <= (-4.2d+24)) then
tmp = z * (t * (y * (-9.0d0)))
else if (z <= 8.4d-29) then
tmp = (x * 2.0d0) + (27.0d0 * (a * b))
else
tmp = t * (y * ((-9.0d0) * z))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -4.2e+24) {
tmp = z * (t * (y * -9.0));
} else if (z <= 8.4e-29) {
tmp = (x * 2.0) + (27.0 * (a * b));
} else {
tmp = t * (y * (-9.0 * z));
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -4.2e+24: tmp = z * (t * (y * -9.0)) elif z <= 8.4e-29: tmp = (x * 2.0) + (27.0 * (a * b)) else: tmp = t * (y * (-9.0 * z)) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -4.2e+24) tmp = Float64(z * Float64(t * Float64(y * -9.0))); elseif (z <= 8.4e-29) tmp = Float64(Float64(x * 2.0) + Float64(27.0 * Float64(a * b))); else tmp = Float64(t * Float64(y * Float64(-9.0 * z))); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -4.2e+24)
tmp = z * (t * (y * -9.0));
elseif (z <= 8.4e-29)
tmp = (x * 2.0) + (27.0 * (a * b));
else
tmp = t * (y * (-9.0 * z));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -4.2e+24], N[(z * N[(t * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 8.4e-29], N[(N[(x * 2.0), $MachinePrecision] + N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t * N[(y * N[(-9.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -4.2 \cdot 10^{+24}:\\
\;\;\;\;z \cdot \left(t \cdot \left(y \cdot -9\right)\right)\\
\mathbf{elif}\;z \leq 8.4 \cdot 10^{-29}:\\
\;\;\;\;x \cdot 2 + 27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(-9 \cdot z\right)\right)\\
\end{array}
\end{array}
if z < -4.2000000000000003e24Initial program 90.6%
sub-neg90.6%
sub-neg90.6%
associate-*l*94.9%
associate-*l*95.1%
Simplified95.1%
Taylor expanded in z around inf 98.0%
Taylor expanded in z around inf 65.2%
associate-*r*65.3%
*-commutative65.3%
associate-*l*65.2%
*-commutative65.2%
Simplified65.2%
if -4.2000000000000003e24 < z < 8.39999999999999958e-29Initial program 98.0%
+-commutative98.0%
associate-+r-98.0%
*-commutative98.0%
cancel-sign-sub-inv98.0%
associate-*r*93.6%
distribute-lft-neg-in93.6%
*-commutative93.6%
cancel-sign-sub-inv93.6%
associate-+r-93.6%
associate-*l*93.5%
fma-define93.5%
cancel-sign-sub-inv93.5%
fma-define93.5%
distribute-lft-neg-in93.5%
distribute-rgt-neg-in93.5%
*-commutative93.5%
associate-*r*97.9%
associate-*l*98.0%
neg-mul-198.0%
associate-*r*98.0%
Simplified98.0%
Taylor expanded in t around 0 74.7%
if 8.39999999999999958e-29 < z Initial program 93.8%
+-commutative93.8%
associate-+r-93.8%
*-commutative93.8%
cancel-sign-sub-inv93.8%
associate-*r*96.2%
distribute-lft-neg-in96.2%
*-commutative96.2%
cancel-sign-sub-inv96.2%
associate-+r-96.2%
associate-*l*96.3%
fma-define99.9%
cancel-sign-sub-inv99.9%
fma-define99.9%
distribute-lft-neg-in99.9%
distribute-rgt-neg-in99.9%
*-commutative99.9%
associate-*r*97.5%
associate-*l*97.5%
neg-mul-197.5%
associate-*r*97.5%
Simplified97.5%
Taylor expanded in t around inf 49.3%
*-commutative49.3%
associate-*r*49.3%
associate-*l*49.3%
Simplified49.3%
Final simplification64.2%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= z -7.5e-29) (not (<= z 1.75e-158))) (* t (* y (* -9.0 z))) (* 27.0 (* a b))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -7.5e-29) || !(z <= 1.75e-158)) {
tmp = t * (y * (-9.0 * z));
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
NOTE: x, y, z, t, 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 <= (-7.5d-29)) .or. (.not. (z <= 1.75d-158))) then
tmp = t * (y * ((-9.0d0) * z))
else
tmp = 27.0d0 * (a * b)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -7.5e-29) || !(z <= 1.75e-158)) {
tmp = t * (y * (-9.0 * z));
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if (z <= -7.5e-29) or not (z <= 1.75e-158): tmp = t * (y * (-9.0 * z)) else: tmp = 27.0 * (a * b) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -7.5e-29) || !(z <= 1.75e-158)) tmp = Float64(t * Float64(y * Float64(-9.0 * z))); else tmp = Float64(27.0 * Float64(a * b)); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((z <= -7.5e-29) || ~((z <= 1.75e-158)))
tmp = t * (y * (-9.0 * z));
else
tmp = 27.0 * (a * b);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -7.5e-29], N[Not[LessEqual[z, 1.75e-158]], $MachinePrecision]], N[(t * N[(y * N[(-9.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -7.5 \cdot 10^{-29} \lor \neg \left(z \leq 1.75 \cdot 10^{-158}\right):\\
\;\;\;\;t \cdot \left(y \cdot \left(-9 \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if z < -7.50000000000000006e-29 or 1.75000000000000006e-158 < z Initial program 94.1%
+-commutative94.1%
associate-+r-94.1%
*-commutative94.1%
cancel-sign-sub-inv94.1%
associate-*r*96.0%
distribute-lft-neg-in96.0%
*-commutative96.0%
cancel-sign-sub-inv96.0%
associate-+r-96.0%
associate-*l*96.1%
fma-define98.2%
cancel-sign-sub-inv98.2%
fma-define98.2%
distribute-lft-neg-in98.2%
distribute-rgt-neg-in98.2%
*-commutative98.2%
associate-*r*96.3%
associate-*l*96.3%
neg-mul-196.3%
associate-*r*96.3%
Simplified96.3%
Taylor expanded in t around inf 50.1%
*-commutative50.1%
associate-*r*50.1%
associate-*l*50.1%
Simplified50.1%
if -7.50000000000000006e-29 < z < 1.75000000000000006e-158Initial program 96.9%
+-commutative96.9%
associate-+r-96.9%
*-commutative96.9%
cancel-sign-sub-inv96.9%
associate-*r*93.9%
distribute-lft-neg-in93.9%
*-commutative93.9%
cancel-sign-sub-inv93.9%
associate-+r-93.9%
associate-*l*93.9%
fma-define93.9%
cancel-sign-sub-inv93.9%
fma-define93.9%
distribute-lft-neg-in93.9%
distribute-rgt-neg-in93.9%
*-commutative93.9%
associate-*r*96.9%
associate-*l*96.9%
neg-mul-196.9%
associate-*r*96.9%
Simplified96.9%
Taylor expanded in a around inf 44.6%
Final simplification48.7%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= z -2.75e-28) (not (<= z 1.15e-157))) (* -9.0 (* t (* y z))) (* 27.0 (* a b))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.75e-28) || !(z <= 1.15e-157)) {
tmp = -9.0 * (t * (y * z));
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
NOTE: x, y, z, t, 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 <= (-2.75d-28)) .or. (.not. (z <= 1.15d-157))) then
tmp = (-9.0d0) * (t * (y * z))
else
tmp = 27.0d0 * (a * b)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((z <= -2.75e-28) || !(z <= 1.15e-157)) {
tmp = -9.0 * (t * (y * z));
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if (z <= -2.75e-28) or not (z <= 1.15e-157): tmp = -9.0 * (t * (y * z)) else: tmp = 27.0 * (a * b) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((z <= -2.75e-28) || !(z <= 1.15e-157)) tmp = Float64(-9.0 * Float64(t * Float64(y * z))); else tmp = Float64(27.0 * Float64(a * b)); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((z <= -2.75e-28) || ~((z <= 1.15e-157)))
tmp = -9.0 * (t * (y * z));
else
tmp = 27.0 * (a * b);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[z, -2.75e-28], N[Not[LessEqual[z, 1.15e-157]], $MachinePrecision]], N[(-9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -2.75 \cdot 10^{-28} \lor \neg \left(z \leq 1.15 \cdot 10^{-157}\right):\\
\;\;\;\;-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if z < -2.74999999999999984e-28 or 1.14999999999999994e-157 < z Initial program 94.1%
+-commutative94.1%
associate-+r-94.1%
*-commutative94.1%
cancel-sign-sub-inv94.1%
associate-*r*96.0%
distribute-lft-neg-in96.0%
*-commutative96.0%
cancel-sign-sub-inv96.0%
associate-+r-96.0%
associate-*l*96.1%
fma-define98.2%
cancel-sign-sub-inv98.2%
fma-define98.2%
distribute-lft-neg-in98.2%
distribute-rgt-neg-in98.2%
*-commutative98.2%
associate-*r*96.3%
associate-*l*96.3%
neg-mul-196.3%
associate-*r*96.3%
Simplified96.3%
Taylor expanded in t around inf 50.1%
if -2.74999999999999984e-28 < z < 1.14999999999999994e-157Initial program 96.9%
+-commutative96.9%
associate-+r-96.9%
*-commutative96.9%
cancel-sign-sub-inv96.9%
associate-*r*93.9%
distribute-lft-neg-in93.9%
*-commutative93.9%
cancel-sign-sub-inv93.9%
associate-+r-93.9%
associate-*l*93.9%
fma-define93.9%
cancel-sign-sub-inv93.9%
fma-define93.9%
distribute-lft-neg-in93.9%
distribute-rgt-neg-in93.9%
*-commutative93.9%
associate-*r*96.9%
associate-*l*96.9%
neg-mul-196.9%
associate-*r*96.9%
Simplified96.9%
Taylor expanded in a around inf 44.6%
Final simplification48.7%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z -1.45e-28) (* z (* t (* y -9.0))) (if (<= z 1.02e-157) (* 27.0 (* a b)) (* t (* y (* -9.0 z))))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.45e-28) {
tmp = z * (t * (y * -9.0));
} else if (z <= 1.02e-157) {
tmp = 27.0 * (a * b);
} else {
tmp = t * (y * (-9.0 * z));
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-1.45d-28)) then
tmp = z * (t * (y * (-9.0d0)))
else if (z <= 1.02d-157) then
tmp = 27.0d0 * (a * b)
else
tmp = t * (y * ((-9.0d0) * z))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.45e-28) {
tmp = z * (t * (y * -9.0));
} else if (z <= 1.02e-157) {
tmp = 27.0 * (a * b);
} else {
tmp = t * (y * (-9.0 * z));
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -1.45e-28: tmp = z * (t * (y * -9.0)) elif z <= 1.02e-157: tmp = 27.0 * (a * b) else: tmp = t * (y * (-9.0 * z)) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.45e-28) tmp = Float64(z * Float64(t * Float64(y * -9.0))); elseif (z <= 1.02e-157) tmp = Float64(27.0 * Float64(a * b)); else tmp = Float64(t * Float64(y * Float64(-9.0 * z))); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -1.45e-28)
tmp = z * (t * (y * -9.0));
elseif (z <= 1.02e-157)
tmp = 27.0 * (a * b);
else
tmp = t * (y * (-9.0 * z));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.45e-28], N[(z * N[(t * N[(y * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 1.02e-157], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], N[(t * N[(y * N[(-9.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.45 \cdot 10^{-28}:\\
\;\;\;\;z \cdot \left(t \cdot \left(y \cdot -9\right)\right)\\
\mathbf{elif}\;z \leq 1.02 \cdot 10^{-157}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(-9 \cdot z\right)\right)\\
\end{array}
\end{array}
if z < -1.45000000000000006e-28Initial program 91.8%
sub-neg91.8%
sub-neg91.8%
associate-*l*95.6%
associate-*l*95.7%
Simplified95.7%
Taylor expanded in z around inf 98.2%
Taylor expanded in z around inf 65.5%
associate-*r*65.6%
*-commutative65.6%
associate-*l*65.5%
*-commutative65.5%
Simplified65.5%
if -1.45000000000000006e-28 < z < 1.0200000000000001e-157Initial program 96.9%
+-commutative96.9%
associate-+r-96.9%
*-commutative96.9%
cancel-sign-sub-inv96.9%
associate-*r*93.9%
distribute-lft-neg-in93.9%
*-commutative93.9%
cancel-sign-sub-inv93.9%
associate-+r-93.9%
associate-*l*93.9%
fma-define93.9%
cancel-sign-sub-inv93.9%
fma-define93.9%
distribute-lft-neg-in93.9%
distribute-rgt-neg-in93.9%
*-commutative93.9%
associate-*r*96.9%
associate-*l*96.9%
neg-mul-196.9%
associate-*r*96.9%
Simplified96.9%
Taylor expanded in a around inf 44.6%
if 1.0200000000000001e-157 < z Initial program 95.6%
+-commutative95.6%
associate-+r-95.6%
*-commutative95.6%
cancel-sign-sub-inv95.6%
associate-*r*94.7%
distribute-lft-neg-in94.7%
*-commutative94.7%
cancel-sign-sub-inv94.7%
associate-+r-94.7%
associate-*l*94.8%
fma-define97.3%
cancel-sign-sub-inv97.3%
fma-define97.3%
distribute-lft-neg-in97.3%
distribute-rgt-neg-in97.3%
*-commutative97.3%
associate-*r*98.1%
associate-*l*98.1%
neg-mul-198.1%
associate-*r*98.1%
Simplified98.1%
Taylor expanded in t around inf 44.0%
*-commutative44.0%
associate-*r*44.0%
associate-*l*44.0%
Simplified44.0%
Final simplification50.1%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (<= z -1.15e-27) (* y (* z (* t -9.0))) (if (<= z 6e-158) (* 27.0 (* a b)) (* t (* y (* -9.0 z))))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.15e-27) {
tmp = y * (z * (t * -9.0));
} else if (z <= 6e-158) {
tmp = 27.0 * (a * b);
} else {
tmp = t * (y * (-9.0 * z));
}
return tmp;
}
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function.
real(8) function code(x, y, z, t, a, b)
real(8), intent (in) :: x
real(8), intent (in) :: y
real(8), intent (in) :: z
real(8), intent (in) :: t
real(8), intent (in) :: a
real(8), intent (in) :: b
real(8) :: tmp
if (z <= (-1.15d-27)) then
tmp = y * (z * (t * (-9.0d0)))
else if (z <= 6d-158) then
tmp = 27.0d0 * (a * b)
else
tmp = t * (y * ((-9.0d0) * z))
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if (z <= -1.15e-27) {
tmp = y * (z * (t * -9.0));
} else if (z <= 6e-158) {
tmp = 27.0 * (a * b);
} else {
tmp = t * (y * (-9.0 * z));
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if z <= -1.15e-27: tmp = y * (z * (t * -9.0)) elif z <= 6e-158: tmp = 27.0 * (a * b) else: tmp = t * (y * (-9.0 * z)) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if (z <= -1.15e-27) tmp = Float64(y * Float64(z * Float64(t * -9.0))); elseif (z <= 6e-158) tmp = Float64(27.0 * Float64(a * b)); else tmp = Float64(t * Float64(y * Float64(-9.0 * z))); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if (z <= -1.15e-27)
tmp = y * (z * (t * -9.0));
elseif (z <= 6e-158)
tmp = 27.0 * (a * b);
else
tmp = t * (y * (-9.0 * z));
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[LessEqual[z, -1.15e-27], N[(y * N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[z, 6e-158], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], N[(t * N[(y * N[(-9.0 * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;z \leq -1.15 \cdot 10^{-27}:\\
\;\;\;\;y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\\
\mathbf{elif}\;z \leq 6 \cdot 10^{-158}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;t \cdot \left(y \cdot \left(-9 \cdot z\right)\right)\\
\end{array}
\end{array}
if z < -1.15e-27Initial program 91.8%
+-commutative91.8%
associate-+r-91.8%
*-commutative91.8%
cancel-sign-sub-inv91.8%
associate-*r*98.2%
distribute-lft-neg-in98.2%
*-commutative98.2%
cancel-sign-sub-inv98.2%
associate-+r-98.2%
associate-*l*98.3%
fma-define99.7%
cancel-sign-sub-inv99.7%
fma-define99.7%
distribute-lft-neg-in99.7%
distribute-rgt-neg-in99.7%
*-commutative99.7%
associate-*r*93.3%
associate-*l*93.3%
neg-mul-193.3%
associate-*r*93.3%
Simplified93.3%
fma-undefine91.9%
fma-undefine91.9%
associate-+r+91.9%
*-commutative91.9%
associate-*l*95.6%
*-commutative95.6%
associate-*r*95.6%
*-commutative95.6%
*-commutative95.6%
associate-*r*95.7%
associate-*l*95.7%
metadata-eval95.7%
distribute-lft-neg-in95.7%
*-commutative95.7%
distribute-rgt-neg-in95.7%
*-commutative95.7%
associate-+r+95.7%
sub-neg95.7%
Applied egg-rr95.6%
Taylor expanded in z around 0 95.6%
*-commutative95.6%
associate-*l*95.5%
*-commutative95.5%
Simplified95.5%
Taylor expanded in y around inf 60.3%
*-commutative60.3%
associate-*r*60.3%
*-commutative60.3%
associate-*l*60.3%
Simplified60.3%
*-commutative60.3%
associate-*l*65.5%
associate-*r*65.6%
*-commutative65.6%
pow165.6%
*-commutative65.6%
associate-*l*62.8%
Applied egg-rr62.8%
unpow162.8%
*-commutative62.8%
*-commutative62.8%
Simplified62.8%
if -1.15e-27 < z < 6e-158Initial program 96.9%
+-commutative96.9%
associate-+r-96.9%
*-commutative96.9%
cancel-sign-sub-inv96.9%
associate-*r*93.9%
distribute-lft-neg-in93.9%
*-commutative93.9%
cancel-sign-sub-inv93.9%
associate-+r-93.9%
associate-*l*93.9%
fma-define93.9%
cancel-sign-sub-inv93.9%
fma-define93.9%
distribute-lft-neg-in93.9%
distribute-rgt-neg-in93.9%
*-commutative93.9%
associate-*r*96.9%
associate-*l*96.9%
neg-mul-196.9%
associate-*r*96.9%
Simplified96.9%
Taylor expanded in a around inf 44.6%
if 6e-158 < z Initial program 95.6%
+-commutative95.6%
associate-+r-95.6%
*-commutative95.6%
cancel-sign-sub-inv95.6%
associate-*r*94.7%
distribute-lft-neg-in94.7%
*-commutative94.7%
cancel-sign-sub-inv94.7%
associate-+r-94.7%
associate-*l*94.8%
fma-define97.3%
cancel-sign-sub-inv97.3%
fma-define97.3%
distribute-lft-neg-in97.3%
distribute-rgt-neg-in97.3%
*-commutative97.3%
associate-*r*98.1%
associate-*l*98.1%
neg-mul-198.1%
associate-*r*98.1%
Simplified98.1%
Taylor expanded in t around inf 44.0%
*-commutative44.0%
associate-*r*44.0%
associate-*l*44.0%
Simplified44.0%
Final simplification49.4%
NOTE: x, y, z, t, 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 (* 9.0 (* y z)))) (* b (* a 27.0))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (t * (9.0 * (y * z)))) + (b * (a * 27.0));
}
NOTE: x, y, z, t, 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 * (9.0d0 * (y * z)))) + (b * (a * 27.0d0))
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return ((x * 2.0) - (t * (9.0 * (y * z)))) + (b * (a * 27.0));
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): return ((x * 2.0) - (t * (9.0 * (y * z)))) + (b * (a * 27.0))
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(9.0 * Float64(y * z)))) + Float64(b * Float64(a * 27.0))) end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = ((x * 2.0) - (t * (9.0 * (y * z)))) + (b * (a * 27.0));
end
NOTE: x, y, z, t, 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[(9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\left(x \cdot 2 - t \cdot \left(9 \cdot \left(y \cdot z\right)\right)\right) + b \cdot \left(a \cdot 27\right)
\end{array}
Initial program 94.9%
Taylor expanded in y around 0 94.9%
Final simplification94.9%
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. (FPCore (x y z t a b) :precision binary64 (if (or (<= x -1.8e+22) (not (<= x 4.1e+105))) (* x 2.0) (* 27.0 (* a b))))
assert(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -1.8e+22) || !(x <= 4.1e+105)) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
NOTE: x, y, z, t, 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 ((x <= (-1.8d+22)) .or. (.not. (x <= 4.1d+105))) then
tmp = x * 2.0d0
else
tmp = 27.0d0 * (a * b)
end if
code = tmp
end function
assert x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
double tmp;
if ((x <= -1.8e+22) || !(x <= 4.1e+105)) {
tmp = x * 2.0;
} else {
tmp = 27.0 * (a * b);
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): tmp = 0 if (x <= -1.8e+22) or not (x <= 4.1e+105): tmp = x * 2.0 else: tmp = 27.0 * (a * b) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) tmp = 0.0 if ((x <= -1.8e+22) || !(x <= 4.1e+105)) tmp = Float64(x * 2.0); else tmp = Float64(27.0 * Float64(a * b)); end return tmp end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp_2 = code(x, y, z, t, a, b)
tmp = 0.0;
if ((x <= -1.8e+22) || ~((x <= 4.1e+105)))
tmp = x * 2.0;
else
tmp = 27.0 * (a * b);
end
tmp_2 = tmp;
end
NOTE: x, y, z, t, a, and b should be sorted in increasing order before calling this function. code[x_, y_, z_, t_, a_, b_] := If[Or[LessEqual[x, -1.8e+22], N[Not[LessEqual[x, 4.1e+105]], $MachinePrecision]], N[(x * 2.0), $MachinePrecision], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;x \leq -1.8 \cdot 10^{+22} \lor \neg \left(x \leq 4.1 \cdot 10^{+105}\right):\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if x < -1.8e22 or 4.1000000000000002e105 < x Initial program 92.1%
+-commutative92.1%
associate-+r-92.1%
*-commutative92.1%
cancel-sign-sub-inv92.1%
associate-*r*94.0%
distribute-lft-neg-in94.0%
*-commutative94.0%
cancel-sign-sub-inv94.0%
associate-+r-94.0%
associate-*l*94.0%
fma-define96.4%
cancel-sign-sub-inv96.4%
fma-define96.4%
distribute-lft-neg-in96.4%
distribute-rgt-neg-in96.4%
*-commutative96.4%
associate-*r*94.4%
associate-*l*94.4%
neg-mul-194.4%
associate-*r*94.4%
Simplified94.4%
Taylor expanded in t around 0 75.2%
Taylor expanded in x around inf 60.2%
if -1.8e22 < x < 4.1000000000000002e105Initial program 96.3%
+-commutative96.3%
associate-+r-96.3%
*-commutative96.3%
cancel-sign-sub-inv96.3%
associate-*r*96.2%
distribute-lft-neg-in96.2%
*-commutative96.2%
cancel-sign-sub-inv96.2%
associate-+r-96.2%
associate-*l*96.3%
fma-define97.4%
cancel-sign-sub-inv97.4%
fma-define97.4%
distribute-lft-neg-in97.4%
distribute-rgt-neg-in97.4%
*-commutative97.4%
associate-*r*97.5%
associate-*l*97.5%
neg-mul-197.5%
associate-*r*97.5%
Simplified97.5%
Taylor expanded in a around inf 42.9%
Final simplification48.6%
NOTE: x, y, z, t, 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(x < y && y < z && z < t && t < a && a < b);
double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
NOTE: x, y, z, t, 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 x < y && y < z && z < t && t < a && a < b;
public static double code(double x, double y, double z, double t, double a, double b) {
return x * 2.0;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): return x * 2.0
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) return Float64(x * 2.0) end
x, y, z, t, a, b = num2cell(sort([x, y, z, t, a, b])){:}
function tmp = code(x, y, z, t, a, b)
tmp = x * 2.0;
end
NOTE: x, y, z, t, 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}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
x \cdot 2
\end{array}
Initial program 94.9%
+-commutative94.9%
associate-+r-94.9%
*-commutative94.9%
cancel-sign-sub-inv94.9%
associate-*r*95.5%
distribute-lft-neg-in95.5%
*-commutative95.5%
cancel-sign-sub-inv95.5%
associate-+r-95.5%
associate-*l*95.5%
fma-define97.1%
cancel-sign-sub-inv97.1%
fma-define97.1%
distribute-lft-neg-in97.1%
distribute-rgt-neg-in97.1%
*-commutative97.1%
associate-*r*96.5%
associate-*l*96.5%
neg-mul-196.5%
associate-*r*96.5%
Simplified96.5%
Taylor expanded in t around 0 59.1%
Taylor expanded in x around inf 27.0%
Final simplification27.0%
(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 2024143
(FPCore (x y z t a b)
:name "Diagrams.Solve.Polynomial:cubForm from diagrams-solve-0.1, A"
:precision binary64
:alt
(! :herbie-platform default (if (< y 7590524218811189/100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000) (+ (- (* x 2) (* (* (* y 9) z) t)) (* a (* 27 b))) (+ (- (* x 2) (* 9 (* y (* t z)))) (* (* a 27) b))))
(+ (- (* x 2.0) (* (* (* y 9.0) z) t)) (* (* a 27.0) b)))