
(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 (if (<= (* y 9.0) -1e+108) (fma a (* 27.0 b) (fma x 2.0 (* y (* z (* t -9.0))))) (+ (- (* x 2.0) (* t (* (* y 9.0) 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) {
double tmp;
if ((y * 9.0) <= -1e+108) {
tmp = fma(a, (27.0 * b), fma(x, 2.0, (y * (z * (t * -9.0)))));
} else {
tmp = ((x * 2.0) - (t * ((y * 9.0) * z))) + (b * (a * 27.0));
}
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 (Float64(y * 9.0) <= -1e+108) tmp = fma(a, Float64(27.0 * b), fma(x, 2.0, Float64(y * Float64(z * Float64(t * -9.0))))); else tmp = Float64(Float64(Float64(x * 2.0) - Float64(t * Float64(Float64(y * 9.0) * z))) + Float64(b * Float64(a * 27.0))); end return 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[N[(y * 9.0), $MachinePrecision], -1e+108], N[(a * N[(27.0 * b), $MachinePrecision] + N[(x * 2.0 + N[(y * N[(z * N[(t * -9.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(N[(y * 9.0), $MachinePrecision] * z), $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])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot 9 \leq -1 \cdot 10^{+108}:\\
\;\;\;\;\mathsf{fma}\left(a, 27 \cdot b, \mathsf{fma}\left(x, 2, y \cdot \left(z \cdot \left(t \cdot -9\right)\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\left(x \cdot 2 - t \cdot \left(\left(y \cdot 9\right) \cdot z\right)\right) + b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if (*.f64 y #s(literal 9 binary64)) < -1e108Initial program 94.7%
+-commutative94.7%
associate-+r-94.7%
*-commutative94.7%
cancel-sign-sub-inv94.7%
associate-*r*85.2%
distribute-lft-neg-in85.2%
*-commutative85.2%
cancel-sign-sub-inv85.2%
associate-+r-85.2%
associate-*l*85.2%
fma-define85.2%
fmm-def85.2%
associate-*l*97.4%
distribute-rgt-neg-in97.4%
*-commutative97.4%
associate-*l*97.3%
*-commutative97.3%
distribute-lft-neg-in97.3%
associate-*r*97.3%
Simplified97.3%
if -1e108 < (*.f64 y #s(literal 9 binary64)) Initial program 93.3%
Final simplification93.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
(let* ((t_1 (* 27.0 (* a b))))
(if (or (<= z -4e-181) (not (<= z 2.1e-117)))
(- t_1 (* 9.0 (* t (* y z))))
(+ t_1 (* 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) {
double t_1 = 27.0 * (a * b);
double tmp;
if ((z <= -4e-181) || !(z <= 2.1e-117)) {
tmp = t_1 - (9.0 * (t * (y * z)));
} else {
tmp = t_1 + (x * 2.0);
}
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) :: t_1
real(8) :: tmp
t_1 = 27.0d0 * (a * b)
if ((z <= (-4d-181)) .or. (.not. (z <= 2.1d-117))) then
tmp = t_1 - (9.0d0 * (t * (y * z)))
else
tmp = t_1 + (x * 2.0d0)
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 t_1 = 27.0 * (a * b);
double tmp;
if ((z <= -4e-181) || !(z <= 2.1e-117)) {
tmp = t_1 - (9.0 * (t * (y * z)));
} else {
tmp = t_1 + (x * 2.0);
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): t_1 = 27.0 * (a * b) tmp = 0 if (z <= -4e-181) or not (z <= 2.1e-117): tmp = t_1 - (9.0 * (t * (y * z))) else: tmp = t_1 + (x * 2.0) return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(27.0 * Float64(a * b)) tmp = 0.0 if ((z <= -4e-181) || !(z <= 2.1e-117)) tmp = Float64(t_1 - Float64(9.0 * Float64(t * Float64(y * z)))); else tmp = Float64(t_1 + Float64(x * 2.0)); 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)
t_1 = 27.0 * (a * b);
tmp = 0.0;
if ((z <= -4e-181) || ~((z <= 2.1e-117)))
tmp = t_1 - (9.0 * (t * (y * z)));
else
tmp = t_1 + (x * 2.0);
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_] := Block[{t$95$1 = N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[z, -4e-181], N[Not[LessEqual[z, 2.1e-117]], $MachinePrecision]], N[(t$95$1 - N[(9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(t$95$1 + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := 27 \cdot \left(a \cdot b\right)\\
\mathbf{if}\;z \leq -4 \cdot 10^{-181} \lor \neg \left(z \leq 2.1 \cdot 10^{-117}\right):\\
\;\;\;\;t\_1 - 9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1 + x \cdot 2\\
\end{array}
\end{array}
if z < -4.00000000000000019e-181 or 2.0999999999999999e-117 < z Initial program 92.1%
sub-neg92.1%
sub-neg92.1%
associate-*l*93.1%
associate-*l*93.1%
Simplified93.1%
Taylor expanded in x around 0 70.8%
if -4.00000000000000019e-181 < z < 2.0999999999999999e-117Initial program 97.4%
+-commutative97.4%
associate-+r-97.4%
*-commutative97.4%
cancel-sign-sub-inv97.4%
associate-*r*90.3%
distribute-lft-neg-in90.3%
*-commutative90.3%
cancel-sign-sub-inv90.3%
associate-+r-90.3%
associate-*l*90.3%
fma-define90.3%
fmm-def90.3%
associate-*l*98.3%
distribute-rgt-neg-in98.3%
*-commutative98.3%
associate-*l*99.8%
*-commutative99.8%
distribute-lft-neg-in99.8%
associate-*r*99.8%
Simplified99.8%
Taylor expanded in y around 0 92.6%
Final simplification76.8%
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 (<= (* y 9.0) -2e+149) (not (<= (* y 9.0) 5e-125))) (* -9.0 (* t (* y z))) (+ (* 27.0 (* a b)) (* 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) {
double tmp;
if (((y * 9.0) <= -2e+149) || !((y * 9.0) <= 5e-125)) {
tmp = -9.0 * (t * (y * z));
} else {
tmp = (27.0 * (a * b)) + (x * 2.0);
}
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 (((y * 9.0d0) <= (-2d+149)) .or. (.not. ((y * 9.0d0) <= 5d-125))) then
tmp = (-9.0d0) * (t * (y * z))
else
tmp = (27.0d0 * (a * b)) + (x * 2.0d0)
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 (((y * 9.0) <= -2e+149) || !((y * 9.0) <= 5e-125)) {
tmp = -9.0 * (t * (y * z));
} else {
tmp = (27.0 * (a * b)) + (x * 2.0);
}
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 ((y * 9.0) <= -2e+149) or not ((y * 9.0) <= 5e-125): tmp = -9.0 * (t * (y * z)) else: tmp = (27.0 * (a * b)) + (x * 2.0) 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 ((Float64(y * 9.0) <= -2e+149) || !(Float64(y * 9.0) <= 5e-125)) tmp = Float64(-9.0 * Float64(t * Float64(y * z))); else tmp = Float64(Float64(27.0 * Float64(a * b)) + Float64(x * 2.0)); 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 (((y * 9.0) <= -2e+149) || ~(((y * 9.0) <= 5e-125)))
tmp = -9.0 * (t * (y * z));
else
tmp = (27.0 * (a * b)) + (x * 2.0);
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[N[(y * 9.0), $MachinePrecision], -2e+149], N[Not[LessEqual[N[(y * 9.0), $MachinePrecision], 5e-125]], $MachinePrecision]], N[(-9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot 9 \leq -2 \cdot 10^{+149} \lor \neg \left(y \cdot 9 \leq 5 \cdot 10^{-125}\right):\\
\;\;\;\;-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) + x \cdot 2\\
\end{array}
\end{array}
if (*.f64 y #s(literal 9 binary64)) < -2.0000000000000001e149 or 4.99999999999999967e-125 < (*.f64 y #s(literal 9 binary64)) Initial program 87.6%
+-commutative87.6%
associate-+r-87.6%
*-commutative87.6%
cancel-sign-sub-inv87.6%
associate-*r*91.3%
distribute-lft-neg-in91.3%
*-commutative91.3%
cancel-sign-sub-inv91.3%
associate-+r-91.3%
associate-*l*91.3%
fma-define92.9%
fmm-def92.9%
associate-*l*97.5%
distribute-rgt-neg-in97.5%
*-commutative97.5%
associate-*l*98.3%
*-commutative98.3%
distribute-lft-neg-in98.3%
associate-*r*98.3%
Simplified98.3%
Taylor expanded in y around inf 41.1%
if -2.0000000000000001e149 < (*.f64 y #s(literal 9 binary64)) < 4.99999999999999967e-125Initial program 99.2%
+-commutative99.2%
associate-+r-99.2%
*-commutative99.2%
cancel-sign-sub-inv99.2%
associate-*r*97.7%
distribute-lft-neg-in97.7%
*-commutative97.7%
cancel-sign-sub-inv97.7%
associate-+r-97.7%
associate-*l*97.7%
fma-define97.7%
fmm-def97.7%
associate-*l*93.3%
distribute-rgt-neg-in93.3%
*-commutative93.3%
associate-*l*93.3%
*-commutative93.3%
distribute-lft-neg-in93.3%
associate-*r*93.3%
Simplified93.3%
Taylor expanded in y around 0 77.4%
Final simplification59.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
(let* ((t_1 (* t (* y z))))
(if (<= (* y 9.0) -4e+91)
(- (* x 2.0) (* 9.0 t_1))
(if (<= (* y 9.0) 5e-125) (+ (* 27.0 (* a b)) (* x 2.0)) (* -9.0 t_1)))))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 t_1 = t * (y * z);
double tmp;
if ((y * 9.0) <= -4e+91) {
tmp = (x * 2.0) - (9.0 * t_1);
} else if ((y * 9.0) <= 5e-125) {
tmp = (27.0 * (a * b)) + (x * 2.0);
} else {
tmp = -9.0 * t_1;
}
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) :: t_1
real(8) :: tmp
t_1 = t * (y * z)
if ((y * 9.0d0) <= (-4d+91)) then
tmp = (x * 2.0d0) - (9.0d0 * t_1)
else if ((y * 9.0d0) <= 5d-125) then
tmp = (27.0d0 * (a * b)) + (x * 2.0d0)
else
tmp = (-9.0d0) * t_1
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 t_1 = t * (y * z);
double tmp;
if ((y * 9.0) <= -4e+91) {
tmp = (x * 2.0) - (9.0 * t_1);
} else if ((y * 9.0) <= 5e-125) {
tmp = (27.0 * (a * b)) + (x * 2.0);
} else {
tmp = -9.0 * t_1;
}
return tmp;
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): t_1 = t * (y * z) tmp = 0 if (y * 9.0) <= -4e+91: tmp = (x * 2.0) - (9.0 * t_1) elif (y * 9.0) <= 5e-125: tmp = (27.0 * (a * b)) + (x * 2.0) else: tmp = -9.0 * t_1 return tmp
x, y, z, t, a, b = sort([x, y, z, t, a, b]) function code(x, y, z, t, a, b) t_1 = Float64(t * Float64(y * z)) tmp = 0.0 if (Float64(y * 9.0) <= -4e+91) tmp = Float64(Float64(x * 2.0) - Float64(9.0 * t_1)); elseif (Float64(y * 9.0) <= 5e-125) tmp = Float64(Float64(27.0 * Float64(a * b)) + Float64(x * 2.0)); else tmp = Float64(-9.0 * t_1); 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)
t_1 = t * (y * z);
tmp = 0.0;
if ((y * 9.0) <= -4e+91)
tmp = (x * 2.0) - (9.0 * t_1);
elseif ((y * 9.0) <= 5e-125)
tmp = (27.0 * (a * b)) + (x * 2.0);
else
tmp = -9.0 * t_1;
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_] := Block[{t$95$1 = N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(y * 9.0), $MachinePrecision], -4e+91], N[(N[(x * 2.0), $MachinePrecision] - N[(9.0 * t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(y * 9.0), $MachinePrecision], 5e-125], N[(N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision] + N[(x * 2.0), $MachinePrecision]), $MachinePrecision], N[(-9.0 * t$95$1), $MachinePrecision]]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
t_1 := t \cdot \left(y \cdot z\right)\\
\mathbf{if}\;y \cdot 9 \leq -4 \cdot 10^{+91}:\\
\;\;\;\;x \cdot 2 - 9 \cdot t\_1\\
\mathbf{elif}\;y \cdot 9 \leq 5 \cdot 10^{-125}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right) + x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;-9 \cdot t\_1\\
\end{array}
\end{array}
if (*.f64 y #s(literal 9 binary64)) < -4.00000000000000032e91Initial program 95.2%
sub-neg95.2%
sub-neg95.2%
associate-*l*97.5%
associate-*l*97.6%
Simplified97.6%
Taylor expanded in a around 0 77.2%
if -4.00000000000000032e91 < (*.f64 y #s(literal 9 binary64)) < 4.99999999999999967e-125Initial program 99.2%
+-commutative99.2%
associate-+r-99.2%
*-commutative99.2%
cancel-sign-sub-inv99.2%
associate-*r*99.1%
distribute-lft-neg-in99.1%
*-commutative99.1%
cancel-sign-sub-inv99.1%
associate-+r-99.1%
associate-*l*99.1%
fma-define99.1%
fmm-def99.1%
associate-*l*92.7%
distribute-rgt-neg-in92.7%
*-commutative92.7%
associate-*l*92.7%
*-commutative92.7%
distribute-lft-neg-in92.7%
associate-*r*92.7%
Simplified92.7%
Taylor expanded in y around 0 78.6%
if 4.99999999999999967e-125 < (*.f64 y #s(literal 9 binary64)) Initial program 85.5%
+-commutative85.5%
associate-+r-85.5%
*-commutative85.5%
cancel-sign-sub-inv85.5%
associate-*r*93.5%
distribute-lft-neg-in93.5%
*-commutative93.5%
cancel-sign-sub-inv93.5%
associate-+r-93.5%
associate-*l*93.5%
fma-define95.7%
fmm-def95.7%
associate-*l*97.7%
distribute-rgt-neg-in97.7%
*-commutative97.7%
associate-*l*98.9%
*-commutative98.9%
distribute-lft-neg-in98.9%
associate-*r*98.8%
Simplified98.8%
Taylor expanded in y around inf 31.3%
Final simplification61.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 (<= (* y 9.0) -4e+91) (not (<= (* y 9.0) 5e-125))) (* -9.0 (* t (* 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) {
double tmp;
if (((y * 9.0) <= -4e+91) || !((y * 9.0) <= 5e-125)) {
tmp = -9.0 * (t * (y * z));
} else {
tmp = b * (a * 27.0);
}
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 (((y * 9.0d0) <= (-4d+91)) .or. (.not. ((y * 9.0d0) <= 5d-125))) then
tmp = (-9.0d0) * (t * (y * z))
else
tmp = b * (a * 27.0d0)
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 (((y * 9.0) <= -4e+91) || !((y * 9.0) <= 5e-125)) {
tmp = -9.0 * (t * (y * z));
} else {
tmp = b * (a * 27.0);
}
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 ((y * 9.0) <= -4e+91) or not ((y * 9.0) <= 5e-125): tmp = -9.0 * (t * (y * z)) else: tmp = b * (a * 27.0) 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 ((Float64(y * 9.0) <= -4e+91) || !(Float64(y * 9.0) <= 5e-125)) tmp = Float64(-9.0 * Float64(t * Float64(y * z))); else tmp = Float64(b * Float64(a * 27.0)); 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 (((y * 9.0) <= -4e+91) || ~(((y * 9.0) <= 5e-125)))
tmp = -9.0 * (t * (y * z));
else
tmp = b * (a * 27.0);
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[N[(y * 9.0), $MachinePrecision], -4e+91], N[Not[LessEqual[N[(y * 9.0), $MachinePrecision], 5e-125]], $MachinePrecision]], N[(-9.0 * N[(t * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;y \cdot 9 \leq -4 \cdot 10^{+91} \lor \neg \left(y \cdot 9 \leq 5 \cdot 10^{-125}\right):\\
\;\;\;\;-9 \cdot \left(t \cdot \left(y \cdot z\right)\right)\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if (*.f64 y #s(literal 9 binary64)) < -4.00000000000000032e91 or 4.99999999999999967e-125 < (*.f64 y #s(literal 9 binary64)) Initial program 88.6%
+-commutative88.6%
associate-+r-88.6%
*-commutative88.6%
cancel-sign-sub-inv88.6%
associate-*r*90.6%
distribute-lft-neg-in90.6%
*-commutative90.6%
cancel-sign-sub-inv90.6%
associate-+r-90.6%
associate-*l*90.7%
fma-define92.1%
fmm-def92.1%
associate-*l*97.7%
distribute-rgt-neg-in97.7%
*-commutative97.7%
associate-*l*98.4%
*-commutative98.4%
distribute-lft-neg-in98.4%
associate-*r*98.4%
Simplified98.4%
Taylor expanded in y around inf 41.6%
if -4.00000000000000032e91 < (*.f64 y #s(literal 9 binary64)) < 4.99999999999999967e-125Initial program 99.2%
+-commutative99.2%
associate-+r-99.2%
*-commutative99.2%
cancel-sign-sub-inv99.2%
associate-*r*99.1%
distribute-lft-neg-in99.1%
*-commutative99.1%
cancel-sign-sub-inv99.1%
associate-+r-99.1%
associate-*l*99.1%
fma-define99.1%
fmm-def99.1%
associate-*l*92.7%
distribute-rgt-neg-in92.7%
*-commutative92.7%
associate-*l*92.7%
*-commutative92.7%
distribute-lft-neg-in92.7%
associate-*r*92.7%
Simplified92.7%
Taylor expanded in a around inf 46.3%
associate-*r*46.3%
Simplified46.3%
Final simplification43.8%
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 (* (* y 9.0) 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 * ((y * 9.0) * 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 * ((y * 9.0d0) * 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 * ((y * 9.0) * 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 * ((y * 9.0) * 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(Float64(y * 9.0) * 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 * ((y * 9.0) * 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[(N[(y * 9.0), $MachinePrecision] * z), $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(\left(y \cdot 9\right) \cdot z\right)\right) + b \cdot \left(a \cdot 27\right)
\end{array}
Initial program 93.5%
Final simplification93.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 (+ (* b (* a 27.0)) (- (* x 2.0) (* t (* 9.0 (* 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) {
return (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z))));
}
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 = (b * (a * 27.0d0)) + ((x * 2.0d0) - (t * (9.0d0 * (y * z))))
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 (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z))));
}
[x, y, z, t, a, b] = sort([x, y, z, t, a, b]) def code(x, y, z, t, a, b): return (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * z))))
x, y, z, t, a, b = sort([x, y, z, t, 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(9.0 * Float64(y * z))))) 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 = (b * (a * 27.0)) + ((x * 2.0) - (t * (9.0 * (y * 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[(N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision] + N[(N[(x * 2.0), $MachinePrecision] - N[(t * N[(9.0 * N[(y * z), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
b \cdot \left(a \cdot 27\right) + \left(x \cdot 2 - t \cdot \left(9 \cdot \left(y \cdot z\right)\right)\right)
\end{array}
Initial program 93.5%
Taylor expanded in y around 0 93.8%
Final simplification93.8%
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 (<= b -2.3e-5) (not (<= b 6.3e-12))) (* 27.0 (* a b)) (* 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) {
double tmp;
if ((b <= -2.3e-5) || !(b <= 6.3e-12)) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
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 ((b <= (-2.3d-5)) .or. (.not. (b <= 6.3d-12))) then
tmp = 27.0d0 * (a * b)
else
tmp = x * 2.0d0
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 ((b <= -2.3e-5) || !(b <= 6.3e-12)) {
tmp = 27.0 * (a * b);
} else {
tmp = x * 2.0;
}
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 (b <= -2.3e-5) or not (b <= 6.3e-12): tmp = 27.0 * (a * b) else: tmp = x * 2.0 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 ((b <= -2.3e-5) || !(b <= 6.3e-12)) tmp = Float64(27.0 * Float64(a * b)); else tmp = Float64(x * 2.0); 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 ((b <= -2.3e-5) || ~((b <= 6.3e-12)))
tmp = 27.0 * (a * b);
else
tmp = x * 2.0;
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[b, -2.3e-5], N[Not[LessEqual[b, 6.3e-12]], $MachinePrecision]], N[(27.0 * N[(a * b), $MachinePrecision]), $MachinePrecision], N[(x * 2.0), $MachinePrecision]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.3 \cdot 10^{-5} \lor \neg \left(b \leq 6.3 \cdot 10^{-12}\right):\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\mathbf{else}:\\
\;\;\;\;x \cdot 2\\
\end{array}
\end{array}
if b < -2.3e-5 or 6.3000000000000002e-12 < b Initial program 93.9%
+-commutative93.9%
associate-+r-93.9%
*-commutative93.9%
cancel-sign-sub-inv93.9%
associate-*r*93.2%
distribute-lft-neg-in93.2%
*-commutative93.2%
cancel-sign-sub-inv93.2%
associate-+r-93.2%
associate-*l*93.2%
fma-define94.7%
fmm-def94.7%
associate-*l*96.0%
distribute-rgt-neg-in96.0%
*-commutative96.0%
associate-*l*96.8%
*-commutative96.8%
distribute-lft-neg-in96.8%
associate-*r*96.8%
Simplified96.8%
Taylor expanded in a around inf 65.4%
if -2.3e-5 < b < 6.3000000000000002e-12Initial program 93.2%
Taylor expanded in y around 0 93.2%
Taylor expanded in x around inf 41.1%
Final simplification53.3%
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 (<= b -2.6e-6) (* a (* 27.0 b)) (if (<= b 6.8e-12) (* x 2.0) (* 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) {
double tmp;
if (b <= -2.6e-6) {
tmp = a * (27.0 * b);
} else if (b <= 6.8e-12) {
tmp = x * 2.0;
} else {
tmp = b * (a * 27.0);
}
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 (b <= (-2.6d-6)) then
tmp = a * (27.0d0 * b)
else if (b <= 6.8d-12) then
tmp = x * 2.0d0
else
tmp = b * (a * 27.0d0)
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 (b <= -2.6e-6) {
tmp = a * (27.0 * b);
} else if (b <= 6.8e-12) {
tmp = x * 2.0;
} else {
tmp = b * (a * 27.0);
}
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 b <= -2.6e-6: tmp = a * (27.0 * b) elif b <= 6.8e-12: tmp = x * 2.0 else: tmp = b * (a * 27.0) 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 (b <= -2.6e-6) tmp = Float64(a * Float64(27.0 * b)); elseif (b <= 6.8e-12) tmp = Float64(x * 2.0); else tmp = Float64(b * Float64(a * 27.0)); 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 (b <= -2.6e-6)
tmp = a * (27.0 * b);
elseif (b <= 6.8e-12)
tmp = x * 2.0;
else
tmp = b * (a * 27.0);
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[b, -2.6e-6], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 6.8e-12], N[(x * 2.0), $MachinePrecision], N[(b * N[(a * 27.0), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[x, y, z, t, a, b] = \mathsf{sort}([x, y, z, t, a, b])\\
\\
\begin{array}{l}
\mathbf{if}\;b \leq -2.6 \cdot 10^{-6}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;b \leq 6.8 \cdot 10^{-12}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;b \cdot \left(a \cdot 27\right)\\
\end{array}
\end{array}
if b < -2.60000000000000009e-6Initial program 95.6%
Taylor expanded in y around 0 96.9%
Taylor expanded in a around inf 61.1%
associate-*r*61.1%
*-commutative61.1%
associate-*r*61.2%
Simplified61.2%
if -2.60000000000000009e-6 < b < 6.8000000000000001e-12Initial program 93.2%
Taylor expanded in y around 0 93.2%
Taylor expanded in x around inf 41.1%
if 6.8000000000000001e-12 < b Initial program 91.9%
+-commutative91.9%
associate-+r-91.9%
*-commutative91.9%
cancel-sign-sub-inv91.9%
associate-*r*95.0%
distribute-lft-neg-in95.0%
*-commutative95.0%
cancel-sign-sub-inv95.0%
associate-+r-95.0%
associate-*l*94.9%
fma-define96.6%
fmm-def96.6%
associate-*l*96.5%
distribute-rgt-neg-in96.5%
*-commutative96.5%
associate-*l*96.5%
*-commutative96.5%
distribute-lft-neg-in96.5%
associate-*r*96.5%
Simplified96.5%
Taylor expanded in a around inf 70.3%
associate-*r*70.3%
Simplified70.3%
Final simplification53.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 (if (<= b -7.5e-13) (* a (* 27.0 b)) (if (<= b 5.6e-11) (* 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 (b <= -7.5e-13) {
tmp = a * (27.0 * b);
} else if (b <= 5.6e-11) {
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 (b <= (-7.5d-13)) then
tmp = a * (27.0d0 * b)
else if (b <= 5.6d-11) 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 (b <= -7.5e-13) {
tmp = a * (27.0 * b);
} else if (b <= 5.6e-11) {
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 b <= -7.5e-13: tmp = a * (27.0 * b) elif b <= 5.6e-11: 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 (b <= -7.5e-13) tmp = Float64(a * Float64(27.0 * b)); elseif (b <= 5.6e-11) 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 (b <= -7.5e-13)
tmp = a * (27.0 * b);
elseif (b <= 5.6e-11)
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[LessEqual[b, -7.5e-13], N[(a * N[(27.0 * b), $MachinePrecision]), $MachinePrecision], If[LessEqual[b, 5.6e-11], 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}\;b \leq -7.5 \cdot 10^{-13}:\\
\;\;\;\;a \cdot \left(27 \cdot b\right)\\
\mathbf{elif}\;b \leq 5.6 \cdot 10^{-11}:\\
\;\;\;\;x \cdot 2\\
\mathbf{else}:\\
\;\;\;\;27 \cdot \left(a \cdot b\right)\\
\end{array}
\end{array}
if b < -7.5000000000000004e-13Initial program 95.6%
Taylor expanded in y around 0 96.9%
Taylor expanded in a around inf 61.1%
associate-*r*61.1%
*-commutative61.1%
associate-*r*61.2%
Simplified61.2%
if -7.5000000000000004e-13 < b < 5.6e-11Initial program 93.2%
Taylor expanded in y around 0 93.2%
Taylor expanded in x around inf 41.1%
if 5.6e-11 < b Initial program 91.9%
+-commutative91.9%
associate-+r-91.9%
*-commutative91.9%
cancel-sign-sub-inv91.9%
associate-*r*95.0%
distribute-lft-neg-in95.0%
*-commutative95.0%
cancel-sign-sub-inv95.0%
associate-+r-95.0%
associate-*l*94.9%
fma-define96.6%
fmm-def96.6%
associate-*l*96.5%
distribute-rgt-neg-in96.5%
*-commutative96.5%
associate-*l*96.5%
*-commutative96.5%
distribute-lft-neg-in96.5%
associate-*r*96.5%
Simplified96.5%
Taylor expanded in a around inf 70.3%
Final simplification53.3%
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 93.5%
Taylor expanded in y around 0 93.8%
Taylor expanded in x around inf 27.8%
Final simplification27.8%
(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 2024152
(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)))